Open Noah-Huppert opened 2 years ago
https://github.com/saltstack/salt/blob/master/salt/pillar/stack.py#L424
🤦♂️, Missed that...
Troubleshooting a problem with ext_pillar encountered while trying to upgrade my salt master, I encountered this bug as well. For what it's worth, it looks like has been fixed in 3006(.2?)
3005.2 master (onedir) output from # salt-run pillar.show_pillar
:
_errors:
- Failed to load ext_pillar stack: while scanning an alias
in "<unicode string>", line 7, column 5
did not find expected alphabetic or numeric character
in "<unicode string>", line 7, column 6
3006.2 master (onedir) output from # salt-run pillar.show_pillar
:
_errors:
- Failed to load ext_pillar stack: Stack pillar yaml parsing error in /srv/pillar/mydev/hostsfile/common.sls:
while scanning an alias
in "<unicode string>", line 7, column 5:
*: None
^
expected alphabetic or numeric character, but found ':'
in "<unicode string>", line 7, column 6:
*: None
^
Now, I just need to figure out why the exact same ext_pillar files that load fine in 3005.1 'classic' salt master produce this error in 3005+ onedir....
Description The "stack" external pillar calls a function named
_process_stack_cfg
. This function then calls the Salt YAML safe load function for each pillar file which needs to be parsed. However the_process_stack_cfg
function does not catch this error. So the exception bubbles all the way up tosalt/pillar/__init__.py#ext_pillar()
leaving the user completely confused about where the YAML parsing error actually occurred.This type of ambiguous YAML parse error "but from where?" sort of issue plagues Salt stack. This is just one case of it.
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.
Running in Minion mode.
Steps to Reproduce the behavior
With
/etc/salt/minion
containing default values except:Then in all of the
/srv/pillar/*/pillar-stack.cfg
files place the text*/*
. Next to this file place directories withinit.sls
files inside of them. Make one of theseinit.sls
files have a YAML syntax error and watch as you get the extremely ambiguous error:As you can see, the user really isn't given any information about where the YAML error occurred. In fact to the user it may seem like the error came from their
/etc/salt/minion
file, sinceext_pillar stack
is mentioned.Expected behavior
If Salt fails to parse a YAML file it gives the path to that file.
Versions Report
salt --versions-report
(Provided by running salt --versions-report. Please also mention any differences in master/minion versions.) ```yaml Salt Version: Salt: 3005 Dependency Versions: cffi: Not Installed cherrypy: Not Installed dateutil: Not Installed docker-py: Not Installed gitdb: Not Installed gitpython: Not Installed Jinja2: 3.0.3 libgit2: Not Installed M2Crypto: 0.38.0 Mako: 1.1.3 msgpack: 1.0.4 msgpack-pure: Not Installed mysql-python: Not Installed pycparser: Not Installed pycrypto: Not Installed pycryptodome: 3.15.0 pygit2: Not Installed Python: 3.10.5 (main, Jun 8 2022, 02:00:39) [GCC 10.2.1 20201203] python-gnupg: Not Installed PyYAML: 6.0 PyZMQ: 23.2.0 smmap: Not Installed timelib: Not Installed Tornado: 4.5.3 ZMQ: 4.3.4 System Versions: dist: void rolling void locale: utf-8 machine: x86_64 release: 5.18.11_1 system: Linux version: Void rolling void ```