From 97f16b77007598f130280f68cded618b1cdf677b Mon Sep 17 00:00:00 2001 From: Michael Scherer Date: Mon, 16 May 2016 14:10:07 +0200 Subject: [PATCH] Port shell snippet to python3/2.4 compatible syntax (#15874) --- lib/ansible/module_utils/shell.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/ansible/module_utils/shell.py b/lib/ansible/module_utils/shell.py index a01b41b0c5b..9e244cd6387 100644 --- a/lib/ansible/module_utils/shell.py +++ b/lib/ansible/module_utils/shell.py @@ -31,6 +31,7 @@ try: except ImportError: HAS_PARAMIKO = False +from ansible.module_utils.basic import get_exception ANSI_RE = re.compile(r'(\x1b\[\?1h\x1b=)') @@ -135,7 +136,8 @@ class Shell(object): if self.read(window): resp = self.strip(recv.getvalue()) return self.sanitize(cmd, resp) - except ShellError, exc: + except ShellError: + exc = get_exception() exc.command = cmd raise