Move installer adapters to the new modules directory 97/24397/4
authorjose.lausuch <jose.lausuch@ericsson.com>
Wed, 16 Nov 2016 09:54:23 +0000 (10:54 +0100)
committerjose.lausuch <jose.lausuch@ericsson.com>
Wed, 16 Nov 2016 15:46:11 +0000 (16:46 +0100)
JIRA: RELENG-149
JIRA: RELENG-161

Now that we have a modules directory in place, let's
move all the shared python code to this location.
We need to create a setup.py to install these
modules in the system so that we don't have to
modify the pythonpath.

Change-Id: I7e608ce6e1e6b3d111405bc789cdb2ff7fcb49c3
Signed-off-by: jose.lausuch <jose.lausuch@ericsson.com>
16 files changed:
modules/README.rst [moved from modules/Readme.txt with 76% similarity]
modules/opnfv/__init__.py [moved from utils/installer-adapter/__init__.py with 100% similarity]
modules/opnfv/installer_adapters/InstallerHandler.py [moved from utils/installer-adapter/InstallerHandler.py with 100% similarity]
modules/opnfv/installer_adapters/__init__.py [moved from modules/__init.py__ with 100% similarity]
modules/opnfv/installer_adapters/apex/ApexAdapter.py [moved from utils/installer-adapter/ApexAdapter.py with 100% similarity]
modules/opnfv/installer_adapters/apex/__init__.py [moved from modules/installer_adapters/__init.py__ with 100% similarity]
modules/opnfv/installer_adapters/compass/CompassAdapter.py [moved from utils/installer-adapter/CompassAdapter.py with 100% similarity]
modules/opnfv/installer_adapters/compass/__init__.py [moved from modules/utils/__init.py__ with 100% similarity]
modules/opnfv/installer_adapters/fuel/FuelAdapter.py [moved from utils/installer-adapter/FuelAdapter.py with 98% similarity]
modules/opnfv/installer_adapters/fuel/__init__.py [new file with mode: 0644]
modules/opnfv/installer_adapters/fuel/example.py [moved from utils/installer-adapter/example.py with 100% similarity]
modules/opnfv/installer_adapters/joid/JoidAdapter.py [moved from utils/installer-adapter/JoidAdapter.py with 100% similarity]
modules/opnfv/installer_adapters/joid/__init__.py [new file with mode: 0644]
modules/opnfv/utils/OPNFVLogger.py [moved from utils/installer-adapter/RelengLogger.py with 100% similarity]
modules/opnfv/utils/SSHUtils.py [moved from utils/installer-adapter/SSHUtils.py with 97% similarity]
modules/opnfv/utils/__init__.py [new file with mode: 0644]

similarity index 76%
rename from modules/Readme.txt
rename to modules/README.rst
index 32becc2..7c91eca 100644 (file)
@@ -3,8 +3,8 @@ This directory may be used to add new tools that might be useful for any
 project in OPNFV. This tools must be python based and shall be imported
 as follows:
 
-  from releng.modules.utils import SSHUtils
-  from releng.modules.utils import RelengLogger
+  from opnfv.utils import SSHUtils
+  from opnfv.utils import RelengLogger
   ...
 
 For further information about how to use this modules directory, contact:
@@ -8,8 +8,8 @@
 # http://www.apache.org/licenses/LICENSE-2.0
 ##############################################################################
 
-import SSHUtils as ssh_utils
-import RelengLogger as rl
+import opnfv.modules.utils.SSHUtils as ssh_utils
+import opnfv.modules.utils.OPNFVLogger as logger
 
 
 class FuelAdapter:
@@ -22,7 +22,7 @@ class FuelAdapter:
             installer_ip,
             self.installer_user,
             password=self.installer_password)
-        self.logger = rl.Logger("Handler").getLogger()
+        self.logger = logger.Logger("FuelHandler").getLogger()
 
     def runcmd_fuel_installer(self, cmd):
         _, stdout, stderr = (self
diff --git a/modules/opnfv/installer_adapters/fuel/__init__.py b/modules/opnfv/installer_adapters/fuel/__init__.py
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/modules/opnfv/installer_adapters/joid/__init__.py b/modules/opnfv/installer_adapters/joid/__init__.py
new file mode 100644 (file)
index 0000000..e69de29
similarity index 97%
rename from utils/installer-adapter/SSHUtils.py
rename to modules/opnfv/utils/SSHUtils.py
index c938886..2f48add 100644 (file)
 
 
 import paramiko
-import RelengLogger as rl
+import opnfv.modules.utils.OPNFVLogger as OPNFVLogger
 import os
 
-logger = rl.Logger('SSHUtils').getLogger()
+logger = OPNFVLogger.Logger('SSHUtils').getLogger()
 
 
 def get_ssh_client(hostname, username, password=None, jumphost=None):
@@ -66,6 +66,7 @@ class JumpHostHopClient(paramiko.SSHClient):
     '''
     Connect to a remote server using a jumphost hop
     '''
+
     def __init__(self, *args, **kwargs):
         self.logger = rl.Logger("JumpHostHopClient").getLogger()
         self.jumphost_ssh = None
diff --git a/modules/opnfv/utils/__init__.py b/modules/opnfv/utils/__init__.py
new file mode 100644 (file)
index 0000000..e69de29