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

Unarchive modules always reports 'changed' with non-default permissions on items in zip files. (breaks idempotence) #22254

Closed
chriskarel opened this issue Mar 3, 2017 · 1 comment · Fixed by #24580
Labels
affects_2.2 This issue/PR affects Ansible v2.2 bug This issue/PR relates to a bug. m:unarchive This issue/PR relates to the unarchive module. module This issue/PR relates to a module. support:core This issue/PR relates to code supported by the Ansible Engineering Team.

Comments

@chriskarel
Copy link
Contributor

chriskarel commented Mar 3, 2017

ISSUE TYPE
  • Bug Report
COMPONENT NAME

unarchive module

ANSIBLE VERSION
ansible 2.2.1.0
  config file = /etc/ansible/ansible.cfg
  configured module search path = Default w/o overrides
CONFIGURATION

Defaults

OS / ENVIRONMENT

Running on OEL 7.3 (RHEL equivalent)

SUMMARY

Zip files containing items with non-default permissions are always reported as changed, every run. Totally breaking idempotence.

STEPS TO REPRODUCE
### Create two files, and change the permissions on one of them.
$ touch test-777 test-default
$ chmod 777 test-777

### Put both files in seperate zip files
$ zip test-777.zip test-777
  adding: test-777 (stored 0%)
$ zip test-default.zip test-default
  adding: test-default (stored 0%)

#### Make a playbook that unarchives those.
$ cat ../test.yaml
---
- hosts: localhost

  tasks:

  - name: 777 zip
    unarchive:
      src=test-777.zip
      dest=/


  - name: Default zip
    unarchive:
      src=test-default.zip
      dest=/

###  First run should report 'changed' for both tasks.
$ ansible-playbook ../test.yaml 
 [WARNING]: provided hosts list is empty, only localhost is available

PLAY [localhost] ***************************************************************

TASK [setup] *******************************************************************
ok: [localhost]

TASK [777 zip] *****************************************************************
changed: [localhost]

TASK [Default zip] *************************************************************
changed: [localhost]

PLAY RECAP *********************************************************************
localhost                  : ok=3    changed=2    unreachable=0    failed=0   

### Verify the files look proper
$ ls -l /test-777 test-777 /test-default test-default
-rwxrwxrwx. 1 root root 0 Mar  3 11:13 /test-777
-rwxrwxrwx. 1 root root 0 Mar  3 11:13 test-777
-rw-r--r--. 1 root root 0 Mar  3 11:10 /test-default
-rw-r--r--. 1 root root 0 Mar  3 11:10 test-default


### Second run should report no changes.
$ ansible-playbook ../test.yaml --diff
 [WARNING]: provided hosts list is empty, only localhost is available

PLAY [localhost] ***************************************************************

TASK [setup] *******************************************************************
ok: [localhost]

TASK [777 zip] *****************************************************************
.f...p...?? test-777/
changed: [localhost]

TASK [Default zip] *************************************************************
ok: [localhost]

PLAY RECAP *********************************************************************
localhost                  : ok=3    **changed=1**    unreachable=0    failed=0   
EXPECTED RESULTS

The second ansible run should not make/report any changes. The files already exists properly on the destination, due to the first ansible run

ACTUAL RESULTS

The second ansible run reports a change on the file with non-default permissions.

$ ansible-playbook test.yaml --diff
 [WARNING]: provided hosts list is empty, only localhost is available

PLAY [localhost] ***************************************************************

TASK [setup] *******************************************************************
ok: [localhost]

TASK [777 zip] *****************************************************************
.f...p...?? test-777
changed: [localhost]

TASK [Default zip] *************************************************************
ok: [localhost]

PLAY RECAP *********************************************************************
localhost                  : ok=3    **changed=1**    unreachable=0    failed=0   

@chriskarel chriskarel changed the title Unarchive modules always reports 'changed' with non-default permissions on items in zip files. (break idempotence) Unarchive modules always reports 'changed' with non-default permissions on items in zip files. (breaks idempotence) Mar 3, 2017
@ansibot
Copy link
Contributor

ansibot commented Mar 3, 2017

@ansibot ansibot added affects_2.2 This issue/PR affects Ansible v2.2 bug_report module This issue/PR relates to a module. needs_triage Needs a first human triage before being processed. labels Mar 3, 2017
@s-hertel s-hertel removed the needs_triage Needs a first human triage before being processed. label Mar 3, 2017
@ansibot ansibot added the support:core This issue/PR relates to code supported by the Ansible Engineering Team. label Jun 29, 2017
@dagwieers dagwieers added the m:unarchive This issue/PR relates to the unarchive module. label Sep 27, 2017
@ansibot ansibot added bug This issue/PR relates to a bug. and removed bug_report labels Mar 7, 2018
@ansible ansible locked and limited conversation to collaborators Apr 26, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
affects_2.2 This issue/PR affects Ansible v2.2 bug This issue/PR relates to a bug. m:unarchive This issue/PR relates to the unarchive module. module This issue/PR relates to a module. support:core This issue/PR relates to code supported by the Ansible Engineering Team.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants