I am trying to handle in my user class assigning user to groups, and 
handling that some groups might not be defined for that node.  Example here 
is handling a non-datase node,


"juser" fails with  "Error: Failed to apply catalog: Parameter groups 
failed on User[juser]: Group names must not be empty. If you want to 
specify "no groups" pass an empty array" even in the notice and logs the 
correct value ("wheel") is logged?  


I was inital just planning on passing undef variables, but the dont seems 
to undefined (see the second example (hsmith)


Any suggestions on either fixing the empty groups issue ora  better 
handling groups that are not part of this node would be greatly appreciated.



Thanks


my user class
....

  $default_groups = [ 'wheel' ]
  # db_user will be "undef" and it need to be a empty string
  if defined(Class['mysql']) {
    $db_group = $mysql::params::group
  } else {
    $db_group = ''
  }

  $all_groups = [ $default_groups, $db_group ]

  notice "All: <${all_groups}>"  # This logs correctly     
"Scope(Class[User::Users]) (notice): All: <wheel>"

  #fails, but the "notice" function does correctly log the correct groups 
value
  @user::virtual{ 'juser':   groups => $all_groups }
  
  #fails, even though mysql::params is never include, it is defined... 
 maybe autoloaded?
  @user::virtual{ 'hsmith':  groups => [ 'wheel', $mysql::params::group ] }



Here is the virtual class

define  user::virtual ( $groups = [] ) {

  $user = hiera($title,nil,"${environment}/user")

  notice "Virt: <${groups}>"     #log correcly   
Scope(User::Virtual[juser]) (notice): Virt: <wheel>

  user { $title:
    ensure            =>  'present',
    uid               =>  $user['uid'],
    gid               =>  $title,
    groups            =>  $groups,  # also tried [ $groups ], same result
    shell             =>  '/bin/bash',
    home              =>  "/home/${title}",
    comment           =>  $user['comment'],
    password          =>  $user['hash'],
    managehome        =>  true,
    require           =>  Group[$title],
  }
...






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


Reply via email to