Skip to content

Commit

Permalink
Adds wait parameters to bigiq applications (ansible#40420)
Browse files Browse the repository at this point in the history
The wait parameter allows the module to wait or not wait when
an application is created. By default the modules will wait.
  • Loading branch information
caphrim007 authored May 18, 2018
1 parent 1492414 commit 5af91ef
Show file tree
Hide file tree
Showing 6 changed files with 97 additions and 49 deletions.
24 changes: 16 additions & 8 deletions lib/ansible/modules/network/f5/bigiq_application_fasthttp.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,11 @@
choices:
- absent
- present
wait:
description:
- If the module should wait for the application to be created, deleted or updated.
type: bool
default: yes
extends_documentation_fragment: f5
notes:
- This module does not support updating of your application (whether deployed or not).
Expand Down Expand Up @@ -572,9 +577,10 @@ def remove(self):
if self.module.check_mode:
return True
self_link = self.remove_from_device()
self.wait_for_apply_template_task(self_link)
if self.exists():
raise F5ModuleError("Failed to delete the resource.")
if self.want.wait:
self.wait_for_apply_template_task(self_link)
if self.exists():
raise F5ModuleError("Failed to delete the resource.")
return True

def has_no_service_environment(self):
Expand Down Expand Up @@ -605,11 +611,12 @@ def create(self):
if self.module.check_mode:
return True
self_link = self.create_on_device()
self.wait_for_apply_template_task(self_link)
if not self.exists():
raise F5ModuleError(
"Failed to deploy application."
)
if self.want.wait:
self.wait_for_apply_template_task(self_link)
if not self.exists():
raise F5ModuleError(
"Failed to deploy application."
)
return True

def create_on_device(self):
Expand Down Expand Up @@ -710,6 +717,7 @@ def __init__(self):
default='present',
choices=['present', 'absent']
),
wait=dict(type='bool', default='yes')
)
self.argument_spec = {}
self.argument_spec.update(f5_argument_spec)
Expand Down
24 changes: 16 additions & 8 deletions lib/ansible/modules/network/f5/bigiq_application_fastl4_tcp.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,11 @@
choices:
- absent
- present
wait:
description:
- If the module should wait for the application to be created, deleted or updated.
type: bool
default: yes
extends_documentation_fragment: f5
notes:
- This module does not support updating of your application (whether deployed or not).
Expand Down Expand Up @@ -530,9 +535,10 @@ def remove(self):
if self.module.check_mode:
return True
self_link = self.remove_from_device()
self.wait_for_apply_template_task(self_link)
if self.exists():
raise F5ModuleError("Failed to delete the resource.")
if self.want.wait:
self.wait_for_apply_template_task(self_link)
if self.exists():
raise F5ModuleError("Failed to delete the resource.")
return True

def create(self):
Expand All @@ -552,11 +558,12 @@ def create(self):
if self.module.check_mode:
return True
self_link = self.create_on_device()
self.wait_for_apply_template_task(self_link)
if not self.exists():
raise F5ModuleError(
"Failed to deploy application."
)
if self.want.wait:
self.wait_for_apply_template_task(self_link)
if not self.exists():
raise F5ModuleError(
"Failed to deploy application."
)
return True

def create_on_device(self):
Expand Down Expand Up @@ -657,6 +664,7 @@ def __init__(self):
default='present',
choices=['present', 'absent']
),
wait=dict(type='bool', default='yes')
)
self.argument_spec = {}
self.argument_spec.update(f5_argument_spec)
Expand Down
24 changes: 16 additions & 8 deletions lib/ansible/modules/network/f5/bigiq_application_fastl4_udp.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,11 @@
choices:
- absent
- present
wait:
description:
- If the module should wait for the application to be created, deleted or updated.
type: bool
default: yes
extends_documentation_fragment: f5
notes:
- This module does not support updating of your application (whether deployed or not).
Expand Down Expand Up @@ -530,9 +535,10 @@ def remove(self):
if self.module.check_mode:
return True
self_link = self.remove_from_device()
self.wait_for_apply_template_task(self_link)
if self.exists():
raise F5ModuleError("Failed to delete the resource.")
if self.want.wait:
self.wait_for_apply_template_task(self_link)
if self.exists():
raise F5ModuleError("Failed to delete the resource.")
return True

def create(self):
Expand All @@ -552,11 +558,12 @@ def create(self):
if self.module.check_mode:
return True
self_link = self.create_on_device()
self.wait_for_apply_template_task(self_link)
if not self.exists():
raise F5ModuleError(
"Failed to deploy application."
)
if self.want.wait:
self.wait_for_apply_template_task(self_link)
if not self.exists():
raise F5ModuleError(
"Failed to deploy application."
)
return True

