Ask Your Question
0

Evaluation Error while using the Hiera hash

asked 2016-04-25 03:20:43 -0500

Spaniard89 gravatar image

Hi,

I have the following values in my hiera yaml file:

test::config_php::php_modules :
  -'soap'
  -'mcrypt'
  -'pdo'
  -'mbstring'
  -'php-process'
  -'pecl-memcache'
  -'devel'
  -'php-gd'
  -'pear'
  -'mysql'
  -'xml'

and following is my test class:

class test::config_php (
$php_version,
$php_modules = hiera_hash('php_modules', {}),
$module_name,
){

class { 'php':
version => $php_version,
}

$php_modules.each |String $php_module| {
php::module { $php_module: }
}
}

While running my puppet manifests I get the following error:

Error: Evaluation Error: Error while evaluating a Function Call, create_resources(): second argument must be a hash   at /tmp/vagrant-puppet/modules-f38a037289f9864906c44863800dbacf/ssh/manifests/init.pp:46:3 on node testdays-1a.vagrant.loc.vag

I am quite confused on what exactly am I doing wrong. My puppet version is 3.6.2 and I also have parser = future

I would really appreciate any help here.

edit retag flag offensive close merge delete

Comments

Can you tell us what's going on at line 46 in /tmp/vagrant-puppet/modules-f38a037289f9864906c44863800dbacf/ssh/manifests/init.pp It looks like the error message has nothing to do with the code you've provided. Thanks

Alex Harvey gravatar imageAlex Harvey ( 2016-04-26 01:51:41 -0500 )edit

@Alex Its a upstream ssh module from puppet labs. Line 46 looks something like this: ´create_resources('::ssh::client::config::user', $fin_users_client_options)´ It seems this error is caused only when you set parser = future. It seems the puppet module that I have doesn't support this parameter.

Spaniard89 gravatar imageSpaniard89 ( 2016-04-26 04:35:17 -0500 )edit

Which module is it specifically? I'll have a look at the code.

Alex Harvey gravatar imageAlex Harvey ( 2016-04-26 04:46:53 -0500 )edit

It is this one: https://github.com/saz/puppet-ssh but without parser = future everything seems to be working fine.

Spaniard89 gravatar imageSpaniard89 ( 2016-04-26 04:51:01 -0500 )edit

@Alex BTW I already see a pull request here: https://github.com/saz/puppet-ssh/pull/161 which would eventually solve this issue for the aforementioned ssh module.

Spaniard89 gravatar imageSpaniard89 ( 2016-04-26 04:55:34 -0500 )edit

1 answer

Sort by » oldest newest most voted
0

answered 2016-04-26 04:42:54 -0500

Spaniard89 gravatar image

The problem was with my puppet version, somehow version 3.6 acts weird when creating resources, for instance it was failing on the following line,:

create_resources('::ssh::client::config::user', $fin_users_client_options)

The exception was thrown when the parameter parser = future was set in the config file

I cannot iterate using each without setting future as the parser, therefore I decided to change my source as follow:

I created a new class:

define test::install_modules {
php::module { $name: }
}

and then I changed the config config_php to:

class test::config_php (
$php_version,
$php_modules = [],
){

class { 'php':
version => $php_version,
}

install_modules { $php_modules: }
}

Everything seems to be much better now.

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: 2016-04-25 03:20:43 -0500

Seen: 267 times

Last updated: Apr 26 '16