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

copy with backup=yes fails if file is unchanged #2380

Closed
britcey opened this issue Mar 12, 2013 · 3 comments
Closed

copy with backup=yes fails if file is unchanged #2380

britcey opened this issue Mar 12, 2013 · 3 comments

Comments

@britcey
Copy link
Contributor

britcey commented Mar 12, 2013

~/github/ansible> git pull
Already up-to-date.

~/github/ansible> ansible --version
ansible 1.1 (devel e307658) last updated 2013/03/12 16:01:30 (GMT -400)

Steps to reproduce:


touch /tmp/testfile1

cat copytest.yml

  • hosts: nagios
    connection: ssh
    sudo: true
    gather_facts: False
    tasks:
    • name: test copy module
      action: copy src=/tmp/testfile1 dest=/tmp/testfile1 backup=yes

First run is fine

ansible-playbook -l app01 copytest.yml

PLAY [nagios] *********************

TASK: [test copy module] *********************
changed: [prod-nagios-app01.xxx]

PLAY RECAP *********************
prod-nagios-app01.xxx : ok=1 changed=1 unreachable=0 failed=0

subsequent runs fail

ansible-playbook -l app01 copytest.yml

PLAY [nagios] *********************

TASK: [test copy module] *********************
failed: [prod-nagios-app01.xxx] => {"failed": true}
msg: unsupported parameter for module: backup

FATAL: all hosts have already failed -- aborting

PLAY RECAP *********************
prod-nagios-app01.xxxm : ok=0 changed=0 unreachable=0 failed=1


I made a brief attempt at debugging, but nothing jumped out.

please let me know if you need more info.

@skinp
Copy link
Contributor

skinp commented Mar 13, 2013

This is the same as #2365.

File module is unaware of the option backup. The same problem would also arise with option force I guess.

@mpdehaan
Copy link
Contributor

ok, this comes from recent development work to add 'argument checking' to
file, this is a super easy fix and I'll get this tonight.

Thanks!

On Tue, Mar 12, 2013 at 8:47 PM, Patrick Pelletier <[email protected]

wrote:

This is the same as #2365 #2365
.

File module is unaware of the option backup. The same problem would also
arise with option force I guess.


Reply to this email directly or view it on GitHubhttps://github.com//issues/2380#issuecomment-14815434
.

@britcey
Copy link
Contributor Author

britcey commented Mar 13, 2013

Confirmed it fixes the issue; I was in the right area to supply a patch until @dhozac pointed out (rightfully) that 'file' doesn't take 'backup', etc. Glad I wasn't completely off the mark. /me delays actually contributing any bugfixes yet again

robinro pushed a commit to robinro/ansible that referenced this issue Dec 9, 2016
* Fix syntax for exception catching

* Friendlier error message as per suggestion by @bcoca
@ansible ansible locked and limited conversation to collaborators Apr 24, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants