Merge "Officially deprecate rollback for introspection rules"

This commit is contained in:
Jenkins 2016-03-10 09:45:00 +00:00 committed by Gerrit Code Review
commit de5442c6b6
5 changed files with 13 additions and 10 deletions

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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)

View File

@ -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.