From 43f3a71588858cdbb0cf7d5f4653598c5e3ba2ed Mon Sep 17 00:00:00 2001 From: Yuiko Takada Date: Tue, 21 Jul 2015 21:12:32 -0400 Subject: [PATCH] Make endpoint type configurable Currently, Ironic Inspector talks with Ironic using public API endpoint. This patch fix this by making endpoint type configurable and also make default value "internalURL". Change-Id: I11f8016a69fabe450989174b846cf84eacf83652 Partial-Bug: #1470565 --- example.conf | 6 ++++++ ironic_inspector/conf.py | 6 ++++++ ironic_inspector/utils.py | 14 ++++++++------ 3 files changed, 20 insertions(+), 6 deletions(-) diff --git a/example.conf b/example.conf index c629bdddc..2d3d62043 100644 --- a/example.conf +++ b/example.conf @@ -247,6 +247,12 @@ # value) #ironic_url = http://localhost:6385/ +# Ironic service type. (string value) +#os_service_type = baremetal + +# Ironic endpoint type. (string value) +#os_endpoint_type = internalURL + [keystone_authtoken] diff --git a/ironic_inspector/conf.py b/ironic_inspector/conf.py index 2d3459144..2c8d23ba2 100644 --- a/ironic_inspector/conf.py +++ b/ironic_inspector/conf.py @@ -59,6 +59,12 @@ IRONIC_OPTS = [ 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.'), ] diff --git a/ironic_inspector/utils.py b/ironic_inspector/utils.py index ed26f65f0..221d2da4d 100644 --- a/ironic_inspector/utils.py +++ b/ironic_inspector/utils.py @@ -64,13 +64,15 @@ def get_client(): # pragma: no cover """Get Ironic client instance.""" # 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}) + args = {'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}) + args = {'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, + 'os_service_type': CONF.ironic.os_service_type, + 'os_endpoint_type': CONF.ironic.os_endpoint_type} return client.get_client(1, **args)