diff --git a/mistral/executors/default_executor.py b/mistral/executors/default_executor.py index 64492c338..6d09c6df6 100644 --- a/mistral/executors/default_executor.py +++ b/mistral/executors/default_executor.py @@ -16,7 +16,10 @@ from oslo_log import log as logging from osprofiler import profiler +from mistral_lib import actions as mistral_lib + from mistral.actions import action_factory as a_f +from mistral import context from mistral import exceptions as exc from mistral.executors import base from mistral.rpc import clients as rpc @@ -99,7 +102,14 @@ class DefaultExecutor(base.Executor): # Run action. try: - result = action.run() + + # NOTE(d0ugal): If the action is a subclass of mistral-lib we know + # that it expects to be passed the context. We should deprecate + # the builtin action class in Mistral. + if isinstance(action, mistral_lib.Action): + result = action.run(context.ctx()) + else: + result = action.run() # Note: it's made for backwards compatibility with already # existing Mistral actions which don't return result as diff --git a/requirements.txt b/requirements.txt index 66b9c1a67..4990e5da0 100644 --- a/requirements.txt +++ b/requirements.txt @@ -12,6 +12,7 @@ gnocchiclient>=2.7.0 # Apache-2.0 Jinja2!=2.9.0,!=2.9.1,!=2.9.2,!=2.9.3,!=2.9.4,>=2.8 # BSD License (3 clause) jsonschema!=2.5.0,<3.0.0,>=2.0.0 # MIT keystonemiddleware>=4.12.0 # Apache-2.0 +mistral-lib>=0.1.0 # Apache-2.0 networkx>=1.10 # BSD oslo.concurrency>=3.8.0 # Apache-2.0 oslo.config>=3.22.0 # Apache-2.0