Skip to content
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

Issue with setting up schedule job via state.apply #36855

Closed
edwardsdanielj opened this issue Oct 7, 2016 · 3 comments
Closed

Issue with setting up schedule job via state.apply #36855

edwardsdanielj opened this issue Oct 7, 2016 · 3 comments
Labels
Bug broken, incorrect, or confusing behavior Documentation Relates to Salt documentation fixed-pls-verify fix is linked, bug author to confirm fix P4 Priority 4 severity-medium 3rd level, incorrect or bad functionality, confusing and lacks a work around
Milestone

Comments

@edwardsdanielj
Copy link

Heya code junkies, I'm attempting to set up a schedule job from a salt state and from what I can see on https://docs.saltstack.com/en/latest/ref/states/all/salt.states.schedule.html#salt.states.schedule.present my state is correct:

My .sls file is the following:

# vim: tabstop=2 expandtab shiftwidth=2 softtabstop=2
# Adds watchIPtables job to schedule
watchIPtables:
  schedule.present:
    - function: state.sls
    - job_args:
      - base.schedule_jobs.watchIPtables
    - seconds: 1800
    - splay:
      - start:    30
      - end:      120
    - maxrunning: 1
    - enabled: True

My intention with this schedule job is to have the watchIPtabes state run every 30 minutes to detect if iptables is down. If it is down then it sends an event to the reactor and the reactor executes the salt state to restart iptables.

However, I get the following error repeated every second in /var/log/salt/minion:
"2016-10-07 17:07:54,931 [salt.minion ][ERROR ][64302] Exception can only concatenate list (not "int") to list occurred in scheduled job"

The command I use to add the schedule job is:
salt <minionID> state.apply </path/to/schedule/job/>

All that I need to do to produce this issue is add the schedule job to my minion via that salt command. I run salt <minion> schedule.list and the following is the output:

<minion>:
    schedule:
      enabled: true
      watchIPtables:
        args:
        - base.schedule_jobs.watchIPtables
        enabled: true
        function: state.sls
        jid_include: true
        maxrunning: 1
        name: watchIPtables
        seconds: 1800
        splay:
        - start: 30
        - end: 120

My master node environment looks like the following:

Salt Version:
           Salt: 2016.3.1

Dependency Versions:
           cffi: Not Installed
       cherrypy: Not Installed
       dateutil: 1.4.1
          gitdb: 0.5.4
      gitpython: 0.3.2 RC1
          ioflo: Not Installed
         Jinja2: 2.7.3
        libgit2: Not Installed
        libnacl: Not Installed
       M2Crypto: 0.20.2
           Mako: Not Installed
   msgpack-pure: Not Installed
 msgpack-python: 0.4.6
   mysql-python: 1.2.3c1
      pycparser: Not Installed
       pycrypto: 2.6.1
         pygit2: Not Installed
         Python: 2.6.6 (r266:84292, May 22 2015, 08:34:51)
   python-gnupg: 0.3.7
         PyYAML: 3.11
          PyZMQ: 14.5.0
           RAET: Not Installed
          smmap: 0.8.1
        timelib: Not Installed
        Tornado: 4.2.1
            ZMQ: 4.0.5

System Versions:
           dist: redhat 6.8 Santiago
        machine: x86_64
        release: 2.6.32-642.3.1.el6.x86_64
         system: Linux
        version: Red Hat Enterprise Linux Server 6.8 Santiago

My minion environment looks similar:

Salt Version:
           Salt: 2016.3.1

Dependency Versions:
           cffi: Not Installed
       cherrypy: Not Installed
       dateutil: 1.4.1
          gitdb: Not Installed
      gitpython: Not Installed
          ioflo: Not Installed
         Jinja2: 2.7.3
        libgit2: Not Installed
        libnacl: Not Installed
       M2Crypto: 0.20.2
           Mako: Not Installed
   msgpack-pure: Not Installed
 msgpack-python: 0.4.6
   mysql-python: Not Installed
      pycparser: Not Installed
       pycrypto: 2.6.1
         pygit2: Not Installed
         Python: 2.6.6 (r266:84292, May 22 2015, 08:34:51)
   python-gnupg: 0.3.7
         PyYAML: 3.11
          PyZMQ: 14.5.0
           RAET: Not Installed
          smmap: Not Installed
        timelib: Not Installed
        Tornado: 4.2.1
            ZMQ: 4.0.5

System Versions:
           dist: redhat 6.8 Santiago
        machine: x86_64
        release: 2.6.32-573.12.1.el6.x86_64
         system: Linux
        version: Red Hat Enterprise Linux Server 6.8 Santiago

Any help or correction to what I'm doing/executing or what my state looks like would be very appreciated.

@gtmanfred
Copy link
Contributor

That is weird, cause the problem is that splay is an ordered dictionary, if you change it to a regular dict it all works. But our docs show that it should be an ordered dict.

If you change the state to

# vim: tabstop=2 expandtab shiftwidth=2 softtabstop=2
# Adds watchIPtables job to schedule
watchIPtables:
  schedule.present:
    - function: state.sls
    - job_args:
      - base.schedule_jobs.watchIPtables
    - seconds: 1800
    - splay:
        start:    30
        end:      120
    - maxrunning: 1
    - enabled: True

It works.

@gtmanfred gtmanfred added this to the Blocked milestone Oct 10, 2016
@gtmanfred gtmanfred added pending-changes The pull request needs additional changes before it can be merged Documentation Relates to Salt documentation labels Oct 10, 2016
@gtmanfred gtmanfred modified the milestones: Approved, Blocked Oct 10, 2016
@gtmanfred
Copy link
Contributor

@jfindlay can you take a look at this? The stuff on https://docs.saltstack.com/en/latest/topics/jobs/ says splay should be a dictionary, but it looks like the scheduler.present state has splay as an ordered dictionary.

Thanks!

@rallytime rallytime added Bug broken, incorrect, or confusing behavior severity-medium 3rd level, incorrect or bad functionality, confusing and lacks a work around fixed-pls-verify fix is linked, bug author to confirm fix P4 Priority 4 and removed pending-changes The pull request needs additional changes before it can be merged labels Oct 10, 2016
@rallytime
Copy link
Contributor

Docs were updated in #36894.

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 Documentation Relates to Salt documentation fixed-pls-verify fix is linked, bug author to confirm fix P4 Priority 4 severity-medium 3rd level, incorrect or bad functionality, confusing and lacks a work around
Projects
None yet
Development

No branches or pull requests

3 participants