Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 28646200C4A for ; Sun, 2 Apr 2017 10:54:57 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 26D8E160B8E; Sun, 2 Apr 2017 08:54:57 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 4770E160B77 for ; Sun, 2 Apr 2017 10:54:56 +0200 (CEST) Received: (qmail 22520 invoked by uid 500); 2 Apr 2017 08:54:55 -0000 Mailing-List: contact dev-help@ariatosca.incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@ariatosca.incubator.apache.org Delivered-To: mailing list dev@ariatosca.incubator.apache.org Received: (qmail 22509 invoked by uid 99); 2 Apr 2017 08:54:55 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd3-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 02 Apr 2017 08:54:55 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd3-us-west.apache.org (ASF Mail Server at spamd3-us-west.apache.org) with ESMTP id 19FE0181406 for ; Sun, 2 Apr 2017 08:54:55 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd3-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -4.221 X-Spam-Level: X-Spam-Status: No, score=-4.221 tagged_above=-999 required=6.31 tests=[HK_RANDOM_FROM=0.001, KAM_ASCII_DIVIDERS=0.8, RCVD_IN_DNSWL_HI=-5, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, RP_MATCHES_RCVD=-0.001, SPF_PASS=-0.001] autolearn=disabled Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd3-us-west.apache.org [10.40.0.10]) (amavisd-new, port 10024) with ESMTP id TIpk_GIUfbWh for ; Sun, 2 Apr 2017 08:54:53 +0000 (UTC) Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with SMTP id 905235F5C6 for ; Sun, 2 Apr 2017 08:54:52 +0000 (UTC) Received: (qmail 22505 invoked by uid 99); 2 Apr 2017 08:54:51 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 02 Apr 2017 08:54:51 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 8A932DFDCD; Sun, 2 Apr 2017 08:54:51 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: mxmrlv@apache.org To: dev@ariatosca.incubator.apache.org Message-Id: <2d65448275794c669dee4d4ad3243053@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: incubator-ariatosca git commit: fixes [Forced Update!] Date: Sun, 2 Apr 2017 08:54:51 +0000 (UTC) archived-at: Sun, 02 Apr 2017 08:54:57 -0000 Repository: incubator-ariatosca Updated Branches: refs/heads/minor_fixes_to_script_ctx_mechanism 67aa92585 -> 84c41afde (forced update) fixes Project: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/commit/84c41afd Tree: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/tree/84c41afd Diff: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/diff/84c41afd Branch: refs/heads/minor_fixes_to_script_ctx_mechanism Commit: 84c41afde59f168f3fa02c7647eea4ce67f3d632 Parents: 718c78c Author: max-orlov Authored: Thu Mar 30 17:36:47 2017 +0300 Committer: max-orlov Committed: Sun Apr 2 11:54:17 2017 +0300 ---------------------------------------------------------------------- aria/modeling/__init__.py | 2 ++ aria/modeling/utils.py | 14 ++++++++++++++ aria/orchestrator/context/common.py | 2 +- .../orchestrator/execution_plugin/ctx_proxy/server.py | 3 ++- aria/orchestrator/workflows/executor/process.py | 6 ++++-- 5 files changed, 23 insertions(+), 4 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/84c41afd/aria/modeling/__init__.py ---------------------------------------------------------------------- diff --git a/aria/modeling/__init__.py b/aria/modeling/__init__.py index 4dfc39d..4ac79e7 100644 --- a/aria/modeling/__init__.py +++ b/aria/modeling/__init__.py @@ -19,6 +19,7 @@ from . import ( mixins, types, models, + utils, service_template as _service_template_bases, service_instance as _service_instance_bases, service_changes as _service_changes_bases, @@ -45,4 +46,5 @@ __all__ = ( 'types', 'models', 'model_bases', + 'utils' ) http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/84c41afd/aria/modeling/utils.py ---------------------------------------------------------------------- diff --git a/aria/modeling/utils.py b/aria/modeling/utils.py index 44d7e10..1da780c 100644 --- a/aria/modeling/utils.py +++ b/aria/modeling/utils.py @@ -13,6 +13,7 @@ # See the License for the specific language governing permissions and # limitations under the License. +from json import JSONEncoder from StringIO import StringIO from . import exceptions @@ -24,6 +25,19 @@ from ..utils.console import puts from ..utils.conversion import convert_value_to_type +class ModelJSONEncoder(JSONEncoder): + def default(self, o): + from .mixins import ModelMixin + if isinstance(o, ModelMixin): + if hasattr(o, 'value'): + dict_to_return = o.to_dict(fields=('value',)) + return dict_to_return['value'] + else: + return o.to_dict() + else: + return JSONEncoder.default(self, o) + + def create_inputs(inputs, template_inputs): """ :param inputs: key-value dict http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/84c41afd/aria/orchestrator/context/common.py ---------------------------------------------------------------------- diff --git a/aria/orchestrator/context/common.py b/aria/orchestrator/context/common.py index 06e283c..3861982 100644 --- a/aria/orchestrator/context/common.py +++ b/aria/orchestrator/context/common.py @@ -195,7 +195,7 @@ class BaseContext(object): try: return self.resource.service.read(entry_id=str(self.service.id), path=path) except exceptions.StorageError: - return self.resource.service.read(entry_id=str(self.service_template.id), path=path) + return self.resource.service_template.read(entry_id=str(self.service_template.id), path=path) def get_resource_and_render(self, path=None, variables=None): """ http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/84c41afd/aria/orchestrator/execution_plugin/ctx_proxy/server.py ---------------------------------------------------------------------- diff --git a/aria/orchestrator/execution_plugin/ctx_proxy/server.py b/aria/orchestrator/execution_plugin/ctx_proxy/server.py index 817d064..52a5312 100644 --- a/aria/orchestrator/execution_plugin/ctx_proxy/server.py +++ b/aria/orchestrator/execution_plugin/ctx_proxy/server.py @@ -24,6 +24,7 @@ import StringIO import wsgiref.simple_server import bottle +from aria import modeling from .. import exceptions @@ -111,7 +112,7 @@ class CtxProxy(object): result = json.dumps({ 'type': result_type, 'payload': payload - }) + }, cls=modeling.utils.ModelJSONEncoder) except Exception as e: traceback_out = StringIO.StringIO() traceback.print_exc(file=traceback_out) http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/84c41afd/aria/orchestrator/workflows/executor/process.py ---------------------------------------------------------------------- diff --git a/aria/orchestrator/workflows/executor/process.py b/aria/orchestrator/workflows/executor/process.py index 6397e88..da82bba 100644 --- a/aria/orchestrator/workflows/executor/process.py +++ b/aria/orchestrator/workflows/executor/process.py @@ -145,10 +145,12 @@ class ProcessExecutor(base.BaseExecutor): raise RuntimeError('Executor closed') def _create_arguments_dict(self, task): + operation_inputs = dict((k, v.value) for k, v in task.inputs.iteritems()) + operation_inputs.update({'script_path': task.implementation}) return { 'task_id': task.id, - 'implementation': task.implementation, - 'operation_inputs': dict((k, v.value) for k, v in task.inputs.iteritems()), + 'implementation': 'aria.orchestrator.execution_plugin.operations.run_script_locally', + 'operation_inputs': operation_inputs, 'port': self._server_port, 'context': task.context.serialization_dict, }