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

file.directory with test=true, file_mode and an existing file in correct state, makes file.directory think there will be changes #52667

Closed
whytewolf opened this issue Apr 23, 2019 · 2 comments
Labels
Duplicate Duplicate of another issue or PR - will be closed stale ZD The issue is related to a Zendesk customer support ticket.
Milestone

Comments

@whytewolf
Copy link
Contributor

Description of Issue/Question

It looks like there is an issue with mode detection in test=true with file.directory.

If a file exists in the directory named in file.directory. And file_mode is set in the state.

And you use test=true.

The state will return every time that a file named the same as the directory will be changed to the mode of the file_mode

Setup

mkdir -p /tmp/testing
chmod 755 /tmp/testing
touch /tmp/testing/file
chmod 644 /tmp/testing/file

And the state to use

/tmp/testing:
  file.directory:
    - user: root
    - group: root
    - dir_mode: 755
    - file_mode: 644
    - makedirs: True
    - recurse:
       - user
       - group
       - mode

output

[root@salt00 client_certs]# salt-call state.apply testing.test1 test=true
local:
----------
          ID: /tmp/testing
    Function: file.directory
      Result: None
     Comment: The following files will be changed:
              /tmp/testing: mode - 0644
     Started: 10:58:10.233768
    Duration: 7.909 ms
     Changes:

Summary for local
------------
Succeeded: 1 (unchanged=1)
Failed:    0
------------
Total states run:     1
Total run time:   7.909 ms
[root@salt00 client_certs]# salt-call state.apply testing.test1
local:
----------
          ID: /tmp/testing
    Function: file.directory
      Result: True
     Comment: Directory /tmp/testing is in the correct state
     Started: 10:58:15.246392
    Duration: 9.435 ms
     Changes:

Summary for local
------------
Succeeded: 1
Failed:    0
------------
Total states run:     1
Total run time:   9.435 ms

Steps to Reproduce Issue

See above.

debug info is not really that helpful but for the function, this was the only thing that showed up different than a normal run

[INFO    ] Executing state file.directory for [/tmp/testing]
[DEBUG   ] Closing AsyncZeroMQReqChannel instance
[DEBUG   ] LazyLoaded file.user_to_uid
[INFO    ] The following files will be changed:
/tmp/testing: mode - 0644

[INFO    ] Completed state [/tmp/testing] at time 10:59:51.458886 (duration_in_ms=8.538)

Versions Report

salt-call --versions
Salt Version:
           Salt: 2019.2.0

Dependency Versions:
           cffi: 1.11.5
       cherrypy: Not Installed
       dateutil: 1.5
      docker-py: Not Installed
          gitdb: Not Installed
      gitpython: Not Installed
          ioflo: Not Installed
         Jinja2: 2.7.2
        libgit2: Not Installed
        libnacl: Not Installed
       M2Crypto: Not Installed
           Mako: Not Installed
   msgpack-pure: Not Installed
 msgpack-python: 0.5.6
   mysql-python: Not Installed
      pycparser: 2.14
       pycrypto: 2.6.1
   pycryptodome: Not Installed
         pygit2: Not Installed
         Python: 2.7.5 (default, Apr  9 2019, 14:30:50)
   python-gnupg: Not Installed
         PyYAML: 3.13
          PyZMQ: 15.3.0
           RAET: Not Installed
          smmap: Not Installed
        timelib: Not Installed
        Tornado: 4.2.1
            ZMQ: 4.1.4

System Versions:
           dist: centos 7.6.1810 Core
         locale: UTF-8
        machine: x86_64
        release: 3.10.0-957.10.1.el7.x86_64
         system: Linux
        version: CentOS Linux 7.6.1810 Core

Most likely also exists in 2018.3

@whytewolf whytewolf added the ZD The issue is related to a Zendesk customer support ticket. label Apr 23, 2019
@Akm0d
Copy link
Contributor

Akm0d commented Apr 24, 2019

Duplicate of #52173

@Akm0d Akm0d marked this as a duplicate of #52173 Apr 24, 2019
@Akm0d Akm0d added the Duplicate Duplicate of another issue or PR - will be closed label Apr 24, 2019
@Ch3LL Ch3LL added this to the Blocked milestone Apr 26, 2019
@stale
Copy link

stale bot commented Jan 8, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

If this issue is closed prematurely, please leave a comment and we will gladly reopen the issue.

@stale stale bot added the stale label Jan 8, 2020
@stale stale bot closed this as completed Jan 15, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Duplicate Duplicate of another issue or PR - will be closed stale ZD The issue is related to a Zendesk customer support ticket.
Projects
None yet
Development

No branches or pull requests

3 participants