Browse code

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

John L. Villalovos authored on 2016/11/12 08:26:11
Showing 1 changed files
... ...
@@ -1767,6 +1767,9 @@ function enable_plugin {
1767 1767
     local name=$1
1768 1768
     local url=$2
1769 1769
     local branch=${3:-master}
1770
+    if [[ ",${DEVSTACK_PLUGINS}," =~ ,${name}, ]]; then
1771
+        die $LINENO "Plugin attempted to be enabled twice: ${name} ${url} ${branch}"
1772
+    fi
1770 1773
     DEVSTACK_PLUGINS+=",$name"
1771 1774
     GITREPO[$name]=$url
1772 1775
     GITDIR[$name]=$DEST/$name