Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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?

share|improve this question
add comment

1 Answer

up vote 4 down vote accepted

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.

share|improve this answer
    
Very impressive! It worked! –  Sandra Aug 24 '12 at 23:12
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.