You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Please be as specific as possible and give set-up details.
on-prem machine
VM (Virtualbox, KVM, etc. please specify) - Virtualbox/vSphere
VM running on a cloud service, please be explicit and add details
container (Kubernetes, Docker, containerd, etc. please specify)
or a combination, please be explicit
jails if it is FreeBSD
classic packaging
onedir packaging
used bootstrap to install
Steps to Reproduce the behavior
The initial run:
# salt-call state.apply --output-diff poc
local:
----------
ID: weird-file
Function: file.managed
Name: /tmp/weird#folder/file
Result: True
Comment: File /tmp/weird#folder/file updated
Started: 11:47:28.625839
Duration: 2.269 ms
Changes:
----------
diff:
New file
Summary for local
------------
Succeeded: 2 (changed=1)
Failed: 0
------------
Total states run: 2
Total run time: 7.262 ms
Running again after the weird-filecontents field has been changes (ie. to contents: Updated content)
# salt-call state.apply --output-diff poc
local:
Summary for local
------------
Succeeded: 2
Failed: 0
------------
Total states run: 2
Total run time: 15.518 ms
Note no change, when the file contents should have been updated to Updated content
Doing the same thing again but this time as a test run:
# salt-call state.apply --output-diff poc test=True
[ERROR ] Failed to diff files: Failed to read /tmp/weird: No such file or directory
local:
----------
ID: weird-file
Function: file.managed
Name: /tmp/weird#folder/file
Result: None
Comment: The file /tmp/weird#folder/file is set to be changed
Note: No changes made, actual changes may
be different due to other states.
Started: 11:50:22.090511
Duration: 10.408 ms
Changes:
----------
diff:
Failed to read /tmp/weird: No such file or directory
Summary for local
------------
Succeeded: 2 (unchanged=1, changed=1)
Failed: 0
------------
Total states run: 2
Total run time: 15.271 ms
Note that Salt is trying to diff on the incorrect file /tmp/weird instead of /tmp/weird#folder/file
Expected behavior
The file should be managed the same as any other file that doesn't contain a # in its path name.
Screenshots
N/A
Versions Report
# salt-call --versions-report
Salt Version:
Salt: 3005.1
Dependency Versions:
cffi: Not Installed
cherrypy: Not Installed
dateutil: 2.8.1
docker-py: Not Installed
gitdb: Not Installed
gitpython: Not Installed
Jinja2: 3.0.3
libgit2: Not Installed
M2Crypto: Not Installed
Mako: Not Installed
msgpack: 1.0.3
msgpack-pure: Not Installed
mysql-python: Not Installed
pycparser: Not Installed
pycrypto: Not Installed
pycryptodome: 3.11.0
pygit2: Not Installed
Python: 3.10.6 (main, Nov 2 2022, 18:53:38) [GCC 11.3.0]
python-gnupg: 0.4.8
PyYAML: 5.4.1
PyZMQ: 22.3.0
smmap: Not Installed
timelib: Not Installed
Tornado: 4.5.3
ZMQ: 4.3.4
System Versions:
dist: ubuntu 22.04 Jammy Jellyfish
locale: utf-8
machine: x86_64
release: 5.15.0-52-generic
system: Linux
version: Ubuntu 22.04 Jammy Jellyfish
Additional context
As far as I can tell the problem seems to stem from the use of URL parsing of local filenames in /usr/lib/python3/dist-packages/salt/fileclient.py(482)get_url()
Description
The
file.managed
state does not work correctly if the file path contains a#
character.On the first run the file will be correctly created (if it doesn't already exist), but any subsequent run will fail to manage the file correctly.
Setup
Example state file:
Please be as specific as possible and give set-up details.
Steps to Reproduce the behavior
The initial run:
Running again after the
weird-file
contents
field has been changes (ie. tocontents: Updated content
)Note no change, when the file contents should have been updated to
Updated content
Doing the same thing again but this time as a test run:
Note that Salt is trying to diff on the incorrect file
/tmp/weird
instead of/tmp/weird#folder/file
Expected behavior
The file should be managed the same as any other file that doesn't contain a
#
in its path name.Screenshots
N/A
Versions Report
Additional context
As far as I can tell the problem seems to stem from the use of URL parsing of local filenames in
/usr/lib/python3/dist-packages/salt/fileclient.py(482)get_url()
The text was updated successfully, but these errors were encountered: