diff --git a/example.conf b/example.conf index 119c3a97a..e75738721 100644 --- a/example.conf +++ b/example.conf @@ -116,6 +116,15 @@ # Deprecated group/name - [discoverd]/ironic_retry_period #ironic_retry_period = 5 +# Method to use for authentication: noauth or keystone. (string value) +# Allowed values: keystone, noauth +#auth_strategy = keystone + +# Ironic API URL, used to set Ironic API URL when auth_strategy option +# is noauth to work with standalone Ironic without keystone. (string +# value) +#ironic_url = http://localhost:6385/ + [processing] diff --git a/ironic_inspector/conf.py b/ironic_inspector/conf.py index c7c8aff72..35d00c92a 100644 --- a/ironic_inspector/conf.py +++ b/ironic_inspector/conf.py @@ -50,6 +50,15 @@ IRONIC_OPTS = [ help='Amount of time between attempts to connect to Ironic ' 'on start up.', deprecated_group='discoverd'), + 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.'), ] diff --git a/ironic_inspector/utils.py b/ironic_inspector/utils.py index 10170ac52..65a48c38d 100644 --- a/ironic_inspector/utils.py +++ b/ironic_inspector/utils.py @@ -55,10 +55,15 @@ def spawn_n(*args, **kwargs): def get_client(): # pragma: no cover """Get Ironic client instance.""" - args = dict({'os_password': CONF.ironic.os_password, - 'os_username': CONF.ironic.os_username, - 'os_auth_url': CONF.ironic.os_auth_url, - 'os_tenant_name': CONF.ironic.os_tenant_name}) + # NOTE: To support standalone ironic without keystone + if CONF.ironic.auth_strategy == 'noauth': + args = dict({'os_auth_token': 'noauth', + 'ironic_url': CONF.ironic.ironic_url}) + else: + args = dict({'os_password': CONF.ironic.os_password, + 'os_username': CONF.ironic.os_username, + 'os_auth_url': CONF.ironic.os_auth_url, + 'os_tenant_name': CONF.ironic.os_tenant_name}) return client.get_client(1, **args)