Thank you for the reply, however I do not see where that resolves the 
dependency problem. Let me paste what I've been playing with as maybe that 
will clarify my problem:

class admins($username, $ensure='present') {
  if $ensure == 'present' {
    $dirensure = 'directory'
  }
  elsif $ensure == 'absent' {
    $dirensure = "$ensure"
  }
  file { "${homedir}/${username}":
    owner => "$username",
    group => "$username",
    ensure => directory,
    mode => 700,
  }
  file { "${homedir}/${username}/somedir":
    owner => "$username",
    group => "$username",
    ensure => "$dirensure",
    mode => 700,
  }
  user { "$username":
    ensure => "$ensure",
    home   => "${homedir}/${username}",
    shell => "$shell",
  }
}

Puppet apply does as expected when called as
class { 'users': username => 'testuser', ensure => 'present' }

but when removing a user with:
class { 'users': username => 'testuser', ensure => 'absent' }

I get the following error:

debug: User[testuser](provider=useradd): Executing '/usr/sbin/userdel 
testuser'
notice: /Stage[main]/Users/User[testuser]/ensure: removed
err: /Stage[main]/Users/File[/home/testuser]: Could not evaluate: Could not 
find user testuser
notice: /Stage[main]/Users/File[/home/testuser/somedir]: Dependency 
File[/home/testuser] has failures: true
warning: /Stage[main]/Users/File[/home/testuser/somedir]: Skipping because 
of failed dependencies

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/puppet-users/-/w913Sj-Bv5IJ.
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