[FEATURE REQUEST] Cleaning files in extrn_files
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 15.7k
- Forks
- 5.6k
- Avg merge
- 2d 44m
- Merged PRs (30d)
- 80
Description
Is your feature request related to a problem? Please describe.
I found that the file is left in minion when I do the following.
[root@mymaster ~]# salt 'mytest' cmd.script https://raw.githubusercontent.com/saltstack/salt-bootstrap/develop/bootstrap-salt.sh ' -v'
mytest:
----------
pid:
59590
retcode:
0
stderr:
stdout:
/tmp/__salt.tmp.kxkxfr3w.sh -- Version 2023.11.07
[root@mytest ~]# ls -lR /var/cache/salt/minion/extrn_files/base
/var/cache/salt/minion/extrn_files/base:
total 0
drwxr-xr-x 3 root root 23 Nov 12 02:54 raw.githubusercontent.com
/var/cache/salt/minion/extrn_files/base/raw.githubusercontent.com:
total 0
drwxr-xr-x 3 root root 28 Nov 12 02:54 saltstack
/var/cache/salt/minion/extrn_files/base/raw.githubusercontent.com/saltstack:
total 0
drwxr-xr-x 3 root root 21 Nov 12 02:54 salt-bootstrap
/var/cache/salt/minion/extrn_files/base/raw.githubusercontent.com/saltstack/salt-bootstrap:
total 0
drwxr-xr-x 2 root root 31 Nov 12 02:54 develop
/var/cache/salt/minion/extrn_files/base/raw.githubusercontent.com/saltstack/salt-bootstrap/develop:
total 348
-rw-r--r-- 1 root root 355156 Nov 12 02:54 bootstrap-salt.sh
If I repeatedly do cmd.script where the source url keeps changing, the garbage will gradually increase.
For now, I periodically delete the files inside /var/cache/salt/minion/extrn_files.
The information of these files could not be found in the salt document.
Describe the solution you'd like
I think there are options as follows.
- When the cmd.script is finished, delete the used file in /var/cache/salt/minion/extrn_files.
- Add the function to clean extrn_files in to the saltutil module.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the cmd.script request and inspecting how its downloaded file remains under /var/cache/salt/minion/extrn_files. Review the saltutil module as a possible cleanup entry point. Done should include a defined cleanup behavior for downloaded files and documentation for managing extrn_files.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- devops
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100