1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

winrm: remove exception appender (#33443)

* winrm: remove exception appender

* went the other way and made the import error msg available in the msg
This commit is contained in:
Jordan Borean 2017-12-05 10:33:28 +10:00 committed by GitHub
parent 46f7fadbaf
commit dccf58efe3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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: