|
|
|
@ -704,6 +704,7 @@ class Changes(Parameters):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class UsableChanges(Changes):
|
|
|
|
|
|
|
|
|
|
@property
|
|
|
|
|
def virtual_server_dependencies(self):
|
|
|
|
|
if self._values['virtual_server_dependencies'] is None:
|
|
|
|
@ -957,21 +958,10 @@ class ModuleManager(object):
|
|
|
|
|
else:
|
|
|
|
|
return self.create()
|
|
|
|
|
|
|
|
|
|
def exists(self):
|
|
|
|
|
uri = "https://{0}:{1}/mgmt/tm/gtm/server/{2}/virtual-servers/{3}".format(
|
|
|
|
|
self.client.provider['server'],
|
|
|
|
|
self.client.provider['server_port'],
|
|
|
|
|
transform_name(self.want.partition, self.want.server_name),
|
|
|
|
|
self.want.name
|
|
|
|
|
)
|
|
|
|
|
resp = self.client.api.get(uri)
|
|
|
|
|
try:
|
|
|
|
|
response = resp.json()
|
|
|
|
|
except ValueError:
|
|
|
|
|
return False
|
|
|
|
|
if resp.status == 404 or 'code' in response and response['code'] == 404:
|
|
|
|
|
def absent(self):
|
|
|
|
|
if self.exists():
|
|
|
|
|
return self.remove()
|
|
|
|
|
return False
|
|
|
|
|
return True
|
|
|
|
|
|
|
|
|
|
def update(self):
|
|
|
|
|
self.have = self.read_current_from_device()
|
|
|
|
@ -1013,6 +1003,22 @@ class ModuleManager(object):
|
|
|
|
|
self.create_on_device()
|
|
|
|
|
return True
|
|
|
|
|
|
|
|
|
|
def exists(self):
|
|
|
|
|
uri = "https://{0}:{1}/mgmt/tm/gtm/server/{2}/virtual-servers/{3}".format(
|
|
|
|
|
self.client.provider['server'],
|
|
|
|
|
self.client.provider['server_port'],
|
|
|
|
|
transform_name(self.want.partition, self.want.server_name),
|
|
|
|
|
transform_name(name=self.want.name)
|
|
|
|
|
)
|
|
|
|
|
resp = self.client.api.get(uri)
|
|
|
|
|
try:
|
|
|
|
|
response = resp.json()
|
|
|
|
|
except ValueError:
|
|
|
|
|
return False
|
|
|
|
|
if resp.status == 404 or 'code' in response and response['code'] == 404:
|
|
|
|
|
return False
|
|
|
|
|
return True
|
|
|
|
|
|
|
|
|
|
def create_on_device(self):
|
|
|
|
|
params = self.changes.api_params()
|
|
|
|
|
params['name'] = self.want.name
|
|
|
|
@ -1040,7 +1046,7 @@ class ModuleManager(object):
|
|
|
|
|
self.client.provider['server'],
|
|
|
|
|
self.client.provider['server_port'],
|
|
|
|
|
transform_name(self.want.partition, self.want.server_name),
|
|
|
|
|
self.want.name
|
|
|
|
|
transform_name(name=self.want.name)
|
|
|
|
|
)
|
|
|
|
|
resp = self.client.api.patch(uri, json=params)
|
|
|
|
|
try:
|
|
|
|
@ -1054,17 +1060,12 @@ class ModuleManager(object):
|
|
|
|
|
else:
|
|
|
|
|
raise F5ModuleError(resp.content)
|
|
|
|
|
|
|
|
|
|
def absent(self):
|
|
|
|
|
if self.exists():
|
|
|
|
|
return self.remove()
|
|
|
|
|
return False
|
|
|
|
|
|
|
|
|
|
def remove_from_device(self):
|
|
|
|
|
uri = "https://{0}:{1}/mgmt/tm/gtm/server/{2}/virtual-servers/{3}".format(
|
|
|
|
|
self.client.provider['server'],
|
|
|
|
|
self.client.provider['server_port'],
|
|
|
|
|
transform_name(self.want.partition, self.want.server_name),
|
|
|
|
|
self.want.name
|
|
|
|
|
transform_name(name=self.want.name)
|
|
|
|
|
)
|
|
|
|
|
response = self.client.api.delete(uri)
|
|
|
|
|
if response.status == 200:
|
|
|
|
@ -1076,7 +1077,7 @@ class ModuleManager(object):
|
|
|
|
|
self.client.provider['server'],
|
|
|
|
|
self.client.provider['server_port'],
|
|
|
|
|
transform_name(self.want.partition, self.want.server_name),
|
|
|
|
|
self.want.name
|
|
|
|
|
transform_name(name=self.want.name)
|
|
|
|
|
)
|
|
|
|
|
resp = self.client.api.get(uri)
|
|
|
|
|
try:
|
|
|
|
|