[Bug]: list_jobs with search_target fails if targets is not iterable
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 15.7k
- Forks
- 5.6k
- Avg merge
- 2d 44m
- Merged PRs (30d)
- 80
Description
What happened?
There are execution and state failures that can leave Target as something other than a string or list in the job cache. salt.runners.jobs line 334 iterates across the targets in the job but doesn't check if the target is iterable. If line 334 in jobs.py was changed from targets = ret[item]["Target"] to targets = ret[item]["Target"] if hasattr(ret[item]["Target"], '__iter__') else [] it would resolve this issue
Type of salt install
Official rpm
Major version
3006.x
What supported OS are you seeing the problem on? Can select multiple. (If bug appears on an unsupported OS, please open a GitHub Discussion instead)
opensuse-leap-15.5, rhel-8
salt --versions-report output
Salt Version:
Salt: 3006.21
Python Version:
Python: 3.10.19 (main, Feb 5 2026, 07:05:38) [GCC 11.2.0]
Dependency Versions:
cffi: 2.0.0
cherrypy: 18.10.0
cryptography: 42.0.5
dateutil: 2.8.1
docker-py: Not Installed
gitdb: 4.0.12
gitpython: 3.1.45
Jinja2: 3.1.6
libgit2: Not Installed
looseversion: 1.0.2
M2Crypto: Not Installed
Mako: Not Installed
msgpack: 1.0.2
msgpack-pure: Not Installed
mysql-python: Not Installed
packaging: 24.0
pycparser: 2.21
pycrypto: Not Installed
pycryptodome: 3.19.1
pygit2: Not Installed
python-gnupg: 0.4.8
PyYAML: 6.0.1
PyZMQ: 23.2.0
relenv: 0.22.3
smmap: 5.0.2
timelib: 0.3.0
Tornado: 4.5.3
ZMQ: 4.3.4
Salt Extensions:
saltext.elasticsearch: 1.2.3
System Versions:
dist: opensuse-leap 15.6
locale: utf-8
machine: x86_64
release: 6.4.0-150600.23.84-default
system: Linux
version: openSUSE Leap 15.6
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 in salt.runners.jobs at jobs.py line 334 and inspect how list_jobs with search_target handles the cached Target value. Reproduce the failure with a non-iterable Target, then verify the command completes without the iteration error and add regression coverage for that case.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- infrastructure
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 52/100