summaryrefslogtreecommitdiff
path: root/openstackclient
diff options
context:
space:
mode:
authorTerryHowe <terrylhowe@gmail.com>2015-07-04 09:32:16 -0600
committerTerryHowe <terrylhowe@gmail.com>2015-07-15 10:11:59 -0600
commit36391a81a3415d24c55d6bbc318157dc119da8a7 (patch)
treee460c472a29c15769a430bc0f0ca70f6b4fff7d8 /openstackclient
parentee64c2fa6b9eb6f8d628e8899df39a4ee01c2bb3 (diff)
downloadpython-openstackclient-36391a81a3415d24c55d6bbc318157dc119da8a7.tar.gz
Rename endpoint type to interface
Change-Id: I4e21d09bc747e8210f4f79a1d6c4c7ccf2f25d1c Closes-Bug: #1454392
Diffstat (limited to 'openstackclient')
-rw-r--r--openstackclient/common/clientmanager.py12
-rw-r--r--openstackclient/compute/client.py5
-rw-r--r--openstackclient/identity/client.py5
-rw-r--r--openstackclient/image/client.py4
-rw-r--r--openstackclient/network/client.py5
-rw-r--r--openstackclient/object/client.py2
-rw-r--r--openstackclient/shell.py18
-rw-r--r--openstackclient/tests/common/test_clientmanager.py8
-rw-r--r--openstackclient/tests/fakes.py2
-rw-r--r--openstackclient/tests/test_shell.py10
-rw-r--r--openstackclient/volume/client.py5
11 files changed, 36 insertions, 40 deletions
diff --git a/openstackclient/common/clientmanager.py b/openstackclient/common/clientmanager.py
index fae95630..8612a614 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/compute/client.py b/openstackclient/compute/client.py
index 27d63a95..6ae87b79 100644
--- a/openstackclient/compute/client.py
+++ b/openstackclient/compute/client.py
@@ -48,9 +48,8 @@ def make_client(instance):
extensions = [extension.Extension('list_extensions', list_extensions)]
- # Remember endpoint_type only if it is set
- kwargs = utils.build_kwargs_dict('endpoint_type',
- instance._endpoint_type)
+ # Remember interface only if it is set
+ kwargs = utils.build_kwargs_dict('endpoint_type', instance._interface)
client = compute_client(
session=instance.session,
diff --git a/openstackclient/identity/client.py b/openstackclient/identity/client.py
index cc803511..d7b663dd 100644
--- a/openstackclient/identity/client.py
+++ b/openstackclient/identity/client.py
@@ -46,9 +46,8 @@ def make_client(instance):
API_VERSIONS)
LOG.debug('Instantiating identity client: %s', identity_client)
- # Remember interface only if endpoint_type is set
- kwargs = utils.build_kwargs_dict('interface',
- instance._endpoint_type)
+ # Remember interface only if interface is set
+ kwargs = utils.build_kwargs_dict('interface', instance._interface)
client = identity_client(
session=instance.session,
diff --git a/openstackclient/image/client.py b/openstackclient/image/client.py
index 8e2d6cd9..8fbf8c0f 100644
--- a/openstackclient/image/client.py
+++ b/openstackclient/image/client.py
@@ -46,7 +46,7 @@ def make_client(instance):
endpoint = instance.get_endpoint_for_service_type(
API_NAME,
region_name=instance._region_name,
- endpoint_type=instance._endpoint_type,
+ interface=instance._interface,
)
client = image_client(
@@ -69,7 +69,7 @@ def make_client(instance):
endpoint=instance.get_endpoint_for_service_type(
IMAGE_API_TYPE,
region_name=instance._region_name,
- endpoint_type=instance._endpoint_type,
+ interface=instance._interface,
)
)
diff --git a/openstackclient/network/client.py b/openstackclient/network/client.py
index de08e5e2..0ef68852 100644
--- a/openstackclient/network/client.py
+++ b/openstackclient/network/client.py
@@ -47,12 +47,11 @@ def make_client(instance):
endpoint = instance.get_endpoint_for_service_type(
API_NAME,
region_name=instance._region_name,
- endpoint_type=instance._endpoint_type,
+ interface=instance._interface,
)
# Remember endpoint_type only if it is set
- kwargs = utils.build_kwargs_dict('endpoint_type',
- instance._endpoint_type)
+ kwargs = utils.build_kwargs_dict('endpoint_type', instance._interface)
client = network_client(
session=instance.session,
diff --git a/openstackclient/object/client.py b/openstackclient/object/client.py
index 676f6642..0359940d 100644
--- a/openstackclient/object/client.py
+++ b/openstackclient/object/client.py
@@ -36,7 +36,7 @@ def make_client(instance):
endpoint = instance.get_endpoint_for_service_type(
'object-store',
region_name=instance._region_name,
- endpoint_type=instance._endpoint_type,
+ interface=instance._interface,
)
client = object_store_v1.APIv1(
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='<endpoint-type>',
- dest='endpoint_type',
+ '--os-interface',
+ metavar='<interface>',
+ 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 674d8345..4e1b0ed8 100644
--- a/openstackclient/tests/test_shell.py
+++ b/openstackclient/tests/test_shell.py
@@ -38,7 +38,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"
@@ -62,7 +62,7 @@ CLOUD_1 = {
},
'region_name': 'occ-cloud',
'donut': 'glazed',
- 'endpoint_type': 'public',
+ 'interface': 'public',
}
}
}
@@ -106,7 +106,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 = {
@@ -126,7 +126,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),
}
@@ -614,7 +614,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")
diff --git a/openstackclient/volume/client.py b/openstackclient/volume/client.py
index 965c42ec..093178e3 100644
--- a/openstackclient/volume/client.py
+++ b/openstackclient/volume/client.py
@@ -53,9 +53,8 @@ def make_client(instance):
extensions = [extension.Extension('list_extensions', list_extensions)]
- # Remember endpoint_type only if it is set
- kwargs = utils.build_kwargs_dict('endpoint_type',
- instance._endpoint_type)
+ # Remember interface only if it is set
+ kwargs = utils.build_kwargs_dict('endpoint_type', instance._interface)
client = volume_client(
session=instance.session,