0

I'm using Puppet 3.4.3.

I'm trying to use the cron type to manage cron jobs (as documented here: https://docs.puppetlabs.com/references/latest/type.html). However, any time I try and run my configuration:

Error: Could not retrieve catalog from remote server: Error 400 on SERVER: Could not find class cron for app on node app

As far as I can tell, the documentation is referencing and inbuilt type, and I shouldn't have to include any modules or download anything extra? Is the minimum version for the cron type higher than 3.4.3?

It's not a problem with my individual configuration, as even the logrotate example given on the documentation page fails with the same error message.

Any help would be appreciated!

Edit: Here is the code i'm using:

cron { laravelschedule:
        command => "php /var/www/sociaspire/artisan schedule:run >> /dev/null 2>&1",
        user => www-data,
        hour => '*',
        minute => '*',
        month => '*',
        monthday => '*',
        week => '*',  
}

Edit: Output from ls -ltr:

total 36
-rw-r--r-- 1 root root 7357 Aug 20 10:37 sociaspire-testing.pp
-rw-r--r-- 1 root root 6481 Aug 20 10:37 sociaspire.pp
-rw-r--r-- 1 root root 3128 Aug 20 10:37 sociaspire-lb.pp
-rw-r--r-- 1 root root 3074 Aug 20 10:37 sociaspire-db.pp
-rw-r--r-- 1 root root 8195 Sep 10 13:23 sociaspire-standalone.pp

Output from tree -f:

.
├── ./classes
│   └── ./classes/sociaspire-standalone.pp
└── ./site.pp
  • I call syntax error. Please add a code excerpt to your question to illustrate how you try and implement the cron type. – Felix Frank Aug 31 '15 at 14:01
  • quote the resource title laravelschedule should be "laravelschedule" – c4f4t0r Sep 12 '15 at 13:53
  • @c4f4t0r I tried both variations of quoted and unquoted to no avail. The PuppetLabs reference also uses unquoted resource titles. – BnMcG Sep 15 '15 at 10:32
0

The solution I have found is to use a cron module (specifically: https://forge.puppetlabs.com/torrancew/cron).

Syntax is very similar but this module seems to work for me where Puppet's inbuilt type didn't.

0

This is the problem, but I cannot write the whole code in a comment, using puppet-lint you can see if your code style is correct

This is the result checking your code style.

puppet-lint /home/user01/programming/puppet/bad.pp
WARNING: double quoted string containing no variables on line 2
ERROR: trailing whitespace found on line 8
WARNING: line has more than 80 characters on line 2
WARNING: indentation of => is not properly aligned on line 2
WARNING: indentation of => is not properly aligned on line 3
WARNING: indentation of => is not properly aligned on line 4
WARNING: indentation of => is not properly aligned on line 5
WARNING: indentation of => is not properly aligned on line 6
WARNING: indentation of => is not properly aligned on line 8
WARNING: unquoted resource title on line 1

As you can see above, in line one, the resource title need to be quoted.

You can fix your code using puppet-lint -f /home/user01/programming/puppet/bad.pp Now if you run again puppet-lint /home/user01/programming/puppet/bad.pp you will see no errors and wornings

Looking the puppetlabs doc https://docs.puppetlabs.com/references/latest/type.html#cron where the example of cron provider the resource title is quoted with single quote if you don't have a variabile in the resource title, the week attribute need to be weekday

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.