Port shell snippet to python3/2.4 compatible syntax (#15874)

This commit is contained in:
Michael Scherer 2016-05-16 14:10:07 +02:00 committed by Brian Coca
parent 127a37f67c
commit 97f16b7700

View file

@ -31,6 +31,7 @@ try:
except ImportError: except ImportError:
HAS_PARAMIKO = False HAS_PARAMIKO = False
from ansible.module_utils.basic import get_exception
ANSI_RE = re.compile(r'(\x1b\[\?1h\x1b=)') ANSI_RE = re.compile(r'(\x1b\[\?1h\x1b=)')
@ -135,7 +136,8 @@ class Shell(object):
if self.read(window): if self.read(window):
resp = self.strip(recv.getvalue()) resp = self.strip(recv.getvalue())
return self.sanitize(cmd, resp) return self.sanitize(cmd, resp)
except ShellError, exc: except ShellError:
exc = get_exception()
exc.command = cmd exc.command = cmd
raise raise