-
Notifications
You must be signed in to change notification settings - Fork 24k
Open
Labels
P3Priority 3 - Approved, No Time LimitationPriority 3 - Approved, No Time Limitationaffects_2.4This issue/PR affects Ansible v2.4This issue/PR affects Ansible v2.4bugThis issue/PR relates to a bug.This issue/PR relates to a bug.filesFiles categoryFiles categoryhas_prThis issue has an associated PR.This issue has an associated PR.moduleThis issue/PR relates to a module.This issue/PR relates to a module.needs_infoThis issue requires further information. Please answer any outstanding questions.This issue requires further information. Please answer any outstanding questions.support:coreThis issue/PR relates to code supported by the Ansible Engineering Team.This issue/PR relates to code supported by the Ansible Engineering Team.
Description
ISSUE TYPE
- Bug Report
COMPONENT NAME
copy module
ANSIBLE VERSION
ansible 2.4.0 (devel 91e995d691) last updated 2017/06/14 08:27:05 (GMT +100)
config file = /etc/ansible/ansible.cfg
configured module search path = [u'/home/alan-sysop/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
ansible python module location = /home/alan-sysop/src/ansible/lib/ansible
executable location = /home/alan-sysop/src/ansible/bin/ansible
python version = 2.7.13 (default, May 10 2017, 20:04:28) [GCC 6.3.1 20161221 (Red Hat 6.3.1-1)]
CONFIGURATION
Tested with -c local
.
OS / ENVIRONMENT
N/A
SUMMARY
When a directory exists with the same name as a file in src
directory, the copy module does the wrong thing. (It should simply fail, like cp -r
does (cp: cannot overwrite directory 'dest' with non-directory
)).
STEPS TO REPRODUCE
# test.yml
- hosts: all
tasks:
- copy:
src: src/
dest: /tmp/dest
mkdir src
touch src/a
mkdir /tmp/dest
mkdir /tmp/dest/a
ansible-playbook -c local -i localhost, test.yml
tree /tmp/dest
# WARNING rm -r
rm -r /tmp/dest
mkdir /tmp/dest
mkdir /tmp/dest/a
mkdir /tmp/dest/a/a
ansible-playbook -c local -i localhost, test.yml
EXPECTED RESULTS
Both of the above ansible commands should fail, with an error message similar to cp -r, cp: cannot overwrite directory 'a' with non-directory
.
ACTUAL RESULTS
PLAY [all] *********************************************************************
TASK [Gathering Facts] *********************************************************
ok: [localhost]
TASK [copy] ********************************************************************
changed: [localhost]
PLAY RECAP *********************************************************************
localhost : ok=2 changed=1 unreachable=0 failed=0
/tmp/dest
└── a
└── a
PLAY [all] *********************************************************************
TASK [Gathering Facts] *********************************************************
ok: [localhost]
TASK [copy] ********************************************************************
fatal: [localhost]: FAILED! => {"changed": false, "checksum": "da39a3ee5e6b4b0d3255bfef95601890afd80709", "failed": true,
"msg": "attempted to take checksum of directory: /tmp/dest/a/a"}
to retry, use: --limit @/home/alan-sysop/t/test.retry
PLAY RECAP *********************************************************************
localhost : ok=1 changed=0 unreachable=0 failed=1
ForeverWintr
Metadata
Metadata
Assignees
Labels
P3Priority 3 - Approved, No Time LimitationPriority 3 - Approved, No Time Limitationaffects_2.4This issue/PR affects Ansible v2.4This issue/PR affects Ansible v2.4bugThis issue/PR relates to a bug.This issue/PR relates to a bug.filesFiles categoryFiles categoryhas_prThis issue has an associated PR.This issue has an associated PR.moduleThis issue/PR relates to a module.This issue/PR relates to a module.needs_infoThis issue requires further information. Please answer any outstanding questions.This issue requires further information. Please answer any outstanding questions.support:coreThis issue/PR relates to code supported by the Ansible Engineering Team.This issue/PR relates to code supported by the Ansible Engineering Team.