Thanks Krzysztof. It successfully runs now, but output is misleading on subsequent runs:
build ~]# puppet agent -tv Info: Retrieving plugin Info: Caching catalog for build Info: Applying configuration version '1349482471' /Stage[main]/Baseline-testing::Ntpd/Package[ntp]/ensure: ensure changed '4.2.4p8-2.el6' to 'purged' Finished catalog run in 6.10 seconds build ~]# build ~]# puppet agent -tv Info: Retrieving plugin Info: Caching catalog for build Info: Applying configuration version '1349482471' /Stage[main]/Baseline-testing::Ntpd/Package[ntp]/ensure: created Finished catalog run in 1.10 seconds build ~]# build ~]# rpm -q ntp package ntp is not installed The only class being called for the 'build' node is 'baseline-testing::ntpd', which only ensures that the NTP package is removed (the 8 lines of code you recommended). It does remove the package, but I don't know why it mentions creating it upon the second run, even though it does not actually get re-installed. Maybe traditional 'if' statements are advised. ~Matt On Friday, October 5, 2012 11:09:03 AM UTC-4, Krzysztof Wilczynski wrote: > > Hey, > > This selector expects to get a true boolean value e.g. true / false > (TrueClass / FalseClass in Ruby) and that is why it is failing, since you > are passing a string "true" from the fact (and all values coming from > Facter are strings, even numeric values). > > Grab this: > > > https://raw.github.com/kwilczynski/puppet-functions/master/lib/puppet/parser/functions/str2bool.rb > > And then try: > > class baseline-testing::ntpd { > package { "ntp": > ensure => str2bool($is_virtual) ? { > false => present, > true => purged > } > } > } > > Hope that helps :) > > KW > > On Wednesday, October 3, 2012 2:43:01 AM UTC+1, Matt wrote: >> >> I too have been pushed into Puppet 3.0. Clients and PuppetMaster are now >> at 3.0.0. Not sure if this is a version change or syntax error that I am >> experiencing. We'll use 'ntp' as the example and the "build" host is a VM. >> >> The old way: >> >> class baseline::ntpd { >> package { "ntp": >> ensure => $virtual ? { >> physical => present, >> vmware => purged, >> default => present >> } >> } >> >> On the client, it always says that it is created, even though it's not >> present: >> >> [root@build ~]# puppet agent -tv >> Info: Retrieving plugin >> Info: Caching catalog for build >> Info: Applying configuration version '1349227476' >> /Stage[main]/Baseline::Ntpd/Package[ntp]/ensure: created >> Finished catalog run in 1.46 seconds >> [root@build ~]# >> [root@build ~]# rpm -q ntp >> package ntp is not installed >> [root@build ~]# >> >> >> >> When trying the $is_virtual facter...... >> >> class baseline-testing::ntpd { >> package { "ntp": >> ensure => $is_virtual ? { >> false => present, >> true => purged >> } >> } >> } >> >> >> On client: >> >> [root@build ~]# puppet agent -tv >> Info: Retrieving plugin >> Error: Could not retrieve catalog from remote server: Error 400 on >> SERVER: No matching value for selector param 'true' at >> /etc/puppet/manifests/classes/baseline_linux-testing.pp:35 on node build >> [root@build ~]# >> [root@build ~]# facter | grep virtual >> is_virtual => true >> virtual => vmware >> > -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/8JkoXA2w8Q0J. 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.