[BUG] Using source_hash when renaming a file shows warning of unsupported protocol
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 15.7k
- Forks
- 5.6k
- Avg merge
- 2d 44m
- Merged PRs (30d)
- 80
Description
Description
file.managed documentation states that source_hash:
When using a source hash file the source_hash argument needs to be a url, the standard download urls are supported, ftp, http, salt etc
Local file could be mentioned before the "etc".
It was fixed in code in:
Having the warning message is worrying because it is read as it no checksum was made, but it was made, as I tested with the wrong checksum and it failed.
Setup
(Please provide relevant configs and/or SLS files (be sure to remove sensitive info. There is no general set-up of Salt.)
Please be as specific as possible and give set-up details.
- VM (Virtualbox, KVM, etc. please specify) - Xen - QubesOS
- classic packaging - packaged by Qubes developers
Steps to Reproduce the behavior
(Include debug logs if possible and relevant)
I ran the state locally.
id:
file.managed:
- name: /tmp/a
- source: /tmp/b
- source_hash: sha256=theshasum
[WARNING ] source_hash is only used with 'http', 'https' or 'ftp'
File is correctly copied if the hash is correct and not copied if it is incorrect.
In case it is incorrect:
Comment: Specified sha256 checksum for /var/lib/qubes/vm-kernels/vmlinuz (18a1ee52574b9a4fc5eda265922bcbcface90f7c43ed7a68dc8e201a2ac0a7dc) does not match actual checksum (78a1ee52574b9a4fc5eda265922bcbcface90f7c43ed7a68dc8e201a2ac0a7dc)
Expected behavior
No warning message and the documentation stating that local files are also supported.
Versions Report
No difference in master and minion version.
Salt Version:
Salt: 3006.9
Python Version:
Python: 3.11.6 (main, Oct 3 2023, 00:00:00) [GCC 12.3.1 20230508 (Red Hat 12.3.1-1)]
Dependency Versions:
cffi: 1.15.1
cherrypy: Not Installed
cryptography: Not Installed
dateutil: 2.8.2
docker-py: Not Installed
gitdb: Not Installed
gitpython: Not Installed
Jinja2: 3.0.3
libgit2: 1.3.1
looseversion: 1.2.0
M2Crypto: Not Installed
Mako: Not Installed
msgpack: 1.0.4
msgpack-pure: Not Installed
mysql-python: Not Installed
packaging: 21.3
pycparser: 2.20
pycrypto: Not Installed
pycryptodome: 3.19.0
pygit2: 1.7.1
python-gnupg: Not Installed
PyYAML: 6.0
PyZMQ: 23.2.0
relenv: Not Installed
smmap: Not Installed
timelib: Not Installed
Tornado: 4.5.3
ZMQ: 4.3.4
System Versions:
dist: qubes 4.2.3 R4.2
locale: utf-8
machine: x86_64
release: 6.6.48-1.qubes.fc37.x86_64
system: Linux
version: Qubes OS 4.2.3 R4.2
Additional context
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the file.managed state and its source_hash handling, using the provided local-source SLS example to reproduce the warning. Check the file.managed documentation alongside the warning path and the behavior described in pull request 44794. Done means local files are checksum-validated without the unsupported-protocol warning and the documentation mentions local files.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- devops
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100