Skip to content

Commit

Permalink
Deprecate nova.hooks
Browse files Browse the repository at this point in the history
This emits a warning message when hooks are used to ensure that admins
understand that this facility is deprecated in Nova going forward. It
also removes the links to the meager documentation on hooks to ensure
no one finds these by accident and starts using them. Also add a
comment to the code file itself incase someone ends up in it from
other searches.

Change-Id: I31b1223a0dc3fdffe356a816b591fdd88a31483a
  • Loading branch information
sdague committed Mar 1, 2016
1 parent 10da208 commit 7be5644
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 59 deletions.
57 changes: 0 additions & 57 deletions doc/source/hooks.rst

This file was deleted.

1 change: 0 additions & 1 deletion doc/source/index.rst
Expand Up @@ -153,7 +153,6 @@ Open Development.
i18n
filter_scheduler
rpc
hooks
block_device_mapping
addmethod.openstackapi
conductor
Expand Down
7 changes: 6 additions & 1 deletion nova/hooks.py
Expand Up @@ -16,6 +16,9 @@
"""Decorator and config option definitions for adding custom code (hooks)
around callables.
NOTE: as of Nova 13.0 hooks are DEPRECATED and will be removed in the
near future. You should not build any new code using this facility.
Any method may have the 'add_hook' decorator applied, which yields the
ability to invoke Hook objects before or after the method. (i.e. pre and
post)
Expand Down Expand Up @@ -47,7 +50,7 @@
from oslo_log import log as logging
import stevedore

from nova.i18n import _, _LE
from nova.i18n import _, _LE, _LW

LOG = logging.getLogger(__name__)
NS = 'nova.hooks'
Expand Down Expand Up @@ -82,6 +85,8 @@ def _run(self, name, method_type, args, kwargs, func=None):
obj = e.obj
hook_method = getattr(obj, method_type, None)
if hook_method:
LOG.warning(_LW("Hooks are deprecated as of Nova 13.0 and "
"will be removed in a future release"))
LOG.debug("Running %(name)s %(type)s-hook: %(obj)s",
{'name': name, 'type': method_type, 'obj': obj})
try:
Expand Down
7 changes: 7 additions & 0 deletions releasenotes/notes/deprecate_hooks-6f6d60ac206a6da6.yaml
@@ -0,0 +1,7 @@
---
deprecations:
- Deprecate the use of nova.hooks. This facility used to let
arbitrary out of tree code be executed around certain internal
actions, but is unsuitable for having a well maintained
API. Anyone using this facility should bring forward their use
cases in the Newton cycle as nova-specs.

0 comments on commit 7be5644

Please sign in to comment.