From 4ff7f72b14c05b8efb31dc266d5f35fefa14172b Mon Sep 17 00:00:00 2001 From: Ramamani Yeleswarapu Date: Wed, 14 Jun 2017 12:11:16 -0700 Subject: [PATCH] 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 69157e5554ef6ad10f3d6d3ffc313d4e498ec21b) --- devstack/upgrade/settings | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/devstack/upgrade/settings b/devstack/upgrade/settings index b195f0a31..328a278bb 100644 --- a/devstack/upgrade/settings +++ b/devstack/upgrade/settings @@ -4,11 +4,27 @@ 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 # NOTE(dtantsur): enable possible work arounds for grenade specifically. # We can't use shell variables "thanks" to tempest using tox.