summaryrefslogtreecommitdiffstats
path: root/libs/connect/ssh.py
diff options
context:
space:
mode:
Diffstat (limited to 'libs/connect/ssh.py')
-rwxr-xr-xlibs/connect/ssh.py27
1 files changed, 4 insertions, 23 deletions
diff --git a/libs/connect/ssh.py b/libs/connect/ssh.py
index e4540d5..c2d5613 100755
--- a/libs/connect/ssh.py
+++ b/libs/connect/ssh.py
@@ -78,32 +78,13 @@ class SshConnection():
transport = self._connection.get_transport()
channel = transport.open_session()
channel.exec_command(command)
- # Adding sleep to get the correct exit_status.
- timeout = 60
- sleeptime = 5
- while timeout:
- time.sleep(sleeptime)
- exit_status_ready_flag = channel.exit_status_ready()
- if not exit_status_ready_flag:
- timeout -=1
- continue
- else:
- break
-
- if not exit_status_ready_flag:
- stdin = channel.makefile("wb")
-
- if commandInput:
- stdin.write(commandInput)
- else:
- logger.error("This command requirs Command Input \
- after executing comamnd for command completion")
- stdin.write("\n")
- return output
+ stdin = channel.makefile("wb")
+ if commandInput:
+ stdin.write(commandInput)
+ exit_status = channel.recv_exit_status()
stdout = channel.makefile("rb")
stderr = channel.makefile_stderr("rb")
- exit_status = channel.recv_exit_status()
output["exitstatus"] = exit_status
output["stdoutdata"] = stdout.readlines()