adds function to do version checks for bigiq (#53985)

pull/53395/head
Wojciech Wypior 6 years ago committed by Tim Rupp
parent 648ac17be3
commit 55d2632d78

@ -280,7 +280,7 @@ class TransactionContextManager(object):
return self.client
def __exit__(self, exc_type, exc_value, exc_tb):
self.client.request.headers.pop('X-F5-REST-Coordination-Id')
self.client.api.request.headers.pop('X-F5-REST-Coordination-Id')
if exc_tb is None:
uri = "https://{0}:{1}/mgmt/tm/transaction/{2}".format(
self.client.provider['server'],
@ -506,6 +506,35 @@ def tmos_version(client):
return version
def bigiq_version(client):
uri = "https://{0}:{1}/mgmt/shared/resolver/device-groups/cm-shared-all-big-iqs/devices".format(
client.provider['server'],
client.provider['server_port'],
)
query = "?$select=version"
resp = client.api.get(uri + query)
try:
response = resp.json()
except ValueError as ex:
raise F5ModuleError(str(ex))
if 'code' in response and response['code'] in [400, 403]:
if 'message' in response:
raise F5ModuleError(response['message'])
else:
raise F5ModuleError(resp.content)
if 'items' in response:
version = response['items'][0]['version']
return version
raise F5ModuleError(
'Failed to retrieve BIGIQ version information.'
)
def module_provisioned(client, module_name):
provisioned = modules_provisioned(client)
if module_name in provisioned:

Loading…
Cancel
Save