diff --git a/pssh/pssh_client.py b/pssh/pssh_client.py index f147572c..d12b0442 100644 --- a/pssh/pssh_client.py +++ b/pssh/pssh_client.py @@ -401,8 +401,10 @@ def join(self, output): """Block until all remote commands in output have finished and retrieve exit codes""" for host in output: - for line in output[host]['stdout']: - pass + stdout = output[host].get('stdout') + if stdout: + for _ in stdout: + pass self.get_exit_codes(output) def get_exit_codes(self, output): @@ -429,7 +431,7 @@ def get_exit_code(self, host_output): def _get_exit_code(self, channel): """Get exit code from channel if ready""" - if not channel.exit_status_ready(): + if not channel or not channel.exit_status_ready(): return channel.close() return channel.recv_exit_status()