Can't undef only be used with the inheritance syntax?

The closest we have to initializing to undefined is an empty string  
('') - you can compare this quite easily in .6  - check the language  
tut - but you need to do a case/selector for comparism pre-.6

E.g.;
case $uid {
   '': {
     user { '..':
       other_params => whatever
     }
   }
   default: {
     user { '..':
       uid => $uid
     }
   }
}

On 4/11/2008, at 2:47 PM, "Paul Lathrop" <[EMAIL PROTECTED]> wrote:

>
> You want uid => undef
>
> --Paul
>
> On Mon, Nov 3, 2008 at 11:44 AM, Tim Harper <[EMAIL PROTECTED]>  
> wrote:
>>
>> I have a define that acts as a convenience wrapper around the user
>> type and a few other things.
>>
>> With the 'user' type, if don't pass the uid parameter, it will  
>> default
>> to let the system auto-assign it.  However, passing uid => null,
>> false, -1, etc all try and set a specific uid, which is obviously  
>> wrong.
>>
>> Am I up a creek without a paddle :)?  Anybody have any idea how to do
>> this?
>>
>> Here's what I have so far (it sucks, but it's the best I could do to
>> work around):
>>
>> define normal_user ( $ensure = present, $comment = "Puppet created
>> user", $groups = [], $default_password = false, $key_type = "ssh- 
>> rsa",
>> $key_name = "puppet-installed-key", $key = false, $uid = false,  
>> $gid =
>> false) {
>>  # how do you pass in a variable as undefined???
>>  if $uid {
>>    user { $title:
>>      ensure     => $ensure,
>>      comment    => $comment,
>>      home       => "/home/$title",
>>      managehome => true,
>>      groups     => $groups,
>>      gid        => $gid,
>>      uid        => $uid
>>    }
>>  } else {
>>    user { $title:
>>      ensure     => $ensure,
>>      comment    => $comment,
>>      home       => "/home/$title",
>>      managehome => true,
>>      groups     => $groups,
>>    }
>>  }
>>  if $key {
>>    ssh_authorized_key { $title: ensure => $ensure, type =>
>> $key_type, user => $title, name => $key_name, key => $key }
>>  }
>>  if $default_password {
>>    default_password { $title: password => $default_password }
>>  }
>> }
>>
>>
>>
>> Thanks!
>>
>> Tim
>>
>>>
>>
>
> >

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To post to this group, send email to puppet-users@googlegroups.com
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