2

Background

I would like to apply this idea of having a common class that includes all the specific info about my setup.

So I have created /etc/puppet/modules/common/manifests/init.pp with

class common { include common::data }
class common::data { $ntpServerList = [ 'ntp51.ex.com','ntp3.ex.com' ] }

and installed this ntp module and have created a node like so

node testip {
  include myconfig::ntpp
}

Problem

/etc/puppet/modules/myconfig/manifests/init.pp contains

class myconfig::ntpp {
  include common
  class {'ntp':
      server_list => $ntpServerList
#          server_list => ['ntp.ex.com']    # this works
  }
}

and I would have expected that $ntpServerList would be available, but it isn't. The error is

Error: Could not retrieve catalog from remote server: Error 400 on SERVER: Failed to parse template ntp/ntp.conf.erb:
  Filepath: /usr/lib/ruby/site_ruby/1.8/puppet/parser/templatewrapper.rb
  Line: 64
  Detail: Could not find value for 'server_list' at /etc/puppet/modules/ntp/templates/ntp.conf.erb:25
 at /etc/puppet/modules/ntp/manifests/init.pp:183 on node testip

Question

Can anyone figure out what is wrong with my myconfig::ntpp class?

Sandra
  • 10,303
  • 38
  • 112
  • 165

1 Answers1

4

You need to fully qualify your variables; $common::data::ntpServerList.

As it is, your code is looking for a variable called ntpServerList in the local scope ($myconfig::ntpp::ntpServerList) which doesn't exist, so it falls back to the top scope ($::ntpServerList) where it also doesn't exist.

See here for more details.

phemmer
  • 5,909
  • 2
  • 27
  • 36