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.retention_schedule always reports changes #63033

Closed
nicholasmhughes opened this issue Nov 8, 2022 · 0 comments · Fixed by #63034
Closed

[BUG] file.retention_schedule always reports changes #63033

nicholasmhughes opened this issue Nov 8, 2022 · 0 comments · Fixed by #63034
Labels
Bug broken, incorrect, or confusing behavior State-Module

Comments

@nicholasmhughes
Copy link
Collaborator

Description
The file.retention_schedule state function always reports changes, regardless of outcome.

Setup
Make a test directory to operate against:

mkdir /tmp/src
touch /tmp/src/one

Basic state YAML (copied from state function docs):

/tmp/src:
  file.retention_schedule:
    - retain:
        most_recent: 5
        first_of_hour: 4
        first_of_day: 7
        first_of_week: 6    # NotImplemented yet.
        first_of_month: 6
        first_of_year: all
    - strptime_format: example_name_%Y%m%dT%H%M%S.tar.bz2
    - timezone: None

Running it shows that nothing will be deleted, but a changes dictionary with informational data is returned:

local:
----------
          ID: /tmp/src
    Function: file.retention_schedule
      Result: True
     Comment: 0 backups were removed from /tmp/src.
     Started: 20:07:11.329835
    Duration: 10.78 ms
     Changes:   
              ----------
              deleted:
              ignored:
                  - one
                  - ..
                  - .
              retained:

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

Expected behavior
States should only report changes when changes are made.

Versions Report*

salt --versions-report (Provided by running salt --versions-report. Please also mention any differences in master/minion versions.)
Salt Version:
          Salt: 3005.1
 
Dependency Versions:
          cffi: Not Installed
      cherrypy: Not Installed
      dateutil: Not Installed
     docker-py: Not Installed
         gitdb: Not Installed
     gitpython: Not Installed
        Jinja2: 3.1.2
       libgit2: Not Installed
      M2Crypto: Not Installed
          Mako: Not Installed
       msgpack: 1.0.4
  msgpack-pure: Not Installed
  mysql-python: Not Installed
     pycparser: Not Installed
      pycrypto: 2.6.1
  pycryptodome: 3.15.0
        pygit2: Not Installed
        Python: 3.7.3 (default, Oct 31 2022, 14:04:00)
  python-gnupg: Not Installed
        PyYAML: 6.0
         PyZMQ: 24.0.1
         smmap: Not Installed
       timelib: Not Installed
       Tornado: 4.5.3
           ZMQ: 4.3.4
 
System Versions:
          dist: debian 10 buster
        locale: UTF-8
       machine: x86_64
       release: 4.19.0-22-amd64
        system: Linux
       version: Debian GNU/Linux 10 buster
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 State-Module
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant