Issue #13594 has been updated by Patrick Carlisle.

Status changed from Unreviewed to Investigating
Assignee set to Patrick Carlisle

You could inherit from useradd and then just override chage and the options, 
but I don't know if you'd then be able to remove the features that you've 
commented out (i think probably not). Otherwise it seems like you're more or 
less on the right track.
----------------------------------------
Bug #13594: netbsd support
https://projects.puppetlabs.com/issues/13594#change-59701

Author: matthew sporleder
Status: Investigating
Priority: Normal
Assignee: Patrick Carlisle
Category: 
Target version: 
Affected Puppet version: 
Keywords: netbsd user provider
Branch: 


So far NetBSD basically works but the first hurdle is finding a working user 
provider.

useradd works except for 'chage'.  usermod the same stuff as chage, but might 
be less convenient.

I patched useradd.rb to make useradd_netbsd.rb like this* but I was wondering 
if there wasn't an easier way to override has_features or have usermod as an 
alternative to chage.

*
<pre>
--- useradd.rb  2012-03-24 08:04:50.000000000 -0400
+++ useradd_netbsd.rb   2012-04-02 19:37:19.000000000 -0400
@@ -1,17 +1,17 @@
 require 'puppet/provider/nameservice/objectadd'
 
-Puppet::Type.type(:user).provide :useradd, :parent => 
Puppet::Provider::NameService::ObjectAdd do
+Puppet::Type.type(:user).provide :useradd_netbsd, :parent => 
Puppet::Provider::NameService::ObjectAdd do
   desc "User management via `useradd` and its ilk.  Note that you will need to
     install Ruby's shadow password library (often known as `ruby-libshadow`)
     if you wish to manage user passwords."
 
-  commands :add => "useradd", :delete => "userdel", :modify => "usermod", 
:password => "chage"
+  commands :add => "useradd", :delete => "userdel", :modify => "usermod", 
:password => "usermod"
 
   options :home, :flag => "-d", :method => :dir
   options :comment, :method => :gecos
   options :groups, :flag => "-G"
-  options :password_min_age, :flag => "-m"
-  options :password_max_age, :flag => "-M"
+  options :password_min_age, :flag => "-e"
+  options :password_max_age, :flag => "-f"
 
   verify :gid, "GID must be an integer" do |value|
     value.is_a? Integer
@@ -23,7 +23,7 @@
 
   has_features :manages_homedir, :allows_duplicates, :manages_expiry, 
:system_users
 
-  has_features :manages_passwords, :manages_password_age if 
Puppet.features.libshadow?
+#  has_features :manages_passwords, :manages_password_age if 
Puppet.features.libshadow?
 
   def check_allow_dup
     @resource.allowdupe? ? ["-o"] : []
</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 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-bugs?hl=en.

Reply via email to