Skip to content

The file lookup no longer respects the errors parameter #79291

@briantist

Description

@briantist

Summary

Since #79230 , the file lookup now seems to ignore setting errors, so for example, if errors='warn' or errors='ignore', the lookup will still fail on an error as though it was not set at all.

Issue Type

Bug Report

Component Name

file

Ansible Version

$ ansible --version
ansible [core 2.13.6rc1.post0]
  config file = None
  configured module search path = ['/home/briantist/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /home/briantist/.a213/lib/python3.8/site-packages/ansible
  ansible collection location = /home/briantist/.ansible/collections:/usr/share/ansible/collections
  executable location = /home/briantist/.a213/bin/ansible
  python version = 3.8.0 (default, Feb 25 2021, 22:10:10) [GCC 8.4.0]
  jinja version = 3.1.2
  libyaml = True

Configuration

# if using a version older than ansible-core 2.12 you should omit the '-t all'
$ ansible-config dump --only-changed -t all
DEFAULT_FORKS(env: ANSIBLE_FORKS) = 30

OS / Environment

Ubuntu 18.04

Steps to Reproduce

- debug:
    msg: "{{ lookup('file', '_fake', errors='ignore' ) }}"

Expected Results

An ok task with no contents returned

Actual Results

localhost | FAILED! => {
    "msg": "The 'file' lookup had an issue accessing the file '_fake'. file not found, use -vvvvv to see paths searched"
}

Code of Conduct

  • I agree to follow the Ansible Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    affects_2.13bugThis issue/PR relates to a bug.has_prThis issue has an associated PR.moduleThis issue/PR relates to a module.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions