diff --git a/muranoagent/app.py b/muranoagent/app.py index c0960bf2..eb0c1757 100644 --- a/muranoagent/app.py +++ b/muranoagent/app.py @@ -18,11 +18,11 @@ import sys import time import types -import bunch from oslo_log import log as logging from oslo_service import service import semantic_version +from muranoagent import bunch from muranoagent.common import config from muranoagent.common import messaging from muranoagent import exceptions as exc diff --git a/muranoagent/bunch.py b/muranoagent/bunch.py new file mode 100644 index 00000000..534ff3ad --- /dev/null +++ b/muranoagent/bunch.py @@ -0,0 +1,29 @@ +# Copyright (c) 2014 Mirantis, Inc. +# +# Licensed 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. + + +class Bunch(dict): + """Bunch dict/object-like container. + + Bunch container provides both dictionary-like and + object-like attribute access. + """ + def __getattr__(self, item): + return self.__getitem__(item) + + def __setattr__(self, key, value): + return self.__setitem__(key, value) + + def __delattr__(self, key): + del self[key] diff --git a/muranoagent/execution_plan_queue.py b/muranoagent/execution_plan_queue.py index 2be1d98a..058c655f 100644 --- a/muranoagent/execution_plan_queue.py +++ b/muranoagent/execution_plan_queue.py @@ -18,8 +18,8 @@ import os import shutil import time -import bunch +from muranoagent import bunch from muranoagent.common import config CONF = config.CONF diff --git a/muranoagent/execution_plan_runner.py b/muranoagent/execution_plan_runner.py index 54d87c77..b1b7b78c 100644 --- a/muranoagent/execution_plan_runner.py +++ b/muranoagent/execution_plan_runner.py @@ -15,8 +15,8 @@ import sys -import bunch +from muranoagent import bunch from muranoagent import files_manager as fm from muranoagent import script_runner diff --git a/muranoagent/executors/application/__init__.py b/muranoagent/executors/application/__init__.py index 5dba9991..ca95cb9c 100644 --- a/muranoagent/executors/application/__init__.py +++ b/muranoagent/executors/application/__init__.py @@ -18,9 +18,9 @@ import stat import subprocess import sys -import bunch from oslo_log import log as logging +from muranoagent import bunch import muranoagent.exceptions from muranoagent import executors diff --git a/muranoagent/executors/chef/__init__.py b/muranoagent/executors/chef/__init__.py index 990d4c52..b1a9983b 100644 --- a/muranoagent/executors/chef/__init__.py +++ b/muranoagent/executors/chef/__init__.py @@ -13,13 +13,13 @@ # See the License for the specific language governing permissions and # limitations under the License. -import bunch import json import os import subprocess from oslo_log import log as logging +from muranoagent import bunch import muranoagent.exceptions from muranoagent import executors from muranoagent.executors import chef_puppet_executor_base diff --git a/muranoagent/executors/chef_puppet_executor_base.py b/muranoagent/executors/chef_puppet_executor_base.py index 865e4c52..f59b684d 100644 --- a/muranoagent/executors/chef_puppet_executor_base.py +++ b/muranoagent/executors/chef_puppet_executor_base.py @@ -13,13 +13,13 @@ # See the License for the specific language governing permissions and # limitations under the License. -import bunch import json import os import subprocess from oslo_log import log as logging +from muranoagent import bunch import muranoagent.exceptions from muranoagent import executors diff --git a/muranoagent/executors/puppet/__init__.py b/muranoagent/executors/puppet/__init__.py index 4a7c57dc..fd1cc244 100644 --- a/muranoagent/executors/puppet/__init__.py +++ b/muranoagent/executors/puppet/__init__.py @@ -12,13 +12,13 @@ # implied. # See the License for the specific language governing permissions and # limitations under the License. -import bunch import os import subprocess import yaml from oslo_log import log as logging +from muranoagent import bunch import muranoagent.exceptions from muranoagent import executors from muranoagent.executors import chef_puppet_executor_base diff --git a/muranoagent/tests/unit/execution_plan.py b/muranoagent/tests/unit/execution_plan.py index c6375db8..bb334774 100644 --- a/muranoagent/tests/unit/execution_plan.py +++ b/muranoagent/tests/unit/execution_plan.py @@ -13,9 +13,10 @@ # See the License for the specific language governing permissions and # limitations under the License. -import bunch import fixtures +from muranoagent import bunch + class ExPlanDownloable(fixtures.Fixture): def setUp(self): diff --git a/muranoagent/tests/unit/executors/test_chef.py b/muranoagent/tests/unit/executors/test_chef.py index c86fe967..ec53318e 100644 --- a/muranoagent/tests/unit/executors/test_chef.py +++ b/muranoagent/tests/unit/executors/test_chef.py @@ -12,11 +12,11 @@ # License for the specific language governing permissions and limitations # under the License. -import bunch import fixtures import json import mock +from muranoagent import bunch from muranoagent.common import config as cfg from muranoagent import exceptions as ex from muranoagent.executors import chef diff --git a/muranoagent/tests/unit/executors/test_puppet.py b/muranoagent/tests/unit/executors/test_puppet.py index 2808fa13..c9a45acc 100644 --- a/muranoagent/tests/unit/executors/test_puppet.py +++ b/muranoagent/tests/unit/executors/test_puppet.py @@ -11,10 +11,11 @@ # 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 bunch + import fixtures import mock +from muranoagent import bunch from muranoagent.common import config as cfg from muranoagent import exceptions as ex from muranoagent.executors import puppet diff --git a/muranoagent/tests/unit/test_app.py b/muranoagent/tests/unit/test_app.py index ec43eed8..f8a1b4b0 100644 --- a/muranoagent/tests/unit/test_app.py +++ b/muranoagent/tests/unit/test_app.py @@ -12,11 +12,11 @@ # License for the specific language governing permissions and limitations # under the License. -import bunch import fixtures import mock from muranoagent import app +from muranoagent import bunch from muranoagent.common import config as cfg from muranoagent import exceptions as exc from muranoagent.tests.unit import base diff --git a/muranoagent/tests/unit/test_files_manager.py b/muranoagent/tests/unit/test_files_manager.py index fea5be48..cb1fdeca 100644 --- a/muranoagent/tests/unit/test_files_manager.py +++ b/muranoagent/tests/unit/test_files_manager.py @@ -12,10 +12,10 @@ # License for the specific language governing permissions and limitations # under the License. -import bunch import mock import os.path +from muranoagent import bunch from muranoagent.common import config as cfg from muranoagent import files_manager from muranoagent.tests.unit import base diff --git a/muranoagent/tests/unit/test_script_runner.py b/muranoagent/tests/unit/test_script_runner.py index 521c1f54..1bdf67d8 100644 --- a/muranoagent/tests/unit/test_script_runner.py +++ b/muranoagent/tests/unit/test_script_runner.py @@ -12,10 +12,10 @@ # License for the specific language governing permissions and limitations # under the License. -import bunch import git import mock +from muranoagent import bunch from muranoagent.common import config as cfg from muranoagent import files_manager as fmanager from muranoagent import script_runner diff --git a/requirements.txt b/requirements.txt index 42cc95d6..d0eeb468 100644 --- a/requirements.txt +++ b/requirements.txt @@ -5,6 +5,7 @@ pbr<2.0,>=0.11 anyjson>=0.3.3 Babel>=1.3 eventlet>=0.17.4 +GitPython>=1.0.1 # BSD License (3 clause) iso8601>=0.1.9 kombu>=3.0.7 oslo.config>=1.11.0 # Apache-2.0 @@ -16,7 +17,3 @@ six>=1.9.0 stevedore>=1.5.0 # Apache-2.0 semantic-version>=2.3.1 requests>=2.5.2 - -# not listed in global requirements -bunch -gitpython