diff options
Diffstat (limited to 'functest/utils')
-rwxr-xr-x | functest/utils/functest_logger.py | 2 | ||||
-rw-r--r-- | functest/utils/functest_utils.py | 9 | ||||
-rw-r--r-- | functest/utils/openstack_tacker.py | 5 |
3 files changed, 14 insertions, 2 deletions
diff --git a/functest/utils/functest_logger.py b/functest/utils/functest_logger.py index 6dc46ef2..022211cb 100755 --- a/functest/utils/functest_logger.py +++ b/functest/utils/functest_logger.py @@ -29,7 +29,7 @@ import json from functest.utils.constants import CONST -class Logger: +class Logger(object): def __init__(self, logger_name): self.setup_logging() diff --git a/functest/utils/functest_utils.py b/functest/utils/functest_utils.py index b2c36cff..dbed811a 100644 --- a/functest/utils/functest_utils.py +++ b/functest/utils/functest_utils.py @@ -291,6 +291,13 @@ def get_ci_envvars(): return ci_env_var +def execute_command_raise(cmd, info=False, error_msg="", + verbose=True, output_file=None): + ret = execute_command(cmd, info, error_msg, verbose, output_file) + if ret != 0: + raise Exception(error_msg) + + def execute_command(cmd, info=False, error_msg="", verbose=True, output_file=None): if not error_msg: @@ -362,7 +369,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 diff --git a/functest/utils/openstack_tacker.py b/functest/utils/openstack_tacker.py index 07acc8b3..8327fdbe 100644 --- a/functest/utils/openstack_tacker.py +++ b/functest/utils/openstack_tacker.py @@ -176,6 +176,11 @@ def wait_for_vnf(tacker_client, vnf_id=None, vnf_name=None, timeout=60): elif vnf['status'] == 'PENDING_CREATE': time.sleep(3) timeout -= 3 + vnf = get_vnf(tacker_client, vnf_id, vnf_name) + + if (timeout < 0): + raise Exception('Timeout when booting vnf %s' % vnf['id']) + return vnf['id'] except Exception, e: logger.error("error [wait_for_vnf(tacker_client, '%s', '%s')]: %s" |