Skip to content

Commit bd054c5

Browse files
Jenkinsopenstack-gerrit
authored andcommitted
Merge "Add function is_plugin_enabled"
2 parents 99730fa + 5158486 commit bd054c5

1 file changed

Lines changed: 14 additions & 1 deletion

File tree

functions-common

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1882,7 +1882,7 @@ function enable_plugin {
18821882
local name=$1
18831883
local url=$2
18841884
local branch=${3:-master}
1885-
if [[ ",${DEVSTACK_PLUGINS}," =~ ,${name}, ]]; then
1885+
if is_plugin_enabled $name; then
18861886
die $LINENO "Plugin attempted to be enabled twice: ${name} ${url} ${branch}"
18871887
fi
18881888
DEVSTACK_PLUGINS+=",$name"
@@ -1891,6 +1891,19 @@ function enable_plugin {
18911891
GITBRANCH[$name]=$branch
18921892
}
18931893

1894+
# is_plugin_enabled <name>
1895+
#
1896+
# Check if the plugin was enabled, e.g. using enable_plugin
1897+
#
1898+
# ``name`` The name with which the plugin was enabled
1899+
function is_plugin_enabled {
1900+
local name=$1
1901+
if [[ ",${DEVSTACK_PLUGINS}," =~ ",${name}," ]]; then
1902+
return 0
1903+
fi
1904+
return 1
1905+
}
1906+
18941907
# fetch_plugins
18951908
#
18961909
# clones all plugins

0 commit comments

Comments
 (0)