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
Description
Sometimes - I assume when the minion-master connection is temporarily unavailable * - beacon.present just crashes with a traceback: TypeError: argument of type 'NoneType' is not iterable
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.
on-prem machine
VM (KVM)
onedir packaging
used bootstrap to install
* The behavior usually manifests shortly after a daemon restart - startup_states: highstate is in my config. Maybe there is some race condition.
Steps to Reproduce the behavior
stop the local Salt minion
run salt-call --local state.single beacon.present
Expected behavior
Return an error description or retry (it happens when the daemon is up, the reproduction above just simulates what happens).
Screenshots
[ERROR ] Encountered StreamClosedException[ERROR ] An exception occurred in this state: Traceback (most recent call last): File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/state.py", line 2424, in call ret = self.states[cdata["full"]]( File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/loader/lazy.py", line 159, in __call__ ret = self.loader.run(run_func, *args, **kwargs) File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/loader/lazy.py", line 1251, in run return self._last_context.run(self._run_as, _func_or_method, *args, **kwargs) File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/loader/lazy.py", line 1266, in _run_as return _func_or_method(*args, **kwargs) File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/loader/lazy.py", line 1299, in wrapper return f(*args, **kwargs) File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/states/beacon.py", line 104, in present if name in current_beacons:TypeError: argument of type 'NoneType' is not iterablelocal:---------- ID: test Function: beacon.present Result: False Comment: An exception occurred in this state: Traceback (most recent call last): File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/state.py", line 2424, in call ret = self.states[cdata["full"]]( File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/loader/lazy.py", line 159, in __call__ ret = self.loader.run(run_func, *args, **kwargs) File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/loader/lazy.py", line 1251, in run return self._last_context.run(self._run_as, _func_or_method, *args, **kwargs) File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/loader/lazy.py", line 1266, in _run_as return _func_or_method(*args, **kwargs) File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/loader/lazy.py", line 1299, in wrapper return f(*args, **kwargs) File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/states/beacon.py", line 104, in present if name in current_beacons: TypeError: argument of type 'NoneType' is not iterable Started: 21:22:55.647197 Duration: 1009.19 ms Changes:Summary for local------------Succeeded: 0Failed: 1------------Total states run: 1Total run time: 1.009 s
Versions Report
salt --versions-report
(Provided by running salt --versions-report. Please also mention any differences in master/minion versions.)
Salt Version:
Salt: 3006.7Python Version:
Python: 3.10.13 (main, Feb 19 2024, 03:31:20) [GCC 11.2.0]Dependency Versions:
cffi: 1.14.6cherrypy: unknowndateutil: 2.8.1docker-py: Not Installedgitdb: 4.0.11gitpython: 3.1.42Jinja2: 3.1.3libgit2: Not Installedlooseversion: 1.0.2M2Crypto: Not InstalledMako: Not Installedmsgpack: 1.0.2msgpack-pure: Not Installedmysql-python: Not Installedpackaging: 22.0pycparser: 2.21pycrypto: Not Installedpycryptodome: 3.19.1pygit2: Not Installedpython-gnupg: 0.4.8PyYAML: 6.0.1PyZMQ: 23.2.0relenv: 0.15.1smmap: 5.0.1timelib: 0.2.4Tornado: 4.5.3ZMQ: 4.3.4System Versions:
dist: rocky 9.3 Blue Onyxlocale: utf-8machine: x86_64release: 5.14.0-362.13.1.el9_3.x86_64system: Linuxversion: Rocky Linux 9.3 Blue Onyx
Additional context
This is caused by beacons.list returning None when event.fire fails and beacon.present indiscriminately iterating over the result.
I think the solution should be twofold:
check if the return value is None
if so, retry after a delay up to a configurable timeout
Another note: beacons.list potentially returns three different value types:
None when the event fails completely
a ret dict when unexpected data is returned
the actual list of beacons
2. could cause weird behavior as well.
The text was updated successfully, but these errors were encountered:
Description
Sometimes - I assume when the minion-master connection is temporarily unavailable * -
beacon.present
just crashes with a traceback:TypeError: argument of type 'NoneType' is not iterable
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.
* The behavior usually manifests shortly after a daemon restart -
startup_states: highstate
is in my config. Maybe there is some race condition.Steps to Reproduce the behavior
salt-call --local state.single beacon.present
Expected behavior
Return an error description or retry (it happens when the daemon is up, the reproduction above just simulates what happens).
Screenshots
Versions Report
salt --versions-report
(Provided by running salt --versions-report. Please also mention any differences in master/minion versions.)Additional context
This is caused by
beacons.list
returningNone
whenevent.fire
fails andbeacon.present
indiscriminately iterating over the result.I think the solution should be twofold:
None
Another note:
beacons.list
potentially returns three different value types:None
when the event fails completely2. could cause weird behavior as well.
The text was updated successfully, but these errors were encountered: