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:
Tim Rupp 2018-01-21 10:11:27 -08:00 committed by GitHub
commit bff862b05d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 113 additions and 46 deletions

View file

@ -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