Ask Your Question
0

hiera define creat_resources works with Puppet 3.8 but not with 4.2

asked 2015-09-03 07:33:04 -0600

winningpanthers gravatar image

updated 2015-09-03 16:33:48 -0600

ramindk gravatar image

I could run the below code in init.pp in Puppet version 3.8. But in 4.2 I had to remove the init.pp for this code to work.

My current mything.pp looks like this.

define my_hash(
  $directory,
  $portnumber,
)  {

  file { "/tmp/t1${directory}.${portnumber}":
    ensure => directory,
  }

  notify { "currently looping PORTNUMBER $directory:$portnumber": }
}

$my_hash = hiera_hash('mything')
create_resources( my_hash, $my_hash )

logs

root@euca-81-235:/opt/puppetlabs/puppet/modules/testcode/manifests # puppet apply -t mything.pp
Info: Loading facts
Info: Loading facts
Info: Loading facts
Info: Loading facts
Info: Loading facts
Info: Loading facts
Notice: Compiled catalog for 10.64.81.235 in environment production in 0.42 seconds
Info: Applying configuration version '1441252774'
Notice: currently looping PORTNUMBER CCC1:9998
Notice: /Stage[main]/Main/My_hash[k1]/Notify[currently looping PORTNUMBER CCC1:9998]/message: defined 'message' as 'currently looping PORTNUMBER CCC1:9998'
Notice: currently looping PORTNUMBER CDB:9999
Notice: /Stage[main]/Main/My_hash[k2]/Notify[currently looping PORTNUMBER CDB:9999]/message: defined 'message' as 'currently looping PORTNUMBER CDB:9999'
Notice: Applied catalog in 0.23 seconds

This is my hash in hiera.

mything:
  k1:
    directory: CCC1
    portnumber: 9998
  k2:
    directory:  CDB
    portnumber: 9999

How do I map this class on Puppet EM without init.pp? It is not showing up on Puppet EM. In Puppet version 3.8, I could include the above in init.pp and run it peacefully. Looks like something has changed in Puppet version 4.2? I am not using puppet parser future in 3.8. It works fine with init.pp on 3.8 even with or without future parser enabled. Any thoughts/help on this tricky issue would be of tremendous help. Thanks.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2016-01-08 12:45:50 -0600

I have exactly the same issue.

Moved from v3.7.2 to v4.2.1 and this has stopped working

Error: Evaluation Error: Error while evaluating a Function Call, Puppet::Parser::AST::Resource failed with error ArgumentError: Invalid resource type creating_users at c:/puppet/puppet/modules/users/manifests/init.pp:13:1 on node xxxx

Edit: After hours of head scratching, realised it should have been

createresource( users::creatingusers, $users) in v4.2 (i.e. add the class "users::")

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2015-09-03 07:33:04 -0600

Seen: 207 times

Last updated: Jan 08 '16