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

task_result _check_key should handle empty results #16766

Merged
merged 1 commit into from
Aug 4, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/ansible/executor/task_result.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ def is_unreachable(self):
return self._check_key('unreachable')

def _check_key(self, key):
if 'results' in self._result and self._task.loop:
if self._result.get('results', []) and self._task.loop:
flag = False
for res in self._result.get('results', []):
if isinstance(res, dict):
Expand Down
12 changes: 12 additions & 0 deletions test/integration/roles/test_yum/tasks/yum.yml
Original file line number Diff line number Diff line change
Expand Up @@ -185,3 +185,15 @@

- name: uninstall sos and sharutils
yum: name=sos,sharutils state=removed

- name: install non-existent rpm
yum: name="{{ item }}"
with_items:
- does-not-exist
register: non_existent_rpm
ignore_errors: True

- name: check non-existent rpm install failed
assert:
that:
- non_existent_rpm|failed