If plugin is enabled multiple times fail

When using the enable_plugin command and grenade jobs it can be
easy to enable the same plugin twice, as the grenade job has a
registration section and the configuration in project-config can also
enable it due to code-reuse in project-config.

If a plugin is enabled twice it will likely fail, though it won't be
obvious that it was due to the plugin being enabled multiple times.

This change makes it so if it sees the same plugin name is enabled
more than once it will die and an error message outputted.

Change-Id: I9f1d7e58b861b04473b6a57c9ad404203fb7277a
(cherry picked from commit 21d84c29b2)
This commit is contained in:
John L. Villalovos 2016-11-11 15:26:11 -08:00
parent 00a846aaa5
commit 98758fd405
1 changed files with 3 additions and 0 deletions

View File

@ -1779,6 +1779,9 @@ function enable_plugin {
local name=$1
local url=$2
local branch=${3:-master}
if [[ ",${DEVSTACK_PLUGINS}," =~ ,${name}, ]]; then
die $LINENO "Plugin attempted to be enabled twice: ${name} ${url} ${branch}"
fi
DEVSTACK_PLUGINS+=",$name"
GITREPO[$name]=$url
GITDIR[$name]=$DEST/$name