# remote_host.py
-
-#
+#
+#
# The RemoteHost class provides methods to do operations on a remote host
#
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):
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")