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

[BUG] file.recurse clean on windows removing files from master. #62197

Closed
4 of 6 tasks
whytewolf opened this issue Jun 21, 2022 · 1 comment · Fixed by #62807
Closed
4 of 6 tasks

[BUG] file.recurse clean on windows removing files from master. #62197

whytewolf opened this issue Jun 21, 2022 · 1 comment · Fixed by #62807
Assignees
Labels
Bug broken, incorrect, or confusing behavior Execution-Module Sulfur v3006.0 release code name and version VMware Windows

Comments

@whytewolf
Copy link
Collaborator

Description
When using file directory structure with forward slashes instead of backslashes file.recurse clean will delete files after putting them on the minion.

Setup

mkdir /srv/salt/tests/files
touch /srv/salt/tests/files/Local.sls

SLS used

windows file test:
  file.recurse:
    - name: c:/test/
    - source: salt://tests/files
    - clean: True

result

root@salt00:/srv/salt/tests# salt amity state.apply tests.file
amity:
----------
          ID: windows file test
    Function: file.recurse
        Name: c:/test/
      Result: True
     Comment: Recursively updated c:/test/
     Started: 13:24:00.625507
    Duration: 189.0 ms
     Changes:
              ----------
              c:/test/Local.tst:
                  ----------
                  diff:
                      New file
              removed:
                  - c:\test\Local.tst

Summary for amity
------------
Succeeded: 1 (changed=1)
Failed:    0
------------
Total states run:     1
Total run time: 189.000 ms

change the file.sls to the following and it works

windows file test:
  file.recurse:
    - name: c:\test\
    - source: salt://tests/files
    - clean: True

results 2x run

root@salt00:/srv/salt/tests# salt amity state.apply tests.file
amity:
----------
          ID: windows file test
    Function: file.recurse
        Name: c:\test\
      Result: True
     Comment: Recursively updated c:\test\
     Started: 13:25:37.283983
    Duration: 182.514 ms
     Changes:
              ----------
              c:\test\Local.tst:
                  ----------
                  diff:
                      New file

Summary for amity
------------
Succeeded: 1 (changed=1)
Failed:    0
------------
Total states run:     1
Total run time: 182.514 ms
root@salt00:/srv/salt/tests# salt amity state.apply tests.file
amity:
----------
          ID: windows file test
    Function: file.recurse
        Name: c:\test\
      Result: True
     Comment: The directory c:\test\ is in the correct state
     Started: 13:25:41.750410
    Duration: 114.001 ms
     Changes:

Summary for amity
------------
Succeeded: 1
Failed:    0
------------
Total states run:     1
Total run time: 114.001 ms

Please be as specific as possible and give set-up details.

  • on-prem machine
  • VM (Virtualbox, KVM, etc. please specify)
  • VM running on a cloud service, please be explicit and add details
  • container (Kubernetes, Docker, containerd, etc. please specify)
  • or a combination, please be explicit
  • jails if it is FreeBSD

Versions Report

salt --versions-report (Provided by running salt --versions-report. Please also mention any differences in master/minion versions.)
root@salt00:/srv/salt/tests# salt amity test.versions
amity:
    Salt Version:
              Salt: 3004.2

    Dependency Versions:
              cffi: 1.14.6
          cherrypy: 18.6.1
          dateutil: 2.8.1
         docker-py: Not Installed
             gitdb: 4.0.7
         gitpython: 3.1.18
            Jinja2: 2.10.1
           libgit2: Not Installed
          M2Crypto: Not Installed
              Mako: 1.1.4
           msgpack: 0.6.2
      msgpack-pure: Not Installed
      mysql-python: Not Installed
         pycparser: 2.20
          pycrypto: Not Installed
      pycryptodome: 3.10.1
            pygit2: Not Installed
            Python: 3.8.8 (tags/v3.8.8:024d805, Feb 19 2021, 13:18:16) [MSC v.1928 64 bit (AMD64)]
      python-gnupg: 0.4.7
            PyYAML: 5.4.1
             PyZMQ: 19.0.0
             smmap: 4.0.0
           timelib: 0.2.4
           Tornado: 4.5.3
               ZMQ: 4.3.2

    System Versions:
              dist:
            locale: cp1252
           machine: AMD64
           release: 10
            system: Windows
           version: 10 10.0.19041 SP0 Multiprocessor Free

Additional context
Add any other context about the problem here.

@whytewolf whytewolf added Bug broken, incorrect, or confusing behavior VMware labels Jun 21, 2022
@twangboy
Copy link
Contributor

Ah... it's probably doing a compare and thinking that it's different because of the slashes...

@twangboy twangboy added this to the Sulphur v3006.0 milestone Jun 21, 2022
@twangboy twangboy added Execution-Module Windows Sulfur v3006.0 release code name and version labels Jun 21, 2022
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 Execution-Module Sulfur v3006.0 release code name and version VMware Windows
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants