saltstack / saltstack/salt

[BUG] file.recurse does not honour backup for deleted files

Open
#61,247 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug severity-medium
Dominant language
Python
Stars
15.7k
Forks
5.6k
Avg merge
2d 44m
Merged PRs (30d)
80

Description

Description
When using "clean: True" on file.recurse, deleted files are not backed up.
The _clean_dir function in states/file.py does not consider the backup parameter at all.

Steps to Reproduce the behavior

  1. Create a state which calls file.recurse with clean: True and backup: minion
  2. Manually add some extra files in the target directory
  3. Run the state and see the extra files removed
  4. Check the minion cache's backup file location and see that the files were never backed up.

Expected behavior
The extra files should be in the minions cache dir as backups.

Version
Name : salt
Version : 3003.2
Release : 1.el7
Architecture: noarch

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in states/file.py at the _clean_dir function and trace how file.recurse handles clean: True and backup: minion. Reproduce the issue with extra files in the target directory, then verify that removed files appear in the minion cache's backup location as expected.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
devops
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.