Hi guys,

I'm testing a new Puppet cron module to be used with Hiera 
(https://github.com/roman-mueller/rmueller-cron).

I'm trying to create a new cron job on a test node by passing data with 
hiera_hash and create resources.

init.pp

class cron (
  $manage_package = false,
  $package_ensure = 'installed',
) {

  if $manage_package {
    class { '::cron::install':
      package_ensure => $package_ensure,
    }
  }

  # Create jobs from hiera
  $cron_job=hiera_hash('cron::job', undef)
  if $cron_job {
    create_resources('cron::job',$cron_job)
  }


job.pp

define cron::job (
  $command,
  $ensure      = 'present',
  $minute      = '*',
  $hour        = '*',
  $date        = '*',
  $month       = '*',
  $weekday     = '*',
  $environment = [],
  $user        = 'root',
  $mode        = '0644',
  $description = undef,
) {



node.yaml in Hiera

cron::job:
  'mysqlbackup':
    command: 'mysqldump -u root mydb'
    minute: 0
    hour: 0
    date: '*'
    month: '*'
    weekday: '*'
    user: root
    environment:
      - 'MAILTO=root'
      - 'PATH="/usr/bin:/bin"'
    description: 'Mysql backup'


But when I run "puppet agent --test" from the test node I get the below 
error.

err: Could not retrieve catalog from remote server: Error 400 on SERVER: 
undefined method `merge' for "mysqlbackup_monthly":String at 
/root/puppet/modules/cron/manifests/init.pp:40 on node test
warning: Not using cache on failed catalog
err: Could not retrieve catalog; skipping run

Any pointers?

Thx.

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/e1ef8875-4287-48ff-943a-190fe9c61380%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to