Skip to content

[BUG] salt schedule does not work masterless, offline required #67979

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
amalaguti opened this issue Apr 22, 2025 · 0 comments
Open

[BUG] salt schedule does not work masterless, offline required #67979

amalaguti opened this issue Apr 22, 2025 · 0 comments
Labels
Bug broken, incorrect, or confusing behavior needs-triage

Comments

@amalaguti
Copy link

amalaguti commented Apr 22, 2025

Description
Salt scheduler does not work when minion configured in masterless, in order to add a job to schedule the offline: true argument is required in the state. Despite that, once added, in order to list the job with salt-call offline=true is needed but is not possible to run the job on demand, for schedule.run_job offline is not a valid argument.
The job is not found. schedule.show_next_fire_time also does not work.

And also it seems it's not executed on scheduled time either.

PS C:\Windows\system32> salt-call schedule.list offline=true
local:
    schedule:
      schedule_temp_folder_fix:
        args:
        - myapp.myapp_temp_folder
        enabled: true
        function: state.sls
        jid_include: true
        kwargs:
          queue: true
          saltenv: base
        maxrunning: 1
        name: schedule_temp_folder_fix
        return_job: false
        saved: true
        when:
        - Wednesday 11:55am

PS C:\Windows\system32> salt-call schedule.run_job schedule_temp_folder_fix
local:
    ----------
    comment:
        Job schedule_temp_folder_fix does not exist.
    result:
        False

PS C:\Windows\system32> salt-call schedule.run_job schedule_temp_folder_fix offline=true
The following keyword arguments are not valid: offline=True

schedule.show_next_fire_time does not work either:

PS C:\Windows\system32> salt-call schedule.add schedule_temp_folder_fix function='state.sls' args='["tanium.tanium_temp_folder"]' kwargs='{"saltenv": "base", "queue": true}' maxrunning=1 when='Tuesday 6:50am' offline=true
local:
    ----------
    changes:
        ----------
        schedule_temp_folder_fix:
            added
    comment:
        Added job: schedule_temp_folder_fix to schedule.
    result:
        True

PS C:\Windows\system32> salt-call schedule.show_next_fire_time schedule_temp_folder_fix

Passed invalid arguments: argument of type 'NoneType' is not iterable.

Usage:

    Show the next fire time for scheduled job

    .. versionadded:: 2018.3.0

    CLI Example:

    .. code-block:: bash

        salt '*' schedule.show_next_fire_time job_name

Setup
minion in masterless setup with schedule job

file_client: local
use_master_when_local: false
file_roots:
  base:
    - 'G:\\salt\\states'
log_level_logfile: debug
scheduler_before_connect: true

Steps to Reproduce the behavior

  • Configure minion in masterless
  • Run state to add job or add it with salt-call, without offline=true it fails
PS C:\Windows\system32> salt-call schedule.add schedule_temp_folder_fix function='state.sls' args='["myapp.myapp_temp_folder"]' kwargs='{"saltenv": "base", "queue": true}' maxrunning=1 when='Wednesday 11:55am'
local:
    ----------
    changes:
        ----------
    comment:
        Failed to add job schedule_temp_folder_fix to schedule.
    result:
        False
{%- set schedule_date_time = 'Wednesday 11:55am' %}
{%- set state_file_path = 'myapp.myapp_temp_folder' %}
{%- set job_kwargs = {} %}
{%- do job_kwargs.update({'saltenv': 'base','queue': True}) %}
schedule_temp_folder_fix:
  schedule.present:
    - function: state.sls
    - job_args:
      - {{ state_file_path }}   
    - job_kwargs: {{ job_kwargs }}
    - enabled: true
    - return_job: false
    - offline: true #OFFLINE TRUE
    - when:
      - {{schedule_date_time }}
salt-call schedule.add schedule_temp_folder_fix function='state.sls' args='["myapp.myapp_temp_folder"]' kwargs='{"saltenv": "base", "queue": true}' maxrunning=1 when='Wednesday 11:55am' offline=true

Expected behavior
Given the minion is already set in masterless, I would expect offline to not be required. And more important, the schedule job should run on demand, which it seems not possible due schedule.run_job does not accept offline arg.

Versions Report
3006.7 at leasst

@amalaguti amalaguti added Bug broken, incorrect, or confusing behavior needs-triage labels Apr 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug broken, incorrect, or confusing behavior needs-triage
Projects
None yet
Development

No branches or pull requests

1 participant