def create_on_device(self):
Expand Down Expand Up @@ -657,6 +664,7 @@ def __init__(self):
default='present',
choices=['present', 'absent']
),
wait=dict(type='bool', default='yes')
)
self.argument_spec = {}
self.argument_spec.update(f5_argument_spec)
Expand Down
24 changes: 16 additions & 8 deletions lib/ansible/modules/network/f5/bigiq_application_http.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,11 @@
choices:
- absent
- present
wait:
description:
- If the module should wait for the application to be created, deleted or updated.
type: bool
default: yes
extends_documentation_fragment: f5
notes:
- This module does not support updating of your application (whether deployed or not).
Expand Down Expand Up @@ -572,9 +577,10 @@ def remove(self):
if self.module.check_mode:
return True
self_link = self.remove_from_device()
self.wait_for_apply_template_task(self_link)
if self.exists():
raise F5ModuleError("Failed to delete the resource.")
if self.want.wait:
self.wait_for_apply_template_task(self_link)
if self.exists():
raise F5ModuleError("Failed to delete the resource.")
return True

def has_no_service_environment(self):
Expand Down Expand Up @@ -605,11 +611,12 @@ def create(self):
if self.module.check_mode:
return True
self_link = self.create_on_device()
self.wait_for_apply_template_task(self_link)
if not self.exists():
raise F5ModuleError(
"Failed to deploy application."
)
if self.want.wait:
self.wait_for_apply_template_task(self_link)
if not self.exists():
raise F5ModuleError(
"Failed to deploy application."
)
return True

def create_on_device(self):
Expand Down Expand Up @@ -710,6 +717,7 @@ def __init__(self):
default='present',
choices=['present', 'absent']
),
wait=dict(type='bool', default='yes')
)
self.argument_spec = {}
self.argument_spec.update(f5_argument_spec)
Expand Down
24 changes: 16 additions & 8 deletions lib/ansible/modules/network/f5/bigiq_application_https_offload.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,11 @@
choices:
- absent
- present
wait:
description:
- If the module should wait for the application to be created, deleted or updated.
type: bool
default: yes
extends_documentation_fragment: f5
author:
- Tim Rupp (@caphrim007)
Expand Down Expand Up @@ -788,9 +793,10 @@ def remove(self):
if self.module.check_mode:
return True
self_link = self.remove_from_device()
self.wait_for_apply_template_task(self_link)
if self.exists():
raise F5ModuleError("Failed to delete the resource.")
if self.want.wait:
self.wait_for_apply_template_task(self_link)
if self.exists():
raise F5ModuleError("Failed to delete the resource.")
return True

def has_no_service_environment(self):
Expand Down Expand Up @@ -821,11 +827,12 @@ def create(self):
if self.module.check_mode:
return True
self_link = self.create_on_device()
self.wait_for_apply_template_task(self_link)
if not self.exists():
raise F5ModuleError(
"Failed to deploy application."
)
if self.want.wait:
self.wait_for_apply_template_task(self_link)
if not self.exists():
raise F5ModuleError(
"Failed to deploy application."
)
return True

def create_on_device(self):
Expand Down Expand Up @@ -947,6 +954,7 @@ def __init__(self):
)
),
add_analytics=dict(type='bool', default='no'),
wait=dict(type='bool', default='yes')
)
self.argument_spec = {}
self.argument_spec.update(f5_argument_spec)
Expand Down
26 changes: 17 additions & 9 deletions lib/ansible/modules/network/f5/bigiq_application_https_waf.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,11 @@
choices:
- absent
- present
wait:
description:
- If the module should wait for the application to be created, deleted or updated.
type: bool
default: yes
extends_documentation_fragment: f5
author:
- Tim Rupp (@caphrim007)
Expand Down Expand Up @@ -811,9 +816,10 @@ def remove(self):
if self.module.check_mode:
return True
self_link = self.remove_from_device()
self.wait_for_apply_template_task(self_link)
if self.exists():
raise F5ModuleError("Failed to delete the resource.")
if self.want.wait:
self.wait_for_apply_template_task(self_link)
if self.exists():
raise F5ModuleError("Failed to delete the resource.")
return True

def has_no_service_environment(self):
Expand Down Expand Up @@ -848,11 +854,12 @@ def create(self):
if self.module.check_mode:
return True
self_link = self.create_on_device()
self.wait_for_apply_template_task(self_link)
if not self.exists():
raise F5ModuleError(
"Failed to deploy application."
)
if self.want.wait:
self.wait_for_apply_template_task(self_link)
if not self.exists():
raise F5ModuleError(
"Failed to deploy application."
)
return True

def create_on_device(self):
Expand Down Expand Up @@ -974,7 +981,8 @@ def __init__(self):
)
),
add_analytics=dict(type='bool', default='no'),
domain_names=dict(type='list')
domain_names=dict(type='list'),
wait=dict(type='bool', default='yes')
)
self.argument_spec = {}
self.argument_spec.update(f5_argument_spec)
Expand Down

0 comments on commit 5af91ef

Please sign in to comment.