Merge "Add function is_plugin_enabled"

This commit is contained in:
Jenkins 2017-09-06 01:15:32 +00:00 committed by Gerrit Code Review
commit bd054c58de

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