Merge "Ignore unreachable errors for scale playbook"

This commit is contained in:
Zuul 2022-06-20 10:37:17 +00:00 committed by Gerrit Code Review
commit 797c934166
3 changed files with 24 additions and 18 deletions

View File

@ -246,6 +246,7 @@ class TestDeleteNode(fakes.TestDeleteNode):
ssh_user='tripleo-admin',
limit_hosts='overcast-controller-1:overcast-compute-0',
reproduce_command=True,
ignore_unreachable=True,
extra_env_variables={
"ANSIBLE_BECOME": True,
"ANSIBLE_PRIVATE_KEY_FILE":

View File

@ -254,7 +254,8 @@ def run_ansible_playbook(playbook, inventory, workdir, playbook_dir=None,
callback_whitelist=constants.ANSIBLE_CWL,
ansible_cfg=None, ansible_timeout=30,
reproduce_command=True,
timeout=None, forks=None):
timeout=None, forks=None,
ignore_unreachable=False):
"""Simple wrapper for ansible-playbook.
:param playbook: Playbook filename.
@ -706,27 +707,30 @@ def run_ansible_playbook(playbook, inventory, workdir, playbook_dir=None,
f.write(str(val))
if rc != 0:
err_msg = (
'Ansible execution failed. playbook: {},'
' Run Status: {},'
' Return Code: {}'.format(
playbook,
status,
rc
)
)
if command_path:
err_msg += (
', To rerun the failed command manually execute the'
' following script: {}'.format(
command_path
if rc == 4 and ignore_unreachable:
LOG.info('Ignoring unreachable nodes')
else:
err_msg = (
'Ansible execution failed. playbook: {},'
' Run Status: {},'
' Return Code: {}'.format(
playbook,
status,
rc
)
)
if command_path:
err_msg += (
', To rerun the failed command manually execute the'
' following script: {}'.format(
command_path
)
)
if not quiet:
LOG.error(err_msg)
if not quiet:
LOG.error(err_msg)
raise RuntimeError(err_msg)
raise RuntimeError(err_msg)
LOG.info(
'Ansible execution success. playbook: {}'.format(

View File

@ -180,6 +180,7 @@ class DeleteNode(command.Command):
ssh_user='tripleo-admin',
limit_hosts=':'.join('%s' % node for node in nodes),
reproduce_command=True,
ignore_unreachable=True,
extra_env_variables={
"ANSIBLE_BECOME": True,
"ANSIBLE_PRIVATE_KEY_FILE": key_file