|
|
|
@ -194,10 +194,10 @@ import re
|
|
|
|
|
from distutils.version import LooseVersion
|
|
|
|
|
from ansible.module_utils.f5_utils import AnsibleF5Client
|
|
|
|
|
from ansible.module_utils.f5_utils import AnsibleF5Parameters
|
|
|
|
|
from ansible.module_utils.f5_utils import defaultdict
|
|
|
|
|
from ansible.module_utils.f5_utils import HAS_F5SDK
|
|
|
|
|
from ansible.module_utils.f5_utils import F5ModuleError
|
|
|
|
|
from ansible.module_utils.six import iteritems
|
|
|
|
|
from collections import defaultdict
|
|
|
|
|
|
|
|
|
|
try:
|
|
|
|
|
from StringIO import StringIO
|
|
|
|
@ -669,6 +669,16 @@ class ArgumentSpec(object):
|
|
|
|
|
self.f5_product_name = 'bigip'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def cleanup_tokens(client):
|
|
|
|
|
try:
|
|
|
|
|
resource = client.api.shared.authz.tokens_s.token.load(
|
|
|
|
|
name=client.api.icrs.token
|
|
|
|
|
)
|
|
|
|
|
resource.delete()
|
|
|
|
|
except Exception:
|
|
|
|
|
pass
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def main():
|
|
|
|
|
if not HAS_F5SDK:
|
|
|
|
|
raise F5ModuleError("The python f5-sdk module is required")
|
|
|
|
@ -684,8 +694,10 @@ def main():
|
|
|
|
|
try:
|
|
|
|
|
mm = ModuleManager(client)
|
|
|
|
|
results = mm.exec_module()
|
|
|
|
|
cleanup_tokens(client)
|
|
|
|
|
client.module.exit_json(**results)
|
|
|
|
|
except F5ModuleError as e:
|
|
|
|
|
cleanup_tokens(client)
|
|
|
|
|
client.module.fail_json(msg=str(e))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|