Avoid duplicate 'barbican' service_available option
The cinder and barbican tempest plugins both need the 'barbican'
service_available option to be defined, but they both can't register
the option. This patch ensures the cinder plugin registers the option
only when the barbican plugin isn't present.
Closes-Bug: #1991068
Change-Id: I51a22afae4fc98e2c2b8c1e82e8211a27649022c
Alan Bishop
3 years ago
| 25 | 25 |
|
| 26 | 26 |
# The barbican service is discovered by config_tempest [1], and will appear
|
| 27 | 27 |
# in the [service_available] group in tempest.conf. However, the 'barbican'
|
| 28 | |
# option isn't registered by tempest itself, and so we do it here. This adds
|
| 29 | |
# the ability to test CONF.service_available.barbican.
|
|
28 |
# option isn't registered by tempest itself, and so we may need to do it.
|
|
29 |
# This adds the ability to test CONF.service_available.barbican.
|
| 30 | 30 |
#
|
| 31 | 31 |
# [1] I96800a95f844ce7675d266e456e01620e63e347a
|
| 32 | |
service_available_option = [
|
|
32 |
barbican_service_option = [
|
| 33 | 33 |
cfg.BoolOpt('barbican',
|
| 34 | 34 |
default=False,
|
| 35 | 35 |
help="Whether or not barbican is expected to be available"),
|
| 13 | 13 |
# under the License.
|
| 14 | 14 |
|
| 15 | 15 |
import os
|
|
16 |
import sys
|
| 16 | 17 |
|
| 17 | 18 |
from tempest import config
|
| 18 | 19 |
from tempest.test_discover import plugins
|
|
| 45 | 46 |
config.register_opt_group(conf, config.volume_feature_group,
|
| 46 | 47 |
project_config.cinder_option)
|
| 47 | 48 |
|
| 48 | |
config.register_opt_group(conf, config.service_available_group,
|
| 49 | |
project_config.service_available_option)
|
|
49 |
# Define the 'barbican' service_available option, but only if the
|
|
50 |
# barbican_tempest_plugin isn't present. It also defines the option,
|
|
51 |
# and we need to avoid a duplicate option registration.
|
|
52 |
if 'barbican_tempest_plugin' not in sys.modules:
|
|
53 |
config.register_opt_group(conf, config.service_available_group,
|
|
54 |
project_config.barbican_service_option)
|
| 50 | 55 |
|
| 51 | 56 |
def get_opt_lists(self):
|
| 52 | 57 |
"""Get a list of options for sample config generation.
|
|
| 54 | 59 |
:return: A list of tuples with the group name and options in that
|
| 55 | 60 |
group.
|
| 56 | 61 |
"""
|
| 57 | |
return [
|
|
62 |
opt_lists = [
|
| 58 | 63 |
(config.volume_feature_group.name, project_config.cinder_option),
|
| 59 | |
(config.service_available_group.name,
|
| 60 | |
project_config.service_available_option),
|
| 61 | 64 |
]
|
|
65 |
|
|
66 |
if 'barbican_tempest_plugin' not in sys.modules:
|
|
67 |
opt_lists.append((config.service_available_group.name,
|
|
68 |
project_config.barbican_service_option))
|
|
69 |
|
|
70 |
return opt_lists
|