osc_lib.cli package¶
Submodules¶
osc_lib.cli.client_config module¶
OpenStackConfig subclass for argument compatibility
-
class
osc_lib.cli.client_config.
OSC_Config
(config_files=None, vendor_files=None, override_defaults=None, force_ipv4=None, envvar_prefix=None, secure_files=None, pw_func=None, session_constructor=None, app_name=None, app_version=None, load_yaml_config=True, load_envvars=True, statsd_host=None, statsd_port=None, statsd_prefix=None, influxdb_config=None)¶ Bases:
openstack.config.loader.OpenStackConfig
-
auth_config_hook
(config)¶ Allow examination of config values before loading auth plugin
OpenStackClient will override this to perform additional chacks on auth_type.
-
load_auth_plugin
(config)¶ Get auth plugin and validate args
-
osc_lib.cli.format_columns module¶
Formattable column for specify content type
-
class
osc_lib.cli.format_columns.
DictColumn
(value)¶ Bases:
cliff.columns.FormattableColumn
Format column for dict content
-
human_readable
()¶ Return a basic human readable version of the data.
-
-
class
osc_lib.cli.format_columns.
DictListColumn
(value)¶ Bases:
cliff.columns.FormattableColumn
Format column for dict, key is string, value is list
-
human_readable
()¶ Return a basic human readable version of the data.
-
osc_lib.cli.identity module¶
-
osc_lib.cli.identity.
add_project_owner_option_to_parser
(parser)¶ Register project and project domain options.
- Parameters
parser – argparse.Argument parser object.
-
osc_lib.cli.identity.
find_project
(sdk_connection, name_or_id, domain_name_or_id=None)¶ Find a project by its name name or ID.
If Forbidden to find the resource (a common case if the user does not have permission), then return the resource by creating a local instance of openstack.identity.v3.Project resource.
- Parameters
sdk_connection (openstack.connection.Connection) – Connection object of OpenStack SDK.
name_or_id (string) – Name or ID of the project
domain_name_or_id – Domain name or ID of the project. This can be used when there are multiple projects with a same name.
- Returns
the project object found
- Return type
openstack.identity.v3.project.Project
osc_lib.cli.parseractions module¶
argparse Custom Actions
-
class
osc_lib.cli.parseractions.
KeyValueAction
(option_strings, dest, nargs=None, const=None, default=None, type=None, choices=None, required=False, help=None, metavar=None)¶ Bases:
argparse.Action
A custom action to parse arguments as key=value pairs
Ensures that
dest
is a dict
-
class
osc_lib.cli.parseractions.
MultiKeyValueAction
(option_strings, dest, nargs=None, required_keys=None, optional_keys=None, **kwargs)¶ Bases:
argparse.Action
A custom action to parse arguments as key1=value1,key2=value2 pairs
Ensure that
dest
is a list. The list will finally contain multiple dicts, with key=value pairs in them.NOTE: The arguments string should be a comma separated key-value pairs. And comma(‘,’) and equal(‘=’) may not be used in the key or value.
-
class
osc_lib.cli.parseractions.
MultiKeyValueCommaAction
(option_strings, dest, nargs=None, required_keys=None, optional_keys=None, **kwargs)¶ Bases:
osc_lib.cli.parseractions.MultiKeyValueAction
Custom action to parse arguments from a set of key=value pair
Ensures that
dest
is a dict. Parses dict by separating comma separated string into individual values Ex. key1=val1,val2,key2=val3 => {“key1”: “val1,val2”, “key2”: “val3”}
-
class
osc_lib.cli.parseractions.
NonNegativeAction
(option_strings, dest, nargs=None, const=None, default=None, type=None, choices=None, required=False, help=None, metavar=None)¶ Bases:
argparse.Action
A custom action to check whether the value is non-negative or not
Ensures the value is >= 0.
-
class
osc_lib.cli.parseractions.
RangeAction
(option_strings, dest, nargs=None, const=None, default=None, type=None, choices=None, required=False, help=None, metavar=None)¶ Bases:
argparse.Action
A custom action to parse a single value or a range of values
Parses single integer values or a range of integer values delimited by a colon and returns a tuple of integers: ‘4’ sets
dest
to (4, 4) ‘6:9’ setsdest
to (6, 9)