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
This commit is contained in:
Omer Anson 2017-08-24 17:47:37 +03:00
parent c5aca3c996
commit 5158486124

View File

@ -1882,7 +1882,7 @@ function enable_plugin {
local name=$1
local url=$2
local branch=${3:-master}
if [[ ",${DEVSTACK_PLUGINS}," =~ ,${name}, ]]; then
if is_plugin_enabled $name; then
die $LINENO "Plugin attempted to be enabled twice: ${name} ${url} ${branch}"
fi
DEVSTACK_PLUGINS+=",$name"
@ -1891,6 +1891,19 @@ function enable_plugin {
GITBRANCH[$name]=$branch
}
# is_plugin_enabled <name>
#
# Check if the plugin was enabled, e.g. using enable_plugin
#
# ``name`` The name with which the plugin was enabled
function is_plugin_enabled {
local name=$1
if [[ ",${DEVSTACK_PLUGINS}," =~ ",${name}," ]]; then
return 0
fi
return 1
}
# fetch_plugins
#
# clones all plugins