[03/14] incubator-ariatosca git commit: ARIA-46 Execution plugin
http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/c4429dd5/tests/orchestrator/execution_plugin/test_ctx_proxy_server.py -- diff --git a/tests/orchestrator/execution_plugin/test_ctx_proxy_server.py b/tests/orchestrator/execution_plugin/test_ctx_proxy_server.py new file mode 100644 index 000..98ceff9 --- /dev/null +++ b/tests/orchestrator/execution_plugin/test_ctx_proxy_server.py @@ -0,0 +1,359 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import os +import time +import sys +import subprocess +import StringIO + +import pytest + +from aria.orchestrator.execution_plugin import ctx_proxy + + +class TestCtxProxy(object): + +def test_attribute_access(self, server): +response = self.request(server, 'stub_attr', 'some_property') +assert response == 'some_value' + +def test_sugared_attribute_access(self, server): +response = self.request(server, 'stub-attr', 'some-property') +assert response == 'some_value' + +def test_dict_prop_access_get_key(self, server): +response = self.request(server, 'node', 'properties', 'prop1') +assert response == 'value1' + +def test_dict_prop_access_get_key_nested(self, server): +response = self.request(server, 'node', 'properties', 'prop2.nested_prop1') +assert response == 'nested_value1' + +def test_dict_prop_access_get_with_list_index(self, server): +response = self.request(server, 'node', 'properties', 'prop3[2].value') +assert response == 'value_2' + +def test_dict_prop_access_set(self, server, ctx): +self.request(server, 'node', 'properties', 'prop4.key', 'new_value') +self.request(server, 'node', 'properties', 'prop3[2].value', 'new_value_2') +self.request(server, 'node', 'properties', 'prop4.some.new.path', + 'some_new_value') +assert ctx.node.properties['prop4']['key'] == 'new_value' +assert ctx.node.properties['prop3'][2]['value'] == 'new_value_2' +assert ctx.node.properties['prop4']['some']['new']['path'] == 'some_new_value' + +def test_illegal_dict_access(self, server): +self.request(server, 'node', 'properties', 'prop4.key', 'new_value') +with pytest.raises(RuntimeError): +self.request(server, 'node', 'properties', 'prop4.key', 'new_value', 'what') + +def test_method_invocation(self, server): +args = ['arg1', 'arg2', 'arg3'] +response_args = self.request(server, 'stub-method', *args) +assert response_args == args + +def test_method_invocation_no_args(self, server): +response = self.request(server, 'stub-method') +assert response == [] + +def test_method_invocation_kwargs(self, server): +arg1 = 'arg1' +arg2 = 'arg2' +arg4 = 'arg4_override' +arg5 = 'arg5' +kwargs = dict( +arg4=arg4, +arg5=arg5) +response = self.request(server, 'stub_args', arg1, arg2, kwargs) +assert response == dict( +arg1=arg1, +arg2=arg2, +arg3='arg3', +arg4=arg4, +args=[], +kwargs=dict( +arg5=arg5)) + +def test_empty_return_value(self, server): +response = self.request(server, 'stub_none') +assert response is None + +def test_client_request_timeout(self, server): +with pytest.raises(IOError): +ctx_proxy.client._client_request(server.socket_url, + args=['stub-sleep', '0.5'], + timeout=0.1) + +def test_processing_exception(self, server): +with pytest.raises(ctx_proxy.client._RequestError): +self.request(server, 'property_that_does_not_exist') + +def test_not_json_serializable(self, server): +with pytest.raises(ctx_proxy.client._RequestError): +self.request(server, 'logger') + +def test_no_string_arg(self, server): +args = ['stub_method', 1, 2] +response = self.request(server, *args) +assert response == args[1:] + +class StubAttribute(object): +
[04/14] incubator-ariatosca git commit: ARIA-46 Execution plugin
ARIA-46 Execution plugin Project: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/commit/c4429dd5 Tree: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/tree/c4429dd5 Diff: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/diff/c4429dd5 Branch: refs/heads/ARIA-66-Convert-custom-parser-fields-into-sqla-based-fields Commit: c4429dd59a80bd6e58ba3bec4a2528eeda27a897 Parents: 385b209 Author: Dan KilmanAuthored: Tue Jan 3 17:00:46 2017 +0200 Committer: Dan Kilman Committed: Thu Jan 19 18:13:51 2017 +0200 -- appveyor.yml| 2 +- aria/orchestrator/context/common.py | 4 +- aria/orchestrator/context/operation.py | 5 +- aria/orchestrator/exceptions.py | 2 +- aria/orchestrator/execution_plugin/__init__.py | 33 ++ aria/orchestrator/execution_plugin/common.py| 150 + aria/orchestrator/execution_plugin/constants.py | 51 ++ .../execution_plugin/ctx_proxy/__init__.py | 16 + .../execution_plugin/ctx_proxy/client.py| 105 .../execution_plugin/ctx_proxy/server.py| 239 .../execution_plugin/environment_globals.py | 60 ++ .../orchestrator/execution_plugin/exceptions.py | 38 ++ aria/orchestrator/execution_plugin/local.py | 125 .../orchestrator/execution_plugin/operations.py | 63 ++ .../execution_plugin/ssh/__init__.py| 14 + .../execution_plugin/ssh/operations.py | 192 ++ .../orchestrator/execution_plugin/ssh/tunnel.py | 91 +++ aria/orchestrator/workflows/api/task.py | 12 +- aria/orchestrator/workflows/core/engine.py | 1 - aria/orchestrator/workflows/core/task.py| 3 +- aria/orchestrator/workflows/executor/process.py | 3 +- aria/storage/base_model.py | 26 +- aria/storage/filesystem_rapi.py | 2 +- aria/utils/exceptions.py| 19 + requirements.txt| 5 + setup.py| 9 +- tests/orchestrator/execution_plugin/__init__.py | 14 + .../execution_plugin/test_common.py | 193 ++ .../execution_plugin/test_ctx_proxy_server.py | 359 .../execution_plugin/test_global_ctx.py | 28 + .../orchestrator/execution_plugin/test_local.py | 587 +++ tests/orchestrator/execution_plugin/test_ssh.py | 481 +++ tests/orchestrator/workflows/api/test_task.py | 5 + tests/orchestrator/workflows/core/test_task.py | 38 +- tests/orchestrator/workflows/helpers.py | 37 ++ tests/resources/scripts/test_ssh.sh | 81 +++ tests/test_logger.py| 5 +- tests/utils/test_exceptions.py | 73 +++ tox.ini | 7 + 39 files changed, 3150 insertions(+), 28 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/c4429dd5/appveyor.yml -- diff --git a/appveyor.yml b/appveyor.yml index 3ea8635..cb1ae42 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -3,7 +3,7 @@ environment: TOX_ENV: pywin matrix: -- PYTHON: C:\Python27 +- PYTHON: "C:\\Python27" PYTHON_VERSION: 2.7.8 PYTHON_ARCH: 32 http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/c4429dd5/aria/orchestrator/context/common.py -- diff --git a/aria/orchestrator/context/common.py b/aria/orchestrator/context/common.py index 53844e8..691c17d 100644 --- a/aria/orchestrator/context/common.py +++ b/aria/orchestrator/context/common.py @@ -113,9 +113,7 @@ class BaseContext(logger.LoggerMixin): template using the provided variables. ctx is available to the template without providing it explicitly. """ -self.download_resource(destination=destination, path=path) -with open(destination, 'rb') as f: -resource_content = f.read() +resource_content = self.get_resource(path=path) resource_content = self._render_resource(resource_content=resource_content, variables=variables) with open(destination, 'wb') as f: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/c4429dd5/aria/orchestrator/context/operation.py -- diff --git a/aria/orchestrator/context/operation.py b/aria/orchestrator/context/operation.py index 19bb73a..b33d107 100644 --- a/aria/orchestrator/context/operation.py +++ b/aria/orchestrator/context/operation.py
[02/16] incubator-ariatosca git commit: ARIA-46 Execution plugin
ARIA-46 Execution plugin Project: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/commit/c4429dd5 Tree: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/tree/c4429dd5 Diff: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/diff/c4429dd5 Branch: refs/heads/ARIA-44-Merge-parser-and-storage-models Commit: c4429dd59a80bd6e58ba3bec4a2528eeda27a897 Parents: 385b209 Author: Dan KilmanAuthored: Tue Jan 3 17:00:46 2017 +0200 Committer: Dan Kilman Committed: Thu Jan 19 18:13:51 2017 +0200 -- appveyor.yml| 2 +- aria/orchestrator/context/common.py | 4 +- aria/orchestrator/context/operation.py | 5 +- aria/orchestrator/exceptions.py | 2 +- aria/orchestrator/execution_plugin/__init__.py | 33 ++ aria/orchestrator/execution_plugin/common.py| 150 + aria/orchestrator/execution_plugin/constants.py | 51 ++ .../execution_plugin/ctx_proxy/__init__.py | 16 + .../execution_plugin/ctx_proxy/client.py| 105 .../execution_plugin/ctx_proxy/server.py| 239 .../execution_plugin/environment_globals.py | 60 ++ .../orchestrator/execution_plugin/exceptions.py | 38 ++ aria/orchestrator/execution_plugin/local.py | 125 .../orchestrator/execution_plugin/operations.py | 63 ++ .../execution_plugin/ssh/__init__.py| 14 + .../execution_plugin/ssh/operations.py | 192 ++ .../orchestrator/execution_plugin/ssh/tunnel.py | 91 +++ aria/orchestrator/workflows/api/task.py | 12 +- aria/orchestrator/workflows/core/engine.py | 1 - aria/orchestrator/workflows/core/task.py| 3 +- aria/orchestrator/workflows/executor/process.py | 3 +- aria/storage/base_model.py | 26 +- aria/storage/filesystem_rapi.py | 2 +- aria/utils/exceptions.py| 19 + requirements.txt| 5 + setup.py| 9 +- tests/orchestrator/execution_plugin/__init__.py | 14 + .../execution_plugin/test_common.py | 193 ++ .../execution_plugin/test_ctx_proxy_server.py | 359 .../execution_plugin/test_global_ctx.py | 28 + .../orchestrator/execution_plugin/test_local.py | 587 +++ tests/orchestrator/execution_plugin/test_ssh.py | 481 +++ tests/orchestrator/workflows/api/test_task.py | 5 + tests/orchestrator/workflows/core/test_task.py | 38 +- tests/orchestrator/workflows/helpers.py | 37 ++ tests/resources/scripts/test_ssh.sh | 81 +++ tests/test_logger.py| 5 +- tests/utils/test_exceptions.py | 73 +++ tox.ini | 7 + 39 files changed, 3150 insertions(+), 28 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/c4429dd5/appveyor.yml -- diff --git a/appveyor.yml b/appveyor.yml index 3ea8635..cb1ae42 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -3,7 +3,7 @@ environment: TOX_ENV: pywin matrix: -- PYTHON: C:\Python27 +- PYTHON: "C:\\Python27" PYTHON_VERSION: 2.7.8 PYTHON_ARCH: 32 http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/c4429dd5/aria/orchestrator/context/common.py -- diff --git a/aria/orchestrator/context/common.py b/aria/orchestrator/context/common.py index 53844e8..691c17d 100644 --- a/aria/orchestrator/context/common.py +++ b/aria/orchestrator/context/common.py @@ -113,9 +113,7 @@ class BaseContext(logger.LoggerMixin): template using the provided variables. ctx is available to the template without providing it explicitly. """ -self.download_resource(destination=destination, path=path) -with open(destination, 'rb') as f: -resource_content = f.read() +resource_content = self.get_resource(path=path) resource_content = self._render_resource(resource_content=resource_content, variables=variables) with open(destination, 'wb') as f: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/c4429dd5/aria/orchestrator/context/operation.py -- diff --git a/aria/orchestrator/context/operation.py b/aria/orchestrator/context/operation.py index 19bb73a..b33d107 100644 --- a/aria/orchestrator/context/operation.py +++ b/aria/orchestrator/context/operation.py @@ -42,6 +42,7 @@
[2/2] incubator-ariatosca git commit: ARIA-46 Execution plugin
ARIA-46 Execution plugin Project: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/commit/c4429dd5 Tree: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/tree/c4429dd5 Diff: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/diff/c4429dd5 Branch: refs/heads/master Commit: c4429dd59a80bd6e58ba3bec4a2528eeda27a897 Parents: 385b209 Author: Dan KilmanAuthored: Tue Jan 3 17:00:46 2017 +0200 Committer: Dan Kilman Committed: Thu Jan 19 18:13:51 2017 +0200 -- appveyor.yml| 2 +- aria/orchestrator/context/common.py | 4 +- aria/orchestrator/context/operation.py | 5 +- aria/orchestrator/exceptions.py | 2 +- aria/orchestrator/execution_plugin/__init__.py | 33 ++ aria/orchestrator/execution_plugin/common.py| 150 + aria/orchestrator/execution_plugin/constants.py | 51 ++ .../execution_plugin/ctx_proxy/__init__.py | 16 + .../execution_plugin/ctx_proxy/client.py| 105 .../execution_plugin/ctx_proxy/server.py| 239 .../execution_plugin/environment_globals.py | 60 ++ .../orchestrator/execution_plugin/exceptions.py | 38 ++ aria/orchestrator/execution_plugin/local.py | 125 .../orchestrator/execution_plugin/operations.py | 63 ++ .../execution_plugin/ssh/__init__.py| 14 + .../execution_plugin/ssh/operations.py | 192 ++ .../orchestrator/execution_plugin/ssh/tunnel.py | 91 +++ aria/orchestrator/workflows/api/task.py | 12 +- aria/orchestrator/workflows/core/engine.py | 1 - aria/orchestrator/workflows/core/task.py| 3 +- aria/orchestrator/workflows/executor/process.py | 3 +- aria/storage/base_model.py | 26 +- aria/storage/filesystem_rapi.py | 2 +- aria/utils/exceptions.py| 19 + requirements.txt| 5 + setup.py| 9 +- tests/orchestrator/execution_plugin/__init__.py | 14 + .../execution_plugin/test_common.py | 193 ++ .../execution_plugin/test_ctx_proxy_server.py | 359 .../execution_plugin/test_global_ctx.py | 28 + .../orchestrator/execution_plugin/test_local.py | 587 +++ tests/orchestrator/execution_plugin/test_ssh.py | 481 +++ tests/orchestrator/workflows/api/test_task.py | 5 + tests/orchestrator/workflows/core/test_task.py | 38 +- tests/orchestrator/workflows/helpers.py | 37 ++ tests/resources/scripts/test_ssh.sh | 81 +++ tests/test_logger.py| 5 +- tests/utils/test_exceptions.py | 73 +++ tox.ini | 7 + 39 files changed, 3150 insertions(+), 28 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/c4429dd5/appveyor.yml -- diff --git a/appveyor.yml b/appveyor.yml index 3ea8635..cb1ae42 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -3,7 +3,7 @@ environment: TOX_ENV: pywin matrix: -- PYTHON: C:\Python27 +- PYTHON: "C:\\Python27" PYTHON_VERSION: 2.7.8 PYTHON_ARCH: 32 http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/c4429dd5/aria/orchestrator/context/common.py -- diff --git a/aria/orchestrator/context/common.py b/aria/orchestrator/context/common.py index 53844e8..691c17d 100644 --- a/aria/orchestrator/context/common.py +++ b/aria/orchestrator/context/common.py @@ -113,9 +113,7 @@ class BaseContext(logger.LoggerMixin): template using the provided variables. ctx is available to the template without providing it explicitly. """ -self.download_resource(destination=destination, path=path) -with open(destination, 'rb') as f: -resource_content = f.read() +resource_content = self.get_resource(path=path) resource_content = self._render_resource(resource_content=resource_content, variables=variables) with open(destination, 'wb') as f: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/c4429dd5/aria/orchestrator/context/operation.py -- diff --git a/aria/orchestrator/context/operation.py b/aria/orchestrator/context/operation.py index 19bb73a..b33d107 100644 --- a/aria/orchestrator/context/operation.py +++ b/aria/orchestrator/context/operation.py @@ -42,6 +42,7 @@ class
[1/2] incubator-ariatosca git commit: ARIA-46 Execution plugin
Repository: incubator-ariatosca Updated Branches: refs/heads/master 385b209db -> c4429dd59 http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/c4429dd5/tests/orchestrator/execution_plugin/test_ctx_proxy_server.py -- diff --git a/tests/orchestrator/execution_plugin/test_ctx_proxy_server.py b/tests/orchestrator/execution_plugin/test_ctx_proxy_server.py new file mode 100644 index 000..98ceff9 --- /dev/null +++ b/tests/orchestrator/execution_plugin/test_ctx_proxy_server.py @@ -0,0 +1,359 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import os +import time +import sys +import subprocess +import StringIO + +import pytest + +from aria.orchestrator.execution_plugin import ctx_proxy + + +class TestCtxProxy(object): + +def test_attribute_access(self, server): +response = self.request(server, 'stub_attr', 'some_property') +assert response == 'some_value' + +def test_sugared_attribute_access(self, server): +response = self.request(server, 'stub-attr', 'some-property') +assert response == 'some_value' + +def test_dict_prop_access_get_key(self, server): +response = self.request(server, 'node', 'properties', 'prop1') +assert response == 'value1' + +def test_dict_prop_access_get_key_nested(self, server): +response = self.request(server, 'node', 'properties', 'prop2.nested_prop1') +assert response == 'nested_value1' + +def test_dict_prop_access_get_with_list_index(self, server): +response = self.request(server, 'node', 'properties', 'prop3[2].value') +assert response == 'value_2' + +def test_dict_prop_access_set(self, server, ctx): +self.request(server, 'node', 'properties', 'prop4.key', 'new_value') +self.request(server, 'node', 'properties', 'prop3[2].value', 'new_value_2') +self.request(server, 'node', 'properties', 'prop4.some.new.path', + 'some_new_value') +assert ctx.node.properties['prop4']['key'] == 'new_value' +assert ctx.node.properties['prop3'][2]['value'] == 'new_value_2' +assert ctx.node.properties['prop4']['some']['new']['path'] == 'some_new_value' + +def test_illegal_dict_access(self, server): +self.request(server, 'node', 'properties', 'prop4.key', 'new_value') +with pytest.raises(RuntimeError): +self.request(server, 'node', 'properties', 'prop4.key', 'new_value', 'what') + +def test_method_invocation(self, server): +args = ['arg1', 'arg2', 'arg3'] +response_args = self.request(server, 'stub-method', *args) +assert response_args == args + +def test_method_invocation_no_args(self, server): +response = self.request(server, 'stub-method') +assert response == [] + +def test_method_invocation_kwargs(self, server): +arg1 = 'arg1' +arg2 = 'arg2' +arg4 = 'arg4_override' +arg5 = 'arg5' +kwargs = dict( +arg4=arg4, +arg5=arg5) +response = self.request(server, 'stub_args', arg1, arg2, kwargs) +assert response == dict( +arg1=arg1, +arg2=arg2, +arg3='arg3', +arg4=arg4, +args=[], +kwargs=dict( +arg5=arg5)) + +def test_empty_return_value(self, server): +response = self.request(server, 'stub_none') +assert response is None + +def test_client_request_timeout(self, server): +with pytest.raises(IOError): +ctx_proxy.client._client_request(server.socket_url, + args=['stub-sleep', '0.5'], + timeout=0.1) + +def test_processing_exception(self, server): +with pytest.raises(ctx_proxy.client._RequestError): +self.request(server, 'property_that_does_not_exist') + +def test_not_json_serializable(self, server): +with pytest.raises(ctx_proxy.client._RequestError): +self.request(server, 'logger') + +def test_no_string_arg(self, server): +args = ['stub_method', 1, 2] +response =
[1/2] incubator-ariatosca git commit: ARIA-46 Execution plugin [Forced Update!]
Repository: incubator-ariatosca Updated Branches: refs/heads/ARIA-46-execution-plugin 433d55ea6 -> c4429dd59 (forced update) http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/c4429dd5/tests/orchestrator/execution_plugin/test_ctx_proxy_server.py -- diff --git a/tests/orchestrator/execution_plugin/test_ctx_proxy_server.py b/tests/orchestrator/execution_plugin/test_ctx_proxy_server.py new file mode 100644 index 000..98ceff9 --- /dev/null +++ b/tests/orchestrator/execution_plugin/test_ctx_proxy_server.py @@ -0,0 +1,359 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import os +import time +import sys +import subprocess +import StringIO + +import pytest + +from aria.orchestrator.execution_plugin import ctx_proxy + + +class TestCtxProxy(object): + +def test_attribute_access(self, server): +response = self.request(server, 'stub_attr', 'some_property') +assert response == 'some_value' + +def test_sugared_attribute_access(self, server): +response = self.request(server, 'stub-attr', 'some-property') +assert response == 'some_value' + +def test_dict_prop_access_get_key(self, server): +response = self.request(server, 'node', 'properties', 'prop1') +assert response == 'value1' + +def test_dict_prop_access_get_key_nested(self, server): +response = self.request(server, 'node', 'properties', 'prop2.nested_prop1') +assert response == 'nested_value1' + +def test_dict_prop_access_get_with_list_index(self, server): +response = self.request(server, 'node', 'properties', 'prop3[2].value') +assert response == 'value_2' + +def test_dict_prop_access_set(self, server, ctx): +self.request(server, 'node', 'properties', 'prop4.key', 'new_value') +self.request(server, 'node', 'properties', 'prop3[2].value', 'new_value_2') +self.request(server, 'node', 'properties', 'prop4.some.new.path', + 'some_new_value') +assert ctx.node.properties['prop4']['key'] == 'new_value' +assert ctx.node.properties['prop3'][2]['value'] == 'new_value_2' +assert ctx.node.properties['prop4']['some']['new']['path'] == 'some_new_value' + +def test_illegal_dict_access(self, server): +self.request(server, 'node', 'properties', 'prop4.key', 'new_value') +with pytest.raises(RuntimeError): +self.request(server, 'node', 'properties', 'prop4.key', 'new_value', 'what') + +def test_method_invocation(self, server): +args = ['arg1', 'arg2', 'arg3'] +response_args = self.request(server, 'stub-method', *args) +assert response_args == args + +def test_method_invocation_no_args(self, server): +response = self.request(server, 'stub-method') +assert response == [] + +def test_method_invocation_kwargs(self, server): +arg1 = 'arg1' +arg2 = 'arg2' +arg4 = 'arg4_override' +arg5 = 'arg5' +kwargs = dict( +arg4=arg4, +arg5=arg5) +response = self.request(server, 'stub_args', arg1, arg2, kwargs) +assert response == dict( +arg1=arg1, +arg2=arg2, +arg3='arg3', +arg4=arg4, +args=[], +kwargs=dict( +arg5=arg5)) + +def test_empty_return_value(self, server): +response = self.request(server, 'stub_none') +assert response is None + +def test_client_request_timeout(self, server): +with pytest.raises(IOError): +ctx_proxy.client._client_request(server.socket_url, + args=['stub-sleep', '0.5'], + timeout=0.1) + +def test_processing_exception(self, server): +with pytest.raises(ctx_proxy.client._RequestError): +self.request(server, 'property_that_does_not_exist') + +def test_not_json_serializable(self, server): +with pytest.raises(ctx_proxy.client._RequestError): +self.request(server, 'logger') + +def test_no_string_arg(self, server): +args = ['stub_method', 1, 2] +
[2/2] incubator-ariatosca git commit: ARIA-46 Execution plugin
ARIA-46 Execution plugin Project: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/commit/c4429dd5 Tree: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/tree/c4429dd5 Diff: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/diff/c4429dd5 Branch: refs/heads/ARIA-46-execution-plugin Commit: c4429dd59a80bd6e58ba3bec4a2528eeda27a897 Parents: 385b209 Author: Dan KilmanAuthored: Tue Jan 3 17:00:46 2017 +0200 Committer: Dan Kilman Committed: Thu Jan 19 18:13:51 2017 +0200 -- appveyor.yml| 2 +- aria/orchestrator/context/common.py | 4 +- aria/orchestrator/context/operation.py | 5 +- aria/orchestrator/exceptions.py | 2 +- aria/orchestrator/execution_plugin/__init__.py | 33 ++ aria/orchestrator/execution_plugin/common.py| 150 + aria/orchestrator/execution_plugin/constants.py | 51 ++ .../execution_plugin/ctx_proxy/__init__.py | 16 + .../execution_plugin/ctx_proxy/client.py| 105 .../execution_plugin/ctx_proxy/server.py| 239 .../execution_plugin/environment_globals.py | 60 ++ .../orchestrator/execution_plugin/exceptions.py | 38 ++ aria/orchestrator/execution_plugin/local.py | 125 .../orchestrator/execution_plugin/operations.py | 63 ++ .../execution_plugin/ssh/__init__.py| 14 + .../execution_plugin/ssh/operations.py | 192 ++ .../orchestrator/execution_plugin/ssh/tunnel.py | 91 +++ aria/orchestrator/workflows/api/task.py | 12 +- aria/orchestrator/workflows/core/engine.py | 1 - aria/orchestrator/workflows/core/task.py| 3 +- aria/orchestrator/workflows/executor/process.py | 3 +- aria/storage/base_model.py | 26 +- aria/storage/filesystem_rapi.py | 2 +- aria/utils/exceptions.py| 19 + requirements.txt| 5 + setup.py| 9 +- tests/orchestrator/execution_plugin/__init__.py | 14 + .../execution_plugin/test_common.py | 193 ++ .../execution_plugin/test_ctx_proxy_server.py | 359 .../execution_plugin/test_global_ctx.py | 28 + .../orchestrator/execution_plugin/test_local.py | 587 +++ tests/orchestrator/execution_plugin/test_ssh.py | 481 +++ tests/orchestrator/workflows/api/test_task.py | 5 + tests/orchestrator/workflows/core/test_task.py | 38 +- tests/orchestrator/workflows/helpers.py | 37 ++ tests/resources/scripts/test_ssh.sh | 81 +++ tests/test_logger.py| 5 +- tests/utils/test_exceptions.py | 73 +++ tox.ini | 7 + 39 files changed, 3150 insertions(+), 28 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/c4429dd5/appveyor.yml -- diff --git a/appveyor.yml b/appveyor.yml index 3ea8635..cb1ae42 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -3,7 +3,7 @@ environment: TOX_ENV: pywin matrix: -- PYTHON: C:\Python27 +- PYTHON: "C:\\Python27" PYTHON_VERSION: 2.7.8 PYTHON_ARCH: 32 http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/c4429dd5/aria/orchestrator/context/common.py -- diff --git a/aria/orchestrator/context/common.py b/aria/orchestrator/context/common.py index 53844e8..691c17d 100644 --- a/aria/orchestrator/context/common.py +++ b/aria/orchestrator/context/common.py @@ -113,9 +113,7 @@ class BaseContext(logger.LoggerMixin): template using the provided variables. ctx is available to the template without providing it explicitly. """ -self.download_resource(destination=destination, path=path) -with open(destination, 'rb') as f: -resource_content = f.read() +resource_content = self.get_resource(path=path) resource_content = self._render_resource(resource_content=resource_content, variables=variables) with open(destination, 'wb') as f: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/c4429dd5/aria/orchestrator/context/operation.py -- diff --git a/aria/orchestrator/context/operation.py b/aria/orchestrator/context/operation.py index 19bb73a..b33d107 100644 --- a/aria/orchestrator/context/operation.py +++ b/aria/orchestrator/context/operation.py @@ -42,6 +42,7 @@ class
[2/2] incubator-ariatosca git commit: ARIA-46 Execution plugin
ARIA-46 Execution plugin Project: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/commit/433d55ea Tree: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/tree/433d55ea Diff: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/diff/433d55ea Branch: refs/heads/ARIA-46-execution-plugin Commit: 433d55ea6ec9760fe5aa5e2c8f947d24d929d4ee Parents: 385b209 Author: Dan KilmanAuthored: Tue Jan 3 17:00:46 2017 +0200 Committer: Dan Kilman Committed: Thu Jan 19 17:56:25 2017 +0200 -- appveyor.yml| 2 +- aria/orchestrator/context/common.py | 4 +- aria/orchestrator/context/operation.py | 5 +- aria/orchestrator/exceptions.py | 2 +- aria/orchestrator/execution_plugin/__init__.py | 33 ++ aria/orchestrator/execution_plugin/common.py| 150 + aria/orchestrator/execution_plugin/constants.py | 51 ++ .../execution_plugin/ctx_proxy/__init__.py | 16 + .../execution_plugin/ctx_proxy/client.py| 105 .../execution_plugin/ctx_proxy/server.py| 239 .../execution_plugin/environment_globals.py | 60 ++ .../orchestrator/execution_plugin/exceptions.py | 38 ++ aria/orchestrator/execution_plugin/local.py | 125 .../orchestrator/execution_plugin/operations.py | 63 ++ .../execution_plugin/ssh/__init__.py| 14 + .../execution_plugin/ssh/operations.py | 192 ++ .../orchestrator/execution_plugin/ssh/tunnel.py | 91 +++ aria/orchestrator/workflows/api/task.py | 12 +- aria/orchestrator/workflows/core/engine.py | 1 - aria/orchestrator/workflows/core/task.py| 3 +- aria/orchestrator/workflows/executor/process.py | 3 +- aria/storage/base_model.py | 26 +- aria/storage/filesystem_rapi.py | 2 +- aria/utils/exceptions.py| 19 + requirements.txt| 4 + setup.py| 9 +- tests/orchestrator/execution_plugin/__init__.py | 14 + .../execution_plugin/test_common.py | 193 ++ .../execution_plugin/test_ctx_proxy_server.py | 359 .../execution_plugin/test_global_ctx.py | 28 + .../orchestrator/execution_plugin/test_local.py | 587 +++ tests/orchestrator/execution_plugin/test_ssh.py | 481 +++ tests/orchestrator/workflows/api/test_task.py | 5 + tests/orchestrator/workflows/core/test_task.py | 38 +- tests/orchestrator/workflows/helpers.py | 37 ++ tests/resources/scripts/test_ssh.sh | 81 +++ tests/test_logger.py| 5 +- tests/utils/test_exceptions.py | 73 +++ tox.ini | 7 + 39 files changed, 3149 insertions(+), 28 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/433d55ea/appveyor.yml -- diff --git a/appveyor.yml b/appveyor.yml index 3ea8635..cb1ae42 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -3,7 +3,7 @@ environment: TOX_ENV: pywin matrix: -- PYTHON: C:\Python27 +- PYTHON: "C:\\Python27" PYTHON_VERSION: 2.7.8 PYTHON_ARCH: 32 http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/433d55ea/aria/orchestrator/context/common.py -- diff --git a/aria/orchestrator/context/common.py b/aria/orchestrator/context/common.py index 53844e8..691c17d 100644 --- a/aria/orchestrator/context/common.py +++ b/aria/orchestrator/context/common.py @@ -113,9 +113,7 @@ class BaseContext(logger.LoggerMixin): template using the provided variables. ctx is available to the template without providing it explicitly. """ -self.download_resource(destination=destination, path=path) -with open(destination, 'rb') as f: -resource_content = f.read() +resource_content = self.get_resource(path=path) resource_content = self._render_resource(resource_content=resource_content, variables=variables) with open(destination, 'wb') as f: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/433d55ea/aria/orchestrator/context/operation.py -- diff --git a/aria/orchestrator/context/operation.py b/aria/orchestrator/context/operation.py index 19bb73a..b33d107 100644 --- a/aria/orchestrator/context/operation.py +++ b/aria/orchestrator/context/operation.py @@ -42,6 +42,7 @@ class
[1/2] incubator-ariatosca git commit: ARIA-46 Execution plugin [Forced Update!]
Repository: incubator-ariatosca Updated Branches: refs/heads/ARIA-46-execution-plugin a48d31c74 -> 433d55ea6 (forced update) http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/433d55ea/tests/orchestrator/execution_plugin/test_ctx_proxy_server.py -- diff --git a/tests/orchestrator/execution_plugin/test_ctx_proxy_server.py b/tests/orchestrator/execution_plugin/test_ctx_proxy_server.py new file mode 100644 index 000..98ceff9 --- /dev/null +++ b/tests/orchestrator/execution_plugin/test_ctx_proxy_server.py @@ -0,0 +1,359 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import os +import time +import sys +import subprocess +import StringIO + +import pytest + +from aria.orchestrator.execution_plugin import ctx_proxy + + +class TestCtxProxy(object): + +def test_attribute_access(self, server): +response = self.request(server, 'stub_attr', 'some_property') +assert response == 'some_value' + +def test_sugared_attribute_access(self, server): +response = self.request(server, 'stub-attr', 'some-property') +assert response == 'some_value' + +def test_dict_prop_access_get_key(self, server): +response = self.request(server, 'node', 'properties', 'prop1') +assert response == 'value1' + +def test_dict_prop_access_get_key_nested(self, server): +response = self.request(server, 'node', 'properties', 'prop2.nested_prop1') +assert response == 'nested_value1' + +def test_dict_prop_access_get_with_list_index(self, server): +response = self.request(server, 'node', 'properties', 'prop3[2].value') +assert response == 'value_2' + +def test_dict_prop_access_set(self, server, ctx): +self.request(server, 'node', 'properties', 'prop4.key', 'new_value') +self.request(server, 'node', 'properties', 'prop3[2].value', 'new_value_2') +self.request(server, 'node', 'properties', 'prop4.some.new.path', + 'some_new_value') +assert ctx.node.properties['prop4']['key'] == 'new_value' +assert ctx.node.properties['prop3'][2]['value'] == 'new_value_2' +assert ctx.node.properties['prop4']['some']['new']['path'] == 'some_new_value' + +def test_illegal_dict_access(self, server): +self.request(server, 'node', 'properties', 'prop4.key', 'new_value') +with pytest.raises(RuntimeError): +self.request(server, 'node', 'properties', 'prop4.key', 'new_value', 'what') + +def test_method_invocation(self, server): +args = ['arg1', 'arg2', 'arg3'] +response_args = self.request(server, 'stub-method', *args) +assert response_args == args + +def test_method_invocation_no_args(self, server): +response = self.request(server, 'stub-method') +assert response == [] + +def test_method_invocation_kwargs(self, server): +arg1 = 'arg1' +arg2 = 'arg2' +arg4 = 'arg4_override' +arg5 = 'arg5' +kwargs = dict( +arg4=arg4, +arg5=arg5) +response = self.request(server, 'stub_args', arg1, arg2, kwargs) +assert response == dict( +arg1=arg1, +arg2=arg2, +arg3='arg3', +arg4=arg4, +args=[], +kwargs=dict( +arg5=arg5)) + +def test_empty_return_value(self, server): +response = self.request(server, 'stub_none') +assert response is None + +def test_client_request_timeout(self, server): +with pytest.raises(IOError): +ctx_proxy.client._client_request(server.socket_url, + args=['stub-sleep', '0.5'], + timeout=0.1) + +def test_processing_exception(self, server): +with pytest.raises(ctx_proxy.client._RequestError): +self.request(server, 'property_that_does_not_exist') + +def test_not_json_serializable(self, server): +with pytest.raises(ctx_proxy.client._RequestError): +self.request(server, 'logger') + +def test_no_string_arg(self, server): +args = ['stub_method', 1, 2] +
[1/2] incubator-ariatosca git commit: ARIA-46 Execution plugin [Forced Update!]
Repository: incubator-ariatosca Updated Branches: refs/heads/ARIA-46-execution-plugin 8ca6f51d4 -> a48d31c74 (forced update) http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/a48d31c7/tests/orchestrator/execution_plugin/test_ctx_proxy_server.py -- diff --git a/tests/orchestrator/execution_plugin/test_ctx_proxy_server.py b/tests/orchestrator/execution_plugin/test_ctx_proxy_server.py new file mode 100644 index 000..98ceff9 --- /dev/null +++ b/tests/orchestrator/execution_plugin/test_ctx_proxy_server.py @@ -0,0 +1,359 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import os +import time +import sys +import subprocess +import StringIO + +import pytest + +from aria.orchestrator.execution_plugin import ctx_proxy + + +class TestCtxProxy(object): + +def test_attribute_access(self, server): +response = self.request(server, 'stub_attr', 'some_property') +assert response == 'some_value' + +def test_sugared_attribute_access(self, server): +response = self.request(server, 'stub-attr', 'some-property') +assert response == 'some_value' + +def test_dict_prop_access_get_key(self, server): +response = self.request(server, 'node', 'properties', 'prop1') +assert response == 'value1' + +def test_dict_prop_access_get_key_nested(self, server): +response = self.request(server, 'node', 'properties', 'prop2.nested_prop1') +assert response == 'nested_value1' + +def test_dict_prop_access_get_with_list_index(self, server): +response = self.request(server, 'node', 'properties', 'prop3[2].value') +assert response == 'value_2' + +def test_dict_prop_access_set(self, server, ctx): +self.request(server, 'node', 'properties', 'prop4.key', 'new_value') +self.request(server, 'node', 'properties', 'prop3[2].value', 'new_value_2') +self.request(server, 'node', 'properties', 'prop4.some.new.path', + 'some_new_value') +assert ctx.node.properties['prop4']['key'] == 'new_value' +assert ctx.node.properties['prop3'][2]['value'] == 'new_value_2' +assert ctx.node.properties['prop4']['some']['new']['path'] == 'some_new_value' + +def test_illegal_dict_access(self, server): +self.request(server, 'node', 'properties', 'prop4.key', 'new_value') +with pytest.raises(RuntimeError): +self.request(server, 'node', 'properties', 'prop4.key', 'new_value', 'what') + +def test_method_invocation(self, server): +args = ['arg1', 'arg2', 'arg3'] +response_args = self.request(server, 'stub-method', *args) +assert response_args == args + +def test_method_invocation_no_args(self, server): +response = self.request(server, 'stub-method') +assert response == [] + +def test_method_invocation_kwargs(self, server): +arg1 = 'arg1' +arg2 = 'arg2' +arg4 = 'arg4_override' +arg5 = 'arg5' +kwargs = dict( +arg4=arg4, +arg5=arg5) +response = self.request(server, 'stub_args', arg1, arg2, kwargs) +assert response == dict( +arg1=arg1, +arg2=arg2, +arg3='arg3', +arg4=arg4, +args=[], +kwargs=dict( +arg5=arg5)) + +def test_empty_return_value(self, server): +response = self.request(server, 'stub_none') +assert response is None + +def test_client_request_timeout(self, server): +with pytest.raises(IOError): +ctx_proxy.client._client_request(server.socket_url, + args=['stub-sleep', '0.5'], + timeout=0.1) + +def test_processing_exception(self, server): +with pytest.raises(ctx_proxy.client._RequestError): +self.request(server, 'property_that_does_not_exist') + +def test_not_json_serializable(self, server): +with pytest.raises(ctx_proxy.client._RequestError): +self.request(server, 'logger') + +def test_no_string_arg(self, server): +args = ['stub_method', 1, 2] +
[1/2] incubator-ariatosca git commit: ARIA-46 Execution plugin [Forced Update!]
Repository: incubator-ariatosca Updated Branches: refs/heads/ARIA-46-execution-plugin 1854b1787 -> 8ca6f51d4 (forced update) http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/8ca6f51d/tests/orchestrator/execution_plugin/test_ctx_proxy_server.py -- diff --git a/tests/orchestrator/execution_plugin/test_ctx_proxy_server.py b/tests/orchestrator/execution_plugin/test_ctx_proxy_server.py new file mode 100644 index 000..98ceff9 --- /dev/null +++ b/tests/orchestrator/execution_plugin/test_ctx_proxy_server.py @@ -0,0 +1,359 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import os +import time +import sys +import subprocess +import StringIO + +import pytest + +from aria.orchestrator.execution_plugin import ctx_proxy + + +class TestCtxProxy(object): + +def test_attribute_access(self, server): +response = self.request(server, 'stub_attr', 'some_property') +assert response == 'some_value' + +def test_sugared_attribute_access(self, server): +response = self.request(server, 'stub-attr', 'some-property') +assert response == 'some_value' + +def test_dict_prop_access_get_key(self, server): +response = self.request(server, 'node', 'properties', 'prop1') +assert response == 'value1' + +def test_dict_prop_access_get_key_nested(self, server): +response = self.request(server, 'node', 'properties', 'prop2.nested_prop1') +assert response == 'nested_value1' + +def test_dict_prop_access_get_with_list_index(self, server): +response = self.request(server, 'node', 'properties', 'prop3[2].value') +assert response == 'value_2' + +def test_dict_prop_access_set(self, server, ctx): +self.request(server, 'node', 'properties', 'prop4.key', 'new_value') +self.request(server, 'node', 'properties', 'prop3[2].value', 'new_value_2') +self.request(server, 'node', 'properties', 'prop4.some.new.path', + 'some_new_value') +assert ctx.node.properties['prop4']['key'] == 'new_value' +assert ctx.node.properties['prop3'][2]['value'] == 'new_value_2' +assert ctx.node.properties['prop4']['some']['new']['path'] == 'some_new_value' + +def test_illegal_dict_access(self, server): +self.request(server, 'node', 'properties', 'prop4.key', 'new_value') +with pytest.raises(RuntimeError): +self.request(server, 'node', 'properties', 'prop4.key', 'new_value', 'what') + +def test_method_invocation(self, server): +args = ['arg1', 'arg2', 'arg3'] +response_args = self.request(server, 'stub-method', *args) +assert response_args == args + +def test_method_invocation_no_args(self, server): +response = self.request(server, 'stub-method') +assert response == [] + +def test_method_invocation_kwargs(self, server): +arg1 = 'arg1' +arg2 = 'arg2' +arg4 = 'arg4_override' +arg5 = 'arg5' +kwargs = dict( +arg4=arg4, +arg5=arg5) +response = self.request(server, 'stub_args', arg1, arg2, kwargs) +assert response == dict( +arg1=arg1, +arg2=arg2, +arg3='arg3', +arg4=arg4, +args=[], +kwargs=dict( +arg5=arg5)) + +def test_empty_return_value(self, server): +response = self.request(server, 'stub_none') +assert response is None + +def test_client_request_timeout(self, server): +with pytest.raises(IOError): +ctx_proxy.client._client_request(server.socket_url, + args=['stub-sleep', '0.5'], + timeout=0.1) + +def test_processing_exception(self, server): +with pytest.raises(ctx_proxy.client._RequestError): +self.request(server, 'property_that_does_not_exist') + +def test_not_json_serializable(self, server): +with pytest.raises(ctx_proxy.client._RequestError): +self.request(server, 'logger') + +def test_no_string_arg(self, server): +args = ['stub_method', 1, 2] +
[2/2] incubator-ariatosca git commit: ARIA-46 Execution plugin
ARIA-46 Execution plugin Project: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/commit/8ca6f51d Tree: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/tree/8ca6f51d Diff: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/diff/8ca6f51d Branch: refs/heads/ARIA-46-execution-plugin Commit: 8ca6f51d4e51de884480915388a50dc8cf6ef741 Parents: 385b209 Author: Dan KilmanAuthored: Tue Jan 3 17:00:46 2017 +0200 Committer: Dan Kilman Committed: Thu Jan 19 15:01:27 2017 +0200 -- appveyor.yml| 2 +- aria/orchestrator/context/common.py | 4 +- aria/orchestrator/context/operation.py | 5 +- aria/orchestrator/exceptions.py | 2 +- aria/orchestrator/execution_plugin/__init__.py | 33 ++ aria/orchestrator/execution_plugin/common.py| 149 + aria/orchestrator/execution_plugin/constants.py | 51 ++ .../execution_plugin/ctx_proxy/__init__.py | 16 + .../execution_plugin/ctx_proxy/client.py| 105 .../execution_plugin/ctx_proxy/server.py| 239 .../execution_plugin/environment_globals.py | 60 ++ .../orchestrator/execution_plugin/exceptions.py | 38 ++ aria/orchestrator/execution_plugin/local.py | 125 .../orchestrator/execution_plugin/operations.py | 63 ++ .../execution_plugin/ssh/__init__.py| 14 + .../execution_plugin/ssh/operations.py | 192 ++ .../orchestrator/execution_plugin/ssh/tunnel.py | 91 +++ aria/orchestrator/workflows/api/task.py | 12 +- aria/orchestrator/workflows/core/engine.py | 1 - aria/orchestrator/workflows/core/task.py| 3 +- aria/orchestrator/workflows/executor/process.py | 3 +- aria/storage/base_model.py | 26 +- aria/storage/filesystem_rapi.py | 2 +- aria/utils/exceptions.py| 19 + requirements.txt| 3 + setup.py| 9 +- tests/orchestrator/execution_plugin/__init__.py | 14 + .../execution_plugin/test_common.py | 191 ++ .../execution_plugin/test_ctx_proxy_server.py | 359 .../execution_plugin/test_global_ctx.py | 28 + .../orchestrator/execution_plugin/test_local.py | 587 +++ tests/orchestrator/execution_plugin/test_ssh.py | 481 +++ tests/orchestrator/workflows/api/test_task.py | 5 + tests/orchestrator/workflows/core/test_task.py | 38 +- tests/orchestrator/workflows/helpers.py | 37 ++ tests/resources/scripts/test_ssh.sh | 81 +++ tests/test_logger.py| 5 +- tests/utils/test_exceptions.py | 73 +++ tox.ini | 7 + 39 files changed, 3145 insertions(+), 28 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/8ca6f51d/appveyor.yml -- diff --git a/appveyor.yml b/appveyor.yml index 3ea8635..cb1ae42 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -3,7 +3,7 @@ environment: TOX_ENV: pywin matrix: -- PYTHON: C:\Python27 +- PYTHON: "C:\\Python27" PYTHON_VERSION: 2.7.8 PYTHON_ARCH: 32 http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/8ca6f51d/aria/orchestrator/context/common.py -- diff --git a/aria/orchestrator/context/common.py b/aria/orchestrator/context/common.py index 53844e8..691c17d 100644 --- a/aria/orchestrator/context/common.py +++ b/aria/orchestrator/context/common.py @@ -113,9 +113,7 @@ class BaseContext(logger.LoggerMixin): template using the provided variables. ctx is available to the template without providing it explicitly. """ -self.download_resource(destination=destination, path=path) -with open(destination, 'rb') as f: -resource_content = f.read() +resource_content = self.get_resource(path=path) resource_content = self._render_resource(resource_content=resource_content, variables=variables) with open(destination, 'wb') as f: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/8ca6f51d/aria/orchestrator/context/operation.py -- diff --git a/aria/orchestrator/context/operation.py b/aria/orchestrator/context/operation.py index 19bb73a..b33d107 100644 --- a/aria/orchestrator/context/operation.py +++ b/aria/orchestrator/context/operation.py @@ -42,6 +42,7 @@ class
[1/2] incubator-ariatosca git commit: ARIA-46 Execution plugin [Forced Update!]
Repository: incubator-ariatosca Updated Branches: refs/heads/ARIA-46-execution-plugin 3e0a578d3 -> 1854b1787 (forced update) http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/1854b178/tests/orchestrator/execution_plugin/test_ctx_proxy_server.py -- diff --git a/tests/orchestrator/execution_plugin/test_ctx_proxy_server.py b/tests/orchestrator/execution_plugin/test_ctx_proxy_server.py new file mode 100644 index 000..98ceff9 --- /dev/null +++ b/tests/orchestrator/execution_plugin/test_ctx_proxy_server.py @@ -0,0 +1,359 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import os +import time +import sys +import subprocess +import StringIO + +import pytest + +from aria.orchestrator.execution_plugin import ctx_proxy + + +class TestCtxProxy(object): + +def test_attribute_access(self, server): +response = self.request(server, 'stub_attr', 'some_property') +assert response == 'some_value' + +def test_sugared_attribute_access(self, server): +response = self.request(server, 'stub-attr', 'some-property') +assert response == 'some_value' + +def test_dict_prop_access_get_key(self, server): +response = self.request(server, 'node', 'properties', 'prop1') +assert response == 'value1' + +def test_dict_prop_access_get_key_nested(self, server): +response = self.request(server, 'node', 'properties', 'prop2.nested_prop1') +assert response == 'nested_value1' + +def test_dict_prop_access_get_with_list_index(self, server): +response = self.request(server, 'node', 'properties', 'prop3[2].value') +assert response == 'value_2' + +def test_dict_prop_access_set(self, server, ctx): +self.request(server, 'node', 'properties', 'prop4.key', 'new_value') +self.request(server, 'node', 'properties', 'prop3[2].value', 'new_value_2') +self.request(server, 'node', 'properties', 'prop4.some.new.path', + 'some_new_value') +assert ctx.node.properties['prop4']['key'] == 'new_value' +assert ctx.node.properties['prop3'][2]['value'] == 'new_value_2' +assert ctx.node.properties['prop4']['some']['new']['path'] == 'some_new_value' + +def test_illegal_dict_access(self, server): +self.request(server, 'node', 'properties', 'prop4.key', 'new_value') +with pytest.raises(RuntimeError): +self.request(server, 'node', 'properties', 'prop4.key', 'new_value', 'what') + +def test_method_invocation(self, server): +args = ['arg1', 'arg2', 'arg3'] +response_args = self.request(server, 'stub-method', *args) +assert response_args == args + +def test_method_invocation_no_args(self, server): +response = self.request(server, 'stub-method') +assert response == [] + +def test_method_invocation_kwargs(self, server): +arg1 = 'arg1' +arg2 = 'arg2' +arg4 = 'arg4_override' +arg5 = 'arg5' +kwargs = dict( +arg4=arg4, +arg5=arg5) +response = self.request(server, 'stub_args', arg1, arg2, kwargs) +assert response == dict( +arg1=arg1, +arg2=arg2, +arg3='arg3', +arg4=arg4, +args=[], +kwargs=dict( +arg5=arg5)) + +def test_empty_return_value(self, server): +response = self.request(server, 'stub_none') +assert response is None + +def test_client_request_timeout(self, server): +with pytest.raises(IOError): +ctx_proxy.client._client_request(server.socket_url, + args=['stub-sleep', '0.5'], + timeout=0.1) + +def test_processing_exception(self, server): +with pytest.raises(ctx_proxy.client._RequestError): +self.request(server, 'property_that_does_not_exist') + +def test_not_json_serializable(self, server): +with pytest.raises(ctx_proxy.client._RequestError): +self.request(server, 'logger') + +def test_no_string_arg(self, server): +args = ['stub_method', 1, 2] +
[2/2] incubator-ariatosca git commit: ARIA-46 Execution plugin
ARIA-46 Execution plugin Project: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/commit/1854b178 Tree: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/tree/1854b178 Diff: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/diff/1854b178 Branch: refs/heads/ARIA-46-execution-plugin Commit: 1854b1787bbfe0cf2cd3a9f278d2ce80655aba7d Parents: 385b209 Author: Dan KilmanAuthored: Tue Jan 3 17:00:46 2017 +0200 Committer: Dan Kilman Committed: Thu Jan 19 14:16:36 2017 +0200 -- appveyor.yml| 2 +- aria/orchestrator/context/common.py | 4 +- aria/orchestrator/context/operation.py | 5 +- aria/orchestrator/exceptions.py | 2 +- aria/orchestrator/execution_plugin/__init__.py | 33 ++ aria/orchestrator/execution_plugin/common.py| 145 + aria/orchestrator/execution_plugin/constants.py | 51 ++ .../execution_plugin/ctx_proxy/__init__.py | 16 + .../execution_plugin/ctx_proxy/client.py| 105 .../execution_plugin/ctx_proxy/server.py| 239 .../execution_plugin/environment_globals.py | 60 ++ .../orchestrator/execution_plugin/exceptions.py | 36 ++ aria/orchestrator/execution_plugin/local.py | 125 .../orchestrator/execution_plugin/operations.py | 63 ++ .../execution_plugin/ssh/__init__.py| 14 + .../execution_plugin/ssh/operations.py | 192 ++ .../orchestrator/execution_plugin/ssh/tunnel.py | 91 +++ aria/orchestrator/workflows/api/task.py | 12 +- aria/orchestrator/workflows/core/engine.py | 1 - aria/orchestrator/workflows/core/task.py| 3 +- aria/orchestrator/workflows/executor/process.py | 3 +- aria/storage/base_model.py | 24 +- aria/storage/filesystem_rapi.py | 2 +- aria/utils/exceptions.py| 19 + requirements.txt| 3 + setup.py| 9 +- tests/orchestrator/execution_plugin/__init__.py | 14 + .../execution_plugin/test_common.py | 191 ++ .../execution_plugin/test_ctx_proxy_server.py | 359 .../execution_plugin/test_global_ctx.py | 28 + .../orchestrator/execution_plugin/test_local.py | 587 +++ tests/orchestrator/execution_plugin/test_ssh.py | 481 +++ tests/orchestrator/workflows/api/test_task.py | 5 + tests/orchestrator/workflows/core/test_task.py | 38 +- tests/orchestrator/workflows/helpers.py | 37 ++ tests/resources/scripts/test_ssh.sh | 81 +++ tests/test_logger.py| 5 +- tests/utils/test_exceptions.py | 73 +++ tox.ini | 7 + 39 files changed, 3138 insertions(+), 27 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/1854b178/appveyor.yml -- diff --git a/appveyor.yml b/appveyor.yml index 3ea8635..cb1ae42 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -3,7 +3,7 @@ environment: TOX_ENV: pywin matrix: -- PYTHON: C:\Python27 +- PYTHON: "C:\\Python27" PYTHON_VERSION: 2.7.8 PYTHON_ARCH: 32 http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/1854b178/aria/orchestrator/context/common.py -- diff --git a/aria/orchestrator/context/common.py b/aria/orchestrator/context/common.py index 53844e8..691c17d 100644 --- a/aria/orchestrator/context/common.py +++ b/aria/orchestrator/context/common.py @@ -113,9 +113,7 @@ class BaseContext(logger.LoggerMixin): template using the provided variables. ctx is available to the template without providing it explicitly. """ -self.download_resource(destination=destination, path=path) -with open(destination, 'rb') as f: -resource_content = f.read() +resource_content = self.get_resource(path=path) resource_content = self._render_resource(resource_content=resource_content, variables=variables) with open(destination, 'wb') as f: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/1854b178/aria/orchestrator/context/operation.py -- diff --git a/aria/orchestrator/context/operation.py b/aria/orchestrator/context/operation.py index 19bb73a..b33d107 100644 --- a/aria/orchestrator/context/operation.py +++ b/aria/orchestrator/context/operation.py @@ -42,6 +42,7 @@ class
[2/2] incubator-ariatosca git commit: ARIA-46 Execution plugin
ARIA-46 Execution plugin Project: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/commit/3e0a578d Tree: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/tree/3e0a578d Diff: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/diff/3e0a578d Branch: refs/heads/ARIA-46-execution-plugin Commit: 3e0a578d314f82c4425e2c7749614bbe3f4bdd5b Parents: 385b209 Author: Dan KilmanAuthored: Tue Jan 3 17:00:46 2017 +0200 Committer: Dan Kilman Committed: Thu Jan 19 14:15:56 2017 +0200 -- aria/orchestrator/context/common.py | 4 +- aria/orchestrator/context/operation.py | 5 +- aria/orchestrator/exceptions.py | 2 +- aria/orchestrator/execution_plugin/__init__.py | 33 ++ aria/orchestrator/execution_plugin/common.py| 145 + aria/orchestrator/execution_plugin/constants.py | 51 ++ .../execution_plugin/ctx_proxy/__init__.py | 16 + .../execution_plugin/ctx_proxy/client.py| 105 .../execution_plugin/ctx_proxy/server.py| 239 .../execution_plugin/environment_globals.py | 60 ++ .../orchestrator/execution_plugin/exceptions.py | 36 ++ aria/orchestrator/execution_plugin/local.py | 125 .../orchestrator/execution_plugin/operations.py | 63 ++ .../execution_plugin/ssh/__init__.py| 14 + .../execution_plugin/ssh/operations.py | 192 ++ .../orchestrator/execution_plugin/ssh/tunnel.py | 91 +++ aria/orchestrator/workflows/api/task.py | 12 +- aria/orchestrator/workflows/core/engine.py | 1 - aria/orchestrator/workflows/core/task.py| 3 +- aria/orchestrator/workflows/executor/process.py | 3 +- aria/storage/base_model.py | 24 +- aria/storage/filesystem_rapi.py | 2 +- aria/utils/exceptions.py| 19 + requirements.txt| 3 + setup.py| 9 +- tests/orchestrator/execution_plugin/__init__.py | 14 + .../execution_plugin/test_common.py | 191 ++ .../execution_plugin/test_ctx_proxy_server.py | 359 .../execution_plugin/test_global_ctx.py | 28 + .../orchestrator/execution_plugin/test_local.py | 587 +++ tests/orchestrator/execution_plugin/test_ssh.py | 481 +++ tests/orchestrator/workflows/api/test_task.py | 5 + tests/orchestrator/workflows/core/test_task.py | 38 +- tests/orchestrator/workflows/helpers.py | 37 ++ tests/resources/scripts/test_ssh.sh | 81 +++ tests/test_logger.py| 5 +- tests/utils/test_exceptions.py | 73 +++ tox.ini | 7 + 38 files changed, 3137 insertions(+), 26 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/3e0a578d/aria/orchestrator/context/common.py -- diff --git a/aria/orchestrator/context/common.py b/aria/orchestrator/context/common.py index 53844e8..691c17d 100644 --- a/aria/orchestrator/context/common.py +++ b/aria/orchestrator/context/common.py @@ -113,9 +113,7 @@ class BaseContext(logger.LoggerMixin): template using the provided variables. ctx is available to the template without providing it explicitly. """ -self.download_resource(destination=destination, path=path) -with open(destination, 'rb') as f: -resource_content = f.read() +resource_content = self.get_resource(path=path) resource_content = self._render_resource(resource_content=resource_content, variables=variables) with open(destination, 'wb') as f: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/3e0a578d/aria/orchestrator/context/operation.py -- diff --git a/aria/orchestrator/context/operation.py b/aria/orchestrator/context/operation.py index 19bb73a..b33d107 100644 --- a/aria/orchestrator/context/operation.py +++ b/aria/orchestrator/context/operation.py @@ -42,6 +42,7 @@ class BaseOperationContext(BaseContext): **kwargs) self._task_id = task_id self._actor_id = actor_id +self._task = None def __repr__(self): details = 'operation_mapping={task.operation_mapping}; ' \ @@ -55,7 +56,9 @@ class BaseOperationContext(BaseContext): The task in the model storage :return: Task model """ -return self.model.task.get(self._task_id) +if not self._task: +self._task =
[1/2] incubator-ariatosca git commit: ARIA-46 Execution plugin [Forced Update!]
Repository: incubator-ariatosca Updated Branches: refs/heads/ARIA-46-execution-plugin bcef1e054 -> 3e0a578d3 (forced update) http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/3e0a578d/tests/orchestrator/execution_plugin/test_ctx_proxy_server.py -- diff --git a/tests/orchestrator/execution_plugin/test_ctx_proxy_server.py b/tests/orchestrator/execution_plugin/test_ctx_proxy_server.py new file mode 100644 index 000..98ceff9 --- /dev/null +++ b/tests/orchestrator/execution_plugin/test_ctx_proxy_server.py @@ -0,0 +1,359 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import os +import time +import sys +import subprocess +import StringIO + +import pytest + +from aria.orchestrator.execution_plugin import ctx_proxy + + +class TestCtxProxy(object): + +def test_attribute_access(self, server): +response = self.request(server, 'stub_attr', 'some_property') +assert response == 'some_value' + +def test_sugared_attribute_access(self, server): +response = self.request(server, 'stub-attr', 'some-property') +assert response == 'some_value' + +def test_dict_prop_access_get_key(self, server): +response = self.request(server, 'node', 'properties', 'prop1') +assert response == 'value1' + +def test_dict_prop_access_get_key_nested(self, server): +response = self.request(server, 'node', 'properties', 'prop2.nested_prop1') +assert response == 'nested_value1' + +def test_dict_prop_access_get_with_list_index(self, server): +response = self.request(server, 'node', 'properties', 'prop3[2].value') +assert response == 'value_2' + +def test_dict_prop_access_set(self, server, ctx): +self.request(server, 'node', 'properties', 'prop4.key', 'new_value') +self.request(server, 'node', 'properties', 'prop3[2].value', 'new_value_2') +self.request(server, 'node', 'properties', 'prop4.some.new.path', + 'some_new_value') +assert ctx.node.properties['prop4']['key'] == 'new_value' +assert ctx.node.properties['prop3'][2]['value'] == 'new_value_2' +assert ctx.node.properties['prop4']['some']['new']['path'] == 'some_new_value' + +def test_illegal_dict_access(self, server): +self.request(server, 'node', 'properties', 'prop4.key', 'new_value') +with pytest.raises(RuntimeError): +self.request(server, 'node', 'properties', 'prop4.key', 'new_value', 'what') + +def test_method_invocation(self, server): +args = ['arg1', 'arg2', 'arg3'] +response_args = self.request(server, 'stub-method', *args) +assert response_args == args + +def test_method_invocation_no_args(self, server): +response = self.request(server, 'stub-method') +assert response == [] + +def test_method_invocation_kwargs(self, server): +arg1 = 'arg1' +arg2 = 'arg2' +arg4 = 'arg4_override' +arg5 = 'arg5' +kwargs = dict( +arg4=arg4, +arg5=arg5) +response = self.request(server, 'stub_args', arg1, arg2, kwargs) +assert response == dict( +arg1=arg1, +arg2=arg2, +arg3='arg3', +arg4=arg4, +args=[], +kwargs=dict( +arg5=arg5)) + +def test_empty_return_value(self, server): +response = self.request(server, 'stub_none') +assert response is None + +def test_client_request_timeout(self, server): +with pytest.raises(IOError): +ctx_proxy.client._client_request(server.socket_url, + args=['stub-sleep', '0.5'], + timeout=0.1) + +def test_processing_exception(self, server): +with pytest.raises(ctx_proxy.client._RequestError): +self.request(server, 'property_that_does_not_exist') + +def test_not_json_serializable(self, server): +with pytest.raises(ctx_proxy.client._RequestError): +self.request(server, 'logger') + +def test_no_string_arg(self, server): +args = ['stub_method', 1, 2] +
[1/2] incubator-ariatosca git commit: ARIA-46 Execution plugin [Forced Update!]
Repository: incubator-ariatosca Updated Branches: refs/heads/ARIA-46-execution-plugin 06b2f4d47 -> f91799a49 (forced update) http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/f91799a4/tests/orchestrator/execution_plugin/test_global_ctx.py -- diff --git a/tests/orchestrator/execution_plugin/test_global_ctx.py b/tests/orchestrator/execution_plugin/test_global_ctx.py new file mode 100644 index 000..dad7547 --- /dev/null +++ b/tests/orchestrator/execution_plugin/test_global_ctx.py @@ -0,0 +1,28 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from aria.orchestrator import execution_plugin + + +def test_python_script_scope(): +assert execution_plugin.ctx is None +assert execution_plugin.inputs is None +ctx = object() +inputs = object() +with execution_plugin.python_script_scope(operation_ctx=ctx, operation_inputs=inputs): +assert execution_plugin.ctx is ctx +assert execution_plugin.inputs is inputs +assert execution_plugin.ctx is None +assert execution_plugin.inputs is None http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/f91799a4/tests/orchestrator/execution_plugin/test_local.py -- diff --git a/tests/orchestrator/execution_plugin/test_local.py b/tests/orchestrator/execution_plugin/test_local.py new file mode 100644 index 000..497da48 --- /dev/null +++ b/tests/orchestrator/execution_plugin/test_local.py @@ -0,0 +1,587 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import json +import os + +import pytest + +from aria import workflow +from aria.orchestrator import events +from aria.orchestrator.workflows import api +from aria.orchestrator.workflows.exceptions import ExecutorException +from aria.orchestrator.exceptions import TaskAbortException, TaskRetryException +from aria.orchestrator.execution_plugin import operations +from aria.orchestrator.execution_plugin.exceptions import ProcessException +from aria.orchestrator.execution_plugin import local +from aria.orchestrator.execution_plugin import constants +from aria.orchestrator.workflows.executor import process +from aria.orchestrator.workflows.core import engine + +from tests import mock, storage +from tests.orchestrator.workflows.helpers import events_collector + +IS_WINDOWS = os.name == 'nt' + + +class TestLocalRunScript(object): + +def test_script_path_parameter(self, executor, workflow_context, tmpdir): +script_path = self._create_script( +tmpdir, +linux_script='''#! /bin/bash -e +ctx node-instance runtime-properties map.key value +''', +windows_script=''' +ctx node-instance runtime-properties map.key value +''') +props = self._run( +executor, workflow_context, +script_path=script_path) +assert props['map']['key'] == 'value' + +def test_process_env(self, executor, workflow_context, tmpdir): +script_path = self._create_script( +tmpdir, +linux_script='''#! /bin/bash -e +ctx node-instance runtime-properties map.key1 $key1 +ctx node-instance runtime-properties map.key2 $key2 +''', +windows_script=''' +ctx node-instance runtime-properties map.key1 %key1% +ctx node-instance runtime-properties map.key2 %key2% +''') +
[6/6] incubator-ariatosca git commit: ARIA-46 Execution plugin
ARIA-46 Execution plugin Project: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/commit/06b2f4d4 Tree: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/tree/06b2f4d4 Diff: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/diff/06b2f4d4 Branch: refs/heads/ARIA-46-execution-plugin Commit: 06b2f4d47a3a11f1557b70a89b7a03ab56d5a92f Parents: 385b209 Author: Dan KilmanAuthored: Tue Jan 3 17:00:46 2017 +0200 Committer: Dan Kilman Committed: Tue Jan 17 12:48:38 2017 +0200 -- MANIFEST.in | 1 + aria/orchestrator/execution_plugin/__init__.py | 33 ++ aria/orchestrator/execution_plugin/common.py| 145 + aria/orchestrator/execution_plugin/constants.py | 51 ++ .../execution_plugin/ctx_proxy/__init__.py | 16 + .../execution_plugin/ctx_proxy/client.py| 105 .../execution_plugin/ctx_proxy/server.py| 240 .../execution_plugin/environment_globals.py | 60 ++ .../orchestrator/execution_plugin/exceptions.py | 38 ++ aria/orchestrator/execution_plugin/local.py | 123 .../orchestrator/execution_plugin/operations.py | 59 ++ .../execution_plugin/ssh/__init__.py| 14 + .../execution_plugin/ssh/operations.py | 190 ++ .../orchestrator/execution_plugin/ssh/tunnel.py | 91 +++ aria/orchestrator/workflows/api/task.py | 12 +- aria/orchestrator/workflows/core/engine.py | 1 - aria/orchestrator/workflows/core/task.py| 3 +- aria/storage/base_model.py | 24 +- aria/storage/filesystem_rapi.py | 2 +- requirements.txt| 3 + setup.py| 9 +- tests/orchestrator/execution_plugin/__init__.py | 14 + .../execution_plugin/test_common.py | 193 +++ .../execution_plugin/test_ctx_proxy_server.py | 355 .../orchestrator/execution_plugin/test_local.py | 572 +++ tests/orchestrator/execution_plugin/test_ssh.py | 378 tests/orchestrator/workflows/api/test_task.py | 5 + tests/orchestrator/workflows/core/test_task.py | 38 +- 28 files changed, 2756 insertions(+), 19 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/06b2f4d4/MANIFEST.in -- diff --git a/MANIFEST.in b/MANIFEST.in index f9bd145..6b08eeb 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1 +1,2 @@ include requirements.txt +include aria/orchestrator/execution_plugin/ctx_proxy/binaries/ctx http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/06b2f4d4/aria/orchestrator/execution_plugin/__init__.py -- diff --git a/aria/orchestrator/execution_plugin/__init__.py b/aria/orchestrator/execution_plugin/__init__.py new file mode 100644 index 000..372022f --- /dev/null +++ b/aria/orchestrator/execution_plugin/__init__.py @@ -0,0 +1,33 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from contextlib import contextmanager + +# Populated during execution of python scripts +ctx = None +inputs = None + + +@contextmanager +def python_script_scope(operation_ctx, operation_inputs): +global ctx +global inputs +try: +ctx = operation_ctx +inputs = operation_inputs +yield +finally: +ctx = None +inputs = None http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/06b2f4d4/aria/orchestrator/execution_plugin/common.py -- diff --git a/aria/orchestrator/execution_plugin/common.py b/aria/orchestrator/execution_plugin/common.py new file mode 100644 index 000..b77474c --- /dev/null +++ b/aria/orchestrator/execution_plugin/common.py @@ -0,0 +1,145 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements.
[5/6] incubator-ariatosca git commit: ARIA-46 Execution plugin
http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/06b2f4d4/tests/orchestrator/execution_plugin/test_local.py -- diff --git a/tests/orchestrator/execution_plugin/test_local.py b/tests/orchestrator/execution_plugin/test_local.py new file mode 100644 index 000..8123ae8 --- /dev/null +++ b/tests/orchestrator/execution_plugin/test_local.py @@ -0,0 +1,572 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import json +import os + +import pytest + +from aria import workflow +from aria.orchestrator.workflows import api +from aria.orchestrator.exceptions import TaskAbortException +from aria.orchestrator.execution_plugin import operations +from aria.orchestrator.execution_plugin.exceptions import ProcessException +from aria.orchestrator.execution_plugin import local +from aria.orchestrator.execution_plugin import constants +from aria.orchestrator.workflows.executor import process +from aria.orchestrator.workflows.core import engine + +from tests import mock, storage + +IS_WINDOWS = os.name == 'nt' + +import logging +logging.basicConfig() + + +class TestLocalRunScript(object): + +def test_script_path_parameter(self, executor, workflow_context, tmpdir): +script_path = self._create_script( +tmpdir, +linux_script='''#! /bin/bash -e +ctx node-instance runtime-properties map.key value +''', +windows_script=''' +ctx node-instance runtime-properties map.key value +''') +props = self._run( +executor, workflow_context, +script_path=script_path) +assert props['map']['key'] == 'value' + +def test_process_env(self, executor, workflow_context, tmpdir): +script_path = self._create_script( +tmpdir, +linux_script='''#! /bin/bash -e +ctx node-instance runtime-properties map.key1 $key1 +ctx node-instance runtime-properties map.key2 $key2 +''', +windows_script=''' +ctx node-instance runtime-properties map.key1 %key1% +ctx node-instance runtime-properties map.key2 %key2% +''') +props = self._run( +executor, workflow_context, +script_path=script_path, +process={ +'env': { +'key1': 'value1', +'key2': 'value2' +} +}) +p_map = props['map'] +assert p_map['key1'] == 'value1' +assert p_map['key2'] == 'value2' + +def test_process_cwd(self, executor, workflow_context, tmpdir): +script_path = self._create_script( +tmpdir, +linux_script='''#! /bin/bash -e +ctx node-instance runtime-properties map.cwd $PWD +''', +windows_script=''' +ctx node-instance runtime-properties map.cwd %CD% +''') +tmpdir = str(tmpdir) +props = self._run( +executor, workflow_context, +script_path=script_path, +process={ +'cwd': tmpdir +}) +p_map = props['map'] +assert p_map['cwd'] == tmpdir + +def test_process_command_prefix(self, executor, workflow_context, tmpdir): +use_ctx = 'ctx node-instance runtime-properties map.key value' +python_script = ['import subprocess', + 'subprocess.Popen("{0}").split(' ')).communicate()[0]'.format(use_ctx)] +script_path = self._create_script( +tmpdir, +linux_script='\n'.join(python_script), +windows_script=''' +ctx node-instance runtime-properties map.key $env:TEST_KEY +''', +windows_suffix='.ps1') +# TODO: this (powershell) happens implicitly +command_prefix = 'powershell' if IS_WINDOWS else 'python' +props = self._run( +executor, workflow_context, +script_path=script_path, +process={ +'env': {'TEST_KEY': 'value'}, +'command_prefix': command_prefix +}) +p_map = props['map'] +assert p_map['key'] ==
[2/2] incubator-ariatosca git commit: ARIA-46 Execution plugin
ARIA-46 Execution plugin Project: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/commit/e203f6ce Tree: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/tree/e203f6ce Diff: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/diff/e203f6ce Branch: refs/heads/ARIA-46-execution-plugin Commit: e203f6ce9b3a3221589c0284b8b5532c622d97bf Parents: 3caf177 Author: Dan KilmanAuthored: Tue Jan 3 17:00:46 2017 +0200 Committer: Dan Kilman Committed: Mon Jan 9 19:17:29 2017 +0200 -- MANIFEST.in | 1 + aria/orchestrator/execution_plugin/__init__.py | 33 ++ aria/orchestrator/execution_plugin/common.py| 150 + aria/orchestrator/execution_plugin/constants.py | 51 ++ .../execution_plugin/ctx_proxy/__init__.py | 16 + .../execution_plugin/ctx_proxy/client.py| 105 .../execution_plugin/ctx_proxy/server.py| 240 .../execution_plugin/environment_globals.py | 60 ++ .../orchestrator/execution_plugin/exceptions.py | 38 ++ aria/orchestrator/execution_plugin/local.py | 123 .../orchestrator/execution_plugin/operations.py | 59 ++ .../execution_plugin/ssh/__init__.py| 14 + .../execution_plugin/ssh/operations.py | 190 ++ .../orchestrator/execution_plugin/ssh/tunnel.py | 91 +++ aria/orchestrator/workflows/api/task.py | 12 +- aria/orchestrator/workflows/core/engine.py | 1 - aria/orchestrator/workflows/core/task.py| 3 +- aria/orchestrator/workflows/executor/process.py | 3 + aria/storage/base_model.py | 26 +- aria/storage/filesystem_rapi.py | 2 +- requirements.txt| 3 + setup.py| 9 +- tests/orchestrator/execution_plugin/__init__.py | 14 + .../execution_plugin/test_common.py | 193 ++ .../execution_plugin/test_ctx_proxy_server.py | 355 +++ .../orchestrator/execution_plugin/test_local.py | 586 +++ tests/orchestrator/execution_plugin/test_ssh.py | 545 + 27 files changed, 2910 insertions(+), 13 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/e203f6ce/MANIFEST.in -- diff --git a/MANIFEST.in b/MANIFEST.in index f9bd145..6b08eeb 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1 +1,2 @@ include requirements.txt +include aria/orchestrator/execution_plugin/ctx_proxy/binaries/ctx http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/e203f6ce/aria/orchestrator/execution_plugin/__init__.py -- diff --git a/aria/orchestrator/execution_plugin/__init__.py b/aria/orchestrator/execution_plugin/__init__.py new file mode 100644 index 000..372022f --- /dev/null +++ b/aria/orchestrator/execution_plugin/__init__.py @@ -0,0 +1,33 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from contextlib import contextmanager + +# Populated during execution of python scripts +ctx = None +inputs = None + + +@contextmanager +def python_script_scope(operation_ctx, operation_inputs): +global ctx +global inputs +try: +ctx = operation_ctx +inputs = operation_inputs +yield +finally: +ctx = None +inputs = None http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/e203f6ce/aria/orchestrator/execution_plugin/common.py -- diff --git a/aria/orchestrator/execution_plugin/common.py b/aria/orchestrator/execution_plugin/common.py new file mode 100644 index 000..c13555a --- /dev/null +++ b/aria/orchestrator/execution_plugin/common.py @@ -0,0 +1,150 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for
incubator-ariatosca git commit: ARIA-46 Execution plugin [Forced Update!]
Repository: incubator-ariatosca Updated Branches: refs/heads/ARIA-46-execution-plugin b12c12429 -> 76337bb47 (forced update) ARIA-46 Execution plugin Project: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/commit/76337bb4 Tree: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/tree/76337bb4 Diff: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/diff/76337bb4 Branch: refs/heads/ARIA-46-execution-plugin Commit: 76337bb47475eb160910f0953d957dd7691ab3b1 Parents: 3caf177 Author: Dan KilmanAuthored: Tue Jan 3 17:00:46 2017 +0200 Committer: Dan Kilman Committed: Sun Jan 8 11:37:49 2017 +0200 -- MANIFEST.in | 1 + aria/orchestrator/execution_plugin/__init__.py | 33 ++ aria/orchestrator/execution_plugin/common.py| 146 aria/orchestrator/execution_plugin/constants.py | 51 +++ .../execution_plugin/ctx_proxy/__init__.py | 16 + .../execution_plugin/ctx_proxy/client.py| 105 ++ .../execution_plugin/ctx_proxy/server.py| 240 + .../execution_plugin/environment_globals.py | 60 .../orchestrator/execution_plugin/exceptions.py | 36 ++ aria/orchestrator/execution_plugin/local.py | 123 +++ .../orchestrator/execution_plugin/operations.py | 59 +++ .../execution_plugin/ssh/__init__.py| 14 + .../execution_plugin/ssh/operations.py | 210 +++ .../orchestrator/execution_plugin/ssh/tunnel.py | 91 + aria/orchestrator/workflows/api/task.py | 12 +- aria/orchestrator/workflows/core/task.py| 3 +- aria/storage/base_model.py | 26 +- requirements.txt| 3 + setup.py| 9 +- tests/orchestrator/execution_plugin/__init__.py | 14 + .../execution_plugin/test_ctx_proxy_server.py | 355 +++ 21 files changed, 1596 insertions(+), 11 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/76337bb4/MANIFEST.in -- diff --git a/MANIFEST.in b/MANIFEST.in index f9bd145..6b08eeb 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1 +1,2 @@ include requirements.txt +include aria/orchestrator/execution_plugin/ctx_proxy/binaries/ctx http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/76337bb4/aria/orchestrator/execution_plugin/__init__.py -- diff --git a/aria/orchestrator/execution_plugin/__init__.py b/aria/orchestrator/execution_plugin/__init__.py new file mode 100644 index 000..372022f --- /dev/null +++ b/aria/orchestrator/execution_plugin/__init__.py @@ -0,0 +1,33 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from contextlib import contextmanager + +# Populated during execution of python scripts +ctx = None +inputs = None + + +@contextmanager +def python_script_scope(operation_ctx, operation_inputs): +global ctx +global inputs +try: +ctx = operation_ctx +inputs = operation_inputs +yield +finally: +ctx = None +inputs = None http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/76337bb4/aria/orchestrator/execution_plugin/common.py -- diff --git a/aria/orchestrator/execution_plugin/common.py b/aria/orchestrator/execution_plugin/common.py new file mode 100644 index 000..fb6e2b0 --- /dev/null +++ b/aria/orchestrator/execution_plugin/common.py @@ -0,0 +1,146 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You
incubator-ariatosca git commit: ARIA-46 Execution plugin [Forced Update!]
Repository: incubator-ariatosca Updated Branches: refs/heads/ARIA-46-execution-plugin 15ab3e914 -> b12c12429 (forced update) ARIA-46 Execution plugin Project: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/commit/b12c1242 Tree: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/tree/b12c1242 Diff: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/diff/b12c1242 Branch: refs/heads/ARIA-46-execution-plugin Commit: b12c1242931a9e8e124533029cf192bebfaa5bff Parents: 3caf177 Author: Dan KilmanAuthored: Tue Jan 3 17:00:46 2017 +0200 Committer: Dan Kilman Committed: Fri Jan 6 20:33:26 2017 +0200 -- MANIFEST.in | 1 + aria/orchestrator/execution_plugin/__init__.py | 33 +++ aria/orchestrator/execution_plugin/common.py| 146 +++ aria/orchestrator/execution_plugin/constants.py | 51 .../execution_plugin/ctx_proxy/__init__.py | 16 ++ .../execution_plugin/ctx_proxy/client.py| 105 .../execution_plugin/ctx_proxy/server.py| 240 +++ .../execution_plugin/environment_globals.py | 60 + .../orchestrator/execution_plugin/exceptions.py | 36 +++ aria/orchestrator/execution_plugin/local.py | 123 ++ .../orchestrator/execution_plugin/operations.py | 59 + .../execution_plugin/ssh/__init__.py| 14 ++ .../execution_plugin/ssh/operations.py | 210 .../orchestrator/execution_plugin/ssh/tunnel.py | 91 +++ aria/orchestrator/workflows/api/task.py | 12 +- aria/orchestrator/workflows/core/task.py| 3 +- aria/storage/base_model.py | 26 +- requirements.txt| 3 + setup.py| 9 +- 19 files changed, 1227 insertions(+), 11 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/b12c1242/MANIFEST.in -- diff --git a/MANIFEST.in b/MANIFEST.in index f9bd145..6b08eeb 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1 +1,2 @@ include requirements.txt +include aria/orchestrator/execution_plugin/ctx_proxy/binaries/ctx http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/b12c1242/aria/orchestrator/execution_plugin/__init__.py -- diff --git a/aria/orchestrator/execution_plugin/__init__.py b/aria/orchestrator/execution_plugin/__init__.py new file mode 100644 index 000..372022f --- /dev/null +++ b/aria/orchestrator/execution_plugin/__init__.py @@ -0,0 +1,33 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from contextlib import contextmanager + +# Populated during execution of python scripts +ctx = None +inputs = None + + +@contextmanager +def python_script_scope(operation_ctx, operation_inputs): +global ctx +global inputs +try: +ctx = operation_ctx +inputs = operation_inputs +yield +finally: +ctx = None +inputs = None http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/b12c1242/aria/orchestrator/execution_plugin/common.py -- diff --git a/aria/orchestrator/execution_plugin/common.py b/aria/orchestrator/execution_plugin/common.py new file mode 100644 index 000..fb6e2b0 --- /dev/null +++ b/aria/orchestrator/execution_plugin/common.py @@ -0,0 +1,146 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless
incubator-ariatosca git commit: ARIA-46 Execution plugin
Repository: incubator-ariatosca Updated Branches: refs/heads/ARIA-46-execution-plugin [created] 15ab3e914 ARIA-46 Execution plugin Project: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/commit/15ab3e91 Tree: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/tree/15ab3e91 Diff: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/diff/15ab3e91 Branch: refs/heads/ARIA-46-execution-plugin Commit: 15ab3e914f263a56ffdc5492d2521afb8248444c Parents: 3caf177 Author: Dan KilmanAuthored: Tue Jan 3 17:00:46 2017 +0200 Committer: Dan Kilman Committed: Fri Jan 6 02:06:45 2017 +0200 -- MANIFEST.in | 1 + aria/orchestrator/execution_plugin/__init__.py | 33 +++ aria/orchestrator/execution_plugin/common.py| 140 +++ aria/orchestrator/execution_plugin/constants.py | 51 .../execution_plugin/ctx_proxy/__init__.py | 16 ++ .../execution_plugin/ctx_proxy/client.py| 102 .../execution_plugin/ctx_proxy/server.py| 240 +++ .../execution_plugin/environment_globals.py | 60 + .../orchestrator/execution_plugin/exceptions.py | 35 +++ aria/orchestrator/execution_plugin/local.py | 120 ++ .../orchestrator/execution_plugin/operations.py | 56 + .../execution_plugin/ssh/__init__.py| 14 ++ .../execution_plugin/ssh/operations.py | 211 .../orchestrator/execution_plugin/ssh/tunnel.py | 91 +++ aria/orchestrator/workflows/api/task.py | 12 +- aria/orchestrator/workflows/core/task.py| 3 +- aria/storage/base_model.py | 26 +- requirements.txt| 3 + setup.py| 9 +- 19 files changed, 1212 insertions(+), 11 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/15ab3e91/MANIFEST.in -- diff --git a/MANIFEST.in b/MANIFEST.in index f9bd145..6b08eeb 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1 +1,2 @@ include requirements.txt +include aria/orchestrator/execution_plugin/ctx_proxy/binaries/ctx http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/15ab3e91/aria/orchestrator/execution_plugin/__init__.py -- diff --git a/aria/orchestrator/execution_plugin/__init__.py b/aria/orchestrator/execution_plugin/__init__.py new file mode 100644 index 000..372022f --- /dev/null +++ b/aria/orchestrator/execution_plugin/__init__.py @@ -0,0 +1,33 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from contextlib import contextmanager + +# Populated during execution of python scripts +ctx = None +inputs = None + + +@contextmanager +def python_script_scope(operation_ctx, operation_inputs): +global ctx +global inputs +try: +ctx = operation_ctx +inputs = operation_inputs +yield +finally: +ctx = None +inputs = None http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/15ab3e91/aria/orchestrator/execution_plugin/common.py -- diff --git a/aria/orchestrator/execution_plugin/common.py b/aria/orchestrator/execution_plugin/common.py new file mode 100644 index 000..3c36052 --- /dev/null +++ b/aria/orchestrator/execution_plugin/common.py @@ -0,0 +1,140 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by