diff --git a/compass/deployment/installers/installer.py b/compass/deployment/installers/installer.py index 80af157c..99e074f2 100644 --- a/compass/deployment/installers/installer.py +++ b/compass/deployment/installers/installer.py @@ -25,6 +25,7 @@ import os import simplejson as json from compass.deployment.installers.config_manager import BaseConfigManager +from compass.utils import setting_wrapper as compass_setting from compass.utils import util @@ -272,6 +273,12 @@ class PKInstaller(BaseInstaller): return None path = os.path.join(cls.INSTALLER_BASE_DIR, name) + if not os.path.exists(path): + path = os.path.join(os.path.join(os.path.join( + compass_setting.PLUGINS_DIR, name), "implementation"), name) + if not os.path.exists(path): + logging.info("Installer '%s' is not existed!" % name) + return None installer = super(PKInstaller, cls).get_installer(name, path, adapter_info, cluster_info, diff --git a/compass/deployment/installers/pk_installers/chef_installer/__init__.py b/compass/deployment/installers/pk_installers/chef_installer/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/compass/tests/deployment/installers/pk_installers/chef_installer/test_chef.py b/compass/tests/deployment/installers/pk_installers/chef_installer/test_chef.py index 4b7c9b37..dbb2f392 100644 --- a/compass/tests/deployment/installers/pk_installers/chef_installer/test_chef.py +++ b/compass/tests/deployment/installers/pk_installers/chef_installer/test_chef.py @@ -33,12 +33,13 @@ reload(compass_setting) from compass.deployment.installers.config_manager import BaseConfigManager -from compass.deployment.installers.pk_installers.chef_installer.chef_installer\ - import ChefInstaller from compass.tests.deployment.test_data import config_data from compass.utils import flags from compass.utils import logsetting +# TODO(Carl) move this test to plugins +from plugins.chef_installer.implementation.chef_installer import ChefInstaller + class TestChefInstaller(unittest2.TestCase): """Test installer functionality.""" diff --git a/compass/tests_serverside/deployment/installers/pk_installers/chef_installer/test_chef_installer.py b/compass/tests_serverside/deployment/installers/pk_installers/chef_installer/test_chef_installer.py index 18f09c5c..f6e469ac 100644 --- a/compass/tests_serverside/deployment/installers/pk_installers/chef_installer/test_chef_installer.py +++ b/compass/tests_serverside/deployment/installers/pk_installers/chef_installer/test_chef_installer.py @@ -33,8 +33,9 @@ reload(compass_setting) from compass.deployment.installers.config_manager import BaseConfigManager -from compass.deployment.installers.pk_installers.chef_installer.chef_installer\ - import ChefInstaller + +# TODO(Carl) move this test to plugins +from plugins.chef_installer.implementation.chef_installer import ChefInstaller class TestChefInstaller(unittest2.TestCase): diff --git a/plugins/__init__.py b/plugins/__init__.py new file mode 100644 index 00000000..4ee55a4c --- /dev/null +++ b/plugins/__init__.py @@ -0,0 +1,13 @@ +# Copyright 2014 Huawei Technologies Co. Ltd +# +# 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. diff --git a/plugins/chef_installer/__init__.py b/plugins/chef_installer/__init__.py new file mode 100644 index 00000000..4ee55a4c --- /dev/null +++ b/plugins/chef_installer/__init__.py @@ -0,0 +1,13 @@ +# Copyright 2014 Huawei Technologies Co. Ltd +# +# 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. diff --git a/plugins/chef_installer/implementation/__init__.py b/plugins/chef_installer/implementation/__init__.py new file mode 100644 index 00000000..4ee55a4c --- /dev/null +++ b/plugins/chef_installer/implementation/__init__.py @@ -0,0 +1,13 @@ +# Copyright 2014 Huawei Technologies Co. Ltd +# +# 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. diff --git a/compass/deployment/installers/pk_installers/chef_installer/chef_installer.py b/plugins/chef_installer/implementation/chef_installer.py similarity index 100% rename from compass/deployment/installers/pk_installers/chef_installer/chef_installer.py rename to plugins/chef_installer/implementation/chef_installer.py