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 AA53A200C8A for ; Sun, 4 Jun 2017 17:00:49 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id A9363160BE0; Sun, 4 Jun 2017 15:00:49 +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 C7E8E160BB7 for ; Sun, 4 Jun 2017 17:00:48 +0200 (CEST) Received: (qmail 4796 invoked by uid 500); 4 Jun 2017 15:00:48 -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 4783 invoked by uid 99); 4 Jun 2017 15:00:48 -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, 04 Jun 2017 15:00:48 +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 9D0BE1802C9 for ; Sun, 4 Jun 2017 15:00:47 +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 YOC7QHvCi3uW for ; Sun, 4 Jun 2017 15:00:46 +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 3931B5FE2F for ; Sun, 4 Jun 2017 15:00:45 +0000 (UTC) Received: (qmail 4768 invoked by uid 99); 4 Jun 2017 15:00:44 -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, 04 Jun 2017 15:00:44 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id F1A84DFBDA; Sun, 4 Jun 2017 15:00:43 +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: <5a72f6e74bcc437dabb1f42d83f88a94@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: incubator-ariatosca git commit: moved default instrumentation values [Forced Update!] Date: Sun, 4 Jun 2017 15:00:43 +0000 (UTC) archived-at: Sun, 04 Jun 2017 15:00:49 -0000 Repository: incubator-ariatosca Updated Branches: refs/heads/ARIA-262-Inconsistent-node-attributes-behavior 33b6ce743 -> 8db906d4d (forced update) moved default instrumentation values Project: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/commit/8db906d4 Tree: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/tree/8db906d4 Diff: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/diff/8db906d4 Branch: refs/heads/ARIA-262-Inconsistent-node-attributes-behavior Commit: 8db906d4d52fbaa3433549dea35c2aacd4d08f8d Parents: ad7afa2 Author: max-orlov Authored: Sun Jun 4 17:13:40 2017 +0300 Committer: max-orlov Committed: Sun Jun 4 18:00:39 2017 +0300 ---------------------------------------------------------------------- aria/orchestrator/context/operation.py | 7 +++++++ aria/orchestrator/context/toolbelt.py | 6 +----- aria/orchestrator/decorators.py | 6 +----- aria/storage/core.py | 2 +- tests/orchestrator/execution_plugin/test_ssh.py | 2 ++ .../workflows/executor/test_process_executor_extension.py | 4 ++-- 6 files changed, 14 insertions(+), 13 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/8db906d4/aria/orchestrator/context/operation.py ---------------------------------------------------------------------- diff --git a/aria/orchestrator/context/operation.py b/aria/orchestrator/context/operation.py index efdc04d..af7220d 100644 --- a/aria/orchestrator/context/operation.py +++ b/aria/orchestrator/context/operation.py @@ -29,6 +29,13 @@ class BaseOperationContext(common.BaseContext): Context object used during operation creation and execution """ + INSTRUMENTATION_FIELDS = ( + aria.modeling.models.Node.attributes, + aria.modeling.models.Node.properties, + aria.modeling.models.NodeTemplate.attributes, + aria.modeling.models.NodeTemplate.properties + ) + def __init__(self, task_id, actor_id, **kwargs): self._task_id = task_id self._actor_id = actor_id http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/8db906d4/aria/orchestrator/context/toolbelt.py ---------------------------------------------------------------------- diff --git a/aria/orchestrator/context/toolbelt.py b/aria/orchestrator/context/toolbelt.py index 5788ee7..b5a54a9 100644 --- a/aria/orchestrator/context/toolbelt.py +++ b/aria/orchestrator/context/toolbelt.py @@ -33,11 +33,7 @@ class NodeToolBelt(object): :return: """ assert isinstance(self._op_context, operation.NodeOperationContext) - host = self._op_context.node.host - ip = host.attributes.get('ip') - if ip: - return ip.value - + return self._op_context.node.host.attributes.get('ip') class RelationshipToolBelt(object): http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/8db906d4/aria/orchestrator/decorators.py ---------------------------------------------------------------------- diff --git a/aria/orchestrator/decorators.py b/aria/orchestrator/decorators.py index 77cec91..4622aef 100644 --- a/aria/orchestrator/decorators.py +++ b/aria/orchestrator/decorators.py @@ -19,7 +19,6 @@ Workflow and operation decorators from functools import partial, wraps -from aria.modeling import models from ..utils.validation import validate_function_arguments from ..utils.uuid import generate_uuid @@ -74,10 +73,7 @@ def operation(func=None, toolbelt=False, suffix_template='', logging_handlers=No operation_toolbelt = context.toolbelt(ctx) func_kwargs.setdefault('toolbelt', operation_toolbelt) validate_function_arguments(func, ctx=ctx, **func_kwargs) - with ctx.model.instrument(models.Node.attributes, - models.Node.properties, - models.NodeTemplate.attributes, - models.NodeTemplate.properties): + with ctx.model.instrument(*ctx.INSTRUMENTATION_FIELDS): return func(ctx=ctx, **func_kwargs) return _wrapper http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/8db906d4/aria/storage/core.py ---------------------------------------------------------------------- diff --git a/aria/storage/core.py b/aria/storage/core.py index ce4c99d..5933b87 100644 --- a/aria/storage/core.py +++ b/aria/storage/core.py @@ -175,7 +175,7 @@ class ModelStorage(Storage): for field in instrumentation: if remove is False: mapi._instrumentation.append(field) - else: + elif field in mapi._instrumentation: mapi._instrumentation.remove(field) try: _instrument() http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/8db906d4/tests/orchestrator/execution_plugin/test_ssh.py ---------------------------------------------------------------------- diff --git a/tests/orchestrator/execution_plugin/test_ssh.py b/tests/orchestrator/execution_plugin/test_ssh.py index 2f0b39c..8b326e7 100644 --- a/tests/orchestrator/execution_plugin/test_ssh.py +++ b/tests/orchestrator/execution_plugin/test_ssh.py @@ -422,6 +422,8 @@ class TestFabricEnvHideGroupsAndRunCommands(object): raise RuntimeError class _Ctx(object): + INSTRUMENTATION_FIELDS = () + class Task(object): @staticmethod def abort(message=None): http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/8db906d4/tests/orchestrator/workflows/executor/test_process_executor_extension.py ---------------------------------------------------------------------- diff --git a/tests/orchestrator/workflows/executor/test_process_executor_extension.py b/tests/orchestrator/workflows/executor/test_process_executor_extension.py index f3e40b6..7969457 100644 --- a/tests/orchestrator/workflows/executor/test_process_executor_extension.py +++ b/tests/orchestrator/workflows/executor/test_process_executor_extension.py @@ -66,9 +66,9 @@ class MockProcessExecutorExtension(object): def decorate(self): def decorator(function): def wrapper(ctx, **operation_arguments): - with ctx.model.instrument({ctx.model.node.model_cls: ['attributes']}): + with ctx.model.instrument(ctx.model.node.model_cls.attributes): ctx.node.attributes['out'] = {'wrapper_arguments': operation_arguments} - function(ctx=ctx, **operation_arguments) + function(ctx=ctx, **operation_arguments) return wrapper return decorator