From b804efeb026623a75c929df13ad45266cabc5945 Mon Sep 17 00:00:00 2001 From: Pavlo Shchelokovskyy Date: Fri, 4 Mar 2016 14:55:07 +0200 Subject: [PATCH] Move ironic options to common/ironic make it similar to how Swift options are handled Change-Id: Ib155086f68970b6e74cb348778fcb4a6361c54ba --- config-generator.conf | 1 + example.conf | 2 +- ironic_inspector/common/ironic.py | 66 +++++++++++++++++++++++++++++++ ironic_inspector/conf.py | 60 ---------------------------- setup.cfg | 1 + 5 files changed, 69 insertions(+), 61 deletions(-) diff --git a/config-generator.conf b/config-generator.conf index e375b8924..ac71fb450 100644 --- a/config-generator.conf +++ b/config-generator.conf @@ -1,6 +1,7 @@ [DEFAULT] output_file = example.conf namespace = ironic_inspector +namespace = ironic_inspector.common.ironic namespace = ironic_inspector.common.swift namespace = ironic_inspector.plugins.discovery namespace = keystonemiddleware.auth_token diff --git a/example.conf b/example.conf index 58fcec911..57fac5e94 100644 --- a/example.conf +++ b/example.conf @@ -324,7 +324,7 @@ [ironic] # -# From ironic_inspector +# From ironic_inspector.common.ironic # # Keystone authentication endpoint for accessing Ironic API. Use diff --git a/ironic_inspector/common/ironic.py b/ironic_inspector/common/ironic.py index 3405b9a73..4734c4030 100644 --- a/ironic_inspector/common/ironic.py +++ b/ironic_inspector/common/ironic.py @@ -29,6 +29,68 @@ SET_CREDENTIALS_VALID_STATES = {'enroll'} # 1.11 is API version, which support 'enroll' state DEFAULT_IRONIC_API_VERSION = '1.11' +IRONIC_GROUP = 'ironic' + +IRONIC_OPTS = [ + cfg.StrOpt('os_auth_url', + default='', + help='Keystone authentication endpoint for accessing Ironic ' + 'API. Use [keystone_authtoken]/auth_uri for keystone ' + 'authentication.', + deprecated_group='discoverd'), + cfg.StrOpt('os_username', + default='', + help='User name for accessing Ironic API. ' + 'Use [keystone_authtoken]/admin_user for keystone ' + 'authentication.', + deprecated_group='discoverd'), + cfg.StrOpt('os_password', + default='', + help='Password for accessing Ironic API. ' + 'Use [keystone_authtoken]/admin_password for keystone ' + 'authentication.', + secret=True, + deprecated_group='discoverd'), + cfg.StrOpt('os_tenant_name', + default='', + help='Tenant name for accessing Ironic API. ' + 'Use [keystone_authtoken]/admin_tenant_name for keystone ' + 'authentication.', + deprecated_group='discoverd'), + cfg.StrOpt('identity_uri', + default='', + help='Keystone admin endpoint. ' + 'DEPRECATED: use [keystone_authtoken]/identity_uri.', + deprecated_group='discoverd', + deprecated_for_removal=True), + cfg.StrOpt('auth_strategy', + default='keystone', + choices=('keystone', 'noauth'), + help='Method to use for authentication: noauth or keystone.'), + cfg.StrOpt('ironic_url', + default='http://localhost:6385/', + help='Ironic API URL, used to set Ironic API URL when ' + 'auth_strategy option is noauth to work with standalone ' + 'Ironic without keystone.'), + cfg.StrOpt('os_service_type', + default='baremetal', + help='Ironic service type.'), + cfg.StrOpt('os_endpoint_type', + default='internalURL', + help='Ironic endpoint type.'), + cfg.IntOpt('retry_interval', + default=2, + help='Interval between retries in case of conflict error ' + '(HTTP 409).'), + cfg.IntOpt('max_retries', + default=30, + help='Maximum number of retries in case of conflict error ' + '(HTTP 409).'), +] + + +CONF.register_opts(IRONIC_OPTS, group=IRONIC_GROUP) + def get_ipmi_address(node): ipmi_fields = ['ipmi_address'] + CONF.ipmi_address_fields @@ -108,3 +170,7 @@ def dict_to_capabilities(caps_dict): return ','.join(["%s:%s" % (key, value) for key, value in caps_dict.items() if value is not None]) + + +def list_opts(): + return [(IRONIC_GROUP, IRONIC_OPTS)] diff --git a/ironic_inspector/conf.py b/ironic_inspector/conf.py index c50bf85bb..be2b6f5d4 100644 --- a/ironic_inspector/conf.py +++ b/ironic_inspector/conf.py @@ -19,64 +19,6 @@ VALID_KEEP_PORTS_VALUES = ('all', 'present', 'added') VALID_STORE_DATA_VALUES = ('none', 'swift') -IRONIC_OPTS = [ - cfg.StrOpt('os_auth_url', - default='', - help='Keystone authentication endpoint for accessing Ironic ' - 'API. Use [keystone_authtoken]/auth_uri for keystone ' - 'authentication.', - deprecated_group='discoverd'), - cfg.StrOpt('os_username', - default='', - help='User name for accessing Ironic API. ' - 'Use [keystone_authtoken]/admin_user for keystone ' - 'authentication.', - deprecated_group='discoverd'), - cfg.StrOpt('os_password', - default='', - help='Password for accessing Ironic API. ' - 'Use [keystone_authtoken]/admin_password for keystone ' - 'authentication.', - secret=True, - deprecated_group='discoverd'), - cfg.StrOpt('os_tenant_name', - default='', - help='Tenant name for accessing Ironic API. ' - 'Use [keystone_authtoken]/admin_tenant_name for keystone ' - 'authentication.', - deprecated_group='discoverd'), - cfg.StrOpt('identity_uri', - default='', - help='Keystone admin endpoint. ' - 'DEPRECATED: use [keystone_authtoken]/identity_uri.', - deprecated_group='discoverd', - deprecated_for_removal=True), - cfg.StrOpt('auth_strategy', - default='keystone', - choices=('keystone', 'noauth'), - help='Method to use for authentication: noauth or keystone.'), - cfg.StrOpt('ironic_url', - default='http://localhost:6385/', - help='Ironic API URL, used to set Ironic API URL when ' - 'auth_strategy option is noauth to work with standalone ' - 'Ironic without keystone.'), - cfg.StrOpt('os_service_type', - default='baremetal', - help='Ironic service type.'), - cfg.StrOpt('os_endpoint_type', - default='internalURL', - help='Ironic endpoint type.'), - cfg.IntOpt('retry_interval', - default=2, - help='Interval between retries in case of conflict error ' - '(HTTP 409).'), - cfg.IntOpt('max_retries', - default=30, - help='Maximum number of retries in case of conflict error ' - '(HTTP 409).'), -] - - FIREWALL_OPTS = [ cfg.BoolOpt('manage_firewall', default=True, @@ -263,7 +205,6 @@ SERVICE_OPTS = [ cfg.CONF.register_opts(SERVICE_OPTS) cfg.CONF.register_opts(FIREWALL_OPTS, group='firewall') cfg.CONF.register_opts(PROCESSING_OPTS, group='processing') -cfg.CONF.register_opts(IRONIC_OPTS, group='ironic') cfg.CONF.register_opts(DISCOVERD_OPTS, group='discoverd') @@ -271,7 +212,6 @@ def list_opts(): return [ ('', SERVICE_OPTS), ('firewall', FIREWALL_OPTS), - ('ironic', IRONIC_OPTS), ('processing', PROCESSING_OPTS), ('discoverd', DISCOVERD_OPTS), ] diff --git a/setup.cfg b/setup.cfg index 4265af24c..e70f31cda 100644 --- a/setup.cfg +++ b/setup.cfg @@ -55,6 +55,7 @@ ironic_inspector.rules.actions = extend-attribute = ironic_inspector.plugins.rules:ExtendAttributeAction oslo.config.opts = ironic_inspector = ironic_inspector.conf:list_opts + ironic_inspector.common.ironic = ironic_inspector.common.ironic:list_opts ironic_inspector.common.swift = ironic_inspector.common.swift:list_opts ironic_inspector.plugins.discovery = ironic_inspector.plugins.discovery:list_opts