adds function to do version checks for bigiq (#53985)
This commit is contained in:
parent
648ac17be3
commit
55d2632d78
1 changed files with 30 additions and 1 deletions
|
@ -280,7 +280,7 @@ class TransactionContextManager(object):
|
||||||
return self.client
|
return self.client
|
||||||
|
|
||||||
def __exit__(self, exc_type, exc_value, exc_tb):
|
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:
|
if exc_tb is None:
|
||||||
uri = "https://{0}:{1}/mgmt/tm/transaction/{2}".format(
|
uri = "https://{0}:{1}/mgmt/tm/transaction/{2}".format(
|
||||||
self.client.provider['server'],
|
self.client.provider['server'],
|
||||||
|
@ -506,6 +506,35 @@ def tmos_version(client):
|
||||||
return version
|
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):
|
def module_provisioned(client, module_name):
|
||||||
provisioned = modules_provisioned(client)
|
provisioned = modules_provisioned(client)
|
||||||
if module_name in provisioned:
|
if module_name in provisioned:
|
||||||
|
|
Loading…
Reference in a new issue