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:
parent
46f7fadbaf
commit
dccf58efe3
1 changed files with 4 additions and 2 deletions
|
@ -126,12 +126,14 @@ try:
|
||||||
HAS_WINRM = True
|
HAS_WINRM = True
|
||||||
except ImportError as e:
|
except ImportError as e:
|
||||||
HAS_WINRM = False
|
HAS_WINRM = False
|
||||||
|
WINRM_IMPORT_ERR = e
|
||||||
|
|
||||||
try:
|
try:
|
||||||
import xmltodict
|
import xmltodict
|
||||||
HAS_XMLTODICT = True
|
HAS_XMLTODICT = True
|
||||||
except ImportError as e:
|
except ImportError as e:
|
||||||
HAS_XMLTODICT = False
|
HAS_XMLTODICT = False
|
||||||
|
XMLTODICT_IMPORT_ERR = e
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from __main__ import display
|
from __main__ import display
|
||||||
|
@ -372,9 +374,9 @@ class Connection(ConnectionBase):
|
||||||
def _connect(self):
|
def _connect(self):
|
||||||
|
|
||||||
if not HAS_WINRM:
|
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:
|
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()
|
super(Connection, self)._connect()
|
||||||
if not self.protocol:
|
if not self.protocol:
|
||||||
|
|
Loading…
Reference in a new issue