Skip to content

[Bug]: jobs.py list_jobs() search_metadata not working for state.apply #68481

@Adam-P1

Description

@Adam-P1

What happened?

using list_jobs search_metadata keyword on a cmd.run job successfully returns a job, but when I do the exact same after doing a state.apply action, list_jobs with search_metadata returns nothing.

In both cases I am using:
salt-run jobs.list_jobs search_metadata='{"task_id":"token"}'
I can see that the task_id is present in both jobs when I find the jobs from the full list.

I believe this is because list_jobs() is expecting metadata to be nested inside the job id eg.
20251121100403664430: ---------- Arguments: - echo 'test' Function: cmd.run Metadata: ---------- _TOS: +0000 _TS: Fri Nov 21 10:04:00 2025 _TT: 2025 November 21 Fri 10 11 download_link: N/A script: Ping Test source: Flask task_id: 0c47889f user: Admin StartTime: 2025, Nov 21 10:04:03.664430 Target: salt-minion Target-type: glob User: root

However, a state.apply return has the metadata nested within 'arguments' eg.
20251121134552341171: ---------- Arguments: - Sandbox.create_test_file |_ ---------- __kwarg__: True metadata: ---------- script: Sandbox.create_test_file source: flask task_id: bb52013a user: Admin Function: state.apply StartTime: 2025, Nov 21 13:45:52.341171 Target: - salt-minion Target-type: list User: root

Type of salt install

Official deb

Major version

3007.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

salt --versions-report output

Salt Version:
          Salt: 3007.8

Python Version:
        Python: 3.10.18 (main, Jun 10 2025, 09:38:58) [GCC]

Dependency Versions:
          cffi: 2.0.0
      cherrypy: Not Installed
  cryptography: 46.0.3
      dateutil: 2.9.0.post0
     docker-py: Not Installed
         gitdb: Not Installed
     gitpython: Not Installed
        Jinja2: 3.1.6
       libgit2: Not Installed
  looseversion: 1.3.0
      M2Crypto: Not Installed
          Mako: Not Installed
       msgpack: 1.1.2
  msgpack-pure: Not Installed
  mysql-python: Not Installed
     packaging: 25.0
     pycparser: 2.23
      pycrypto: Not Installed
  pycryptodome: Not Installed
        pygit2: Not Installed
  python-gnupg: Not Installed
        PyYAML: 6.0.3
         PyZMQ: 27.1.0
        relenv: Not Installed
         smmap: Not Installed
       timelib: Not Installed
       Tornado: 6.5.2
           ZMQ: 4.3.5

Salt Package Information:
  Package Type: Not Installed

System Versions:
          dist: opensuse 15.6
        locale: utf-8
       machine: x86_64
       release: 6.4.0-150600.23.53-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