Skip to content

[BUG] Master job scheduler using when fails #62858

@lkubb

Description

@lkubb

Description
Scheduling jobs on the master using "when" fails. This is caused by

salt/salt/utils/schedule.py

Lines 1066 to 1068 in 45ead10

elif (
"whens" in self.opts["grains"] and i in self.opts["grains"]["whens"]
):
assuming opts["grains"] exists, which is only true on a minion.

Setup

# master config
schedule:
  highstate:
    function: state.orchestrate
    args:
      - orch.sys.salt.highstate
    when:
      - 4:00am

Please be as specific as possible and give set-up details.

  • on-prem machine
  • VM (KVM)

Steps to Reproduce the behavior

  1. install python-dateutil
  2. set the time appropriately
  3. watch the master log

Expected behavior
Job is executed.

Screenshots

Exception 'grains' occurred in scheduled job

(The error description could be much better imho).

Versions Report

salt --versions-report (Provided by running salt --versions-report. Please also mention any differences in master/minion versions.)
Salt Version:
          Salt: 3004.2

Dependency Versions:
          cffi: Not Installed
      cherrypy: Not Installed
      dateutil: 2.8.2
     docker-py: Not Installed
         gitdb: 2.0.5
     gitpython: 2.1.9
        Jinja2: 2.11.3
       libgit2: Not Installed
      M2Crypto: 0.38.0
          Mako: Not Installed
       msgpack: 0.6.2
  msgpack-pure: Not Installed
  mysql-python: Not Installed
     pycparser: Not Installed
      pycrypto: 3.10.1
  pycryptodome: 3.14.1
        pygit2: Not Installed
        Python: 3.8.12 (default, Sep 26 2021, 13:12:50)
  python-gnupg: Not Installed
        PyYAML: 5.3.1
         PyZMQ: 18.0.1
         smmap: 2.0.3
       timelib: Not Installed
       Tornado: 4.5.3
           ZMQ: 4.3.4

System Versions:
          dist: openbsd 7.0
        locale: utf-8
       machine: amd64
       release: 7.0
        system: OpenBSD
       version: OpenBSD 7.0

Additional context
PR incoming.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Bugbroken, incorrect, or confusing behaviorCorerelates to code central or existential to Saltneeds-triage

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions