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 15:00:43 GMT
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 <maxim@gigaspaces.com>
Authored: Sun Jun 4 17:13:40 2017 +0300
Committer: max-orlov <maxim@gigaspaces.com>
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
 


Mime
View raw message