How would I represent an undef in hiera such that a class parameter will be 
populated as undef? Like this, but in hiera:

#class testing::cwood1 ( $param1 = undef ) {
class testing::cwood1 ( $param1 ) {
  if str2bool($param1) {
    notify { 'mn':
      message => "param1 is ${param1}"
    }
  }
}

I'm dealing with a config file template where most options are always turned 
off. I'm also trying to get our puppet agent runs to fail with catalog 
compilation errors if they can't look up a hiera value, so there are no default 
values in the class parameters. (Exploring if catalog compilation failure is 
safer than the possibility of populating a config with default values.)

If I could list a bunch of obvious 'undef' style items in hiera that might be 
handier than listing 'false', given that the meaning of 'configitem=false' is 
different in this config than an absent configitem.

Details:

In the node yaml doing ~ or null both give me the same result.

testing::cwood1::param1: ~

But that parameter isn't looked up.

Feb  9 10:18:55 pt1 puppet-agent[22696]: Could not retrieve catalog from remote 
server: Error 400 on SERVER: Must pass param1 to Class[Testing::Cwood1] at 
/etc/puppet/environments/production/modules/testing/manifests/init.pp:3 on node 
pt1.hostopia.com

I've checked that the yaml is readable by ruby and the appropriate key shows up 
with pp as 

 "testing::cwood1::param1"=>nil}

so not sure what is up here.

When I use the empty string in the yaml the puppet catalog applies but I do not 
see anything in the log (so the class parameter was accepted).

testing::cwood1::param1: ''

Not really sure if I'm just mucking about with edge cases and should 
special-case my template or what. (http://yaml.org/type/null.html)

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/20150209163717.GA26376%40iniquitous.heresiarch.ca.
For more options, visit https://groups.google.com/d/optout.

Reply via email to