diff --git a/openstack/__init__.py b/openstack/__init__.py index 792305e5a..a32487112 100644 --- a/openstack/__init__.py +++ b/openstack/__init__.py @@ -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. diff --git a/openstack/config/__init__.py b/openstack/config/__init__.py index 3e118b719..75b623db4 100644 --- a/openstack/config/__init__.py +++ b/openstack/config/__init__.py @@ -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)