ironicclient.common.utils
Module¶ironicclient.common.utils.
HelpFormatter
(prog, indent_increment=2, max_help_position=24, width=None)[source]¶Bases: argparse.HelpFormatter
ironicclient.common.utils.
args_array_to_dict
(kwargs, key_to_convert)[source]¶Convert the value in a dictionary entry to a dictionary.
From the kwargs dictionary, converts the value of the key_to_convert entry from a list of key-value pairs to a dictionary.
Parameters: |
|
---|---|
Returns: | kwargs, the (modified) dictionary |
ironicclient.common.utils.
bool_argument_value
(arg_name, bool_str, strict=True, default=False)[source]¶Returns the Boolean represented by bool_str.
Returns the Boolean value for the argument named arg_name. The value is represented by the string bool_str. If the string is an invalid Boolean string: if strict is True, a CommandError exception is raised; otherwise the default value is returned.
Parameters: |
|
---|---|
Returns: | the Boolean value represented by bool_str or the default value if bool_str is invalid and strict is False |
Raises: | CommandError – if bool_str is an invalid Boolean string |
ironicclient.common.utils.
check_for_invalid_fields
(fields, valid_fields)[source]¶Check for invalid fields.
Parameters: |
|
---|---|
Raises: | CommandError – If invalid fields were specified by the user. |
ironicclient.common.utils.
common_filters
(marker=None, limit=None, sort_key=None, sort_dir=None, fields=None, detail=False)[source]¶Generate common filters for any list request.
Parameters: |
|
---|---|
Returns: | list of string filters. |
ironicclient.common.utils.
common_params_for_list
(args, fields, field_labels)[source]¶Generate ‘params’ dict that is common for every ‘list’ command.
Parameters: |
|
---|---|
Returns: | a dict with params to pass to the client method. |
ironicclient.common.utils.
convert_list_props_to_comma_separated
(data, props=None)[source]¶Convert the list-type properties to comma-separated strings
Parameters: |
|
---|---|
Returns: | the result dict instance. |
ironicclient.common.utils.
define_command
(subparsers, command, callback, cmd_mapper)[source]¶Define a command in the subparsers collection.
Parameters: |
|
---|
ironicclient.common.utils.
define_commands_from_module
(subparsers, command_module, cmd_mapper)[source]¶Add do_ methods in a module and add as commands into a subparsers.
ironicclient.common.utils.
get_from_stdin
(info_desc)[source]¶Read information from stdin.
Parameters: | info_desc – A string description of the desired information |
---|---|
Raises: | InvalidAttribute if there was a problem reading from stdin |
Returns: | the string that was read from stdin |
ironicclient.common.utils.
handle_json_or_file_arg
(json_arg)[source]¶Attempts to read JSON argument from file or string.
Parameters: | json_arg – May be a file name containing the JSON, or a JSON string. |
---|---|
Returns: | A list or dictionary parsed from JSON. |
Raises: | InvalidAttribute if the argument cannot be parsed. |
ironicclient.common.utils.
key_value_pairs_to_dict
(key_value_pairs)[source]¶Convert a list of key-value pairs to a dictionary.
Parameters: | key_value_pairs – a list of strings, each string is in the form <key>=<value> |
---|---|
Returns: | a dictionary, possibly empty |
ironicclient.common.utils.
make_configdrive
(path)[source]¶Make the config drive file.
Parameters: | path – The directory containing the config drive files. |
---|---|
Returns: | A gzipped and base64 encoded configdrive string. |
Except where otherwise noted, this document is licensed under Creative Commons Attribution 3.0 License. See all OpenStack Legal Documents.