From 1009c3781b267167651b8ab8c0d3a56d6243d872 Mon Sep 17 00:00:00 2001 From: Takashi Kajinami Date: Tue, 19 Aug 2025 00:38:56 +0900 Subject: [PATCH] Validate endpoint_type option at loading ... instead of documenting the supported values, so that more explicit error is presented to users. Also drop redundant description about the default values. The default values are added to sample config files generated, so don't have to be explained in help texts. Change-Id: I12b201da3e742b55f6cfcf71bdd4413cbf3ee4e5 Signed-off-by: Takashi Kajinami --- watcher/conf/aetos_client.py | 3 ++- watcher/conf/cinder_client.py | 6 +++--- watcher/conf/glance_client.py | 6 +++--- watcher/conf/gnocchi_client.py | 6 +++--- watcher/conf/ironic_client.py | 6 +++--- watcher/conf/monasca_client.py | 6 +++--- watcher/conf/neutron_client.py | 6 +++--- watcher/conf/nova_client.py | 6 +++--- 8 files changed, 23 insertions(+), 22 deletions(-) diff --git a/watcher/conf/aetos_client.py b/watcher/conf/aetos_client.py index 72c7a3509..5561a745d 100644 --- a/watcher/conf/aetos_client.py +++ b/watcher/conf/aetos_client.py @@ -24,7 +24,8 @@ aetos_client = cfg.OptGroup(name='aetos_client', AETOS_CLIENT_OPTS = [ cfg.StrOpt('interface', default='public', - choices=['internal', 'public', 'admin'], + choices=['public', 'internal', 'admin', + 'publicURL', 'internalURL', 'adminURL'], help="Type of endpoint to use in keystoneclient."), cfg.StrOpt('region_name', help="Region in Identity service catalog to use for " diff --git a/watcher/conf/cinder_client.py b/watcher/conf/cinder_client.py index bb72c53b0..d3cf86ba0 100644 --- a/watcher/conf/cinder_client.py +++ b/watcher/conf/cinder_client.py @@ -27,9 +27,9 @@ CINDER_CLIENT_OPTS = [ help='Version of Cinder API to use in cinderclient.'), cfg.StrOpt('endpoint_type', default='publicURL', - help='Type of endpoint to use in cinderclient. ' - 'Supported values: internalURL, publicURL, adminURL. ' - 'The default is publicURL.'), + choices=['public', 'internal', 'admin', + 'publicURL', 'internalURL', 'adminURL'], + help='Type of endpoint to use in cinderclient.'), cfg.StrOpt('region_name', help='Region in Identity service catalog to use for ' 'communication with the OpenStack service.')] diff --git a/watcher/conf/glance_client.py b/watcher/conf/glance_client.py index 801e40bfb..50437d38b 100644 --- a/watcher/conf/glance_client.py +++ b/watcher/conf/glance_client.py @@ -27,9 +27,9 @@ GLANCE_CLIENT_OPTS = [ help='Version of Glance API to use in glanceclient.'), cfg.StrOpt('endpoint_type', default='publicURL', - help='Type of endpoint to use in glanceclient. ' - 'Supported values: internalURL, publicURL, adminURL. ' - 'The default is publicURL.'), + choices=['public', 'internal', 'admin', + 'publicURL', 'internalURL', 'adminURL'], + help='Type of endpoint to use in glanceclient.'), cfg.StrOpt('region_name', help='Region in Identity service catalog to use for ' 'communication with the OpenStack service.')] diff --git a/watcher/conf/gnocchi_client.py b/watcher/conf/gnocchi_client.py index d7950d57e..637002f27 100644 --- a/watcher/conf/gnocchi_client.py +++ b/watcher/conf/gnocchi_client.py @@ -27,9 +27,9 @@ GNOCCHI_CLIENT_OPTS = [ help='Version of Gnocchi API to use in gnocchiclient.'), cfg.StrOpt('endpoint_type', default='public', - help='Type of endpoint to use in gnocchi client. ' - 'Supported values: internal, public, admin. ' - 'The default is public.'), + choices=['public', 'internal', 'admin', + 'publicURL', 'internalURL', 'adminURL'], + help='Type of endpoint to use in gnocchi client.'), cfg.StrOpt('region_name', help='Region in Identity service catalog to use for ' 'communication with the OpenStack service.') diff --git a/watcher/conf/ironic_client.py b/watcher/conf/ironic_client.py index 1cb64a447..31a84cdf5 100644 --- a/watcher/conf/ironic_client.py +++ b/watcher/conf/ironic_client.py @@ -27,9 +27,9 @@ IRONIC_CLIENT_OPTS = [ help='Version of Ironic API to use in ironicclient.'), cfg.StrOpt('endpoint_type', default='publicURL', - help='Type of endpoint to use in ironicclient. ' - 'Supported values: internalURL, publicURL, adminURL. ' - 'The default is publicURL.'), + choices=['public', 'internal', 'admin', + 'publicURL', 'internalURL', 'adminURL'], + help='Type of endpoint to use in ironicclient.'), cfg.StrOpt('region_name', help='Region in Identity service catalog to use for ' 'communication with the OpenStack service.')] diff --git a/watcher/conf/monasca_client.py b/watcher/conf/monasca_client.py index de2ecd7d3..d1f52f48d 100644 --- a/watcher/conf/monasca_client.py +++ b/watcher/conf/monasca_client.py @@ -27,9 +27,9 @@ MONASCA_CLIENT_OPTS = [ help='Version of Monasca API to use in monascaclient.'), cfg.StrOpt('interface', default='internal', - help='Type of interface used for monasca endpoint. ' - 'Supported values: internal, public, admin. ' - 'The default is internal.'), + choices=['public', 'internal', 'admin', + 'publicURL', 'internalURL', 'adminURL'], + help='Type of interface used for monasca endpoint.'), cfg.StrOpt('region_name', help='Region in Identity service catalog to use for ' 'communication with the OpenStack service.')] diff --git a/watcher/conf/neutron_client.py b/watcher/conf/neutron_client.py index e203b4a90..7f3888cf3 100644 --- a/watcher/conf/neutron_client.py +++ b/watcher/conf/neutron_client.py @@ -27,9 +27,9 @@ NEUTRON_CLIENT_OPTS = [ help='Version of Neutron API to use in neutronclient.'), cfg.StrOpt('endpoint_type', default='publicURL', - help='Type of endpoint to use in neutronclient. ' - 'Supported values: internalURL, publicURL, adminURL. ' - 'The default is publicURL.'), + choices=['public', 'internal', 'admin', + 'publicURL', 'internalURL', 'adminURL'], + help='Type of endpoint to use in neutronclient.'), cfg.StrOpt('region_name', help='Region in Identity service catalog to use for ' 'communication with the OpenStack service.')] diff --git a/watcher/conf/nova_client.py b/watcher/conf/nova_client.py index 07c1dbed6..5287b373b 100644 --- a/watcher/conf/nova_client.py +++ b/watcher/conf/nova_client.py @@ -38,9 +38,9 @@ for the compute API microversion history. """ % clients.MIN_NOVA_API_VERSION), cfg.StrOpt('endpoint_type', default='publicURL', - help='Type of endpoint to use in novaclient. ' - 'Supported values: internalURL, publicURL, adminURL. ' - 'The default is publicURL.'), + choices=['public', 'internal', 'admin', + 'publicURL', 'internalURL', 'adminURL'], + help='Type of endpoint to use in novaclient.'), cfg.StrOpt('region_name', help='Region in Identity service catalog to use for ' 'communication with the OpenStack service.')]