mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-08 06:12:51 +00:00
haproxy: fix fail_on_not_found behaviour (#24790)
* haproxy: fix fail_on_not_found behaviour * fix pep8 compliance
This commit is contained in:
@@ -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):
|
||||||
"""
|
"""
|
||||||
|
|||||||
Reference in New Issue
Block a user