Seperate chef installer as a plugin (move chef_installer.py to plugins directory)

Bug: 1506700

This is the third change list of a series of changes that will eventually
convert chef installer as a plugin.
It moves chef_installer.py to the plugins/chef_installer/implementation
The related test was modified accordingly but should be moved to plugins directory in the next change list.

Change-Id: Idb2a6f7f9b1e612d737674d811e9b4e6d7b6212b
This commit is contained in:
Carl Li 2015-10-28 19:40:24 -07:00
parent b073a7837f
commit 02d07a8ad1
8 changed files with 52 additions and 4 deletions

View File

@ -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,

View File

@ -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."""

View File

@ -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):

13
plugins/__init__.py Normal file
View File

@ -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.

View File

@ -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.

View File

@ -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.