-
Notifications
You must be signed in to change notification settings - Fork 5.6k
Description
Is your feature request related to a problem? Please describe.
I'd argue this is technically a bug, as the way file.managed uses hash comparison is kind of unexpected.
So, file.managed will always download a remote file to the cache to compare checksums.
This is very much not ideal for very large files, and the following scenario is impossible to define via file.managed:
- A file,
foo.bar.dat, should be located at/srv/http/foo.bar.dat. This is stateful. - This file should have a checksum of
abc012.... This is stateful. - The file exists and has that checksum. This is a state.
Being that source_hash is required for non-saltfs (salt://) files, a source is already provided (unless skip_verify is explicitly provided). However, this is not used in any way for name if it exists on the filesystem already and is instead used solely for the cache for transmit integrity validation.
The option should be present to have it available for both transmit and local validation, thus:
- decreasing the need for unnecessary source fetches
- and reducing state run times
- giving the opportunity to bypass a local disk's cache directory for a destination that resides on e.g. network storage
Describe the solution you'd like
I propose a new boolean argument, skip_cache, with a default value of False or None.
IF:
skip_cacheis provided/True, the cache will be bypassed entirely for all operations for thisname/sourcepair (unless asalt://source).- The
namedoes not exist on the filesystem, the file will be fetched to the destination, but removed if it does not matchsource_hash. namedoes exist on the filesystem but does not matchsource_hash, the file will be downloaded directly toname.
Describe alternatives you've considered
There are no alternatives; I am managing many multiple-gigabyte ISO files and stuck in a hellscape of an ever-growing minion cache, please help.
Additional context
N/A
Please Note
If this feature request would be considered a substantial change or addition, this should go through a SEP process here https://github.com/saltstack/salt-enhancement-proposals, instead of a feature request.
Unnecessary; this change should be completely backwards-compat with all existing usages of file.managed.