mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-04-23 19:01:26 -07:00
Adds a reconnect method (#25625)
This is being made available so that module developers do not need to use the gnarly long-form version to get a similar result
This commit is contained in:
parent
6b99f0d65c
commit
db834cafaa
1 changed files with 21 additions and 0 deletions
|
@ -203,6 +203,8 @@ class AnsibleF5Client(object):
|
||||||
required_if=None, required_one_of=None,
|
required_if=None, required_one_of=None,
|
||||||
f5_product_name='bigip'):
|
f5_product_name='bigip'):
|
||||||
|
|
||||||
|
self.f5_product_name = f5_product_name
|
||||||
|
|
||||||
merged_arg_spec = dict()
|
merged_arg_spec = dict()
|
||||||
merged_arg_spec.update(F5_COMMON_ARGS)
|
merged_arg_spec.update(F5_COMMON_ARGS)
|
||||||
if argument_spec:
|
if argument_spec:
|
||||||
|
@ -275,6 +277,25 @@ class AnsibleF5Client(object):
|
||||||
token='local'
|
token='local'
|
||||||
)
|
)
|
||||||
|
|
||||||
|
def reconnect(self):
|
||||||
|
"""Attempts to reconnect to a device
|
||||||
|
|
||||||
|
The existing token from a ManagementRoot can become invalid if you,
|
||||||
|
for example, upgrade the device (such as is done in the *_software
|
||||||
|
module.
|
||||||
|
|
||||||
|
This method can be used to reconnect to a remote device without
|
||||||
|
having to re-instantiate the ArgumentSpec and AnsibleF5Client classes
|
||||||
|
it will use the same values that were initially provided to those
|
||||||
|
classes
|
||||||
|
|
||||||
|
:return:
|
||||||
|
:raises iControlUnexpectedHTTPError
|
||||||
|
"""
|
||||||
|
self.client.api = self._get_mgmt_root(
|
||||||
|
self.f5_product_name, **self._connect_params
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
class AnsibleF5Parameters(object):
|
class AnsibleF5Parameters(object):
|
||||||
def __init__(self, params=None):
|
def __init__(self, params=None):
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue