[Pkg-puppet-devel] [SCM] Puppet packaging for Debian branch, master, updated. debian/0.24.6-1-356-g5718585

James Turnbull james at lovedthanlost.net
Fri Jan 23 14:20:54 UTC 2009


The following commit has been merged in the master branch:
commit 0705dfb462b145ac9e4faafc517bbb833f2c81b9
Author: James Turnbull <james at lovedthanlost.net>
Date:   Sat Sep 6 09:52:26 2008 +1000

    Fixes #1455 - Adds HP-UX support for user type

diff --git a/CHANGELOG b/CHANGELOG
index 15f681e..2df61d8 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,4 +1,6 @@
 0.24.x
+    Fixes #1455 - Adds HP-UX support for user type
+
     Fixes #1551 puppetmaster.freshness xmlrpc call returns incorrect type
 
     Fixes #1554 - Fix exception for undefined hostname
diff --git a/lib/puppet/provider/user/hpux.rb b/lib/puppet/provider/user/hpux.rb
new file mode 100644
index 0000000..d50924c
--- /dev/null
+++ b/lib/puppet/provider/user/hpux.rb
@@ -0,0 +1,29 @@
+Puppet::Type.type(:user).provide :hpuxuseradd, :parent => :useradd do
+    desc "User management for hp-ux! Undocumented switch to special usermod because HP-UX regular usermod is TOO STUPID to change stuff while the user is logged in."
+
+    defaultfor :operatingsystem => :"hp-ux"
+
+    commands :modify => "/usr/sbin/usermod", :delete => "/usr/sbin/userdel", :add => "/usr/sbin/useradd"
+    options :comment, :method => :gecos
+    options :groups, :flag => "-G"
+    options :home, :flag => "-d", :method => :dir
+
+    verify :gid, "GID must be an integer" do |value|
+        value.is_a? Integer
+    end
+
+    verify :groups, "Groups must be comma-separated" do |value|
+        value !~ /\s/
+    end
+
+    has_features :manages_homedir, :allows_duplicates
+
+    def deletecmd
+	super.insert(1,"-F")
+    end
+
+    def modifycmd(param,value)
+	super.insert(1,"-F")
+    end
+
+end
diff --git a/spec/unit/provider/user/useradd.rb b/spec/unit/provider/user/hpux.rb
similarity index 59%
copy from spec/unit/provider/user/useradd.rb
copy to spec/unit/provider/user/hpux.rb
index 96a7855..8b31658 100755
--- a/spec/unit/provider/user/useradd.rb
+++ b/spec/unit/provider/user/hpux.rb
@@ -2,30 +2,28 @@
 
 require File.dirname(__FILE__) + '/../../../spec_helper'
 
-provider_class = Puppet::Type.type(:user).provider(:useradd)
+provider_class = Puppet::Type.type(:user).provider(:hpuxuseradd)
 
 describe provider_class do
+    # left from the useradd test... I have no clue what I'm doing.
     before do
         @resource = stub("resource", :name => "myuser", :managehome? => nil)
         @provider = provider_class.new(@resource)
     end
 
-    # #1360
-    it "should add -o when allowdupe is enabled and the user is being created" do
+    it "should add -F when modifying a user" do
         @resource.stubs(:should).returns "fakeval"
         @resource.stubs(:[]).returns "fakeval"
-        @resource.expects(:allowdupe?).returns true
-        @provider.expects(:execute).with { |args| args.include?("-o") }
+        @provider.expects(:execute).with { |args| args.include?("-F") }
 
-        @provider.create
+        @provider.modify
     end
 
-    it "should add -o when allowdupe is enabled and the uid is being modified" do
+    it "should add -F when deleting a user" do
         @resource.stubs(:should).returns "fakeval"
         @resource.stubs(:[]).returns "fakeval"
-        @resource.expects(:allowdupe?).returns true
-        @provider.expects(:execute).with { |args| args.include?("-o") }
+        @provider.expects(:execute).with { |args| args.include?("-F") }
 
-        @provider.uid = 150
+        @provider.delete
     end
 end

-- 
Puppet packaging for Debian



More information about the Pkg-puppet-devel mailing list