-
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
[BUG] file.managed: source_hash
ignored when contents_pillar
or source=salt://...
is used
#63810
Comments
A colleague just pointed out the option |
The main purpose of it is to verify untrusted sources. salt:// and pillar come from Salt itself, so are already trusted. The secondary purpose of change detection is also covered by Salt's refresh mechanisms. |
Sorry for taking so long... If not by checksum how does Salt detect differences in what might be a binary file? |
For files served from Salt, it does the checksums itself. |
I'm going to close this as expected behavior. It is also currently documented "If the file is hosted on an HTTP or FTP server, the source_hash argument is also required." here: https://docs.saltproject.io/en/latest/ref/states/all/salt.states.file.html#salt.states.file.managed |
It doesn't say that it is ignored if not required. |
Good point. I'll re-open to make that more clear. Or the other approach could be to fail if http/ftp is not defined and source_hash is used. |
Closing as per #64227 |
Description
When defining a
file.managed
state with bothcontents_pillar
andsource_hash
set the later one gets ignored.Building test states for this bugreport I found the same behavior with a
salt://
-source for the file.Setup
Master and minions are (amd64) KVM guests, with the master and one of the minions running Debian 11. Other minions
are running CentOS 7 and Ubuntu 22.04 jammy. All of them are using Salt version 3005.1 from https://repo.saltproject.io/ which makes the Debian-based ones onedir-installations and the CentOS ones, well, not.
My current (test) setup uses
ext_pillar
with Vault (for TLS keys and such) andcmd_yaml
(for assigning roles) but my examples below "work" without those.No much changed since #63785 ; )
Steps to Reproduce the behavior
Expected behavior
Files with contents taken from the minion's pillar and ones with content from a
salt://
URL should have their checksum verified whensource_hash
is set.Screenshots
If applicable, add screenshots to help explain your problem.
Versions Report
salt --versions-report
(Provided by running salt --versions-report. Please also mention any differences in master/minion versions.) A CentOS minion, an Ubuntu one and the one on the host running the master: ```yaml centos7-kvm-minion: Salt Version: Salt: 3005.1kvm-master:
Salt Version:
Salt: 3005.1
u2204-kvm-minion:
Salt Version:
Salt: 3005.1
The text was updated successfully, but these errors were encountered: