salt icon indicating copy to clipboard operation
salt copied to clipboard

Scheduler config in pillar is broken for salt 0.17.5

Open bogdanr opened this issue 12 years ago • 15 comments

I still have this exact same problem as Issue #6201 in salt 0.17.5 on CentOS 6.5

I have this in /srv/pillar/schedule.sls

schedule:
  highstate:
    function: state.highstate
    minutes: 10

  log-loadavg:
    function: cmd.run
    seconds: 30
    args:
      - 'logger -t salt < /proc/loadavg'
    kwargs:
      stateful: False
      shell: True

And in /srv/pillar/top.sls I have this:

base:
  '*':
    - schedule
    - collectd
    - rsyslog

If I run salt "webnode1" pillar.data I can see this at the very end:

    schedule:
        ----------
        highstate:
            ----------
            function:
                state.highstate
            minutes:
                10
        log-loadavg:
            ----------
            args:
                - logger -t salt < /proc/loadavg
            function:
                cmd.run
            kwargs:
                ----------
                shell:
                    True
                stateful:
                    False
            seconds:
                30

I would expect at least to have the load average passed to the logs but it doesn't happen. Of course, if I run manually logger -t salt < /proc/loadavg it work fine.

How do I even debug?

bogdanr avatar Feb 20 '14 15:02 bogdanr

Does the highstate run as expected every 10 minutes? Or do none of the scheduled functions run?

basepi avatar Feb 20 '14 17:02 basepi

None of the scheduled functions run. I added both of them so I could see there is not somthing specific to the highstate and so I could debug faster.

On Thu, Feb 20, 2014 at 7:40 PM, Colton Myers [email protected]:

Does the highstate run as expected every 10 minutes? Or do none of the scheduled functions run?

Reply to this email directly or view it on GitHubhttps://github.com/saltstack/salt/issues/10621#issuecomment-35647936 .

bogdanr avatar Feb 20 '14 19:02 bogdanr

Hi Guys, just confirming this is working for me, using 0.17.5 on Centos 6.5.

rhormaza avatar Feb 27 '14 11:02 rhormaza

@rhormaza To double check, you're configuring the scheduler inside of Pillar in 0.17.5 and the scheduled functions are running correctly?

basepi avatar Feb 27 '14 22:02 basepi

@basepi Yes, that's exactly how I'm doing it (using Pillar) and every works just fine.

rhormaza avatar Mar 03 '14 02:03 rhormaza

Thanks for the update! I'll have to try to reproduce this myself, there may be just a small syntax error or something that's preventing @bogdanr from success.

basepi avatar Mar 04 '14 21:03 basepi

does not work for me either... 0.17.5 @ ubuntu 12.04 pillar.items shows that scheduler is filled with highstate command exactly as bogdanr rote above and nothing gets executes (when schedule is defined via pillar)

it works if i move it to /etc/salt/minion ;-/

strzelecki-maciek avatar Mar 05 '14 15:03 strzelecki-maciek

For those who still see broken behavior, can you please try running salt '*' saltutil.sync_all and see if it resolves the issue?

basepi avatar Mar 05 '14 21:03 basepi

I upgrade to salt 2014.1.0 and even though the highstate function works, the cmd.run function still doesn't work even after running saltutil.sync_all.

bogdanr avatar Mar 06 '14 08:03 bogdanr

I just installed a salt 2014.1.0 setup with a master and minion and a very similar config on a clean Debian 7.4 environment and it doesn't run anything from schedule. Both state.highstate and cmd.run don't work from schedule. Of course, they work when issued from the master. Even though they work when issued from the master I still get this message which seems to be wrong!?

[salt.crypt                                  ][ERROR   ] The Salt Master has cached the public key for this node, this salt minion will wait for 10 seconds before attempting to re-authenticate

bogdanr avatar Mar 06 '14 10:03 bogdanr

Scheduler definitely needs better logs. I really can't tell when it runs or not. When I was observing it earlier it never executed the highstate. Apparently at some point, probably after I pushed the highstate from the master the scheduler started to work but only for the highstate.

For the cmd.run function I would expect to see the load average in logs, just as I see it when I run the command manually but the logs are completely clean.

So, at some point after I pushed the highstate from the master, the scheduler started to run the highstate from the minion but not the cmd.run function.

bogdanr avatar Mar 06 '14 21:03 bogdanr

So scheduler config in pillar seems to be working, but that particular cmd.run example is not. We'll definitely investigate this.

Additionally, you're right, we need to improve logging around scheduling so it's blatantly obvious what's going on.

basepi avatar Mar 07 '14 20:03 basepi

Hi @bogdanr.

I tested your configuration today. The problem is in shell: True. The shell argument for cmd.run is to specify a shell in which to execute the given command -- not a boolean. If you take that out, the pillar scheduler works as designed. A stacktrace indicating the problem did appear on the master in my testing.

Please let me know if this works for you. Thanks!

cachedout avatar May 16 '14 18:05 cachedout

Indeed, if I remove shell: True it works. Thanks a lot. Still, please consider improving logging with the scheduler.

bogdanr avatar Jun 10 '14 13:06 bogdanr

Most of the logging that's done with the scheduler is done at the debug level. I'll move some of the more important items up to the info level.

cachedout avatar Jun 10 '14 21:06 cachedout