Skip to content

Commit

Permalink
Fix paramiko chan.recv_exit_status() call order (#313)
Browse files Browse the repository at this point in the history
  • Loading branch information
floatingstatic authored and dbarrosop committed Jan 12, 2019
1 parent c1aed95 commit a310775
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions nornir/plugins/tasks/commands/remote_command.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,13 @@ def remote_command(task: Task, command: str) -> Result:

chan.exec_command(command)

exit_status_code = chan.recv_exit_status()

with chan.makefile() as f:
stdout = f.read().decode()
with chan.makefile_stderr() as f:
stderr = f.read().decode()

exit_status_code = chan.recv_exit_status()

if exit_status_code:
raise CommandError(command, exit_status_code, stdout, stderr)

Expand Down

0 comments on commit a310775

Please sign in to comment.