Issue #17638 has been updated by Kristian Kostecky.

How about:

--- provider/user/useradd.rb.orig       2013-07-09 16:13:41.000000000 -0400
+++ provider/user/useradd.rb    2013-07-09 16:07:21.000000000 -0400
@@ -84,6 +84,7 @@
   def deletecmd
     cmd = [command(:delete)]
     cmd += @resource.managehome? ? ['-r'] : []
+    cmd += @resource.force? ? ['-f'] : []
     cmd << @resource[:name]
   end

--- type/user.rb.orig   2013-07-09 16:11:05.000000000 -0400
+++ type/user.rb        2013-07-09 16:09:13.000000000 -0400
@@ -293,6 +293,15 @@
       defaultto false
     end

+    newparam(:force, :boolean => true) do
+      desc "Whether to force the removal of managed directories on user delete.
+        Defaults to `false`."
+
+      newvalues(:true, :false)
+
+      defaultto false
+    end
+
     newparam(:managehome, :boolean => true) do
       desc "Whether to manage the home directory when managing the user.
         Defaults to `false`."

----------------------------------------
Feature #17638: Ability to pass "-f" or "--force" options to user providers
https://projects.puppetlabs.com/issues/17638#change-94278

* Author: Nick Chappell
* Status: Investigating
* Priority: Normal
* Assignee: Nick Chappell
* Category: provider
* Target version: 
* Affected Puppet version: 
* Keywords: 
* Branch: 
----------------------------------------
The user resource should have the ability to specify a -f or --force option for 
the various user providers so that UID/GID changes or user deletions can be 
forced even if the user has processes currently running.

It could be implemented with something like this:

<pre>
User { ‘nick’:
    ensure => absent,
    force => true,
    #the normal options for user resources would go here
}
</pre>

Currently, if a user has processes running, a user deletion fails with an error 
similar to what is below (userdel binary on RHEL/CentOS):

<pre>
puppet-agent[4217]: (/User[xxxxxx]/ensure) change from present to absent 
failed: Could not delete user xxxxxx: 
  Execution of '/usr/sbin/userdel xxxxxx' returned 8: userdel: user xxxxxx is 
currently logged in
</pre>

The errors depend on the OS-specific providers that are called by Puppet. On a 
Solaris 10 machine, sysmgr gives the following error through Puppet if there is 
a UID/GID change and the user is logged in:

<pre>
change from 1117 to 133 failed: Could not set uid on user[sysmgr]: Execution of 
'/usr/sbin/usermod -u 133 sysmgr' returned 8: usermod: user sysmgr is currently 
logged in
</pre>


-- 
You have received this notification because you have either subscribed to it, 
or are involved in it.
To change your notification preferences, please click here: 
http://projects.puppetlabs.com/my/account

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Bugs" 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-bugs.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to