Merge "added output error message display by remote ssh execution"
authorLuis Gomez <ecelgp@gmail.com>
Sun, 30 Nov 2014 01:24:32 +0000 (01:24 +0000)
committerGerrit Code Review <gerrit@opendaylight.org>
Sun, 30 Nov 2014 01:24:32 +0000 (01:24 +0000)
test/tools/cluster-deployer/remote_host.py

index d6780ce9603cb601e42727c7119a54f1efd4079b..aebea60e2e79ed6fbd2d64c9b329b9124beddcc4 100644 (file)
@@ -1,6 +1,6 @@
 # remote_host.py
-
-# 
+#
+#
 # The RemoteHost class provides methods to do operations on a remote host
 #
 
@@ -18,8 +18,10 @@ class RemoteHost:
                lib = SSHLibrary()
                lib.open_connection(self.host)
                lib.login(username=self.user,password=self.password)
-               lib.execute_command(command)
+               rc = lib.execute_command(command, return_rc = True)
                lib.close_connection()
+               if rc[1] != 0:
+                  raise Exception('remote command failed [{0}] with exit code {1}'.format(command, rc))
 
 
        def mkdir(self, dir_name):
@@ -37,4 +39,4 @@ class RemoteHost:
            self.exec_cmd("ps axf | grep karaf | grep -v grep | awk '{print \"kill -9 \" $1}' | sh")
 
        def start_controller(self, dir_name):
-               self.exec_cmd(dir_name + "/odl/bin/start")
\ No newline at end of file
+               self.exec_cmd(dir_name + "/odl/bin/start")