diff options
author | Miroslav Miklus <mmiklus@cisco.com> | 2016-07-26 16:38:58 +0200 |
---|---|---|
committer | Jan Gelety <jgelety@cisco.com> | 2016-07-28 14:14:02 +0000 |
commit | e82373b2605b7965e91021fc65f574cd097dcc98 (patch) | |
tree | 6e11fc405489cb7a225f731c389484ef27b67687 /resources/libraries/python/SetupFramework.py | |
parent | e3f6b21b75b5d579ce3080a1f173828fc59270bf (diff) |
CSIT-212 SetupFramework scp result - logging fix
Change-Id: I23a8090a117acd9cd0bef8bd69689751742d63e9
Signed-off-by: Miroslav Miklus <mmiklus@cisco.com>
Diffstat (limited to 'resources/libraries/python/SetupFramework.py')
-rw-r--r-- | resources/libraries/python/SetupFramework.py | 26 |
1 files changed, 17 insertions, 9 deletions
diff --git a/resources/libraries/python/SetupFramework.py b/resources/libraries/python/SetupFramework.py index b81a3065c6..570a2baf4b 100644 --- a/resources/libraries/python/SetupFramework.py +++ b/resources/libraries/python/SetupFramework.py @@ -111,7 +111,7 @@ def create_env_directory_at_node(node): else: logger.console('Virtualenv created on {0}'.format(node['host'])) - +#pylint: disable=broad-except def setup_node(args): """Run all set-up methods for a node. @@ -121,14 +121,21 @@ def setup_node(args): :param args: All parameters needed to setup one node. :type args: tuple :return: nothing + :return: True - success, False - error + :rtype: bool """ tarball, remote_tarball, node = args - copy_tarball_to_node(tarball, node) - extract_tarball_at_node(remote_tarball, node) - if node['type'] == NodeType.TG: - create_env_directory_at_node(node) - logger.console('Setup of node {0} done'.format(node['host'])) - + try: + copy_tarball_to_node(tarball, node) + extract_tarball_at_node(remote_tarball, node) + if node['type'] == NodeType.TG: + create_env_directory_at_node(node) + except Exception as exc: + logger.error("Node setup failed, error:'{0}'".format(exc.message)) + return False + else: + logger.console('Setup of node {0} done'.format(node['host'])) + return True def delete_local_tarball(tarball): """Delete local tarball to prevent disk pollution. @@ -166,14 +173,15 @@ class SetupFramework(object): # pylint: disable=too-few-public-methods pool.close() pool.join() + # Turn on logging + BuiltIn().set_log_level(log_level) + logger.info( 'Executed node setups in parallel, waiting for processes to end') result.wait() logger.info('Results: {0}'.format(result.get())) - # Turn on logging - BuiltIn().set_log_level(log_level) logger.trace('Test framework copied to all topology nodes') delete_local_tarball(tarball) logger.console('All nodes are ready') |