def was_command_successful(self, output):
"""
Given the entire output of an SSH command, this will check to see if
the result returned is 0, aka it was successful. If result is not 0,
the command failed and we return False.
:param output: The output string of an SSH command
:type output: str
:returns: True if the command was successful
"""
output_string = ''.join(output)
match = re.match('.*result\s+0', output_string)
if not match:
raise exceptions.SSHException(
"The command did not execute successfully.")
return True
评论列表
文章目录