From 20f66fd8f231c13a31d805c1ac92af227dc2d0a3 Mon Sep 17 00:00:00 2001 From: Dougal Matthews Date: Wed, 5 Apr 2017 09:37:35 +0100 Subject: [PATCH] Add support for mistral-lib to Mistral This patch wont pass CI until mistral-lib is packaged for the TripleO CI. Depends-On-External: https://review.rdoproject.org/r/6266 Depends-On: Icec6d1a3c483a30e9e3fa3175ed0233053c69daa Change-Id: Iab8d093f53477585e60a99413ed5379fb7e5b4ae --- mistral/executors/default_executor.py | 12 +++++++++++- requirements.txt | 1 + 2 files changed, 12 insertions(+), 1 deletion(-) 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