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

ansible 2.8: "skip: true" vs "errors=ignore" #56713

Closed
philfry opened this issue May 21, 2019 · 5 comments
Closed

ansible 2.8: "skip: true" vs "errors=ignore" #56713

philfry opened this issue May 21, 2019 · 5 comments
Labels
affects_2.8 This issue/PR affects Ansible v2.8 bug This issue/PR relates to a bug. python3 support:community This issue/PR relates to code supported by the Ansible community.

Comments

@philfry
Copy link
Contributor

philfry commented May 21, 2019

SUMMARY

find_first: with ansible 2.8 skip=false is marked as deprecated in favour of errors="ignore".
But when using errors="ignore" ansible tells me to use skip: true instead and fails.

ISSUE TYPE
  • Bug Report
COMPONENT NAME

first_found

ANSIBLE VERSION
ansible 2.8.0
  config file = /etc/ansible/ansible.cfg
  configured module search path = ['/home/phil/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python3.7/site-packages/ansible
  executable location = /usr/bin/ansible
  python version = 3.7.3 (default, May 11 2019, 00:38:04) [GCC 9.1.1 20190503 (Red Hat 9.1.1-1)]
CONFIGURATION

n/a

OS / ENVIRONMENT

n/a

STEPS TO REPRODUCE
---
- hosts: localhost
  gather_facts: no
  tasks:
    - include: '{{item}}'
      loop: '{{q("first_found", dict(files=["a.yml", "b.yml", "c.yml"], skip=true))}}'
    - include: '{{item}}'
      loop: '{{q("first_found", dict(files=["a.yml", "b.yml", "c.yml"], errors="ignore"))}}'

please note that none of {a,b,c}.yml must exist.

EXPECTED RESULTS

both tasks being skipped.

ACTUAL RESULTS
PLAY [localhost] *************************************************************************

TASK [include] ***************************************************************************
[DEPRECATION WARNING]: Use errors="ignore" instead of skip. This feature will be removed 
in version 2.12. Deprecation warnings can be disabled by setting 
deprecation_warnings=False in ansible.cfg.

TASK [include] ***************************************************************************
fatal: [localhost]: FAILED! => {"msg": "An unhandled exception occurred while running the lookup plugin 'first_found'. Error was a <class 'ansible.errors.AnsibleLookupError'>, origin
al message: No file was found when using first_found. Use the 'skip: true' option to allow this task to be skipped if no files are found"}

PLAY RECAP *******************************************************************************
localhost                  : ok=0    changed=0    unreachable=0    failed=1    skipped=1    rescued=0    ignored=0
@ansibot
Copy link
Contributor

ansibot commented May 21, 2019

Files identified in the description:

If these files are inaccurate, please update the component name section of the description or use the !component bot command.

click here for bot help

@ansibot ansibot added affects_2.8 This issue/PR affects Ansible v2.8 bug This issue/PR relates to a bug. needs_triage Needs a first human triage before being processed. python3 support:community This issue/PR relates to code supported by the Ansible community. labels May 21, 2019
@philfry
Copy link
Contributor Author

philfry commented May 22, 2019

Looks like my syntax is wrong. It should be

loop: '{{q("first_found", dict(files=["a.yml", "b.yml", "c.yml"]), errors="ignore")}}'

instead of

loop: '{{q("first_found", dict(files=["a.yml", "b.yml", "c.yml"], errors="ignore"))}}'

It still doesn't work but that's a different issue.
Closed in favor of #56775

@philfry philfry closed this as completed May 22, 2019
@mkrizek mkrizek removed the needs_triage Needs a first human triage before being processed. label May 22, 2019
@dvershinin
Copy link

+1. Affected by the same issue.

@andrewrothstein
Copy link
Contributor

me three. I use with_first_found heavily.

@geerlingguy
Copy link
Contributor

I'm having this same issue. Not sure why this issue was closed, but I opened up a bug ticket #58942 because the documentation should be fixed to not recommend a solution that's deprecated (and ideally, that non-deprecated usage would also... work?)

@ansible ansible locked and limited conversation to collaborators Aug 5, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
affects_2.8 This issue/PR affects Ansible v2.8 bug This issue/PR relates to a bug. python3 support:community This issue/PR relates to code supported by the Ansible community.
Projects
None yet
Development

No branches or pull requests

6 participants