mirror of
https://github.com/saltstack/salt.git
synced 2025-04-16 09:40:20 +00:00
fixes saltstack/salt#63033 fix file.retention_schedule always reports changes
This commit is contained in:
parent
b8468c6a10
commit
c1c99cf5f3
3 changed files with 6 additions and 4 deletions
1
changelog/63033.fixed
Normal file
1
changelog/63033.fixed
Normal file
|
@ -0,0 +1 @@
|
||||||
|
Fix file.retention_schedule always reports changes
|
|
@ -4609,6 +4609,7 @@ def retention_schedule(name, retain, strptime_format=None, timezone=None):
|
||||||
Apply retention scheduling to backup storage directory.
|
Apply retention scheduling to backup storage directory.
|
||||||
|
|
||||||
.. versionadded:: 2016.11.0
|
.. versionadded:: 2016.11.0
|
||||||
|
.. versionchanged:: 3006.0
|
||||||
|
|
||||||
:param name:
|
:param name:
|
||||||
The filesystem path to the directory containing backups to be managed.
|
The filesystem path to the directory containing backups to be managed.
|
||||||
|
@ -4671,7 +4672,7 @@ def retention_schedule(name, retain, strptime_format=None, timezone=None):
|
||||||
name = os.path.expanduser(name)
|
name = os.path.expanduser(name)
|
||||||
ret = {
|
ret = {
|
||||||
"name": name,
|
"name": name,
|
||||||
"changes": {"retained": [], "deleted": [], "ignored": []},
|
"changes": {},
|
||||||
"result": True,
|
"result": True,
|
||||||
"comment": "",
|
"comment": "",
|
||||||
}
|
}
|
||||||
|
@ -4785,7 +4786,8 @@ def retention_schedule(name, retain, strptime_format=None, timezone=None):
|
||||||
"deleted": deletable_files,
|
"deleted": deletable_files,
|
||||||
"ignored": sorted(list(ignored_files), reverse=True),
|
"ignored": sorted(list(ignored_files), reverse=True),
|
||||||
}
|
}
|
||||||
ret["changes"] = changes
|
if deletable_files:
|
||||||
|
ret["changes"] = changes
|
||||||
|
|
||||||
# TODO: track and report how much space was / would be reclaimed
|
# TODO: track and report how much space was / would be reclaimed
|
||||||
if __opts__["test"]:
|
if __opts__["test"]:
|
||||||
|
@ -4800,7 +4802,6 @@ def retention_schedule(name, retain, strptime_format=None, timezone=None):
|
||||||
ret["comment"] = "{} backups were removed from {}.\n".format(
|
ret["comment"] = "{} backups were removed from {}.\n".format(
|
||||||
len(deletable_files), name
|
len(deletable_files), name
|
||||||
)
|
)
|
||||||
ret["changes"] = changes
|
|
||||||
|
|
||||||
return ret
|
return ret
|
||||||
|
|
||||||
|
|
|
@ -135,7 +135,7 @@ def test_retention_schedule():
|
||||||
def run_checks(isdir=mock_t, strptime_format=None, test=False):
|
def run_checks(isdir=mock_t, strptime_format=None, test=False):
|
||||||
expected_ret = {
|
expected_ret = {
|
||||||
"name": fake_name,
|
"name": fake_name,
|
||||||
"changes": {"retained": [], "deleted": [], "ignored": []},
|
"changes": {},
|
||||||
"result": True,
|
"result": True,
|
||||||
"comment": "Name provided to file.retention must be a directory",
|
"comment": "Name provided to file.retention must be a directory",
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue