Select endpoint type of freezer api service

This adds the ability to select the type of api endpoint

Adds the following command lint option to the freezer-scheduler

  --os-endpoint-type <endpoint-type>

Implements blueprint: scheduler-endpoint-type

Change-Id: Id0432f1e97165c1d4aca017562b7bcdab3595c50
changes/36/296436/1
Fabrizio Vanni 2015-08-31 12:26:43 +01:00
parent f9b3146a13
commit 0a1b5421dd
1 changed files with 12 additions and 1 deletions

View File

@ -126,6 +126,17 @@ def build_os_option_parser(parser):
'Defaults to env[OS_IDENTITY_API_VERSION]'),
dest='os_identity_api_version',
default=env('OS_IDENTITY_API_VERSION'))
parser.add_argument(
'--os-endpoint-type', action='store',
choices=['public', 'publicURL', 'internal', 'internalURL',
'admin', 'adminURL'],
help=('Endpoint type to select. '
'Valid endpoint types: "public" or "publicURL", '
'"internal" or "internalURL", "admin" or "adminURL". '
'Defaults to env[OS_ENDPOINT_TYPE] or "public"'),
dest='os_endpoint_type',
default=env('OS_ENDPOINT_TYPE', default='public'))
return parser
@ -220,7 +231,7 @@ class Client(object):
auth_ref = self.session.auth.get_auth_ref(self.session)
endpoint = auth_ref.service_catalog.url_for(
service_type=FREEZER_SERVICE_TYPE,
endpoint_type='public',
endpoint_type=self.opts.os_endpoint_type,
)
return endpoint