Support OS_INTERFACE and set V2 API as default

This makes the client work with OS_INTERFACE / --os-interface and
makes it use the version 2 as default for dns.

Change-Id: I8d8bdd39f852dbe87846673d9bffc95b17e9a3cd
This commit is contained in:
Endre Karlson 2015-10-31 00:23:53 +01:00 committed by Kiall Mac Innes
parent ca01ddc20b
commit 2dad9c38a3

View File

@ -31,7 +31,9 @@ def make_client(instance):
cls = oscutils.get_client_class( cls = oscutils.get_client_class(
API_NAME, instance._api_version[API_NAME], API_NAME, instance._api_version[API_NAME],
API_VERSIONS) API_VERSIONS)
return cls(session=instance.session) kwargs = oscutils.build_kwargs_dict('endpoint_type', instance._interface)
return cls(session=instance.session,
region_name=instance._region_name, **kwargs)
def build_option_parser(parser): def build_option_parser(parser):
@ -39,7 +41,7 @@ def build_option_parser(parser):
parser.add_argument( parser.add_argument(
'--os-dns-api-version', '--os-dns-api-version',
metavar='<dns-api-version>', metavar='<dns-api-version>',
default=shell.env('OS_DNS_API_VERSION'), default=shell.env('OS_DNS_API_VERSION', default="2"),
help='DNS API version, default=' + help='DNS API version, default=' +
DEFAULT_API_VERSION + DEFAULT_API_VERSION +
' (Env: OS_DNS_API_VERSION)') ' (Env: OS_DNS_API_VERSION)')