Ask Your Question
0

no implicit conversion of Symbol into Integer : Issues with Hiera calls.

asked 2016-10-31 09:13:49 -0500

Kevin T gravatar image

updated 2016-11-01 06:34:55 -0500

Seems im having issues with Hiera.. Every call to this function no mater what im trying to pull is giving me this syntax.. ive been pulling my hair out and im sure its simple.

File for hiera is common.yaml

ntpservers:     server1

Checking that hiera on the puppet master works.

[root@oc8086083754 manifests]# hiera ntpservers
server1

So i now try to make sure the simple script can pull the value

 [root@oc8086083754 manifests]# puppet apply --debug -e '$somevar = hiera('ntpservers') notify { $somevar: }'
Debug: hiera(): Hiera YAML backend starting
Debug: hiera(): Looking up ntpservers in YAML backend
Error: Evaluation Error: Error while evaluating a Function Call, no implicit conversion of Symbol into Integer at line 1:12 on node oc8086083754.ibm.com
Error: Evaluation Error: Error while evaluating a Function Call, no implicit conversion of Symbol into Integer at line 1:12 on node oc8086083754.ibm.com

Getting this with any hiera('xxxxxx') on the normal .pp files also.
What is happening am i doing wrong :O(

Second Test... Seems i cant get any thing to work :O(

puppet-3.6.2-3.el7.noarch
hiera-1.3.4-5.el7.noarch

[root@oc8086083754 environments]# hiera test::protocol
http://
[root@oc8086083754 environments]# hiera test::hostname
domain.com
[root@oc8086083754 environments]# hiera test::path
/index.html

[root@oc8086083754 environments]# cat /tmp/test.pp 
class test (
  $protocol,
  $hostname,
  $path,
) {
  notify { 'Print an URL':
    message => "${protocol}${hostname}${path}"
  }
}

class { 'test': }

I run my test

[root@oc8086083754 environments]# puppet apply --debug /tmp/test.pp
Debug: hiera(): Hiera YAML backend starting
Debug: hiera(): Looking up test::protocol in YAML backend
Error: Evaluation Error: Error while evaluating a Resource Statement, Error from DataBinding 'hiera' while looking up 'test::protocol': no implicit conversion of Symbol into Integer at /tmp/test.pp:11:1 on node oc8086083754.ibm.com
Error: Evaluation Error: Error while evaluating a Resource Statement, Error from DataBinding 'hiera' while looking up 'test::protocol': no implicit conversion of Symbol into Integer at /tmp/test.pp:11:1 on node oc8086083754.ibm.com
edit retag flag offensive close merge delete

Comments

Try putting quotes around the value in your yaml file (e.g. "server1" or 'server1'). It looks like the ruby internals in Puppet are interpreting server1 as a symbol, rather than a string.

smarlow gravatar imagesmarlow ( 2016-10-31 10:12:50 -0500 )edit

Nope... ntpsersvers: 'server1' and still reports same errors

Kevin T gravatar imageKevin T ( 2016-10-31 10:21:09 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
1

answered 2016-11-01 09:44:46 -0500

Kevin T gravatar image

Solved my problem with a little go back and check everything. datadir: and syntax of /etc/puppet/hiera.yaml was faulty

[root@oc8086083754 ~]# hiera --debug -c /etc/puppet/hiera.yaml rootdir::ntpservers
DEBUG: 2016-11-01 14:36:40 +0000: Hiera YAML backend starting
DEBUG: 2016-11-01 14:36:40 +0000: Looking up rootdir::ntpservers in YAML backend
/usr/share/ruby/vendor_ruby/hiera/backend.rb:18:in `[]': no implicit conversion of Symbol into Integer (TypeError)
        from /usr/share/ruby/vendor_ruby/hiera/backend.rb:18:in `datadir'
        from /usr/share/ruby/vendor_ruby/hiera/backend.rb:98:in `datasourcefiles'

Running hiera with the -c option showed that i actually had an issue with my configuration and datadir.

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-10-31 09:13:49 -0500

Seen: 338 times

Last updated: Nov 01 '16