very interesting. Maybe I need to just bite the bullet and use hiera.

On Tuesday, March 11, 2014 11:00:46 AM UTC-5, David Schmitt wrote:
>
> What about using hiera: 
>
> data.yaml: 
> --- 
> client::dev::sw::server_name: ws.foo.bar 
>
> pp: 
> $server_name = 
> hiera("client::${::client}::${::env}::${name}::server_name", "default 
> value") 
>
> Regards, David 
>
> On 2014-03-11 16:34, Steve Neuharth wrote: 
> > this works: 
> > 
> >  # set up our servername 
> >  if $web_conf[$::client] { 
> >  if $web_conf[$::client][$::env] { 
> >  if $web_conf[$::client][$::env][$name] { 
> >  if $web_conf[$::client][$::env][$name]['server_name'] { 
> >  $server_name = $web_conf[$::client][$::env][$name]['server_name'] 
> >  } else { 
> >  $server_name = "${name}.${client_code}.${::env}.${domain}" 
> >  } 
> >  } else { 
> >  $server_name = "${name}.${client_code}.${::env}.${domain}" 
> >  } 
> >  } else { 
> >  $server_name = "${name}.${client_code}.${::env}.${domain}" 
> >  } 
> >  } else { 
> >  $server_name = "${name}.${client_code}.${::env}.${domain}" 
> >  } 
> > 
> > but it's SO UGLY. Any recommendations on making it prettier? 
> > 
> > On Monday, March 10, 2014 3:42:36 PM UTC-5, Steve Neuharth wrote: 
> > 
> >> I've got a big hash of info that looks like this: 
> >> 
> >> $web_conf = { 
> >> my_client => { 
> >> dev => { 
> >> ws => { 
> >> server_name => 'ws.foo.bar', 
> >> server_aliases => ['ws.dev.bar.foo.com [1]', 
> >> 'ws.dev.another.foo.com [2]'], 
> >> }, 
> >> csr => { 
> >> server_aliases => ['csr.dev.bar.foo.com [3]', 
> >> 'csr.dev.another.foo.com [4]'], 
> >> }, 
> >> mw => { 
> >> server_aliases => ['mw.dev.bar.foo.com [5]', 
> >> 'mw.dev.another.foo.com [6]'], 
> >> }, 
> >> }, 
> >> } 
> >> 
> >> I'm trying to do something like this in my manifest: 
> >> 
> >> # set up our servername 
> >> if $web_conf[$::client][$::env][$name]['server_name'] { 
> >> $server_name = $web_conf[$::client][$::env][$name]['server_name'] 
> >> } else { 
> >> $server_name = "${name}.${client_code}.${::env}.${domain}" 
> >> } 
> >> 
> >> The thought was that I'd have servers that follow a certain naming 
> >> convention and ones that don't. The ones that have 'special' names 
> >> go in the web_conf hash. If the manifest 'sees' a server name in the 
> >> hash, it should use that. If not, then it just does the 'else' bit. 
> >> 
> >> The trouble is that it totally fails if even the top or intermediate 
> >> levels of the hash don't exist. I've tried using "if 
> >> $web_conf[$::client][$::env][$name]['server_name'] != undef", tried 
> >> "if undef($web_conf[$::client][$::env][$name]['server_name'])" etc. 
> >> 
> >> what's the correct way to do this? 
> >> --steve 
> > 
> >  -- 
> >  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 [email protected] <javascript:> [7]. 
> >  To view this discussion on the web visit 
> > 
> > 
> https://groups.google.com/d/msgid/puppet-users/3355ea2c-0aae-436b-9098-d98a7de54dfb%40googlegroups.com
>  
> > [8]. 
> >  For more options, visit https://groups.google.com/d/optout [9]. 
> > 
> > 
> > Links: 
> > ------ 
> > [1] 
> > 
> > 
> http://www.google.com/url?q75http%3A%2F%2Fws.dev.bar.foo.com46sa75D46sntz�75146usg75AFQjCNFmX6cyyTaccoxrdubRxxpiElZdiA
>  
>
> > [2] 
> > 
> > 
> http://www.google.com/url?q75http%3A%2F%2Fws.dev.another.foo.com46sa75D46sntz�75146usg75AFQjCNH3NlITRPS_yRUnnGBU5opR17P7qw
>  
>
> > [3] 
> > 
> > 
> http://www.google.com/url?q75http%3A%2F%2Fcsr.dev.bar.foo.com46sa75D46sntz�75146usg75AFQjCNFFDzU4C1eUsUjzElCeOoQ3wAfpDw
>  
>
> > [4] 
> > 
> > 
> http://www.google.com/url?q75http%3A%2F%2Fcsr.dev.another.foo.com46sa75D46sntz�75146usg75AFQjCNGdGhCjs7JRYmkLXmT3Z194V2MkBw
>  
>
> > [5] 
> > 
> > 
> http://www.google.com/url?q75http%3A%2F%2Fmw.dev.bar.foo.com46sa75D46sntz�75146usg75AFQjCNHrYg2mzHmEkTedOjOqvRgIOOiEdA
>  
>
> > [6] 
> > 
> > 
> http://www.google.com/url?q75http%3A%2F%2Fmw.dev.another.foo.com46sa75D46sntz�75146usg75AFQjCNF0vYQdfXCDOt2znwABX_D1peMUvw
>  
>
> > [7] mailto:[email protected] <javascript:> 
> > [8] 
> > 
> > 
> https://groups.google.com/d/msgid/puppet-users/3355ea2c-0aae-436b-9098-d98a7de54dfb%40googlegroups.com?utm_medium=email&utm_source=footer
>  
> > [9] https://groups.google.com/d/optout 
>
>

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/d9c3d4fa-36e5-47b8-9b1a-7b7e108ae4d2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to