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:
Tim Rupp 2017-06-14 09:09:48 -07:00 committed by John R Barker
parent 6b99f0d65c
commit db834cafaa

View file

@ -203,6 +203,8 @@ class AnsibleF5Client(object):
required_if=None, required_one_of=None,
f5_product_name='bigip'):
self.f5_product_name = f5_product_name
merged_arg_spec = dict()
merged_arg_spec.update(F5_COMMON_ARGS)
if argument_spec:
@ -275,6 +277,25 @@ class AnsibleF5Client(object):
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):
def __init__(self, params=None):