salt
salt copied to clipboard
[FEATURE REQUEST] file.managed / cp.cache_file - support for headers for http(s) urls
Is your feature request related to a problem? Please describe. It would be extremely useful to be able to pass headers / auth information when using file.managed states. Certain file downloads are secured behind rest apis or basic auth.
Describe the solution you'd like Similar to what was proposed here: https://github.com/saltstack/salt/issues/40537#issuecomment-292338562. Having the ability to pass additional args to the http(s) servers when using the source variable. arg options should include the ability to set request type (GET), headers including content types, auth params (user/password)
Describe alternatives you've considered Using cmd.run to do a curl with the required args. Which is not exactly a great use-case and makes it harder to trigger follow on tasks if the file is changed. eg: https://stackoverflow.com/questions/31504258/using-file-managed-for-downloading-a-file-in-salt
Additional context Example uses. downloading private builds from gitlab/github via the api which requires header auth
Seconding this; surprised this isn't implemented already. This is also a necessity for e.g. using token auth to Vault to fetch an internal CA chain (which cannot be done via the quite limited Vault module).
Same, this would be very useful
This would be useful for using nexus as well.
+1 I stumbled upon this feature request while researching how to auth to https servers using file.managed.
Would love to use this as well.
If someone hints me a bit in the direction where I can find the important pieces in the code, I'd be pleased to implement it.
I also want to +1 this. I'm here because I have a server that won't let file.managed download a file unless it provides an Accept header :upside_down_face: