Skip to content

Commit 5158486

Browse files
committed
Add function is_plugin_enabled
Add a function which tests if a plugin has been enabled with enable_plugin. This is helpful if two co-ordinating projects want to run specific setup in devstack in one only if the other is enabled. Change-Id: Ibf113755595b19d028374cdc1c86e19b5170be4f
1 parent c5aca3c commit 5158486

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)