Officially deprecate rollback for introspection rules
This was designed to clean up action effects, but proved too confusing. We should recommend using explicit clean up action instead. Change-Id: Ia414979956cc0cbd5ed040831c49dba18671f86d
This commit is contained in:
parent
2ff09ffcce
commit
3471ec993c
@ -268,10 +268,6 @@ Writing a Plugin
|
||||
|
||||
The following methods and attributes may also be overridden:
|
||||
|
||||
``rollback(node_info,params,**)``
|
||||
called to clean up when conditions were not met.
|
||||
Default implementation does nothing.
|
||||
|
||||
``validate(params,**)``
|
||||
called to validate parameters provided during actions creating.
|
||||
Default implementation requires keys listed in ``REQUIRED_PARAMS`` (and
|
||||
|
@ -49,8 +49,6 @@ them automatically after running all processing hooks.
|
||||
|
||||
A rule consists of conditions to check, and actions to run. If conditions
|
||||
evaluate to true on the introspection data, then actions are run on a node.
|
||||
All actions have "rollback actions" associated with them, which are run when
|
||||
conditions evaluate to false. This way we can safely rerun introspection.
|
||||
|
||||
Available conditions and actions are defined by plugins, and can be extended,
|
||||
see :ref:`contributing_link` for details. See :ref:`api` for specific calls
|
||||
|
@ -16,13 +16,15 @@
|
||||
import abc
|
||||
|
||||
from oslo_config import cfg
|
||||
from oslo_log import log
|
||||
import six
|
||||
import stevedore
|
||||
|
||||
from ironic_inspector.common.i18n import _
|
||||
from ironic_inspector.common.i18n import _, _LW
|
||||
|
||||
|
||||
CONF = cfg.CONF
|
||||
LOG = log.getLogger(__name__)
|
||||
|
||||
|
||||
@six.add_metaclass(abc.ABCMeta)
|
||||
@ -195,4 +197,10 @@ def rule_actions_manager():
|
||||
_ACTIONS_MGR = stevedore.ExtensionManager(
|
||||
'ironic_inspector.rules.actions',
|
||||
invoke_on_load=True)
|
||||
for act in _ACTIONS_MGR:
|
||||
# a trick to detect if function was overriden
|
||||
if "rollback" in act.obj.__class__.__dict__:
|
||||
LOG.warning(_LW('Defining "rollback" for introspection rules '
|
||||
'actions is deprecated (action "%s")'),
|
||||
act.name)
|
||||
return _ACTIONS_MGR
|
||||
|
@ -37,6 +37,3 @@ def example_not_found_hook(introspection_data, **kwargs):
|
||||
class ExampleRuleAction(base.RuleActionPlugin): # pragma: no cover
|
||||
def apply(self, node_info, params, **kwargs):
|
||||
LOG.debug('apply action to %s: %s', node_info.uuid, params)
|
||||
|
||||
def rollback(self, node_info, params, **kwargs):
|
||||
LOG.debug('rollback action to %s: %s', node_info.uuid, params)
|
||||
|
@ -0,0 +1,4 @@
|
||||
---
|
||||
deprecations:
|
||||
- The rollback actions for introspection rules are deprecated. No in-tree
|
||||
actions are using them, 3rdpart should stop using them as soon as possible.
|
Loading…
x
Reference in New Issue
Block a user