Jason Rojas wrote:
> On Nov 26, 2009, at 12:03 AM, David Schmitt wrote:
>
>> Douglas Garstang wrote:
>>> The docs at http://reductivelabs.com/trac/puppet/wiki/LanguageTutorial say:
>>>
>>> file { "/etc/config":
>>> owner => $operatingsystem ? {
>>> "sunos" => "adm",
>>> "redhat" => "bin",
>>> default => undef,
>>> },
>>> }
>>>
>>> I have this..
>>>
>>> file {
>>> "home_dirs":
>>> name => $domain ? {
>>> "corp.xxx.com" => "/u",
>>> "fr.xxx.com" => "/home",
>>> },
>>> ensure => directory;
>>> }
>>>
>>>
>>> As a result of this, on the remove end in the log files I see:
>>>
>>> (//Node[corporate_node]/ldap::client/File[home_dirs]/ensure) created
>>>
>>> which in my opinion is confusing and hard to read. I want to see:
>>>
>>> (//Node[corporate_node]/ldap::client/File[/home]/ensure) created
>>>
>>> How can I refactor the manifest to do this? Basically I want to remove
>>> the use of the symbolic 'home_dirs" name.
>>> $blah = $domain ? {
>>> "corp.xxx.com" => "/u",
>>> "fr.xxx.com" => "/home",
>>> }
>>> file {
>>> $blah:
>>> ensure => directory;
>>> }
>>
>> Regards, DavidS
>>
>>
>
> $blah = $domain ? {
> "corp.xxx.com" => "/u",
> "fr.xxx.com" => "/home",
> }
>
> file {
> $blah:
> ensure => directory;
> }
>
> That would work, however, if there was a ZZZ.xxx.com domain, it would fail.
> I suggest wrapping a case statement around the variable definition which
> would allow for a "default" value.
>
the ?{} selector also allows for default=> values.
Regards, D
--
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.