On Wed, Aug 11, 2010 at 9:48 AM, Nan Liu <[email protected]> wrote:
> On Wed, Aug 11, 2010 at 11:55 AM, Jason Amato <[email protected]> wrote:
>>
>> How can I create a class to install a RPM based on the o/s type and
>> the o/s release.
>> I want to install a package on SLES, but only if it's release 11, not
>> 10.
>>
>
> I suppose you can write nested if statements. Not sure if there are other
> more elegant methods. Assuming facter $operatingsystemrelease for SLES 11
> returns 11.x,  is this what you are looking for?
>
> $os_release = "${operatingsystem}-${operatingsystemrelease}"
>
> $pkg = ${os_release} ? {
>   /^OEL-/ =>  redhat-lsb,
>   /^SLES-11./ =>  lsb,
>   default =>  redhat-lsb,
> }
>
> package { $pkg:
>   ensure => installed,
> }

Won't that try to install 'redhat-lsb' on SLES 10 ?

I think you want

ensure => undef

for SLES 10 if you truly want to not manage it.

I tend to be more of a fan of explicit conditional statements outside
resource definitions these days, nested selectors are harder to parse
quickly, and now we have decent conditional logic, it's much easier.



>
> Thanks,
>
> Nan
>
> --
> You received this message because you are subscribed to the Google Groups
> "Puppet Users" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/puppet-users?hl=en.
>



-- 
nigel

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.

Reply via email to