Skip to content

[Bug]: list_jobs with search_target fails if targets is not iterable #68780

@nychef

Description

@nychef

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugbroken, incorrect, or confusing behaviorneeds-triage

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions