mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-29 16:11:22 -07:00
Fixes bigip_asm_policy (#35154)
This module had been unable to successfully create policies on different partitions. This appears to be fixed now
This commit is contained in:
parent
347b5d1e50
commit
bff862b05d
5 changed files with 113 additions and 46 deletions
|
@ -7,6 +7,8 @@ from __future__ import absolute_import, division, print_function
|
|||
__metaclass__ = type
|
||||
|
||||
|
||||
import time
|
||||
|
||||
try:
|
||||
from f5.bigip import ManagementRoot
|
||||
from icontrol.exceptions import iControlUnexpectedHTTPError
|
||||
|
@ -25,18 +27,24 @@ except ImportError:
|
|||
class F5Client(F5BaseClient):
|
||||
@property
|
||||
def api(self):
|
||||
try:
|
||||
result = ManagementRoot(
|
||||
self.params['server'],
|
||||
self.params['user'],
|
||||
self.params['password'],
|
||||
port=self.params['server_port'],
|
||||
verify=self.params['validate_certs'],
|
||||
token='tmos'
|
||||
)
|
||||
except Exception:
|
||||
result = None
|
||||
for x in range(0, 10):
|
||||
try:
|
||||
result = ManagementRoot(
|
||||
self.params['server'],
|
||||
self.params['user'],
|
||||
self.params['password'],
|
||||
port=self.params['server_port'],
|
||||
verify=self.params['validate_certs'],
|
||||
token='tmos'
|
||||
)
|
||||
break
|
||||
except Exception:
|
||||
time.sleep(3)
|
||||
if result:
|
||||
return result
|
||||
else:
|
||||
raise F5ModuleError(
|
||||
'Unable to connect to {0} on port {1}. '
|
||||
'Is "validate_certs" preventing this?'.format(self.params['server'], self.params['server_port'])
|
||||
)
|
||||
return result
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue