Fix argparse integration
fix docstrings and pass correct arguments around. Change-Id: I2b029b6b93853744e1a6d29f2473ae15980462a9 Closes-Bug: #2102667
This commit is contained in:
parent
c87a4b93f4
commit
f25c47e0ba
@ -67,7 +67,7 @@ def connect(
|
||||
cloud: ty.Optional[str] = None,
|
||||
app_name: ty.Optional[str] = None,
|
||||
app_version: ty.Optional[str] = None,
|
||||
options: ty.Optional[argparse.Namespace] = None,
|
||||
options: ty.Optional[argparse.ArgumentParser] = None,
|
||||
load_yaml_config: bool = True,
|
||||
load_envvars: bool = True,
|
||||
**kwargs: ty.Any,
|
||||
@ -78,10 +78,9 @@ def connect(
|
||||
The name of the configuration to load from clouds.yaml. Defaults
|
||||
to 'envvars' which will load configuration settings from environment
|
||||
variables that start with ``OS_``.
|
||||
:param argparse.Namespace options:
|
||||
An argparse Namespace object. Allows direct passing in of
|
||||
argparse options to be added to the cloud config. Values
|
||||
of None and '' will be removed.
|
||||
:param argparse.ArgumentParser options:
|
||||
An argparse ArgumentParser object. SDK-specific options will be
|
||||
registered, parsed out and used to configure the connection.
|
||||
:param bool load_yaml_config:
|
||||
Whether or not to load config settings from clouds.yaml files.
|
||||
Defaults to True.
|
||||
|
@ -34,8 +34,8 @@ def get_cloud_region(
|
||||
)
|
||||
if options:
|
||||
config.register_argparse_arguments(options, sys.argv, service_key)
|
||||
parsed_options = options.parse_known_args(sys.argv)
|
||||
parsed_options, _rest_of_argv = options.parse_known_args(sys.argv)
|
||||
else:
|
||||
parsed_options = None
|
||||
|
||||
return config.get_one(options=parsed_options, **kwargs)
|
||||
return config.get_one(argparse=parsed_options, **kwargs)
|
||||
|
Loading…
x
Reference in New Issue
Block a user