ariatosca-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mxm...@apache.org
Subject incubator-ariatosca git commit: moved default instrumentation values [Forced Update!]
Date Sun, 04 Jun 2017 14:36:39 GMT
Repository: incubator-ariatosca
Updated Branches:
  refs/heads/ARIA-262-Inconsistent-node-attributes-behavior 767e39873 -> 33b6ce743 (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/33b6ce74
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/tree/33b6ce74
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/diff/33b6ce74

Branch: refs/heads/ARIA-262-Inconsistent-node-attributes-behavior
Commit: 33b6ce74386c4fc89dd57ca6e7824b2b06c03264
Parents: ad7afa2
Author: max-orlov <maxim@gigaspaces.com>
Authored: Sun Jun 4 17:13:40 2017 +0300
Committer: max-orlov <maxim@gigaspaces.com>
Committed: Sun Jun 4 17:36:32 2017 +0300

----------------------------------------------------------------------
 aria/orchestrator/context/operation.py                        | 7 +++++++
 aria/orchestrator/context/toolbelt.py                         | 6 +-----
 aria/orchestrator/decorators.py                               | 6 +-----
 tests/orchestrator/execution_plugin/test_ssh.py               | 2 ++
 .../workflows/executor/test_process_executor_extension.py     | 2 +-
 5 files changed, 12 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/33b6ce74/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/33b6ce74/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/33b6ce74/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/33b6ce74/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/33b6ce74/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..48e272c 100644
--- a/tests/orchestrator/workflows/executor/test_process_executor_extension.py
+++ b/tests/orchestrator/workflows/executor/test_process_executor_extension.py
@@ -66,7 +66,7 @@ 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)
             return wrapper


Mime
View raw message