From 1f2fefbc1912028a0945f55da6248d8b93db1ed3 Mon Sep 17 00:00:00 2001 From: kairat_kushaev Date: Mon, 21 Sep 2015 16:27:27 +0300 Subject: [PATCH] Use common identity parameters fro keystone client The common identity params need to be requested from keystone client instead of storing them in glance client. Change-Id: If1260fb1e01b1fff798e9ce170e58ac62521d97d --- glanceclient/shell.py | 104 +++--------------------------------------- 1 file changed, 6 insertions(+), 98 deletions(-) diff --git a/glanceclient/shell.py b/glanceclient/shell.py index 7534c910..07512423 100755 --- a/glanceclient/shell.py +++ b/glanceclient/shell.py @@ -53,101 +53,21 @@ SUPPORTED_VERSIONS = [1, 2] class OpenStackImagesShell(object): def _append_global_identity_args(self, parser): - # FIXME(bobt): these are global identity (Keystone) arguments which - # should be consistent and shared by all service clients. Therefore, - # they should be provided by python-keystoneclient. We will need to - # refactor this code once this functionality is avaible in - # python-keystoneclient. See - # - # https://bugs.launchpad.net/python-keystoneclient/+bug/1332337 - # - parser.add_argument('-k', '--insecure', - default=False, - action='store_true', - help='Explicitly allow glanceclient to perform ' - '\"insecure SSL\" (https) requests. The server\'s ' - 'certificate will not be verified against any ' - 'certificate authorities. This option should ' - 'be used with caution.') - - parser.add_argument('--os-cert', - help='Path of certificate file to use in SSL ' - 'connection. This file can optionally be ' - 'prepended with the private key.') - - parser.add_argument('--cert-file', - dest='os_cert', - help='DEPRECATED! Use --os-cert.') - - parser.add_argument('--os-key', - help='Path of client key to use in SSL ' - 'connection. This option is not necessary ' - 'if your key is prepended to your cert file.') + # register common identity args + session.Session.register_cli_options(parser) + v3_auth.Password.register_argparse_arguments(parser) parser.add_argument('--key-file', dest='os_key', help='DEPRECATED! Use --os-key.') - parser.add_argument('--os-cacert', - metavar='', - dest='os_cacert', - default=utils.env('OS_CACERT'), - help='Path of CA TLS certificate(s) used to ' - 'verify the remote server\'s certificate. ' - 'Without this option glance looks for the ' - 'default system CA certificates.') - parser.add_argument('--ca-file', dest='os_cacert', help='DEPRECATED! Use --os-cacert.') - parser.add_argument('--os-username', - default=utils.env('OS_USERNAME'), - help='Defaults to env[OS_USERNAME].') - - parser.add_argument('--os_username', - help=argparse.SUPPRESS) - - parser.add_argument('--os-user-id', - default=utils.env('OS_USER_ID'), - help='Defaults to env[OS_USER_ID].') - - parser.add_argument('--os-user-domain-id', - default=utils.env('OS_USER_DOMAIN_ID'), - help='Defaults to env[OS_USER_DOMAIN_ID].') - - parser.add_argument('--os-user-domain-name', - default=utils.env('OS_USER_DOMAIN_NAME'), - help='Defaults to env[OS_USER_DOMAIN_NAME].') - - parser.add_argument('--os-project-id', - default=utils.env('OS_PROJECT_ID'), - help='Another way to specify tenant ID. ' - 'This option is mutually exclusive with ' - ' --os-tenant-id. ' - 'Defaults to env[OS_PROJECT_ID].') - - parser.add_argument('--os-project-name', - default=utils.env('OS_PROJECT_NAME'), - help='Another way to specify tenant name. ' - 'This option is mutually exclusive with ' - ' --os-tenant-name. ' - 'Defaults to env[OS_PROJECT_NAME].') - - parser.add_argument('--os-project-domain-id', - default=utils.env('OS_PROJECT_DOMAIN_ID'), - help='Defaults to env[OS_PROJECT_DOMAIN_ID].') - - parser.add_argument('--os-project-domain-name', - default=utils.env('OS_PROJECT_DOMAIN_NAME'), - help='Defaults to env[OS_PROJECT_DOMAIN_NAME].') - - parser.add_argument('--os-password', - default=utils.env('OS_PASSWORD'), - help='Defaults to env[OS_PASSWORD].') - - parser.add_argument('--os_password', - help=argparse.SUPPRESS) + parser.add_argument('--cert-file', + dest='os_cert', + help='DEPRECATED! Use --os-cert.') parser.add_argument('--os-tenant-id', default=utils.env('OS_TENANT_ID'), @@ -163,13 +83,6 @@ class OpenStackImagesShell(object): parser.add_argument('--os_tenant_name', help=argparse.SUPPRESS) - parser.add_argument('--os-auth-url', - default=utils.env('OS_AUTH_URL'), - help='Defaults to env[OS_AUTH_URL].') - - parser.add_argument('--os_auth_url', - help=argparse.SUPPRESS) - parser.add_argument('--os-region-name', default=utils.env('OS_REGION_NAME'), help='Defaults to env[OS_REGION_NAME].') @@ -234,10 +147,6 @@ class OpenStackImagesShell(object): 'of schema that generates portions of the ' 'help text. Ignored with API version 1.') - parser.add_argument('--timeout', - default=600, - help='Number of seconds to wait for a response.') - parser.add_argument('--no-ssl-compression', dest='ssl_compression', default=True, action='store_false', @@ -286,7 +195,6 @@ class OpenStackImagesShell(object): 'the profiling will not be triggered even ' 'if osprofiler is enabled on server side.') - # FIXME(bobt): this method should come from python-keystoneclient self._append_global_identity_args(parser) return parser