On Jan 12, 2009, at 7:14 PM, chakkerz wrote: > > Hello again > > My yaml file for puppetslave contains the fact: > [r...@puppetbeta manifests]# grep deploysudoers /var/lib/puppet/yaml/ > facts/puppetslave.its.uq.edu.au.yaml > deploysudoers: "false" > > which i note is a string (quotes), not a true / false / boolean ... so > i've fixed my fact by changing my module's init.pp (note the string > comparison): > > class sudoers-linux > { > if $deploysudoers == "true" > { > file > { "/etc/sudoers": > owner => root, > group => root, > mode => 440, > source => "puppet:///shared/etc/sudoers", > } > } > else > { > file > { "/etc/sudoers": > owner => root, > group => root, > mode => 440, > } > } > }
BTW, to remove this code duplication, look into resource overrides in the language reference. > > I've verified that this works as expected by removing / creating the > file which the fact checks exists. The first example at > http://reductivelabs.com/trac/puppet/wiki/LanguageTutorial#if-else > seems to indicate that $variable can be a boolean but i don't see how > i can get a boolean out of a facter. Is there a way? Hmm, I would have thought it would remain a boolean, but in thinking about it, I think Puppet converts everything to a string. I guess that conversion should be modified to leave 'false' and 'true' alone. > > Although it is working, i would really like to have a boolean instead > of a string, because it worries me that someone somwhere (ruby or > facter) could decide that that should be "TRUE" instead of "true" ... > which could foreseeably mean an update might do damage... Could you file a bug about this? -- An expert is a person who has made all the mistakes that can be made in a very narrow field. - Niels Bohr --------------------------------------------------------------------- Luke Kanies | http://reductivelabs.com | http://madstop.com --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---