ironic.common.inspection_rules.utils module¶
Utilities and helper functions for rules.
- class ironic.common.inspection_rules.utils.ShallowMaskDict(data, sensitive_fields=None, mask_enabled=True)[source]¶
Bases:
MutableMapping
Dictionary wrapper to mask sensitive fields on the fly.
This class implements the MutableMapping ABC to provide a complete dict-like interface while masking sensitive fields when accessed.
- class ironic.common.inspection_rules.utils.ShallowMaskList(original_list, sensitive_fields=None, mask_enabled=True)[source]¶
Bases:
MutableSequence
A proxy list to maintain original list and applies masking on the fly.
This class implements the MutableSequence ABC to provide a complete list-like interface while handling sensitive data masking consistently with ShallowMaskDict.
- ironic.common.inspection_rules.utils.normalize_path(path)[source]¶
Convert a path (dot or slash notation) to a list of path parts
- ironic.common.inspection_rules.utils.parse_inverted_operator(op)[source]¶
Handle inverted operators.
Parses a logical condition operator to determine if it has been negated using a single leading exclamation mark (‘!’). Ensures only one exclamation mark is allowed.
- Example Usage:
parse_inverted_operator(“!eq”) # Returns (“eq”, True) parse_inverted_operator(” eq “) # Returns (“eq”, False) parse_inverted_operator(“!!eq”) # Raises ValueError
raises: ValueError: If multiple exclamation marks are present returns: A tuple containing the cleaned operator and a
boolean indicating whether negation was applied.