Merge "Rename endpoint type to interface"
This commit is contained in:
commit
fe95e15ecd
@ -86,7 +86,7 @@ class ClientManager(object):
|
|||||||
self._pw_callback = pw_func
|
self._pw_callback = pw_func
|
||||||
self._url = self._cli_options.auth.get('url', None)
|
self._url = self._cli_options.auth.get('url', None)
|
||||||
self._region_name = self._cli_options.region_name
|
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
|
self.timing = self._cli_options.timing
|
||||||
|
|
||||||
@ -185,22 +185,22 @@ class ClientManager(object):
|
|||||||
return self._auth_ref
|
return self._auth_ref
|
||||||
|
|
||||||
def get_endpoint_for_service_type(self, service_type, region_name=None,
|
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."""
|
"""Return the endpoint URL for the service type."""
|
||||||
if not endpoint_type:
|
if not interface:
|
||||||
endpoint_type = 'public'
|
interface = 'public'
|
||||||
# See if we are using password flow auth, i.e. we have a
|
# See if we are using password flow auth, i.e. we have a
|
||||||
# service catalog to select endpoints from
|
# service catalog to select endpoints from
|
||||||
if self.auth_ref:
|
if self.auth_ref:
|
||||||
endpoint = self.auth_ref.service_catalog.url_for(
|
endpoint = self.auth_ref.service_catalog.url_for(
|
||||||
service_type=service_type,
|
service_type=service_type,
|
||||||
region_name=region_name,
|
region_name=region_name,
|
||||||
endpoint_type=endpoint_type,
|
endpoint_type=interface,
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
# Get the passed endpoint directly from the auth plugin
|
# Get the passed endpoint directly from the auth plugin
|
||||||
endpoint = self.auth.get_endpoint(self.session,
|
endpoint = self.auth.get_endpoint(self.session,
|
||||||
interface=endpoint_type)
|
interface=interface)
|
||||||
return endpoint
|
return endpoint
|
||||||
|
|
||||||
|
|
||||||
|
@ -209,14 +209,14 @@ class OpenStackShell(app.App):
|
|||||||
DEFAULT_DOMAIN +
|
DEFAULT_DOMAIN +
|
||||||
' (Env: OS_DEFAULT_DOMAIN)')
|
' (Env: OS_DEFAULT_DOMAIN)')
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
'--os-endpoint-type',
|
'--os-interface',
|
||||||
metavar='<endpoint-type>',
|
metavar='<interface>',
|
||||||
dest='endpoint_type',
|
dest='interface',
|
||||||
choices=['admin', 'public', 'internal'],
|
choices=['admin', 'public', 'internal'],
|
||||||
default=utils.env('OS_ENDPOINT_TYPE'),
|
default=utils.env('OS_INTERFACE'),
|
||||||
help='Select an endpoint type.'
|
help='Select an interface type.'
|
||||||
' Valid endpoint types: [admin, public, internal].'
|
' Valid interface types: [admin, public, internal].'
|
||||||
' (Env: OS_ENDPOINT_TYPE)')
|
' (Env: OS_INTERFACE)')
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
'--timing',
|
'--timing',
|
||||||
default=False,
|
default=False,
|
||||||
@ -263,10 +263,10 @@ class OpenStackShell(app.App):
|
|||||||
self.options.project_name = tenant_name
|
self.options.project_name = tenant_name
|
||||||
|
|
||||||
# Do configuration file handling
|
# 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.
|
# will it be used.
|
||||||
cc = cloud_config.OpenStackConfig(
|
cc = cloud_config.OpenStackConfig(
|
||||||
override_defaults={'endpoint_type': None, })
|
override_defaults={'interface': None, })
|
||||||
self.log.debug("defaults: %s", cc.defaults)
|
self.log.debug("defaults: %s", cc.defaults)
|
||||||
|
|
||||||
self.cloud = cc.get_one_cloud(
|
self.cloud = cc.get_one_cloud(
|
||||||
|
@ -54,7 +54,7 @@ class FakeOptions(object):
|
|||||||
self.identity_api_version = '2.0'
|
self.identity_api_version = '2.0'
|
||||||
self.timing = None
|
self.timing = None
|
||||||
self.region_name = None
|
self.region_name = None
|
||||||
self.endpoint_type = None
|
self.interface = None
|
||||||
self.url = None
|
self.url = None
|
||||||
self.auth = {}
|
self.auth = {}
|
||||||
self.default_domain = 'default'
|
self.default_domain = 'default'
|
||||||
@ -124,7 +124,7 @@ class TestClientManager(utils.TestCase):
|
|||||||
auth_url=fakes.AUTH_URL,
|
auth_url=fakes.AUTH_URL,
|
||||||
),
|
),
|
||||||
auth_type='v2token',
|
auth_type='v2token',
|
||||||
endpoint_type=fakes.ENDPOINT_TYPE,
|
interface=fakes.INTERFACE,
|
||||||
region_name=fakes.REGION_NAME,
|
region_name=fakes.REGION_NAME,
|
||||||
),
|
),
|
||||||
api_version=API_VERSION,
|
api_version=API_VERSION,
|
||||||
@ -141,8 +141,8 @@ class TestClientManager(utils.TestCase):
|
|||||||
auth_v2.Token,
|
auth_v2.Token,
|
||||||
)
|
)
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
fakes.ENDPOINT_TYPE,
|
fakes.INTERFACE,
|
||||||
client_manager._endpoint_type,
|
client_manager._interface,
|
||||||
)
|
)
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
fakes.REGION_NAME,
|
fakes.REGION_NAME,
|
||||||
|
@ -27,7 +27,7 @@ USERNAME = "itchy"
|
|||||||
PASSWORD = "scratchy"
|
PASSWORD = "scratchy"
|
||||||
PROJECT_NAME = "poochie"
|
PROJECT_NAME = "poochie"
|
||||||
REGION_NAME = "richie"
|
REGION_NAME = "richie"
|
||||||
ENDPOINT_TYPE = "catchy"
|
INTERFACE = "catchy"
|
||||||
|
|
||||||
TEST_RESPONSE_DICT = fixture.V2Token(token_id=AUTH_TOKEN,
|
TEST_RESPONSE_DICT = fixture.V2Token(token_id=AUTH_TOKEN,
|
||||||
user_name=USERNAME)
|
user_name=USERNAME)
|
||||||
|
@ -39,7 +39,7 @@ DEFAULT_REGION_NAME = "ZZ9_Plural_Z_Alpha"
|
|||||||
DEFAULT_TOKEN = "token"
|
DEFAULT_TOKEN = "token"
|
||||||
DEFAULT_SERVICE_URL = "http://127.0.0.1:8771/v3.0/"
|
DEFAULT_SERVICE_URL = "http://127.0.0.1:8771/v3.0/"
|
||||||
DEFAULT_AUTH_PLUGIN = "v2password"
|
DEFAULT_AUTH_PLUGIN = "v2password"
|
||||||
DEFAULT_ENDPOINT_TYPE = "internal"
|
DEFAULT_INTERFACE = "internal"
|
||||||
|
|
||||||
DEFAULT_COMPUTE_API_VERSION = "2"
|
DEFAULT_COMPUTE_API_VERSION = "2"
|
||||||
DEFAULT_IDENTITY_API_VERSION = "2"
|
DEFAULT_IDENTITY_API_VERSION = "2"
|
||||||
@ -63,7 +63,7 @@ CLOUD_1 = {
|
|||||||
},
|
},
|
||||||
'region_name': 'occ-cloud',
|
'region_name': 'occ-cloud',
|
||||||
'donut': 'glazed',
|
'donut': 'glazed',
|
||||||
'endpoint_type': 'public',
|
'interface': 'public',
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -107,7 +107,7 @@ global_options = {
|
|||||||
'--os-default-domain': (DEFAULT_DOMAIN_NAME, True, True),
|
'--os-default-domain': (DEFAULT_DOMAIN_NAME, True, True),
|
||||||
'--os-cacert': ('/dev/null', True, True),
|
'--os-cacert': ('/dev/null', True, True),
|
||||||
'--timing': (True, True, False),
|
'--timing': (True, True, False),
|
||||||
'--os-endpoint-type': (DEFAULT_ENDPOINT_TYPE, True, True)
|
'--os-interface': (DEFAULT_INTERFACE, True, True)
|
||||||
}
|
}
|
||||||
|
|
||||||
auth_options = {
|
auth_options = {
|
||||||
@ -127,7 +127,7 @@ auth_options = {
|
|||||||
'--os-auth-type': ("v2password", True, True),
|
'--os-auth-type': ("v2password", True, True),
|
||||||
'--os-token': (DEFAULT_TOKEN, True, True),
|
'--os-token': (DEFAULT_TOKEN, True, True),
|
||||||
'--os-url': (DEFAULT_SERVICE_URL, 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(
|
self.assertEqual(
|
||||||
'public',
|
'public',
|
||||||
_shell.cloud.config['endpoint_type'],
|
_shell.cloud.config['interface'],
|
||||||
)
|
)
|
||||||
|
|
||||||
@mock.patch("os_client_config.config.OpenStackConfig._load_vendor_file")
|
@mock.patch("os_client_config.config.OpenStackConfig._load_vendor_file")
|
||||||
|
Loading…
Reference in New Issue
Block a user