diff --git a/openstackclient/common/clientmanager.py b/openstackclient/common/clientmanager.py index c77a7848..742509e4 100644 --- a/openstackclient/common/clientmanager.py +++ b/openstackclient/common/clientmanager.py @@ -86,7 +86,7 @@ class ClientManager(object): self._pw_callback = pw_func self._url = self._cli_options.auth.get('url', None) self._region_name = self._cli_options.region_name - self._endpoint_type = self._cli_options.endpoint_type + self._interface = self._cli_options.interface self.timing = self._cli_options.timing @@ -185,22 +185,22 @@ class ClientManager(object): return self._auth_ref def get_endpoint_for_service_type(self, service_type, region_name=None, - endpoint_type='public'): + interface='public'): """Return the endpoint URL for the service type.""" - if not endpoint_type: - endpoint_type = 'public' + if not interface: + interface = 'public' # See if we are using password flow auth, i.e. we have a # service catalog to select endpoints from if self.auth_ref: endpoint = self.auth_ref.service_catalog.url_for( service_type=service_type, region_name=region_name, - endpoint_type=endpoint_type, + endpoint_type=interface, ) else: # Get the passed endpoint directly from the auth plugin endpoint = self.auth.get_endpoint(self.session, - interface=endpoint_type) + interface=interface) return endpoint diff --git a/openstackclient/shell.py b/openstackclient/shell.py index b4e5904c..edeffdfb 100644 --- a/openstackclient/shell.py +++ b/openstackclient/shell.py @@ -209,14 +209,14 @@ class OpenStackShell(app.App): DEFAULT_DOMAIN + ' (Env: OS_DEFAULT_DOMAIN)') parser.add_argument( - '--os-endpoint-type', - metavar='', - dest='endpoint_type', + '--os-interface', + metavar='', + dest='interface', choices=['admin', 'public', 'internal'], - default=utils.env('OS_ENDPOINT_TYPE'), - help='Select an endpoint type.' - ' Valid endpoint types: [admin, public, internal].' - ' (Env: OS_ENDPOINT_TYPE)') + default=utils.env('OS_INTERFACE'), + help='Select an interface type.' + ' Valid interface types: [admin, public, internal].' + ' (Env: OS_INTERFACE)') parser.add_argument( '--timing', default=False, @@ -263,10 +263,10 @@ class OpenStackShell(app.App): self.options.project_name = tenant_name # Do configuration file handling - # Ignore the default value of endpoint_type. Only if it is set later + # Ignore the default value of interface. Only if it is set later # will it be used. cc = cloud_config.OpenStackConfig( - override_defaults={'endpoint_type': None, }) + override_defaults={'interface': None, }) self.log.debug("defaults: %s", cc.defaults) self.cloud = cc.get_one_cloud( diff --git a/openstackclient/tests/common/test_clientmanager.py b/openstackclient/tests/common/test_clientmanager.py index e86ef509..29cc59ed 100644 --- a/openstackclient/tests/common/test_clientmanager.py +++ b/openstackclient/tests/common/test_clientmanager.py @@ -54,7 +54,7 @@ class FakeOptions(object): self.identity_api_version = '2.0' self.timing = None self.region_name = None - self.endpoint_type = None + self.interface = None self.url = None self.auth = {} self.default_domain = 'default' @@ -124,7 +124,7 @@ class TestClientManager(utils.TestCase): auth_url=fakes.AUTH_URL, ), auth_type='v2token', - endpoint_type=fakes.ENDPOINT_TYPE, + interface=fakes.INTERFACE, region_name=fakes.REGION_NAME, ), api_version=API_VERSION, @@ -141,8 +141,8 @@ class TestClientManager(utils.TestCase): auth_v2.Token, ) self.assertEqual( - fakes.ENDPOINT_TYPE, - client_manager._endpoint_type, + fakes.INTERFACE, + client_manager._interface, ) self.assertEqual( fakes.REGION_NAME, diff --git a/openstackclient/tests/fakes.py b/openstackclient/tests/fakes.py index a9322ec3..ff69c190 100644 --- a/openstackclient/tests/fakes.py +++ b/openstackclient/tests/fakes.py @@ -27,7 +27,7 @@ USERNAME = "itchy" PASSWORD = "scratchy" PROJECT_NAME = "poochie" REGION_NAME = "richie" -ENDPOINT_TYPE = "catchy" +INTERFACE = "catchy" TEST_RESPONSE_DICT = fixture.V2Token(token_id=AUTH_TOKEN, user_name=USERNAME) diff --git a/openstackclient/tests/test_shell.py b/openstackclient/tests/test_shell.py index 0b4ff685..e2f0580b 100644 --- a/openstackclient/tests/test_shell.py +++ b/openstackclient/tests/test_shell.py @@ -39,7 +39,7 @@ DEFAULT_REGION_NAME = "ZZ9_Plural_Z_Alpha" DEFAULT_TOKEN = "token" DEFAULT_SERVICE_URL = "http://127.0.0.1:8771/v3.0/" DEFAULT_AUTH_PLUGIN = "v2password" -DEFAULT_ENDPOINT_TYPE = "internal" +DEFAULT_INTERFACE = "internal" DEFAULT_COMPUTE_API_VERSION = "2" DEFAULT_IDENTITY_API_VERSION = "2" @@ -63,7 +63,7 @@ CLOUD_1 = { }, 'region_name': 'occ-cloud', 'donut': 'glazed', - 'endpoint_type': 'public', + 'interface': 'public', } } } @@ -107,7 +107,7 @@ global_options = { '--os-default-domain': (DEFAULT_DOMAIN_NAME, True, True), '--os-cacert': ('/dev/null', True, True), '--timing': (True, True, False), - '--os-endpoint-type': (DEFAULT_ENDPOINT_TYPE, True, True) + '--os-interface': (DEFAULT_INTERFACE, True, True) } auth_options = { @@ -127,7 +127,7 @@ auth_options = { '--os-auth-type': ("v2password", True, True), '--os-token': (DEFAULT_TOKEN, True, True), '--os-url': (DEFAULT_SERVICE_URL, True, True), - '--os-endpoint-type': (DEFAULT_ENDPOINT_TYPE, True, True), + '--os-interface': (DEFAULT_INTERFACE, True, True), } @@ -616,7 +616,7 @@ class TestShellCli(TestShell): ) self.assertEqual( 'public', - _shell.cloud.config['endpoint_type'], + _shell.cloud.config['interface'], ) @mock.patch("os_client_config.config.OpenStackConfig._load_vendor_file")