ironic.common.kernel_parameters module

class ironic.common.kernel_parameters.KernelCommandLine(parameters, init_args)[source]

Bases: object

Represents a kernel command line.

NOTE: An instantiated object of this type does not guarantee that it has passed parsing via KernelParameterParser. ParsedKernelCommandLine is reserved for this distinction.

as_parameter_set()[source]
asdict()[source]
init_args
parameters
classmethod parse(command_line)[source]
class ironic.common.kernel_parameters.KernelParameter(key: ironic.common.kernel_parameters.ParameterKey, value: ironic.common.kernel_parameters.ParameterValue)[source]

Bases: object

key
value
class ironic.common.kernel_parameters.KernelParameterTransformer(visit_tokens=True)[source]

Bases: Transformer

bare_value(items)[source]
init_arguments(items)[source]
init_suffix(items)[source]
kernel_command_line(items)[source]
key(items)[source]
key_value_pair(items)[source]
parameter(items)[source]
parameter_list(items)[source]
quoted_value(items)[source]
value(items)[source]
value_with_spaces(items)[source]
class ironic.common.kernel_parameters.ParameterKey(key: str)[source]

Bases: object

key
class ironic.common.kernel_parameters.ParameterSet(parameters: dict[str, ironic.common.kernel_parameters.KernelParameter])[source]

Bases: object

asdict()[source]
parameters
class ironic.common.kernel_parameters.ParameterValue(value: str)[source]

Bases: object

value
class ironic.common.kernel_parameters.ParsedKernelCommandLine(parameters, init_args)[source]

Bases: KernelCommandLine

Represents a parsed kernel command line.

NOTE: This object should only be instantiated via passing a kernel command line string through KernelParameterParser.parse() and then the resultant parse tree through KernelParameterTransformer.transform(). Constructing this directly is almost certainly a mistake.

This class helps distinguish between kernel command lines that have been validated by parsing and those that have not.

class ironic.common.kernel_parameters.UnsafeKernelCommandLine(parameters, init_args, unstructured_params)[source]

Bases: KernelCommandLine

Represents a kernel command line that has not been parsed.

Includes the field ‘unstructured_params’, which are treated as opaque strings which haven’t been parsed. To convert this to a ParsedKernelCommandLine, use KernelCommandLine.parse(str(unsafe_cmd_line)).

unstructured_params
class ironic.common.kernel_parameters.UnstructuredParameters(value: str)[source]

Bases: object

value
ironic.common.kernel_parameters.sanitize_kernel_command_line(command_line)[source]

Applies filtering to a command line to sanitize it.

NOTE: This does not guarantee a correct or safe kernel command line, for stronger guarantees of correctness and safety use KernelCommandLine.parse().

Parameters:

command_line – A string containing a kernel command line or individual parameters.

Returns:

A filtered string which should be safer for use.