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

archive: Fix empty files to dest #52117

Open
wants to merge 1 commit into
base: devel
from

Conversation

Projects
None yet
3 participants
@NitigyaS
Copy link

NitigyaS commented Feb 12, 2019

SUMMARY

Provides a fix of the issue #34569

ISSUE TYPE
  • Bugfix Pull Request
COMPONENT NAME

archive module

ADDITIONAL INFORMATION

Logic added:
skip, If file being archived is same as destination.
do not skip if file size is 0.

  • Before it was not adding the file with size 0
nitigyas$ ls -l dest/
total 24
-rw-r--r--  1 nitigyas  personal    0 Feb 13 00:14 1.txt
-rw-r--r--  1 nitigyas  personal    5 Feb 13 00:14 2.txt
-rw-r--r--  1 nitigyas  personal   15 Feb 13 00:14 3.txt
-rw-r--r--  1 nitigyas  personal  182 Feb 13 00:34 test.tar.gz

Ansible-playbook run

PLAYBOOK: test-archive.yml *********************************************************************************************************************************************************************************
1 plays in test-archive.yml

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

TASK [Gathering Facts] *************************************************************************************************************************************************************************************
ok: [localhost]
META: ran handlers

TASK [Test archive] ****************************************************************************************************************************************************************************************
task path: /Users/nitigyas/Documents/PlayGround/Vagrant/3Tier/Ansible/test-archive-bug/test-archive.yml:4
changed: [localhost] => {"archived": ["dest/3.txt", "dest/2.txt"], "arcroot": "/", "changed": true, "dest": "dest/test.tar.gz", "expanded_exclude_paths": [], "expanded_paths": ["dest"], "gid": 20, "group": "staff", "missing": [], "mode": "0644", "owner": "nitigyas", "size": 172, "state": "file", "uid": 502}
META: ran handlers
META: ran handlers

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

nitigyas$ ansible-playbook -vv test-archive.yml

  • After fix
PLAYBOOK: test-archive.yml *********************************************************************************************************************************************************************************
1 plays in test-archive.yml

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

TASK [Gathering Facts] *************************************************************************************************************************************************************************************
ok: [localhost]
META: ran handlers

TASK [Test archive] ****************************************************************************************************************************************************************************************
task path: /Users/nitigyas/Documents/PlayGround/Vagrant/3Tier/Ansible/test-archive-bug/test-archive.yml:4
changed: [localhost] => {"archived": ["dest/3.txt", "dest/2.txt", "dest/1.txt"], "arcroot": "/", "changed": true, "dest": "dest/test.tar.gz", "expanded_exclude_paths": [], "expanded_paths": ["dest"], "gid": 20, "group": "staff", "missing": [], "mode": "0644", "owner": "nitigyas", "size": 182, "state": "file", "uid": 502}
META: ran handlers
META: ran handlers

PLAY RECAP *************************************************************************************************************************************************************************************************
localhost                  : ok=2    changed=1    unreachable=0    failed=0
@ansibot

This comment has been minimized.

Copy link
Contributor

ansibot commented Feb 12, 2019

@ansibot ansibot added the stale_ci label Feb 20, 2019

@gundalow gundalow changed the title Fix empty files to dest archive: Fix empty files to dest Feb 21, 2019

@gundalow
Copy link
Contributor

gundalow left a comment

Hi,
Thank you for your PR, your first to Ansible I believe :)
I'd like to see integration tests added for this, they are just Playbooks, and can be found in https://github.com/ansible/ansible/tree/devel/test/integration/targets/archive

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.