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/-/GUQ5PMTcO9wJ.
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.

Reply via email to