mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-08 22:33:25 +00:00
Remove deprecated get_exception API
Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
This commit is contained in:
committed by
Brian Coca
parent
caefe31125
commit
6bd0fbb63c
@@ -103,7 +103,7 @@ EXAMPLES = """
|
||||
"""
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
from ansible.module_utils.network.junos.junos import junos_argument_spec, get_param
|
||||
from ansible.module_utils.pycompat24 import get_exception
|
||||
from ansible.module_utils._text import to_native
|
||||
|
||||
try:
|
||||
from jnpr.junos import Device
|
||||
@@ -134,9 +134,8 @@ def connect(module):
|
||||
device = Device(host, **kwargs)
|
||||
device.open()
|
||||
device.timeout = get_param(module, 'timeout') or 10
|
||||
except ConnectError:
|
||||
exc = get_exception()
|
||||
module.fail_json(msg='unable to connect to %s: %s' % (host, str(exc)))
|
||||
except ConnectError as exc:
|
||||
module.fail_json(msg='unable to connect to %s: %s' % (host, to_native(exc)))
|
||||
|
||||
return device
|
||||
|
||||
|
||||
Reference in New Issue
Block a user