Deprecate hooks.
@@ -4,7 +4,7 @@ from click import ClickException
from pyinfra.api.exceptions import PyinfraError
-from . import pseudo_state
+from . import logger, pseudo_state
HOOKS = {
'before_connect': [],
@@ -26,6 +26,13 @@ def _make_hook_wrapper(hook_name):
if pseudo_state.initialised:
return
+ # COMPAT
+ # TODO: remove this + hooks
+ logger.warning((
+ 'Use of hooks in pyinfra is deprecated, '
+ 'please use the `python.call` operation instead.'
+ ))
+
HOOKS[hook_name].append(func)
@wraps(func)
