mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-22 04:40:22 -07:00
Remove deprecated get_exception API
Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
This commit is contained in:
parent
caefe31125
commit
6bd0fbb63c
42 changed files with 284 additions and 409 deletions
|
@ -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
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue