ironic_inspector.plugins.rules module¶
Standard plugins for rules API.
- class ironic_inspector.plugins.rules.AddTraitAction[source]¶
Bases:
RuleActionPlugin
- REQUIRED_PARAMS = {'name'}¶
Set with names of required parameters.
- class ironic_inspector.plugins.rules.ContainsCondition[source]¶
Bases:
ReCondition
- check(node_info, field, params, **kwargs)[source]¶
Check if condition holds for a given field.
- Parameters:
node_info – NodeInfo object
field – field value
params – parameters as a dictionary, changing it here will change what will be stored in database
kwargs – used for extensibility without breaking existing plugins
- Raises:
ValueError – on unacceptable field value
- Returns:
True if check succeeded, otherwise False
- class ironic_inspector.plugins.rules.EmptyCondition[source]¶
Bases:
RuleConditionPlugin
- ALLOW_NONE = True¶
Whether this condition accepts None when field is not found.
- REQUIRED_PARAMS = {}¶
Set with names of required parameters.
- check(node_info, field, params, **kwargs)[source]¶
Check if condition holds for a given field.
- Parameters:
node_info – NodeInfo object
field – field value
params – parameters as a dictionary, changing it here will change what will be stored in database
kwargs – used for extensibility without breaking existing plugins
- Raises:
ValueError – on unacceptable field value
- Returns:
True if check succeeded, otherwise False
- class ironic_inspector.plugins.rules.EqCondition[source]¶
Bases:
SimpleCondition
- op(b, /)¶
Same as a == b.
- class ironic_inspector.plugins.rules.ExtendAttributeAction[source]¶
Bases:
RuleActionPlugin
- FORMATTED_PARAMS = ['value']¶
List of params will be formatted with python format.
- OPTIONAL_PARAMS = {'unique'}¶
Set with names of optional parameters.
- REQUIRED_PARAMS = {'path', 'value'}¶
Set with names of required parameters.
- class ironic_inspector.plugins.rules.FailAction[source]¶
Bases:
RuleActionPlugin
- REQUIRED_PARAMS = {'message'}¶
Set with names of required parameters.
- class ironic_inspector.plugins.rules.GeCondition[source]¶
Bases:
SimpleCondition
- op(b, /)¶
Same as a >= b.
- class ironic_inspector.plugins.rules.GtCondition[source]¶
Bases:
SimpleCondition
- op(b, /)¶
Same as a > b.
- class ironic_inspector.plugins.rules.LeCondition[source]¶
Bases:
SimpleCondition
- op(b, /)¶
Same as a <= b.
- class ironic_inspector.plugins.rules.LtCondition[source]¶
Bases:
SimpleCondition
- op(b, /)¶
Same as a < b.
- class ironic_inspector.plugins.rules.MatchesCondition[source]¶
Bases:
ReCondition
- check(node_info, field, params, **kwargs)[source]¶
Check if condition holds for a given field.
- Parameters:
node_info – NodeInfo object
field – field value
params – parameters as a dictionary, changing it here will change what will be stored in database
kwargs – used for extensibility without breaking existing plugins
- Raises:
ValueError – on unacceptable field value
- Returns:
True if check succeeded, otherwise False
- class ironic_inspector.plugins.rules.NeCondition[source]¶
Bases:
SimpleCondition
- op(b, /)¶
Same as a != b.
- class ironic_inspector.plugins.rules.NetCondition[source]¶
Bases:
RuleConditionPlugin
- check(node_info, field, params, **kwargs)[source]¶
Check if condition holds for a given field.
- Parameters:
node_info – NodeInfo object
field – field value
params – parameters as a dictionary, changing it here will change what will be stored in database
kwargs – used for extensibility without breaking existing plugins
- Raises:
ValueError – on unacceptable field value
- Returns:
True if check succeeded, otherwise False
- validate(params, **kwargs)[source]¶
Validate params passed during creation.
Default implementation checks for presence of fields from REQUIRED_PARAMS and fails for unexpected fields (not from REQUIRED_PARAMS + OPTIONAL_PARAMS).
- Parameters:
params – params as a dictionary
kwargs – used for extensibility without breaking existing plugins
- Raises:
ValueError on validation failure
- class ironic_inspector.plugins.rules.ReCondition[source]¶
Bases:
RuleConditionPlugin
- validate(params, **kwargs)[source]¶
Validate params passed during creation.
Default implementation checks for presence of fields from REQUIRED_PARAMS and fails for unexpected fields (not from REQUIRED_PARAMS + OPTIONAL_PARAMS).
- Parameters:
params – params as a dictionary
kwargs – used for extensibility without breaking existing plugins
- Raises:
ValueError on validation failure
- class ironic_inspector.plugins.rules.RemoveTraitAction[source]¶
Bases:
RuleActionPlugin
- REQUIRED_PARAMS = {'name'}¶
Set with names of required parameters.
- class ironic_inspector.plugins.rules.SetAttributeAction[source]¶
Bases:
RuleActionPlugin
- FORMATTED_PARAMS = ['value']¶
List of params will be formatted with python format.
- OPTIONAL_PARAMS = {'reset_interfaces', 'value'}¶
Set with names of optional parameters.
- REQUIRED_PARAMS = {'path'}¶
Set with names of required parameters.
- apply(node_info, params, **kwargs)[source]¶
Run action on successful rule match.
- Parameters:
node_info – NodeInfo object
params – parameters as a dictionary
kwargs – used for extensibility without breaking existing plugins
- Raises:
utils.Error on failure
- validate(params, **kwargs)[source]¶
Validate params passed during creation.
Default implementation checks for presence of fields from REQUIRED_PARAMS and fails for unexpected fields (not from REQUIRED_PARAMS + OPTIONAL_PARAMS).
- Parameters:
params – params as a dictionary
kwargs – used for extensibility without breaking existing plugins
- Raises:
ValueError on validation failure
- class ironic_inspector.plugins.rules.SetCapabilityAction[source]¶
Bases:
RuleActionPlugin
- FORMATTED_PARAMS = ['value']¶
List of params will be formatted with python format.
- OPTIONAL_PARAMS = {'value'}¶
Set with names of optional parameters.
- REQUIRED_PARAMS = {'name'}¶
Set with names of required parameters.
- class ironic_inspector.plugins.rules.SimpleCondition[source]¶
Bases:
RuleConditionPlugin
- check(node_info, field, params, **kwargs)[source]¶
Check if condition holds for a given field.
- Parameters:
node_info – NodeInfo object
field – field value
params – parameters as a dictionary, changing it here will change what will be stored in database
kwargs – used for extensibility without breaking existing plugins
- Raises:
ValueError – on unacceptable field value
- Returns:
True if check succeeded, otherwise False
- op = None¶