Repository: incubator-ariatosca Updated Branches: refs/heads/ARIA-42-Generic-ctx-serialization-mechanism 69fb70da2 -> 5fd583d65
minor fixes Project: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/commit/5fd583d6 Tree: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/tree/5fd583d6 Diff: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/diff/5fd583d6 Branch: refs/heads/ARIA-42-Generic-ctx-serialization-mechanism Commit: 5fd583d65e11bf2482e063dc2bf31952834e452b Parents: 69fb70d Author: mxmrlv <[email protected]> Authored: Mon Feb 6 17:13:14 2017 +0200 Committer: mxmrlv <[email protected]> Committed: Mon Feb 6 17:13:14 2017 +0200 ---------------------------------------------------------------------- aria/orchestrator/context/serialization.py | 6 ++---- aria/storage/api.py | 7 ++++--- aria/storage/sql_mapi.py | 1 - requirements.txt | 1 + tests/orchestrator/context/test_serialize.py | 2 -- tests/orchestrator/execution_plugin/test_ssh.py | 2 +- tests/orchestrator/workflows/builtin/test_heal.py | 3 ++- 7 files changed, 10 insertions(+), 12 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/5fd583d6/aria/orchestrator/context/serialization.py ---------------------------------------------------------------------- diff --git a/aria/orchestrator/context/serialization.py b/aria/orchestrator/context/serialization.py index f9ad090..0810541 100644 --- a/aria/orchestrator/context/serialization.py +++ b/aria/orchestrator/context/serialization.py @@ -13,8 +13,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -import dill - import aria @@ -43,7 +41,7 @@ def operation_context_to_dict(context): 'api_cls': resource.api, 'api_kwargs': resource._api_kwargs, 'init_func': resource.api._init_func.__func__ - if hasattr(resource.api, '_init_func') else None + if hasattr(resource.api, '_init_func') else None } else: context_dict['resource_storage'] = None @@ -71,6 +69,6 @@ def operation_context_from_dict(context_dict): api_kwargs = resource_storage['api_kwargs'] init_func = resource_storage['init_func'] context['resource_storage'] = aria.application_resource_storage( - api=api_cls, api_kwargs=api_kwargs, storage_initiator_func=init_func) + api=api_cls, api_kwargs=api_kwargs, storage_initiator_func=init_func) return context_cls(**context) http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/5fd583d6/aria/storage/api.py ---------------------------------------------------------------------- diff --git a/aria/storage/api.py b/aria/storage/api.py index e9f2917..5f6b862 100644 --- a/aria/storage/api.py +++ b/aria/storage/api.py @@ -19,7 +19,7 @@ from functools import partial class StorageAPI(object): - NO_INITIATOR = 'no_initiatior_func' + NO_INITIATOR = 'no_initiator_func' """ General storage Base API @@ -42,7 +42,7 @@ class StorageAPI(object): # If func is None, no storage initiator was set, and nothing should happen. return - if hasattr(cls, '_original_init') and cls._init_func.__func__ == func: + if hasattr(cls, '_original_init') and cls._init_func.__func__ == func: # pylint: disable=no-member # setting the same function twice could cause a loop. we need to avoid that. return @@ -152,11 +152,12 @@ class ResourceAPI(StorageAPI): """ A Base object for the resource. """ - def __init__(self, name): + def __init__(self, name, **kwargs): """ Base resource API :param str name: the resource type """ + super(ResourceAPI, self).__init__(**kwargs) self._name = name @property http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/5fd583d6/aria/storage/sql_mapi.py ---------------------------------------------------------------------- diff --git a/aria/storage/sql_mapi.py b/aria/storage/sql_mapi.py index 1138fff..2ce8998 100644 --- a/aria/storage/sql_mapi.py +++ b/aria/storage/sql_mapi.py @@ -17,7 +17,6 @@ SQLAlchemy based MAPI """ import os import platform -from functools import partial from sqlalchemy import create_engine from sqlalchemy import orm http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/5fd583d6/requirements.txt ---------------------------------------------------------------------- diff --git a/requirements.txt b/requirements.txt index 3f922e8..2a26140 100644 --- a/requirements.txt +++ b/requirements.txt @@ -29,5 +29,6 @@ wagon==0.5.0 bottle==0.12.11 six==1.10.0 Fabric==1.13.1 +dill==0.2.6 # Fabric makes use of this library, but doesn't bring it :( pypiwin32==219 ; sys_platform == 'win32' http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/5fd583d6/tests/orchestrator/context/test_serialize.py ---------------------------------------------------------------------- diff --git a/tests/orchestrator/context/test_serialize.py b/tests/orchestrator/context/test_serialize.py index a6dbc45..60f8708 100644 --- a/tests/orchestrator/context/test_serialize.py +++ b/tests/orchestrator/context/test_serialize.py @@ -102,5 +102,3 @@ def memory_model_storage(): result = aria.application_model_storage(sql_mapi.SQLAlchemyModelAPI) yield result storage.release_sqlite_storage(result) - - http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/5fd583d6/tests/orchestrator/execution_plugin/test_ssh.py ---------------------------------------------------------------------- diff --git a/tests/orchestrator/execution_plugin/test_ssh.py b/tests/orchestrator/execution_plugin/test_ssh.py index 3caf48a..e744c8e 100644 --- a/tests/orchestrator/execution_plugin/test_ssh.py +++ b/tests/orchestrator/execution_plugin/test_ssh.py @@ -266,7 +266,7 @@ class TestWithActualSSHServer(object): @pytest.fixture def workflow_context(self, tmpdir): workflow_context = mock.context.simple(str(tmpdir).join('resources'), - model_driver_kwargs=dict(base_dir=str(tmpdir))) + model_driver_kwargs=dict(base_dir=str(tmpdir))) workflow_context.states = [] workflow_context.exception = None yield workflow_context http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/5fd583d6/tests/orchestrator/workflows/builtin/test_heal.py ---------------------------------------------------------------------- diff --git a/tests/orchestrator/workflows/builtin/test_heal.py b/tests/orchestrator/workflows/builtin/test_heal.py index b78b555..2555919 100644 --- a/tests/orchestrator/workflows/builtin/test_heal.py +++ b/tests/orchestrator/workflows/builtin/test_heal.py @@ -26,7 +26,8 @@ from . import (assert_node_install_operations, @pytest.fixture def ctx(tmpdir): - context = mock.context.simple(model_driver_kwargs=dict(base_dir=str(tmpdir))) + context = mock.context.simple(str(tmpdir), + model_driver_kwargs=dict(base_dir=str(tmpdir))) yield context storage.release_sqlite_storage(context.model)
