saltstack / salt

Software to automate the management and configuration of any infrastructure or application at scale. Install Salt from the Salt package repositories here:
https://docs.saltproject.io/salt/install-guide/en/latest/
Apache License 2.0
14.19k stars 5.48k forks source link

[FEATURE REQUEST] Cleaning files in extrn_files #65538

Open fanaticize opened 1 year ago

fanaticize commented 1 year ago

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.

OrangeDog commented 1 year ago

Does saltutil.clear_cache clear it?

fanaticize commented 1 year ago

Files are deleted, but directories remain.

OrangeDog commented 1 year ago

Related: #34369