Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not double fail hosts for includes #55913

Open
wants to merge 1 commit into
base: devel
from

Conversation

Projects
None yet
5 participants
@mkrizek
Copy link
Contributor

commented Apr 30, 2019

SUMMARY

Fixes #23161

- block:
  - include_tasks: "{{ item }}.yml"
    loop:
      - this_does_not_exist
      - this_does_not_exist_either
  rescue:
     - debug:
          msg: rescue

The above block (either with include_tasks or include_role) fails to execute the rescue section because we double mark hosts as failed for failed includes and so play iterator skips the rescue section.

ISSUE TYPE
  • Bugfix Pull Request
COMPONENT NAME
lib/ansible/plugins/strategy/__init__.py
lib/ansible/plugins/strategy/free.py
lib/ansible/plugins/strategy/linear.py
if host.name not in self._tqm._failed_hosts:
self._tqm._failed_hosts[host.name] = True
iterator.mark_host_failed(host)
display.error(to_text(e), wrap_text=False)

This comment has been minimized.

Copy link
@mkrizek

mkrizek Apr 30, 2019

Author Contributor

This makes the failures handling consistent with how linear strategy does it. I am not sure why that was different or if that was intentional.

@@ -924,8 +925,9 @@ def _do_handler_run(self, handler, handler_name, iterator, play_context, notifie
break
except AnsibleError as e:
for host in included_file._hosts:
iterator.mark_host_failed(host)
self._tqm._failed_hosts[host.name] = True
if host.name not in self._tqm._failed_hosts:

This comment has been minimized.

Copy link
@mkrizek

mkrizek Apr 30, 2019

Author Contributor

I wonder if we should prevent double failing hosts in one place in iterator.mark_host_failed.

@mkrizek

This comment has been minimized.

Copy link
Contributor Author

commented Apr 30, 2019

cc @sivel

@jimi-c

jimi-c approved these changes Apr 30, 2019

@mkrizek mkrizek changed the title [WIP] Do not double fail hosts for includes Do not double fail hosts for includes Apr 30, 2019

@ansibot ansibot added core_review and removed WIP labels Apr 30, 2019

@s-hertel
Copy link
Contributor

left a comment

Tested, looks good to me.

@ansibot ansibot added the stale_ci label May 8, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.