summaryrefslogtreecommitdiffstats
path: root/modules/opnfv/deployment/manager.py
diff options
context:
space:
mode:
authorJose Lausuch <jose.lausuch@ericsson.com>2017-02-21 19:18:05 +0000
committerGerrit Code Review <gerrit@opnfv.org>2017-02-21 19:18:05 +0000
commitbf3316238f541feb41b259b7e32c279433a7daee (patch)
tree553d4d2a8aa13c2a3200f01767b49f8c976595a4 /modules/opnfv/deployment/manager.py
parent2b72e01a433d886999f2159e996a65fb7d855706 (diff)
parent72c3e538dcbcbe51140563d6ac009fae7b731104 (diff)
Merge "[deployment_handler] Fix some nits and improve output"
Diffstat (limited to 'modules/opnfv/deployment/manager.py')
-rw-r--r--modules/opnfv/deployment/manager.py20
1 files changed, 16 insertions, 4 deletions
diff --git a/modules/opnfv/deployment/manager.py b/modules/opnfv/deployment/manager.py
index efa28cea8..1dfbb09e4 100644
--- a/modules/opnfv/deployment/manager.py
+++ b/modules/opnfv/deployment/manager.py
@@ -174,13 +174,15 @@ class Node(object):
Run command remotely on a node
'''
if self.status is not NodeStatus.STATUS_OK:
- logger.error("The node %s is not active" % self.ip)
+ logger.error(
+ "Error running command %s. The node %s is not active"
+ % (cmd, self.ip))
return None
_, stdout, stderr = (self.ssh_client.exec_command(cmd))
error = stderr.readlines()
if len(error) > 0:
logger.error("error %s" % ''.join(error))
- return error
+ return None
output = ''.join(stdout.readlines()).rstrip()
return output
@@ -200,6 +202,14 @@ class Node(object):
'info': self.info
}
+ def is_active(self):
+ '''
+ Returns if the node is active
+ '''
+ if self.status == NodeStatus.STATUS_OK:
+ return True
+ return False
+
def is_controller(self):
'''
Returns if the node is a controller
@@ -222,8 +232,10 @@ class Node(object):
'''
Returns the ovs version installed
'''
- cmd = "ovs-vsctl --version|head -1| sed 's/^.*) //'"
- return self.run_cmd(cmd)
+ if self.is_active():
+ cmd = "ovs-vsctl --version|head -1| sed 's/^.*) //'"
+ return self.run_cmd(cmd)
+ return None
def get_system_info(self):
'''