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

file module reports "absent" on PermissionError #57573

Open
Jakski opened this issue Jun 8, 2019 · 1 comment

Comments

Projects
None yet
3 participants
@Jakski
Copy link

commented Jun 8, 2019

SUMMARY

file module reports absent, when it can't access path to delete.

ISSUE TYPE
  • Bug Report
COMPONENT NAME

file module

ANSIBLE VERSION
ansible 2.9.0.dev0
  config file = None
  configured module search path = ['/home/jakski/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /home/jakski/lib/ansible
  executable location = /home/jakski/venv/bin/ansible
  python version = 3.6.7 (default, Oct 22 2018, 11:32:17) [GCC 8.2.0]

It's from commit c50a75a41e902cebf9f6438818570306e3ea71ba(devel branch).

CONFIGURATION

ansible-config dump --only-changed doesn't return anything. I didn't overwrite any defaults.

OS / ENVIRONMENT
Distributor ID: Ubuntu
Description:    Ubuntu 18.04.2 LTS
Release:        18.04
Codename:       bionic
STEPS TO REPRODUCE
---
- hosts: localhost
  gather_facts: false
  tasks:
    - file:
        path: tst
        state: directory

    - file:
        path: tst/test1
        state: touch

    - file:
        path: tst
        state: directory
        mode: 0000

    - file:
        path: tst/test1
        state: absent

    - file:
        path: tst
        state: directory
        mode: 0700

    - stat:
        path: tst/test1
      register: _test1

    - fail:
        msg: File tst/test1 still exists
      when: _test1.stat.exists
EXPECTED RESULTS

File should be removed or file module should report error, that it can't access path.

ACTUAL RESULTS

Ansible runs all tasks and reports error:

TASK [fail] ***********************************************************************************************
fatal: [localhost]: FAILED! => {"changed": false, "msg": "File tst/test1 still exists"}

Deleting tst/test1 is being reported as an unchanged task.

@Jakski Jakski changed the title file module reports absent on PermissionError file module reports "absent" on PermissionError Jun 8, 2019

Jakski added a commit to Jakski/ansible that referenced this issue Jun 8, 2019

@ansibot

This comment has been minimized.

Copy link
Contributor

commented Jun 8, 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

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.