logo       

Re: Boolean expressions: msg#00299

sysutils.puppet.user

Subject: Re: Boolean expressions

The complication (and apologies for the lousy Outlook-style quoting) is
that if $group was set to anything other than "root" then it should be
left alone.

I've tried the obvious stuff like:

if $group = "root" and $operatingsystem = "freebsd" {}

(with variations of "==" and "&&", because even that doesn't appear to
be documented, the only example in the docco is of the "if $var {}"
form).

I've also tried:

if $group = "root" {
$group = $operatingsystem ? {
"freebsd" => "wheel",
"default" => "root"
}
}

But that's failing on the initial if too so clearly I need to figure
that bit out first.

Had trouble with something similar last week and cheated by using "case"
instead, but I'd rather just get this right.

Matt

-----Original Message-----
From: puppet-users-bounces@xxxxxxxxxxx
[mailto:puppet-users-bounces@xxxxxxxxxxx] On Behalf Of Adrian Phillips
Sent: Monday, 29 October 2007 4:55 PM
To: Puppet User Discussion
Subject: Re: [Puppet-users] Boolean expressions

>>>>> "Matt" == McLeod, Matt <Matt.McLeod@xxxxxxx> writes:

Matt> The big hitch now is that FreeBSD, of course, doesn't do the
Matt> "root" group. It wants "wheel". So I figure what I want to
Matt> do is take a look at $group and $operatingsystem, and if
Matt> need be translate "root" to "wheel". I really don't want to
Matt> be specifying the group on every file.

I think (me newbie) you want the following ,
http://reductivelabs.com/trac/puppet/wiki/LanguageTutorial#selectors
:-

group => $os ? {
freebsd => "wheel",
default => "root",
}

Sincerely,

Adrian Phillips

--
Who really wrote the works of William Shakespeare ?
http://www.pbs.org/wgbh/pages/frontline/shakespeare/
_______________________________________________
Puppet-users mailing list
Puppet-users@xxxxxxxxxxx
https://mail.madstop.com/mailman/listinfo/puppet-users


<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise