Bugfix:Added the adapter info for compass and joid 65/29265/2
authorhelenyao <yaohelan@huawei.com>
Thu, 23 Feb 2017 02:45:21 +0000 (21:45 -0500)
committerhelenyao <yaohelan@huawei.com>
Fri, 24 Feb 2017 00:33:37 +0000 (19:33 -0500)
CI for compass and joid failed as there is no key defined in
installer_params.yaml

Change-Id: I8d17d36d854974c0751d3fd3bab4994205f786bb
Signed-off-by: helenyao <yaohelan@huawei.com>
functest/ci/installer_params.yaml
functest/ci/prepare_env.py
functest/utils/functest_utils.py

index bffa894..26aff9b 100644 (file)
@@ -2,15 +2,15 @@ apex:
     ip: ''
     user: 'stack'
     pkey: '/root/.ssh/id_rsa'
-#compass:
-#    ip: ''
-#    user: 'root'
-#    password: 'root'
+# compass:
+#     ip: '192.168.200.2'
+#     user: 'root'
+#     password: 'root'
 fuel:
     ip: '10.20.0.2'
     user: 'root'
     password: 'r00tme'
-#joid:
-#    ip: ''
-#    user: ''
-#    password: ''
+# joid:
+#     ip: ''
+#     user: ''
+#     password: ''
index 80bcfc7..4b9c820 100755 (executable)
@@ -285,25 +285,30 @@ def print_deployment_info():
                                          'functest/ci/installer_params.yaml')
     if (CONST.INSTALLER_IP and CONST.INSTALLER_TYPE and
             CONST.INSTALLER_TYPE in opnfv_constants.INSTALLERS):
-        installer_params = ft_utils.get_parameter_from_yaml(
-            CONST.INSTALLER_TYPE, installer_params_yaml)
-
-        user = installer_params.get('user', None)
-        password = installer_params.get('password', None)
-        pkey = installer_params.get('pkey', None)
-
         try:
-            handler = factory.Factory.get_handler(
-                installer=CONST.INSTALLER_TYPE,
-                installer_ip=CONST.INSTALLER_IP,
-                installer_user=user,
-                installer_pwd=password,
-                pkey_file=pkey)
-            if handler:
-                logger.info('\n\nDeployment information:\n%s' %
-                            handler.get_deployment_info())
-        except Exception as e:
-            logger.debug("Cannot get deployment information. %s" % e)
+            installer_params = ft_utils.get_parameter_from_yaml(
+                CONST.INSTALLER_TYPE, installer_params_yaml)
+        except ValueError as e:
+            logger.debug('Printing deployment info is not supported for %s' %
+                         CONST.INSTALLER_TYPE)
+            logger.debug(e)
+        else:
+            user = installer_params.get('user', None)
+            password = installer_params.get('password', None)
+            pkey = installer_params.get('pkey', None)
+
+            try:
+                handler = factory.Factory.get_handler(
+                    installer=CONST.INSTALLER_TYPE,
+                    installer_ip=CONST.INSTALLER_IP,
+                    installer_user=user,
+                    installer_pwd=password,
+                    pkey_file=pkey)
+                if handler:
+                    logger.info('\n\nDeployment information:\n%s' %
+                                handler.get_deployment_info())
+            except Exception as e:
+                logger.debug("Cannot get deployment information. %s" % e)
 
 
 def main(**kwargs):
index b2c36cf..17e988b 100644 (file)
@@ -362,7 +362,7 @@ def get_parameter_from_yaml(parameter, file):
         value = value.get(element)
         if value is None:
             raise ValueError("The parameter %s is not defined in"
-                             " config_functest.yaml" % parameter)
+                             " %s" % (parameter, file))
     return value