From 5521e4c504c6a3a06f17a9e4f80444743aa293c7 Mon Sep 17 00:00:00 2001 From: Roxana Gherle Date: Fri, 22 May 2015 16:22:35 -0700 Subject: Add --os-endpoint-type cli optional argument User should be able to specify the endpoint type through a CLI optional argument/ENV variable setting. We will name this new optional argument: --os-endpoint-type (Env: OS_ENDPOINT_TYPE) and based on the value given, the service API will use that specific endpoint type. Possible values: public, admin, internal. DocImpact Closes-Bug: #1454392 Change-Id: Ife3d4e46b44c0ddcd712b1130e27e362545a9a29 --- openstackclient/shell.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'openstackclient/shell.py') diff --git a/openstackclient/shell.py b/openstackclient/shell.py index 36483b3a..6c909586 100644 --- a/openstackclient/shell.py +++ b/openstackclient/shell.py @@ -208,6 +208,15 @@ class OpenStackShell(app.App): help='Default domain ID, default=' + DEFAULT_DOMAIN + ' (Env: OS_DEFAULT_DOMAIN)') + parser.add_argument( + '--os-endpoint-type', + metavar='', + dest='endpoint_type', + 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)') parser.add_argument( '--timing', default=False, @@ -254,7 +263,10 @@ class OpenStackShell(app.App): self.options.project_name = tenant_name # Do configuration file handling - cc = cloud_config.OpenStackConfig() + # Ignore the default value of endpoint_type. Only if it is set later + # will it be used. + cc = cloud_config.OpenStackConfig( + override_defaults={'endpoint_type': None, }) self.log.debug("defaults: %s", cc.defaults) self.cloud = cc.get_one_cloud( -- cgit v1.2.1