-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
file.managed and archive.extracted don't cache remote files #42681
Comments
I do not believe that this is possible right now, but i can see the purpose behind it. @terminalmage is there a reason that we do not check the hash sum from the remote against the already cached file. Thanks, |
Well, the main reason is because we dispose of the archive after downloading it, by default. This is because if someone downloads a large archive to unpack it, they don't necessarily want that archive to be taking up space in the minion file cache. |
Well, you can keep file's checksum in cache - it isn't large, but still enough not to download large files to tens of minions. |
I'm also struggling with this (as described in #38971). I've got quite a few large archives to extract and the default behavior means the master and minion get put under quite a lot of load, whereas previously it was a one time process and subsequent extractions were just skipped. |
@morganwillcock I don't understand, extraction should still be skipped when there is no change internally with regard to the paths in the archive. The best way to skip downloading when the hash hasn't changed is probably to add an additional argument to the |
@terminalmage the load is purely coming from the transfer (salt file server and file client) and the hashing rather than the extraction, and in some cases the transfers may be over wifi or VPN. Previously I had no issues with |
@morganwillcock OK thanks for the followup. I'll get something worked out. |
I happen to have a state file that uses both, file.managed and archive.extracted on files remotely located on a web server. I have control over all of them, but was very surprised to see that on subsequent state runs, all of them got downloaded again and again and again. Is there a path to resolution for this issue? Thanks! |
@anitakrueger I believe the reason for the current behavior had something to do with large archives filling up space in /var, but I'm not sure as I wasn't involved in writing that code. The way I see it, what needs to be done is something like this:
@thatch45 thoughts? Also, do you think it's reasonable to change the default behavior to skip downloading the remote file if one exists in the minion cache and it matches the |
The only potential problem I can see with this is that a minion that has run the state in the past and already has a cached copy, but the remote file's hash has changed since it downloaded the file, will now behave differently from one which doesn't have the file cached. Assuming identical SLS for both minions, the minion without the cached file would download it, try to verify the hash, and fail because the remote hash has changed, while the minion with the older cached copy would proceed and the state would succeed. |
@terminalmage I think that if there was to be some sort intelligent cache control, that should probably be implemented in the file client / transfer method rather than in individual modules (otherwise you are reliant on reading the docs to clarify how hashes are handled in each case). Having to update |
What do you mean by "updating Ultimately however, you are correct that the logic on whether or not to download would be done in the fileclient. The call to |
By remote I was thinking of the SLS file on the master, so that all sounds fine to me. |
This ticket should probably be merged with #38971. In my opinion this is not a feature request, I explain why here: #38971 (comment). |
I have to say I agree with @jdelic. I was using Salt 1.5 years ago for all my configurations and never ran into this problem. Now, being back on the Salt train, this is the first thing I noticed. That remote files were being downloaded again despite me just running the same state 5 mins ago. And there was no property to "fix" this issue. |
I agree, this should not be seen as a feature request. And yes, it appears to be a duplicate of #38971. I'm working on this now. |
#43518 has been opened to fix this. |
hello,
in our saltstack configuration, we use file.managed or archive.extracted with https:// source, and noticed, that salt downloads source files regardless files changed on source/minion or not.
Quite big files (e.g. jdk binary) deployed as state on tens of machines, caused us unexpected network problems in our infrastructure. After investigation I found, that salt downloads those files each time.
I did workaround, adding:
- unless:
- curl -m 15 -Ls {{ file_source }}.sha1 > /tmp/test.sha1
- echo " {{ file_downloaded }}" >> /tmp/test.sha1
- sha1sum -c /tmp/test.sha1
But it shouldn't be like that - first step should be downloading only of sha1 file and if it is different from actual, then download from source.
salt-call 2017.7.0 (Nitrogen) on many systems (Centos7, Ubuntu 16.04, Debian 8, etc.)
The text was updated successfully, but these errors were encountered: