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

salt.states.file.copy does not copy the file if it already exists with force=True #24647

Closed
nmadhok opened this issue Jun 12, 2015 · 5 comments
Closed
Labels
Bug broken, incorrect, or confusing behavior Duplicate Duplicate of another issue or PR - will be closed fixed-pls-verify fix is linked, bug author to confirm fix P3 Priority 3 Platform Relates to OS, containers, platform-based utilities like FS, system based apps severity-medium 3rd level, incorrect or bad functionality, confusing and lacks a work around State-Module
Milestone

Comments

@nmadhok
Copy link
Contributor

nmadhok commented Jun 12, 2015

Here's my state:

Revert to original /etc/sudoers:
  file.copy:
    - name: /etc/sudoers
    - source: /etc/sudoers.orig
    - user: root
    - group: root
    - mode: 0440
    - force: True
    - unless: diff /etc/sudoers /etc/sudoers.orig

Here's what I get when I run it:

----------
          ID: Revert to original /etc/sudoers
    Function: file.copy
        Name: /etc/sudoers
      Result: True
     Comment: The target file "/etc/sudoers" exists and will not be overwritten
     Started: 17:19:51.770100
    Duration: 8.963 ms
     Changes:   

This issue also exists in salt-enterprise-4.0.2:

           Salt: 4.0.2
         Python: 2.6.6 (r266:84292, Jan 22 2014, 01:49:05)
         Jinja2: 2.2.1
       M2Crypto: 0.20.2
 msgpack-python: 0.4.6
   msgpack-pure: Not Installed
       pycrypto: 2.6.1
        libnacl: Not Installed
         PyYAML: 3.10
          ioflo: Not Installed
          PyZMQ: 14.5.0
           RAET: Not Installed
            ZMQ: 4.0.5
           Mako: Not Installed
@tbaker57
Copy link
Contributor

Duplicate of #24295 I think. Looks like this has already been fixed in develop: 0ff4366

cheers,
Tim

@jfindlay jfindlay added State-Module Bug broken, incorrect, or confusing behavior severity-medium 3rd level, incorrect or bad functionality, confusing and lacks a work around fixed-pls-verify fix is linked, bug author to confirm fix Duplicate Duplicate of another issue or PR - will be closed P3 Priority 3 Platform Relates to OS, containers, platform-based utilities like FS, system based apps labels Jun 16, 2015
@jfindlay
Copy link
Contributor

@nmadhok, thanks for the report.

@rallytime
Copy link
Contributor

@nmadhok Does the fix in #254461 solve this one for you?

@nmadhok
Copy link
Contributor Author

nmadhok commented Sep 9, 2015

@rallytime Haven't tested it again and don't have the time to test this but looking at the change, it looks like it should fix it.

@rallytime
Copy link
Contributor

I'm going to close this for now. If there's still trouble here, let us know and we can reopen. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug broken, incorrect, or confusing behavior Duplicate Duplicate of another issue or PR - will be closed fixed-pls-verify fix is linked, bug author to confirm fix P3 Priority 3 Platform Relates to OS, containers, platform-based utilities like FS, system based apps severity-medium 3rd level, incorrect or bad functionality, confusing and lacks a work around State-Module
Projects
None yet
Development

No branches or pull requests

4 participants