mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-02 14:40:19 -07:00
Bugfix.add token cleanup 02 (#34441)
* Adds more token cleanup Token cleanup ensures that the bigip doesnt become wedged from excessive API calls * Fixed missing usage of token cleanup
This commit is contained in:
parent
26d20ec194
commit
19f5d969c5
7 changed files with 93 additions and 9 deletions
|
@ -43,8 +43,8 @@ notes:
|
|||
different ways on each platform. On Debian based systems with C(apt);
|
||||
C(apt-get install rpm). On Mac with C(brew); C(brew install rpm).
|
||||
This command is already present on RedHat based systems.
|
||||
- Requires BIG-IP < 12.1.0 because the required functionality is missing
|
||||
on versions earlier than that.
|
||||
- Requires BIG-IP >= 12.1.0 because the required functionality is missing
|
||||
on versions earlier than that.
|
||||
requirements:
|
||||
- f5-sdk >= 2.2.3
|
||||
- Requires BIG-IP >= 12.1.0
|
||||
|
@ -320,6 +320,16 @@ class ArgumentSpec(object):
|
|||
]
|
||||
|
||||
|
||||
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")
|
||||
|
@ -336,8 +346,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))
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue