summaryrefslogtreecommitdiffstats
path: root/modules/opnfv/utils
diff options
context:
space:
mode:
Diffstat (limited to 'modules/opnfv/utils')
-rw-r--r--modules/opnfv/utils/Credentials.py8
-rw-r--r--modules/opnfv/utils/constants.py11
-rw-r--r--modules/opnfv/utils/opnfv_logger.py (renamed from modules/opnfv/utils/OPNFVLogger.py)0
-rw-r--r--modules/opnfv/utils/ssh_utils.py (renamed from modules/opnfv/utils/SSHUtils.py)32
4 files changed, 39 insertions, 12 deletions
diff --git a/modules/opnfv/utils/Credentials.py b/modules/opnfv/utils/Credentials.py
index 1882692b3..6441b841c 100644
--- a/modules/opnfv/utils/Credentials.py
+++ b/modules/opnfv/utils/Credentials.py
@@ -47,7 +47,7 @@ class Credentials(object):
password)
def __check_installer_name(self, installer):
- if installer not in ("apex", "compass", "fuel", "joid"):
+ if installer not in ("apex", "compass", "daisy", "fuel", "joid"):
return os.EX_CONFIG
else:
return os.EX_OK
@@ -69,6 +69,10 @@ class Credentials(object):
# TODO
pass
+ def __fetch_creds_daisy(self, target_path):
+ # TODO
+ pass
+
def __fetch_creds_fuel(self, target_path):
creds_file = '/root/openrc'
try:
@@ -95,6 +99,8 @@ class Credentials(object):
self.__fetch_creds_apex(target_path)
elif self.installer == "compass":
self.__fetch_creds_compass(target_path)
+ elif self.installer == "daisy":
+ self.__fetch_creds_daisy(target_path)
elif self.installer == "fuel":
self.__fetch_creds_fuel(target_path)
elif self.installer == "joid":
diff --git a/modules/opnfv/utils/constants.py b/modules/opnfv/utils/constants.py
index 29f0d02c5..ed83488d4 100644
--- a/modules/opnfv/utils/constants.py
+++ b/modules/opnfv/utils/constants.py
@@ -7,9 +7,18 @@
# which accompanies this distribution, and is available at
# http://www.apache.org/licenses/LICENSE-2.0
-INSTALLERS = ['apex', 'fuel', 'compass', 'joid']
+INSTALLERS = ['apex', 'fuel', 'compass', 'joid', "daisy"]
VERSIONS = ['arno', 'brahmaputra', 'colorado', 'danube']
EXIT_OK = 0
EXIT_RUN_ERROR = -1
EXIT_PUSH_TO_TEST_DB_ERROR = -2
+
+class Constants(object):
+ INSTALLERS = ['apex', 'fuel', 'compass', 'joid', "daisy"]
+ VERSIONS = ['arno', 'brahmaputra', 'colorado', 'danube']
+
+ EX_OK = 0
+ EX_RUN_ERROR = -1
+ EX_TEST_FAIL = -2
+ EX_PUSH_RESULT_FAIL = -3
diff --git a/modules/opnfv/utils/OPNFVLogger.py b/modules/opnfv/utils/opnfv_logger.py
index 6fa4ef2e2..6fa4ef2e2 100644
--- a/modules/opnfv/utils/OPNFVLogger.py
+++ b/modules/opnfv/utils/opnfv_logger.py
diff --git a/modules/opnfv/utils/SSHUtils.py b/modules/opnfv/utils/ssh_utils.py
index 16e34c3e5..f90045540 100644
--- a/modules/opnfv/utils/SSHUtils.py
+++ b/modules/opnfv/utils/ssh_utils.py
@@ -9,14 +9,19 @@
##############################################################################
-import paramiko
-import opnfv.utils.OPNFVLogger as OPNFVLogger
import os
+import paramiko
-logger = OPNFVLogger.Logger('SSHUtils').getLogger()
+from opnfv.utils import opnfv_logger as logger
+logger = logger.Logger("SSH utils").getLogger()
-def get_ssh_client(hostname, username, password=None, proxy=None):
+
+def get_ssh_client(hostname,
+ username,
+ password=None,
+ proxy=None,
+ pkey_file=None):
client = None
try:
if proxy is None:
@@ -26,14 +31,21 @@ def get_ssh_client(hostname, username, password=None, proxy=None):
client.configure_jump_host(proxy['ip'],
proxy['username'],
proxy['password'])
-
if client is None:
raise Exception('Could not connect to client')
client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
- client.connect(hostname,
- username=username,
- password=password)
+ if pkey_file is not None:
+ key = paramiko.RSAKey.from_private_key_file(pkey_file)
+ client.load_system_host_keys()
+ client.connect(hostname,
+ username=username,
+ pkey=key)
+ else:
+ client.connect(hostname,
+ username=username,
+ password=password)
+
return client
except Exception, e:
logger.error(e)
@@ -66,8 +78,8 @@ class ProxyHopClient(paramiko.SSHClient):
'''
Connect to a remote server using a proxy hop
'''
+
def __init__(self, *args, **kwargs):
- self.logger = OPNFVLogger.Logger("ProxyHopClient").getLogger()
self.proxy_ssh = None
self.proxy_transport = None
self.proxy_channel = None
@@ -117,4 +129,4 @@ class ProxyHopClient(paramiko.SSHClient):
sock=self.proxy_channel)
os.remove(self.local_ssh_key)
except Exception, e:
- self.logger.error(e)
+ logger.error(e)