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

13 views
Skip to first unread message

potlipin

unread,
Jun 2, 2016, 12:18:10 PM6/2/16
to Puppet Users
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.

Reply all
Reply to author
Forward
0 new messages