From dccf58efe393b6912faf2e89cf7e87942e28273e Mon Sep 17 00:00:00 2001 From: Jordan Borean Date: Tue, 5 Dec 2017 10:33:28 +1000 Subject: [PATCH] winrm: remove exception appender (#33443) * winrm: remove exception appender * went the other way and made the import error msg available in the msg --- lib/ansible/plugins/connection/winrm.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/ansible/plugins/connection/winrm.py b/lib/ansible/plugins/connection/winrm.py index 2d20f0c552..3e9626a276 100644 --- a/lib/ansible/plugins/connection/winrm.py +++ b/lib/ansible/plugins/connection/winrm.py @@ -126,12 +126,14 @@ try: HAS_WINRM = True except ImportError as e: HAS_WINRM = False + WINRM_IMPORT_ERR = e try: import xmltodict HAS_XMLTODICT = True except ImportError as e: HAS_XMLTODICT = False + XMLTODICT_IMPORT_ERR = e try: from __main__ import display @@ -372,9 +374,9 @@ class Connection(ConnectionBase): def _connect(self): if not HAS_WINRM: - raise AnsibleError("winrm or requests is not installed: %s" % to_text(e)) + raise AnsibleError("winrm or requests is not installed: %s" % to_text(WINRM_IMPORT_ERR)) elif not HAS_XMLTODICT: - raise AnsibleError("xmltodict is not installed: %s" % to_text(e)) + raise AnsibleError("xmltodict is not installed: %s" % to_text(XMLTODICT_IMPORT_ERR)) super(Connection, self)._connect() if not self.protocol: