Compatible with old Swift service enable

Some of gate job, like ironic-inspector-tempest-dsvm-python3 doesn't
support data stores in Swift[1]. If use swift as tempest default
config, it will breaks that stable branch gate job.

This patch add backward compatibility for swift, and lets default data_store
is None.

[1] https://github.com/openstack/ironic-inspector/blob/stable/rocky/devstack/plugin.sh#L271-L273

Change-Id: Id349ab8c1cf90632032233c7a754e60544efd057
This commit is contained in:
Dongcan Ye 2019-05-21 10:00:42 +00:00
parent 2d992edb3f
commit 2910b1e3ce
3 changed files with 12 additions and 3 deletions

View File

@ -199,6 +199,5 @@ BaremetalIntrospectionGroup = [
help="The driver to set on the newly discovered nodes. "
"Only has effect with auto_discovery_feature is True."),
cfg.StrOpt('data_store',
default='swift',
help="The storage backend for storing introspection data."),
]

View File

@ -94,7 +94,12 @@ class InspectorBasicTest(introspection_manager.InspectorScenarioTest):
for node_id in self.node_ids:
node = self.node_show(node_id)
self.assertEqual('yes', node['extra']['rule_success'])
if CONF.baremetal_introspection.data_store != "none":
data_store = CONF.baremetal_introspection.data_store
if data_store is None:
# Backward compatibility, the option is not set.
data_store = ('swift' if CONF.service_available.swift
else 'none')
if data_store != 'none':
self.verify_node_introspection_data(node)
self.verify_node_flavor(node)

View File

@ -156,7 +156,12 @@ class InspectorDiscoveryTest(introspection_manager.InspectorScenarioTest):
inspected_node = self.node_show(self.node_info['name'])
self.verify_node_flavor(inspected_node)
if CONF.baremetal_introspection.data_store != "none":
data_store = CONF.baremetal_introspection.data_store
if data_store is None:
# Backward compatibility, the option is not set.
data_store = ('swift' if CONF.service_available.swift
else 'none')
if data_store != 'none':
self.verify_node_introspection_data(inspected_node)
self.assertEqual(ProvisionStates.ENROLL,
inspected_node['provision_state'])