def get_base_parser(self): parser = argparse.ArgumentParser( prog='glance', description=__doc__.strip(), epilog='See "glance help COMMAND" '\ 'for help on a specific command.', add_help=False, formatter_class=HelpFormatter, ) # Global arguments parser.add_argument('-h', '--help', action='store_true', help=argparse.SUPPRESS, ) parser.add_argument('--debug', default=False, action='store_true', help=argparse.SUPPRESS) parser.add_argument('--os-username', default=utils.env('OS_USERNAME'), help='Defaults to env[OS_USERNAME]') parser.add_argument('--os-password', default=utils.env('OS_PASSWORD'), help='Defaults to env[OS_PASSWORD]') parser.add_argument('--os-tenant-id', default=utils.env('OS_TENANT_ID'), help='Defaults to env[OS_TENANT_ID]') parser.add_argument('--os-tenant-name', default=utils.env('OS_TENANT_NAME'), help='Defaults to env[OS_TENANT_NAME]') parser.add_argument('--os-auth-url', default=utils.env('OS_AUTH_URL'), help='Defaults to env[OS_AUTH_URL]') parser.add_argument('--os-region-name', default=utils.env('OS_REGION_NAME'), help='Defaults to env[OS_REGION_NAME]') parser.add_argument('--os-auth-token', default=utils.env('OS_AUTH_TOKEN'), help='Defaults to env[OS_AUTH_TOKEN]') parser.add_argument('--os-image-url', default=utils.env('OS_IMAGE_URL'), help='Defaults to env[OS_IMAGE_URL]') parser.add_argument('--os-service-type', default=utils.env('OS_SERVICE_TYPE'), help='Defaults to env[OS_SERVICE_TYPE]') return parser
def get_default(config, *params, default="", env_name=""): # try to get each param in the *params list in order from env_name section of config (or the common section if env_name is empty) # failing that, if env_name is not empty try to get it from an environment variable named <ENV>_<PARAM> (e.g. myenv_OS_AUTH_URL) # failing that, for OS_PROJECT_NAME if env_name is not empty set it to env_name # failing that, try to get it from an environment variable named <PARAM> (e.g. OS_AUTH_URL) # failing that, return the value given in the default keyword argument section = env_section(env_name) for param in params: value = config.get(section, param, fallback=None) if value: return value if env_name != "": env_params = [('%s_%s' % (env_name, param)) for param in params] value = utils.env(*env_params, default=None) if value: return value for param in params: if param == "OS_PROJECT_NAME": return env_name if param == "OS_TENANT_NAME": return env_name return utils.env(*params, default=default)
def _append_global_identity_args(self, parser, argv): # register common identity args parser.set_defaults(os_auth_url=utils.env('OS_AUTH_URL')) parser.set_defaults(os_project_name=utils.env( 'OS_PROJECT_NAME', 'OS_TENANT_NAME')) parser.set_defaults(os_project_id=utils.env( 'OS_PROJECT_ID', 'OS_TENANT_ID')) parser.add_argument('--os_tenant_id', help=argparse.SUPPRESS) parser.add_argument('--os_tenant_name', help=argparse.SUPPRESS) parser.add_argument('--os-region-name', default=utils.env('OS_REGION_NAME'), help='Defaults to env[OS_REGION_NAME].') parser.add_argument('--os_region_name', help=argparse.SUPPRESS) parser.add_argument('--os-auth-token', default=utils.env('OS_AUTH_TOKEN'), help='Defaults to env[OS_AUTH_TOKEN].') parser.add_argument('--os_auth_token', help=argparse.SUPPRESS) parser.add_argument('--os-service-type', default=utils.env('OS_SERVICE_TYPE'), help='Defaults to env[OS_SERVICE_TYPE].') parser.add_argument('--os_service_type', help=argparse.SUPPRESS) parser.add_argument('--os-endpoint-type', default=utils.env('OS_ENDPOINT_TYPE'), help='Defaults to env[OS_ENDPOINT_TYPE].') parser.add_argument('--os_endpoint_type', help=argparse.SUPPRESS) loading.register_session_argparse_arguments(parser) # Peek into argv to see if os-auth-token (or the deprecated # os_auth_token) or the new os-token or the environment variable # OS_AUTH_TOKEN were given. In which case, the token auth plugin is # what the user wants. Else, we'll default to password. default_auth_plugin = 'password' token_opts = ['os-token', 'os-auth-token', 'os_auth-token'] if argv and any(i in token_opts for i in argv): default_auth_plugin = 'token' loading.register_auth_argparse_arguments( parser, argv, default=default_auth_plugin)
def _append_global_identity_args(self, parser): # 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('--ca-file', dest='os_cacert', help='DEPRECATED! Use --os-cacert.') 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'), help='Defaults to env[OS_TENANT_ID].') parser.add_argument('--os_tenant_id', help=argparse.SUPPRESS) parser.add_argument('--os-tenant-name', default=utils.env('OS_TENANT_NAME'), help='Defaults to env[OS_TENANT_NAME].') parser.add_argument('--os_tenant_name', help=argparse.SUPPRESS) parser.add_argument('--os-region-name', default=utils.env('OS_REGION_NAME'), help='Defaults to env[OS_REGION_NAME].') parser.add_argument('--os_region_name', help=argparse.SUPPRESS) parser.add_argument('--os-auth-token', default=utils.env('OS_AUTH_TOKEN'), help='Defaults to env[OS_AUTH_TOKEN].') parser.add_argument('--os_auth_token', help=argparse.SUPPRESS) parser.add_argument('--os-service-type', default=utils.env('OS_SERVICE_TYPE'), help='Defaults to env[OS_SERVICE_TYPE].') parser.add_argument('--os_service_type', help=argparse.SUPPRESS) parser.add_argument('--os-endpoint-type', default=utils.env('OS_ENDPOINT_TYPE'), help='Defaults to env[OS_ENDPOINT_TYPE].') parser.add_argument('--os_endpoint_type', help=argparse.SUPPRESS)
def get_base_parser(self): parser = argparse.ArgumentParser( prog='glance', description=__doc__.strip(), epilog='See "glance help COMMAND" ' 'for help on a specific command.', add_help=False, formatter_class=HelpFormatter, ) # Global arguments parser.add_argument( '-h', '--help', action='store_true', help=argparse.SUPPRESS, ) parser.add_argument('--version', action='version', version=glanceclient.__version__) parser.add_argument('-d', '--debug', default=bool(utils.env('GLANCECLIENT_DEBUG')), action='store_true', help='Defaults to env[GLANCECLIENT_DEBUG]') parser.add_argument('-v', '--verbose', default=False, action="store_true", help="Print more verbose output") parser.add_argument('--get-schema', default=False, action="store_true", dest='get_schema', help='Force retrieving the schema used to generate' ' portions of the help text rather than using' ' a cached copy. Ignored with api version 1') 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('--cert-file', help='Path of certificate file to use in SSL ' 'connection. This file can optionally be ' 'prepended with the private key.') parser.add_argument('--key-file', help='Path of client key to use in SSL ' 'connection. This option is not necessary ' 'if your key is prepended to your cert file.') parser.add_argument('--os-cacert', metavar='<ca-certificate-file>', 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('--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', help='Disable SSL compression when using https.') parser.add_argument('-f', '--force', dest='force', default=False, action='store_true', help='Prevent select actions from requesting ' 'user confirmation.') #NOTE(bcwaldon): DEPRECATED parser.add_argument('--dry-run', default=False, action='store_true', help='DEPRECATED! Only used for deprecated ' 'legacy commands.') #NOTE(bcwaldon): DEPRECATED parser.add_argument('--ssl', dest='use_ssl', default=False, action='store_true', help='DEPRECATED! Send a fully-formed endpoint ' 'using --os-image-url instead.') #NOTE(bcwaldon): DEPRECATED parser.add_argument('-H', '--host', metavar='ADDRESS', help='DEPRECATED! Send a fully-formed endpoint ' 'using --os-image-url instead.') #NOTE(bcwaldon): DEPRECATED parser.add_argument('-p', '--port', dest='port', metavar='PORT', type=int, default=9292, help='DEPRECATED! Send a fully-formed endpoint ' 'using --os-image-url instead.') parser.add_argument('--os-username', default=utils.env('OS_USERNAME'), help='Defaults to env[OS_USERNAME]') parser.add_argument('--os_username', help=argparse.SUPPRESS) #NOTE(bcwaldon): DEPRECATED parser.add_argument('-I', dest='os_username', help='DEPRECATED! Use --os-username.') parser.add_argument('--os-password', default=utils.env('OS_PASSWORD'), help='Defaults to env[OS_PASSWORD]') parser.add_argument('--os_password', help=argparse.SUPPRESS) #NOTE(bcwaldon): DEPRECATED parser.add_argument('-K', dest='os_password', help='DEPRECATED! Use --os-password.') parser.add_argument('--os-tenant-id', default=utils.env('OS_TENANT_ID'), help='Defaults to env[OS_TENANT_ID]') parser.add_argument('--os_tenant_id', help=argparse.SUPPRESS) parser.add_argument('--os-tenant-name', default=utils.env('OS_TENANT_NAME'), help='Defaults to env[OS_TENANT_NAME]') parser.add_argument('--os_tenant_name', help=argparse.SUPPRESS) #NOTE(bcwaldon): DEPRECATED parser.add_argument('-T', dest='os_tenant_name', help='DEPRECATED! Use --os-tenant-name.') 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) #NOTE(bcwaldon): DEPRECATED parser.add_argument('-N', dest='os_auth_url', help='DEPRECATED! Use --os-auth-url.') parser.add_argument('--os-region-name', default=utils.env('OS_REGION_NAME'), help='Defaults to env[OS_REGION_NAME]') parser.add_argument('--os_region_name', help=argparse.SUPPRESS) #NOTE(bcwaldon): DEPRECATED parser.add_argument('-R', dest='os_region_name', help='DEPRECATED! Use --os-region-name.') parser.add_argument('--os-auth-token', default=utils.env('OS_AUTH_TOKEN'), help='Defaults to env[OS_AUTH_TOKEN]') parser.add_argument('--os_auth_token', help=argparse.SUPPRESS) #NOTE(bcwaldon): DEPRECATED parser.add_argument('-A', '--auth_token', dest='os_auth_token', help='DEPRECATED! Use --os-auth-token.') parser.add_argument('--os-image-url', default=utils.env('OS_IMAGE_URL'), help='Defaults to env[OS_IMAGE_URL]') parser.add_argument('--os_image_url', help=argparse.SUPPRESS) #NOTE(bcwaldon): DEPRECATED parser.add_argument('-U', '--url', dest='os_image_url', help='DEPRECATED! Use --os-image-url.') parser.add_argument('--os-image-api-version', default=utils.env('OS_IMAGE_API_VERSION', default='1'), help='Defaults to env[OS_IMAGE_API_VERSION] or 1') parser.add_argument('--os_image_api_version', help=argparse.SUPPRESS) parser.add_argument('--os-service-type', default=utils.env('OS_SERVICE_TYPE'), help='Defaults to env[OS_SERVICE_TYPE]') parser.add_argument('--os_service_type', help=argparse.SUPPRESS) parser.add_argument('--os-endpoint-type', default=utils.env('OS_ENDPOINT_TYPE'), help='Defaults to env[OS_ENDPOINT_TYPE]') parser.add_argument('--os_endpoint_type', help=argparse.SUPPRESS) #NOTE(bcwaldon): DEPRECATED parser.add_argument('-S', '--os_auth_strategy', help='DEPRECATED! This option is ' 'completely ignored.') return parser
def get_base_parser(self, argv): parser = argparse.ArgumentParser( prog='glance', description=__doc__.strip(), epilog='See "glance help COMMAND" ' 'for help on a specific command.', add_help=False, formatter_class=HelpFormatter, ) # Global arguments parser.add_argument('-h', '--help', action='store_true', help=argparse.SUPPRESS, ) parser.add_argument('--version', action='version', version=glanceclient.__version__) parser.add_argument('-d', '--debug', default=bool(utils.env('GLANCECLIENT_DEBUG')), action='store_true', help='Defaults to env[GLANCECLIENT_DEBUG].') parser.add_argument('-v', '--verbose', default=False, action="store_true", help="Print more verbose output.") parser.add_argument('--get-schema', default=False, action="store_true", dest='get_schema', help='Ignores cached copy and forces retrieval ' 'of schema that generates portions of the ' 'help text. Ignored with API version 1.') parser.add_argument('-f', '--force', dest='force', default=False, action='store_true', help='Prevent select actions from requesting ' 'user confirmation.') parser.add_argument('--os-image-url', default=utils.env('OS_IMAGE_URL'), help=('Defaults to env[OS_IMAGE_URL]. ' 'If the provided image url contains ' 'a version number and ' '`--os-image-api-version` is omitted ' 'the version of the URL will be picked as ' 'the image api version to use.')) parser.add_argument('--os_image_url', help=argparse.SUPPRESS) parser.add_argument('--os-image-api-version', default=utils.env('OS_IMAGE_API_VERSION', default=None), help='Defaults to env[OS_IMAGE_API_VERSION] or 2.') parser.add_argument('--os_image_api_version', help=argparse.SUPPRESS) if osprofiler_profiler: parser.add_argument('--profile', metavar='HMAC_KEY', default=utils.env('OS_PROFILE'), help='HMAC key to use for encrypting context ' 'data for performance profiling of operation. ' 'This key should be the value of HMAC key ' 'configured in osprofiler middleware in ' 'glance, it is specified in glance ' 'configuration file at ' '/etc/glance/glance-api.conf and ' '/etc/glance/glance-registry.conf. Without ' 'key the profiling will not be triggered even ' 'if osprofiler is enabled on server side. ' 'Defaults to env[OS_PROFILE].') self._append_global_identity_args(parser, argv) return parser
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.') parser.add_argument('--key-file', dest='os_key', help='DEPRECATED! Use --os-key.') parser.add_argument('--os-cacert', metavar='<ca-certificate-file>', 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('--os-tenant-id', default=utils.env('OS_TENANT_ID'), help='Defaults to env[OS_TENANT_ID].') parser.add_argument('--os_tenant_id', help=argparse.SUPPRESS) parser.add_argument('--os-tenant-name', default=utils.env('OS_TENANT_NAME'), help='Defaults to env[OS_TENANT_NAME].') 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].') parser.add_argument('--os_region_name', help=argparse.SUPPRESS) parser.add_argument('--os-auth-token', default=utils.env('OS_AUTH_TOKEN'), help='Defaults to env[OS_AUTH_TOKEN].') parser.add_argument('--os_auth_token', help=argparse.SUPPRESS) parser.add_argument('--os-service-type', default=utils.env('OS_SERVICE_TYPE'), help='Defaults to env[OS_SERVICE_TYPE].') parser.add_argument('--os_service_type', help=argparse.SUPPRESS) parser.add_argument('--os-endpoint-type', default=utils.env('OS_ENDPOINT_TYPE'), help='Defaults to env[OS_ENDPOINT_TYPE].') parser.add_argument('--os_endpoint_type', help=argparse.SUPPRESS)
def get_base_parser(self): parser = argparse.ArgumentParser( prog='glance', description=__doc__.strip(), epilog='See "glance help COMMAND" ' 'for help on a specific command.', add_help=False, formatter_class=HelpFormatter, ) # Global arguments parser.add_argument('-h', '--help', action='store_true', help=argparse.SUPPRESS, ) parser.add_argument('--version', action='version', version=glanceclient.__version__) parser.add_argument('-d', '--debug', default=bool(utils.env('GLANCECLIENT_DEBUG')), action='store_true', help='Defaults to env[GLANCECLIENT_DEBUG].') parser.add_argument('-v', '--verbose', default=False, action="store_true", help="Print more verbose output") parser.add_argument('--get-schema', default=False, action="store_true", dest='get_schema', help='Ignores cached copy and forces retrieval ' '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', help='Disable SSL compression when using https.') parser.add_argument('-f', '--force', dest='force', default=False, action='store_true', help='Prevent select actions from requesting ' 'user confirmation.') parser.add_argument('--os-image-url', default=utils.env('OS_IMAGE_URL'), help='Defaults to env[OS_IMAGE_URL].') parser.add_argument('--os_image_url', help=argparse.SUPPRESS) parser.add_argument('--os-image-api-version', default=utils.env('OS_IMAGE_API_VERSION', default='1'), help='Defaults to env[OS_IMAGE_API_VERSION] or 1.') parser.add_argument('--os_image_api_version', help=argparse.SUPPRESS) if osprofiler_profiler: parser.add_argument('--profile', metavar='HMAC_KEY', help='HMAC key to use for encrypting context ' 'data for performance profiling of operation. ' 'This key should be the value of HMAC key ' 'configured in osprofiler middleware in ' 'glance, it is specified in paste ' 'configuration file at ' '/etc/glance/api-paste.ini and ' '/etc/glance/registry-paste.ini. Without key ' '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
def get_base_parser(self): parser = argparse.ArgumentParser( prog='glance', description=__doc__.strip(), epilog='See "glance help COMMAND" ' 'for help on a specific command.', add_help=False, formatter_class=HelpFormatter, ) # Global arguments parser.add_argument('-h', '--help', action='store_true', help=argparse.SUPPRESS, ) parser.add_argument('--version', action='version', version=glanceclient.__version__) parser.add_argument('-d', '--debug', default=bool(utils.env('GLANCECLIENT_DEBUG')), action='store_true', help='Defaults to env[GLANCECLIENT_DEBUG].') parser.add_argument('-v', '--verbose', default=False, action="store_true", help="Print more verbose output.") parser.add_argument('--get-schema', default=False, action="store_true", dest='get_schema', help='Ignores cached copy and forces retrieval ' 'of schema that generates portions of the ' 'help text. Ignored with API version 1.') parser.add_argument('--no-ssl-compression', dest='ssl_compression', default=True, action='store_false', help='DEPRECATED! This option is deprecated ' 'and not used anymore. SSL compression ' 'should be disabled by default by the ' 'system SSL library.') parser.add_argument('-f', '--force', dest='force', default=False, action='store_true', help='Prevent select actions from requesting ' 'user confirmation.') parser.add_argument('--os-image-url', default=utils.env('OS_IMAGE_URL'), help=('Defaults to env[OS_IMAGE_URL]. ' 'If the provided image url contains ' 'a version number and ' '`--os-image-api-version` is omitted ' 'the version of the URL will be picked as ' 'the image api version to use.')) parser.add_argument('--os_image_url', help=argparse.SUPPRESS) parser.add_argument('--os-image-api-version', default=utils.env('OS_IMAGE_API_VERSION', default=None), help='Defaults to env[OS_IMAGE_API_VERSION] or 2.') parser.add_argument('--os_image_api_version', help=argparse.SUPPRESS) if osprofiler_profiler: parser.add_argument('--profile', metavar='HMAC_KEY', help='HMAC key to use for encrypting context ' 'data for performance profiling of operation. ' 'This key should be the value of HMAC key ' 'configured in osprofiler middleware in ' 'glance, it is specified in paste ' 'configuration file at ' '/etc/glance/api-paste.ini and ' '/etc/glance/registry-paste.ini. Without key ' 'the profiling will not be triggered even ' 'if osprofiler is enabled on server side.') self._append_global_identity_args(parser) return parser
def get_base_parser(self): parser = argparse.ArgumentParser( prog='glance', description=__doc__.strip(), epilog='See "glance help COMMAND" ' 'for help on a specific command.', add_help=False, formatter_class=HelpFormatter, ) # Global arguments parser.add_argument('-h', '--help', action='store_true', help=argparse.SUPPRESS, ) parser.add_argument('--version', action='version', version=glanceclient.__version__) parser.add_argument('-d', '--debug', default=bool(utils.env('GLANCECLIENT_DEBUG')), action='store_true', help='Defaults to env[GLANCECLIENT_DEBUG]') parser.add_argument('-v', '--verbose', default=False, action="store_true", help="Print more verbose output") parser.add_argument('--get-schema', default=False, action="store_true", dest='get_schema', help='Force retrieving the schema used to generate' ' portions of the help text rather than using' ' a cached copy. Ignored with api version 1') 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('--cert-file', help='Path of certificate file to use in SSL ' 'connection. This file can optionally be ' 'prepended with the private key.') parser.add_argument('--key-file', help='Path of client key to use in SSL ' 'connection. This option is not necessary ' 'if your key is prepended to your cert file.') parser.add_argument('--os-cacert', metavar='<ca-certificate-file>', 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('--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', help='Disable SSL compression when using https.') parser.add_argument('-f', '--force', dest='force', default=False, action='store_true', help='Prevent select actions from requesting ' 'user confirmation.') #NOTE(bcwaldon): DEPRECATED parser.add_argument('--dry-run', default=False, action='store_true', help='DEPRECATED! Only used for deprecated ' 'legacy commands.') #NOTE(bcwaldon): DEPRECATED parser.add_argument('--ssl', dest='use_ssl', default=False, action='store_true', help='DEPRECATED! Send a fully-formed endpoint ' 'using --os-image-url instead.') #NOTE(bcwaldon): DEPRECATED parser.add_argument('-H', '--host', metavar='ADDRESS', help='DEPRECATED! Send a fully-formed endpoint ' 'using --os-image-url instead.') #NOTE(bcwaldon): DEPRECATED parser.add_argument('-p', '--port', dest='port', metavar='PORT', type=int, default=9292, help='DEPRECATED! Send a fully-formed endpoint ' 'using --os-image-url instead.') parser.add_argument('--os-username', default=utils.env('OS_USERNAME'), help='Defaults to env[OS_USERNAME]') parser.add_argument('--os_username', help=argparse.SUPPRESS) #NOTE(bcwaldon): DEPRECATED parser.add_argument('-I', dest='os_username', help='DEPRECATED! Use --os-username.') parser.add_argument('--os-password', default=utils.env('OS_PASSWORD'), help='Defaults to env[OS_PASSWORD]') parser.add_argument('--os_password', help=argparse.SUPPRESS) #NOTE(bcwaldon): DEPRECATED parser.add_argument('-K', dest='os_password', help='DEPRECATED! Use --os-password.') parser.add_argument('--os-tenant-id', default=utils.env('OS_TENANT_ID'), help='Defaults to env[OS_TENANT_ID]') parser.add_argument('--os_tenant_id', help=argparse.SUPPRESS) parser.add_argument('--os-tenant-name', default=utils.env('OS_TENANT_NAME'), help='Defaults to env[OS_TENANT_NAME]') parser.add_argument('--os_tenant_name', help=argparse.SUPPRESS) #NOTE(bcwaldon): DEPRECATED parser.add_argument('-T', dest='os_tenant_name', help='DEPRECATED! Use --os-tenant-name.') 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) #NOTE(bcwaldon): DEPRECATED parser.add_argument('-N', dest='os_auth_url', help='DEPRECATED! Use --os-auth-url.') parser.add_argument('--os-region-name', default=utils.env('OS_REGION_NAME'), help='Defaults to env[OS_REGION_NAME]') parser.add_argument('--os_region_name', help=argparse.SUPPRESS) #NOTE(bcwaldon): DEPRECATED parser.add_argument('-R', dest='os_region_name', help='DEPRECATED! Use --os-region-name.') parser.add_argument('--os-auth-token', default=utils.env('OS_AUTH_TOKEN'), help='Defaults to env[OS_AUTH_TOKEN]') parser.add_argument('--os_auth_token', help=argparse.SUPPRESS) #NOTE(bcwaldon): DEPRECATED parser.add_argument('-A', '--auth_token', dest='os_auth_token', help='DEPRECATED! Use --os-auth-token.') parser.add_argument('--os-image-url', default=utils.env('OS_IMAGE_URL'), help='Defaults to env[OS_IMAGE_URL]') parser.add_argument('--os_image_url', help=argparse.SUPPRESS) #NOTE(bcwaldon): DEPRECATED parser.add_argument('-U', '--url', dest='os_image_url', help='DEPRECATED! Use --os-image-url.') parser.add_argument('--os-image-api-version', default=utils.env('OS_IMAGE_API_VERSION', default='1'), help='Defaults to env[OS_IMAGE_API_VERSION] or 1') parser.add_argument('--os_image_api_version', help=argparse.SUPPRESS) parser.add_argument('--os-service-type', default=utils.env('OS_SERVICE_TYPE'), help='Defaults to env[OS_SERVICE_TYPE]') parser.add_argument('--os_service_type', help=argparse.SUPPRESS) parser.add_argument('--os-endpoint-type', default=utils.env('OS_ENDPOINT_TYPE'), help='Defaults to env[OS_ENDPOINT_TYPE]') parser.add_argument('--os_endpoint_type', help=argparse.SUPPRESS) #NOTE(bcwaldon): DEPRECATED parser.add_argument('-S', '--os_auth_strategy', help='DEPRECATED! This option is ' 'completely ignored.') return parser
def get_base_parser(self): parser = argparse.ArgumentParser( prog='glance', description=__doc__.strip(), epilog='See "glance help COMMAND" ' 'for help on a specific command.', add_help=False, formatter_class=HelpFormatter, ) # Global arguments parser.add_argument('-h', '--help', action='store_true', help=argparse.SUPPRESS, ) parser.add_argument('--debug', default=False, action='store_true', help=argparse.SUPPRESS) parser.add_argument('--insecure', default=False, action='store_true', help=argparse.SUPPRESS) parser.add_argument('--timeout', default=600, help='Number of seconds to wait for a response') 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-password', default=utils.env('OS_PASSWORD'), help='Defaults to env[OS_PASSWORD]') parser.add_argument('--os_password', help=argparse.SUPPRESS) parser.add_argument('--os-tenant-id', default=utils.env('OS_TENANT_ID'), help='Defaults to env[OS_TENANT_ID]') parser.add_argument('--os_tenant_id', help=argparse.SUPPRESS) parser.add_argument('--os-tenant-name', default=utils.env('OS_TENANT_NAME'), help='Defaults to env[OS_TENANT_NAME]') 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]') parser.add_argument('--os_region_name', help=argparse.SUPPRESS) parser.add_argument('--os-auth-token', default=utils.env('OS_AUTH_TOKEN'), help='Defaults to env[OS_AUTH_TOKEN]') parser.add_argument('--os_auth_token', help=argparse.SUPPRESS) parser.add_argument('--os-image-url', default=utils.env('OS_IMAGE_URL'), help='Defaults to env[OS_IMAGE_URL]') parser.add_argument('--os_image_url', help=argparse.SUPPRESS) parser.add_argument('--os-image-api-version', default=utils.env('OS_IMAGE_API_VERSION', default='1'), help='Defaults to env[OS_IMAGE_API_VERSION] or 1') parser.add_argument('--os_image_api_version', help=argparse.SUPPRESS) parser.add_argument('--os-service-type', default=utils.env('OS_SERVICE_TYPE'), help='Defaults to env[OS_SERVICE_TYPE]') parser.add_argument('--os_service_type', help=argparse.SUPPRESS) parser.add_argument('--os-endpoint-type', default=utils.env('OS_ENDPOINT_TYPE'), help='Defaults to env[OS_ENDPOINT_TYPE]') parser.add_argument('--os_endpoint_type', help=argparse.SUPPRESS) return parser
def parse_args(self, argv, initial=True, source_env="", dest_env="", config=ConfigParser()): parser = argparse.ArgumentParser( prog="glancecp", description=__doc__.strip(), add_help=(not initial), formatter_class=argparse.ArgumentDefaultsHelpFormatter) parser.add_argument("source", help=''' A specification of the source image, in the format [<os_environment>:]<image_id|image_name>, where <os_environment> names an OpenStack environment from which to copy the source image which must match the regex [a-zA-Z0-9_.-]+ and <image_id|image_name> can optionally be single or double-quoted. ''') parser.add_argument("dest", help=''' A specification of the destination image, in the format [<os_environment>:]<image_id|image_name>, where <os_environment> names an OpenStack environment from which to copy the source image which must match the regex [a-zA-Z0-9_.-]+ and <image_id|image_name> can optionally be single or double-quoted. ''') parser.add_argument("--config", default=utils.env('GLANCECP_CONFIG_FILE', default="glancecp.config"), help=''' Path to an INI-style config file (or '-' to read configuration from standard input). Values of <os_environment> in the source and destination specifications will be matched against a section of the same name in the INI file. Properties within each section match the names of the usual OpenStack environment variables. For example: OS_AUTH_URL OS_USERNAME OS_PASSWORD OS_TENANT_ID A special [common] section can also be used to define defaults that apply to all sections, and properties defined there would also apply when an <os_environment> is omitted from the source and/or destination specification. If this option is not specified, the default will be to attempt to load configuration from the path set in the environment variable GLANCECP_CONFIG_FILE. If unset, it will attempt to read configuration from a file called 'glancecp.config' in the current directory. ''') parser.add_argument("--properties", default="min_disk,min_ram", help=''' Comma-delimited list of properties to copy from the source image to the destination image. Note that some properties are read-only and attempting to set them will cause the copy to fail. ''') parser.add_argument("--duplicate-name-strategy", default="none", choices=["none", "allow", "replace", "rename"], help=''' Strategy for handling duplicate names at destination: - "none": Do not allow duplicate names, copying will fail if the destination already exists. - "allow": Allow creation of destination even if images with the destination name already exist. - "replace": Remove any images already present with the destination name and replace them with the source image. - "rename": Rename any images already present with the destination name to make them unique. Currently this is implemented with a monotonically increasing integer suffix. ''') parser.add_argument("--duplicate_name_strategy", help=argparse.SUPPRESS) add_openstack_args(parser, source_env, config, prefix="source") add_openstack_args(parser, dest_env, config, prefix="dest") parser.add_argument('--insecure', default=False, help=''' Explicitly allow client to perform "insecure" TLS (https) requests. The server's certificate will not be verified against any certificate authorities. This option should be used with caution. ''') parser.add_argument('--timeout', default=False, help="Set request timeout (in seconds).") if initial: argv_copy = copy.deepcopy(argv) args, extra = parser.parse_known_args(argv_copy) return args else: return parser.parse_args(argv)
def get_base_parser(self): parser = argparse.ArgumentParser( prog='glance', description=__doc__.strip(), epilog='See "glance help COMMAND" ' 'for help on a specific command.', add_help=False, formatter_class=HelpFormatter, ) # Global arguments parser.add_argument( '-h', '--help', action='store_true', help=argparse.SUPPRESS, ) parser.add_argument('--debug', default=False, action='store_true', help=argparse.SUPPRESS) parser.add_argument('--insecure', default=False, action='store_true', help=argparse.SUPPRESS) parser.add_argument('--os-username', default=utils.env('OS_USERNAME'), help='Defaults to env[OS_USERNAME]') parser.add_argument('--os-password', default=utils.env('OS_PASSWORD'), help='Defaults to env[OS_PASSWORD]') parser.add_argument('--os-tenant-id', default=utils.env('OS_TENANT_ID'), help='Defaults to env[OS_TENANT_ID]') parser.add_argument('--os-tenant-name', default=utils.env('OS_TENANT_NAME'), help='Defaults to env[OS_TENANT_NAME]') parser.add_argument('--os-auth-url', default=utils.env('OS_AUTH_URL'), help='Defaults to env[OS_AUTH_URL]') parser.add_argument('--os-region-name', default=utils.env('OS_REGION_NAME'), help='Defaults to env[OS_REGION_NAME]') parser.add_argument('--os-auth-token', default=utils.env('OS_AUTH_TOKEN'), help='Defaults to env[OS_AUTH_TOKEN]') parser.add_argument('--os-image-url', default=utils.env('OS_IMAGE_URL'), help='Defaults to env[OS_IMAGE_URL]') parser.add_argument('--os-image-api-version', default=utils.env('OS_IMAGE_API_VERSION', default='1'), help='Defaults to env[OS_IMAGE_API_VERSION] or 1') parser.add_argument('--os-service-type', default=utils.env('OS_SERVICE_TYPE'), help='Defaults to env[OS_SERVICE_TYPE]') parser.add_argument('--os-endpoint-type', default=utils.env('OS_ENDPOINT_TYPE'), help='Defaults to env[OS_ENDPOINT_TYPE]') return parser
def _append_global_identity_args(self, parser, argv): # register common identity args parser.set_defaults(os_auth_url=utils.env('OS_AUTH_URL')) parser.set_defaults(os_project_name=utils.env( 'OS_PROJECT_NAME', 'OS_TENANT_NAME')) parser.set_defaults(os_project_id=utils.env( 'OS_PROJECT_ID', 'OS_TENANT_ID')) parser.add_argument('--key-file', dest='os_key', help='DEPRECATED! Use --os-key.') parser.add_argument('--ca-file', dest='os_cacert', help='DEPRECATED! Use --os-cacert.') parser.add_argument('--cert-file', dest='os_cert', help='DEPRECATED! Use --os-cert.') parser.add_argument('--os_tenant_id', help=argparse.SUPPRESS) parser.add_argument('--os_tenant_name', help=argparse.SUPPRESS) parser.add_argument('--os-region-name', default=utils.env('OS_REGION_NAME'), help='Defaults to env[OS_REGION_NAME].') parser.add_argument('--os_region_name', help=argparse.SUPPRESS) parser.add_argument('--os-auth-token', default=utils.env('OS_AUTH_TOKEN'), help='Defaults to env[OS_AUTH_TOKEN].') parser.add_argument('--os_auth_token', help=argparse.SUPPRESS) parser.add_argument('--os-service-type', default=utils.env('OS_SERVICE_TYPE'), help='Defaults to env[OS_SERVICE_TYPE].') parser.add_argument('--os_service_type', help=argparse.SUPPRESS) parser.add_argument('--os-endpoint-type', default=utils.env('OS_ENDPOINT_TYPE'), help='Defaults to env[OS_ENDPOINT_TYPE].') parser.add_argument('--os_endpoint_type', help=argparse.SUPPRESS) loading.register_session_argparse_arguments(parser) # Peek into argv to see if os-auth-token (or the deprecated # os_auth_token) or the new os-token or the environment variable # OS_AUTH_TOKEN were given. In which case, the token auth plugin is # what the user wants. Else, we'll default to password. default_auth_plugin = 'password' token_opts = ['os-token', 'os-auth-token', 'os_auth-token'] if argv and any(i in token_opts for i in argv): default_auth_plugin = 'token' loading.register_auth_argparse_arguments( parser, argv, default=default_auth_plugin)
def get_base_parser(self): parser = argparse.ArgumentParser( prog="glance", description=__doc__.strip(), epilog='See "glance help COMMAND" ' "for help on a specific command.", add_help=False, formatter_class=HelpFormatter, ) # Global arguments parser.add_argument("-h", "--help", action="store_true", help=argparse.SUPPRESS) parser.add_argument("--version", action="version", version=glanceclient.__version__) parser.add_argument( "-d", "--debug", default=bool(utils.env("GLANCECLIENT_DEBUG")), action="store_true", help="Defaults to env[GLANCECLIENT_DEBUG]", ) parser.add_argument("-v", "--verbose", default=False, action="store_true", help="Print more verbose output") 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( "--cert-file", help="Path of certificate file to use in SSL " "connection. This file can optionally be " "prepended with the private key.", ) parser.add_argument( "--key-file", help="Path of client key to use in SSL " "connection. This option is not necessary " "if your key is prepended to your cert file.", ) parser.add_argument( "--os-cacert", metavar="<ca-certificate-file>", 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("--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", help="Disable SSL compression when using https.", ) parser.add_argument( "-f", "--force", dest="force", default=False, action="store_true", help="Prevent select actions from requesting " "user confirmation.", ) # NOTE(bcwaldon): DEPRECATED parser.add_argument( "--dry-run", default=False, action="store_true", help="DEPRECATED! Only used for deprecated " "legacy commands.", ) # NOTE(bcwaldon): DEPRECATED parser.add_argument( "--ssl", dest="use_ssl", default=False, action="store_true", help="DEPRECATED! Send a fully-formed endpoint " "using --os-image-url instead.", ) # NOTE(bcwaldon): DEPRECATED parser.add_argument( "-H", "--host", metavar="ADDRESS", help="DEPRECATED! Send a fully-formed endpoint " "using --os-image-url instead.", ) # NOTE(bcwaldon): DEPRECATED parser.add_argument( "-p", "--port", dest="port", metavar="PORT", type=int, default=9292, help="DEPRECATED! Send a fully-formed endpoint " "using --os-image-url instead.", ) parser.add_argument("--os-username", default=utils.env("OS_USERNAME"), help="Defaults to env[OS_USERNAME]") parser.add_argument("--os_username", help=argparse.SUPPRESS) # NOTE(bcwaldon): DEPRECATED parser.add_argument("-I", dest="os_username", help="DEPRECATED! Use --os-username.") parser.add_argument("--os-password", default=utils.env("OS_PASSWORD"), help="Defaults to env[OS_PASSWORD]") parser.add_argument("--os_password", help=argparse.SUPPRESS) # NOTE(bcwaldon): DEPRECATED parser.add_argument("-K", dest="os_password", help="DEPRECATED! Use --os-password.") parser.add_argument("--os-tenant-id", default=utils.env("OS_TENANT_ID"), help="Defaults to env[OS_TENANT_ID]") parser.add_argument("--os_tenant_id", help=argparse.SUPPRESS) parser.add_argument( "--os-tenant-name", default=utils.env("OS_TENANT_NAME"), help="Defaults to env[OS_TENANT_NAME]" ) parser.add_argument("--os_tenant_name", help=argparse.SUPPRESS) # NOTE(bcwaldon): DEPRECATED parser.add_argument("-T", dest="os_tenant_name", help="DEPRECATED! Use --os-tenant-name.") 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) # NOTE(bcwaldon): DEPRECATED parser.add_argument("-N", dest="os_auth_url", help="DEPRECATED! Use --os-auth-url.") parser.add_argument( "--os-region-name", default=utils.env("OS_REGION_NAME"), help="Defaults to env[OS_REGION_NAME]" ) parser.add_argument("--os_region_name", help=argparse.SUPPRESS) # NOTE(bcwaldon): DEPRECATED parser.add_argument("-R", dest="os_region_name", help="DEPRECATED! Use --os-region-name.") parser.add_argument( "--os-auth-token", default=utils.env("OS_AUTH_TOKEN"), help="Defaults to env[OS_AUTH_TOKEN]" ) parser.add_argument("--os_auth_token", help=argparse.SUPPRESS) # NOTE(bcwaldon): DEPRECATED parser.add_argument("-A", "--auth_token", dest="os_auth_token", help="DEPRECATED! Use --os-auth-token.") parser.add_argument("--os-image-url", default=utils.env("OS_IMAGE_URL"), help="Defaults to env[OS_IMAGE_URL]") parser.add_argument("--os_image_url", help=argparse.SUPPRESS) # NOTE(bcwaldon): DEPRECATED parser.add_argument("-U", "--url", dest="os_image_url", help="DEPRECATED! Use --os-image-url.") parser.add_argument( "--os-image-api-version", default=utils.env("OS_IMAGE_API_VERSION", default="1"), help="Defaults to env[OS_IMAGE_API_VERSION] or 1", ) parser.add_argument("--os_image_api_version", help=argparse.SUPPRESS) parser.add_argument( "--os-service-type", default=utils.env("OS_SERVICE_TYPE"), help="Defaults to env[OS_SERVICE_TYPE]" ) parser.add_argument("--os_service_type", help=argparse.SUPPRESS) parser.add_argument( "--os-endpoint-type", default=utils.env("OS_ENDPOINT_TYPE"), help="Defaults to env[OS_ENDPOINT_TYPE]" ) parser.add_argument("--os_endpoint_type", help=argparse.SUPPRESS) # NOTE(bcwaldon): DEPRECATED parser.add_argument("-S", "--os_auth_strategy", help="DEPRECATED! This option is " "completely ignored.") return parser
def get_base_parser(self): parser = argparse.ArgumentParser( prog="glance", description=__doc__.strip(), epilog='See "glance help COMMAND" ' "for help on a specific command.", add_help=False, formatter_class=HelpFormatter, ) # Global arguments parser.add_argument("-h", "--help", action="store_true", help=argparse.SUPPRESS) parser.add_argument("--debug", default=False, action="store_true", help=argparse.SUPPRESS) parser.add_argument("--insecure", default=False, action="store_true", help=argparse.SUPPRESS) parser.add_argument("--os-username", default=utils.env("OS_USERNAME"), help="Defaults to env[OS_USERNAME]") parser.add_argument("--os-password", default=utils.env("OS_PASSWORD"), help="Defaults to env[OS_PASSWORD]") parser.add_argument("--os-tenant-id", default=utils.env("OS_TENANT_ID"), help="Defaults to env[OS_TENANT_ID]") parser.add_argument( "--os-tenant-name", default=utils.env("OS_TENANT_NAME"), help="Defaults to env[OS_TENANT_NAME]" ) parser.add_argument("--os-auth-url", default=utils.env("OS_AUTH_URL"), help="Defaults to env[OS_AUTH_URL]") parser.add_argument( "--os-region-name", default=utils.env("OS_REGION_NAME"), help="Defaults to env[OS_REGION_NAME]" ) parser.add_argument( "--os-auth-token", default=utils.env("OS_AUTH_TOKEN"), help="Defaults to env[OS_AUTH_TOKEN]" ) parser.add_argument("--os-image-url", default=utils.env("OS_IMAGE_URL"), help="Defaults to env[OS_IMAGE_URL]") parser.add_argument( "--os-image-api-version", default=utils.env("OS_IMAGE_API_VERSION", default="1"), help="Defaults to env[OS_IMAGE_API_VERSION] or 1", ) parser.add_argument( "--os-service-type", default=utils.env("OS_SERVICE_TYPE"), help="Defaults to env[OS_SERVICE_TYPE]" ) parser.add_argument( "--os-endpoint-type", default=utils.env("OS_ENDPOINT_TYPE"), help="Defaults to env[OS_ENDPOINT_TYPE]" ) return parser
def debug_enabled(argv): if bool(utils.env('GLANCECP_DEBUG')) is True: return True if '--debug' in argv or '-d' in argv: return True return False
def get_base_parser(self): parser = argparse.ArgumentParser( prog='glance', description=__doc__.strip(), epilog='See "glance help COMMAND" ' 'for help on a specific command.', add_help=False, formatter_class=HelpFormatter, ) # Global arguments parser.add_argument( '-h', '--help', action='store_true', help=argparse.SUPPRESS, ) parser.add_argument('--version', action='version', version=glanceclient.__version__) parser.add_argument('-d', '--debug', default=bool(utils.env('GLANCECLIENT_DEBUG')), action='store_true', help='Defaults to env[GLANCECLIENT_DEBUG].') parser.add_argument('-v', '--verbose', default=False, action="store_true", help="Print more verbose output") parser.add_argument('--get-schema', default=False, action="store_true", dest='get_schema', help='Ignores cached copy and forces retrieval ' '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', help='Disable SSL compression when using https.') parser.add_argument('-f', '--force', dest='force', default=False, action='store_true', help='Prevent select actions from requesting ' 'user confirmation.') parser.add_argument('--os-image-url', default=utils.env('OS_IMAGE_URL'), help='Defaults to env[OS_IMAGE_URL].') parser.add_argument('--os_image_url', help=argparse.SUPPRESS) parser.add_argument('--os-image-api-version', default=utils.env('OS_IMAGE_API_VERSION', default='1'), help='Defaults to env[OS_IMAGE_API_VERSION] or 1.') parser.add_argument('--os_image_api_version', help=argparse.SUPPRESS) if osprofiler_profiler: parser.add_argument('--profile', metavar='HMAC_KEY', help='HMAC key to use for encrypting context ' 'data for performance profiling of operation. ' 'This key should be the value of HMAC key ' 'configured in osprofiler middleware in ' 'glance, it is specified in paste ' 'configuration file at ' '/etc/glance/api-paste.ini and ' '/etc/glance/registry-paste.ini. Without key ' '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