failed: DataBinding 'hiera': undefined method `empty?' for nil:NilClass [closed]

asked 2016-09-20 05:48:19 -0500

wkg21 gravatar image

updated 2016-09-21 03:24:06 -0500

Hello,

we just restored puppetserver from backup but after restoration puppet server is not entirely happy.

It gives this error:

 /opt/puppetlabs/bin/puppet agent --test
Info: Using configured environment 'production'
Info: Retrieving pluginfacts
Info: Retrieving plugin
Info: Loading facts
Error: Could not retrieve catalog from remote server: Error 500 on SERVER: Server Error: Evaluation Error: Error while evaluating a Function Call, Lookup of key 'profile::ruby::packages' failed: DataBinding 'hiera': undefined method `empty?' for nil:NilClass at /etc/puppetlabs/code/modules/profile/manifests/base.pp:2:5 on node ldl.EXAMPLE.COM
Warning: Not using cache on failed catalog
Error: Could not retrieve catalog; skipping run

i am running puppetserver version: 2.5.0

# puppetserver gem list

*** LOCAL GEMS ***

deep_merge (1.0.1)
hiera-eyaml (2.0.8)
hiera-eyaml-gpg (0.5)
highline (1.6.21)
jar-dependencies (0.1.13)
jruby-openssl (0.9.7 java)
json (1.8.0 java)
mini_portile (0.6.2)
rake (10.1.0)
rdoc (4.1.2)
ruby_gpg (0.3.2)
trollop (2.1.2)

# /opt/puppetlabs/puppet/bin/gem  list

*** LOCAL GEMS ***

bigdecimal (1.2.4)
deep_merge (1.0.1)
facter (3.4.1)
hiera (3.2.1)
hiera-eyaml (2.1.0)
hiera-eyaml-gpg (0.6)
highline (1.6.21)
hocon (0.9.3)
io-console (0.4.3)
json (1.8.1)
minitest (4.7.5)
net-ssh (2.9.2)
psych (2.0.5)
puppet (4.6.1)
rake (10.1.0)
rdoc (4.1.0)
semantic_puppet (0.1.2)
stomp (1.3.3)
test-unit (2.1.9.0)
trollop (2.1.2)

# cat /etc/puppetlabs/code/hiera.yaml 
---
:backends:
  - yaml
  - eyaml
:hierarchy:
  - "%{::environment}/%{::trusted.certname}"
  - "%{::environment}"
  - common

:yaml:
  :datadir:  /etc/puppetlabs/code/hieradata
:eyaml:
  :datadir:  /etc/puppetlabs/code/hieradata

:merge_behavior: deeper

# /opt/puppetlabs/bin/puppet config print | grep hiera
data_binding_terminus = hiera
hiera_config = /etc/puppetlabs/code/hiera.yaml

when i run hiera manually looks like it is working:

# hiera 'profile::ruby::packages' environment=production
["ruby"]

here are manifests that are part of above error

# cat /etc/puppetlabs/code/modules/profile/manifests/base.pp
class profile::base {
    include profile::ruby

    $useful_packages = hiera("profile::useful::packages")
    package {$useful_packages:
        ensure => latest,
    }

}


# cat /etc/puppetlabs/code/modules/profile/manifests/ruby.pp
class profile::ruby (
    $packages = hiera('$profile::ruby::packages'),
    $version = hiera('$profile::ruby::version'),

) {
    package { $packages:
        ensure => $version
    }
}

Can anyone point what should be done to fix puppet.?

thanks

Wkg

puppet server error:

2016-09-20 10:11:13,245 DEBUG [qtp1550957461-29] [puppetserver] Puppet Performing a hiera indirector lookup of lookup_options with options {:variables=>Scope(Class[Profile::Ruby]), :merge=>#<Puppet::Pops::HashMergeStrategy:0xa42abb9 @options_t=#<Puppet::Pops::Types::PStructType:0x1f1803f2 @elements=[#<Puppet::Pops::Types::PStructElement:0x26e395c8 @key_type=#<Puppet::Pops::Types::POptionalType:0x277e916a @type=#<Puppet::Pops::Types::PStringType:0x667cda67 @values=["strategy"], @size_type=nil>>, @value_type=#<Puppet::Pops::Types::POptionalType:0x549a1432 @type=#<Puppet::Pops::Types::PPatternType:0x4fa40a02 @patterns=[#<Puppet::Pops::Types::PRegexpType:0x2bd7ac0f @regexp=/hash/, @pattern="hash">]>>>]>, @options={}>}
2016-09-20 10:11:13,245 DEBUG [qtp1550957461-29] [puppetserver] Puppet Performing a hiera indirector lookup of lookup_options with options {:variables=>Scope(Class[Profile::Ruby]), :merge=>#<Puppet::Pops::HashMergeStrategy:0xa42abb9 ...
(more)
edit retag flag offensive reopen merge delete

Closed for the following reason the question is answered, right answer was accepted by wkg21
close date 2016-09-21 03:24:31.480149

Comments

can you post the output of puppet config print | grep hiera

lupin gravatar imagelupin ( 2016-09-21 01:47:04 -0500 )edit

I found what was a problem one of the hiera yaml files had a tab instead spaces. thanks.

wkg21 gravatar imagewkg21 ( 2016-09-21 03:23:13 -0500 )edit