voxpupuli / puppet-cron

Puppet module to manage cron jobs via /etc/cron.d

Home Page:https://forge.puppet.com/puppet/cron

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Can't get weekday options to work as an array of days

sa-github-admin opened this issue · comments

Affected Puppet, Ruby, OS and module versions/distributions

  • Puppet: 2019.7
  • Ruby: ?
  • Distribution: Linux
  • Module version: 2.0.0

How to reproduce (e.g Puppet code you use)

cron::job::multiple { 'osbackup':
jobs => [
{
minute => 30,
hour => 23,
weekday => [0, 1, 2, 3, 4, 5],
user => 'root',
command => '/opt/sndr/tools/osbackup -a -i linux > /var/log/osbackup-linux-cron.log 2>&1',
description => 'Operating system backup Sunday-Friday for Linux',
},
],
}

What are you seeing

Error: Could not retrieve catalog from remote server: Error 500 on SERVER: Server Error: Evaluation Error: Error while evaluating a Resource Statement, Cron::Job::Multiple[osbackup]:
parameter 'jobs' index 0 entry 'weekday' expects a Cron::Weekday = Variant[Cron::Weekdayname = Enum['Fri', 'Mon', 'Sat', 'Sun', 'Thu', 'Tue', 'Wed'], Integer[0, 7], Pattern[/(?x)\A(
* ( / [1-7] )?
| [0-7] ( - [0-7] ( / [1-7] )? )?
( , [0-7] ( - [0-7] ( / [1-7] )? )? )*
)\z/]] value, got Tuple
parameter 'jobs' index 2 entry 'weekday' expects a Cron::Weekday = Variant[Cron::Weekdayname = Enum['Fri', 'Mon', 'Sat', 'Sun', 'Thu', 'Tue', 'Wed'], Integer[0, 7], Pattern[/(?x)\A(
* ( / [1-7] )?
| [0-7] ( - [0-7] ( / [1-7] )? )?
( , [0-7] ( - [0-7] ( / [1-7] )? )? )*
)\z/]] value, got Tuple (file: /etc/puppetlabs/code/environments/feature_c01393_cron_multi/modules/hpsu_linux_base/manifests/cron.pp, line: 46) on node cbclnxadmin.schneider.com

What behaviour did you expect instead

A weekday value in cron entry:
30 23 * * 0,1,2,3,4,5 /opt/sndr/tools/osbackup -a -i linux > /var/log/osbackup-linux-cron.log 2>&1

Output log

Any additional information you'd like to impart

Found work-around and corrected syntax as this module acts differently then the Puppet cron built in type

@sa-github-admin, do you have an example of what you got to work? I'm having trouble getting my head around what the correct syntax is after looking at the documentation and trying a bunch of different combinations that I thought would work.

It'd be real nice if the reference.md or the readme contains some examples of valid syntax beyond the Variant type descriptor.