grenade: Only 'enable_plugin ironic-inspector' if not already in conf

To support multi-node grenade jobs we need to move enabling of the
ironic-inspector devstack plugin out of the ironic-inspector grenade
settings file devstack/upgrade/settings. But if we add enabling of the
ironic-inspector devstack plugin to project-config it will cause the gate
to break as the plugin will be enabled twice.

This patch is similar to the change done in ironic for the same purpose.

This checks to see if the ironic-inspector devstack plugin has already been
enabled:
  * If it has already been enabled it will not enable it again.
  * If it has not yet been enabled it will enable it.

This will allow us to update project-config to enable the ironic-inspector
devstack plugin and not break the gate.

After all the changes have landed we will propose a follow-up patch to
remove all this additonal logic and the enabling of the ironic-inspector
devstack plugin.

Change-Id: Id1a5de9a8aefe751b63c1a6a9f2c942fe4c957b1
Closes-Bug: #1672448
(cherry picked from commit 69157e5554)
This commit is contained in:
Ramamani Yeleswarapu 2017-06-14 12:11:16 -07:00
parent e4fb858b3c
commit da908db4c8
1 changed files with 20 additions and 4 deletions

View File

@ -4,8 +4,24 @@ register_project_for_upgrade ironic-inspector
register_db_to_save ironic_inspector
# Inspector plugin and service registration
devstack_localrc base enable_plugin ironic-inspector https://github.com/openstack/ironic-inspector
devstack_localrc base enable_service ironic-inspector ironic-inspector-dhcp
# NOTE(rama_y): Change similar to what was done in ironic for multi-node grenade testing.
# This file is sourced by the 'load_settings' function in
# grenade/inc/plugin. So usage of local will work.
local insp_gren_conf
local insp_gren_stage
devstack_localrc target enable_plugin ironic-inspector https://github.com/openstack/ironic-inspector
devstack_localrc target enable_service ironic-inspector ironic-inspector-dhcp
for insp_gren_stage in base target; do
# TODO(rama_y): Remove this logic for checking if the ironic-inspector devstack
# plugin is enabled, once the enabling of the ironic-inspector devstack plugin is
# being done in project-config.
insp_gren_conf=$(localrc_path ${insp_gren_stage})
# Only 'enable_plugin ironic-inspector' if it isn't in the file already.
if ! grep -q '^enable_plugin ironic-inspector ' ${insp_gren_conf} ; then
echo "Enabling ironic-inspector devstack plugin via grenade for ${insp_gren_stage}"
devstack_localrc ${insp_gren_stage} enable_plugin ironic-inspector https://github.com/openstack/ironic-inspector
else
echo "ironic-inspector devstack plugin already enabled for ${insp_gren_stage}"
fi
devstack_localrc ${insp_gren_stage} enable_service ironic-inspector ironic-inspector-dhcp
done