mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-04-25 03:41:25 -07:00
haproxy: fix fail_on_not_found behaviour (#24790)
* haproxy: fix fail_on_not_found behaviour * fix pep8 compliance
This commit is contained in:
parent
277b8bfaf0
commit
2f732a621d
1 changed files with 5 additions and 4 deletions
|
@ -291,12 +291,13 @@ class HAProxy(object):
|
||||||
for backend in backends:
|
for backend in backends:
|
||||||
# Fail when backends were not found
|
# Fail when backends were not found
|
||||||
state = self.get_state_for(backend, svname)
|
state = self.get_state_for(backend, svname)
|
||||||
if (self.fail_on_not_found or self.wait) and state is None:
|
if (self.fail_on_not_found) and state is None:
|
||||||
self.module.fail_json(msg="The specified backend '%s/%s' was not found!" % (backend, svname))
|
self.module.fail_json(msg="The specified backend '%s/%s' was not found!" % (backend, svname))
|
||||||
|
|
||||||
self.execute(Template(cmd).substitute(pxname=backend, svname=svname))
|
if state is not None:
|
||||||
if self.wait:
|
self.execute(Template(cmd).substitute(pxname=backend, svname=svname))
|
||||||
self.wait_until_status(backend, svname, wait_for_status)
|
if self.wait:
|
||||||
|
self.wait_until_status(backend, svname, wait_for_status)
|
||||||
|
|
||||||
def get_state_for(self, pxname, svname):
|
def get_state_for(self, pxname, svname):
|
||||||
"""
|
"""
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue