On Dec 18, 2011, at 6:06 PM, Trevor Vaughan wrote:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> The problem with this is that, should someone forget that default in the 
> 'defaults' file (or wherever), then the entire manifest explodes over an
> entry that I don't care about unless it exists.
> 

One way this can be a bit easier is you can put the default in the extlookup 
call itself so it does not require someone to update a separate defaults file, 
but just to write the correct lookup. This makes it less likely to blow up (but 
certainly doesn't prevent it)

For example:

  $vpnaccess = extlookup("vpnaccess", 0)
  case  $vpnaccess {
    '0': { $role_vpngateway = false }
    '1': { $role_vpngateway = true }
  }

This tests for the default value and also does the 0 => false conversion. 

The case this doesn't work for is when you really want the variable to not have 
to exist, so you can use a variable if it exists, or ignore it if it doesn't. 
But it does handle some of the cases. 


> Basically, I want some logic to say: *If* we have extlookup data 'foo', then 
> do something. Otherwise, skip. But I can't currently do that.
> 

I agree this is useful, as I've run into the same problem lots of times, 

Cheers,

Jonathan

-------------------------------------------------------------------------------
Jonathan Stanton         jonat...@spreadconcepts.com
Spread Group Messaging  www.spread.org
Spread Concepts LLC     www.spreadconcepts.com
-------------------------------------------------------------------------------


> 

> 
> On 12/16/2011 04:02 PM, R.I.Pienaar wrote:
>> 
>> 
>> ----- Original Message -----
>>> So, I tried to use extlookup and ended up with a typo that made my
>>> configuration explode with a missing label error.
>>> 
>>> So, how would one go about making a label optional? As in, try to
>>> look
>>> it up, but I don't really care if you fail as I'll just do something
>>> else.
>> 
>> you can tell extlookup to return some expected default when nothing is found
>> and just check for that?
>> 
> 
> - -- 
> Trevor Vaughan
> Vice President, Onyx Point, Inc.
> email: tvaug...@onyxpoint.com
> phone: 410-541-ONYX (6699)
> pgp: 0x6C701E94
> 
> - -- This account not approved for unencrypted sensitive information --
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.11 (GNU/Linux)
> 
> iQEcBAEBAgAGBQJO7nIJAAoJECNCGV1OLcypj3UIAKDMQCEqHannj5NlvB91DCLo
> rAZBCTbKvkOjHnShjG8Xtf7AmfzZTOHYtAvprTPcIfOITLDwlljTaS2RA+P5d8pq
> 4p2jfeUJMZGnrv8RHy7qo0w3Liuz4jlZhtW7j2XGHaYtXh7KPZZFDtk7ozdBQmGa
> FfFpAPrZuMZ3ODWIX1RUSmoB76s8iujh6LJ+sVZohYNUvVMhte8kAkLIE8R7U6Cb
> m9r4kq+S5NGB7h/OZwHUxE+ESiMYHF18l+zIHsyaR0RA1qsbgvl1sXPgtWWZu67E
> sptHZJ2JNNhPdOQEpyuMj18LYjitD6CnPllAE/tKj6SRoJmo4M9lrb2jhqSuIiI=
> =Ivxk
> -----END PGP SIGNATURE-----
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Puppet Users" group.
> To post to this group, send email to puppet-users@googlegroups.com.
> To unsubscribe from this group, send email to 
> puppet-users+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/puppet-users?hl=en.
> 

<<attachment: tvaughan.vcf>>

> 

Attachment: smime.p7s
Description: S/MIME cryptographic signature

Reply via email to