diff options
| author | luke <luke@980ebf18-57e1-0310-9a29-db15c13687c0> | 2005-09-17 15:06:48 +0000 |
|---|---|---|
| committer | luke <luke@980ebf18-57e1-0310-9a29-db15c13687c0> | 2005-09-17 15:06:48 +0000 |
| commit | 6654c4cb44a0043314b2cb5cbefe3f6c1529aa23 (patch) | |
| tree | 253b5bc18755bf23616fb875c1407d36e15be634 | |
| parent | 106d397bc0de9512b24724c5b3ed95db501671ea (diff) | |
| download | puppet-6654c4cb44a0043314b2cb5cbefe3f6c1529aa23.tar.gz puppet-6654c4cb44a0043314b2cb5cbefe3f6c1529aa23.tar.xz puppet-6654c4cb44a0043314b2cb5cbefe3f6c1529aa23.zip | |
fixing users on normal machines
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@685 980ebf18-57e1-0310-9a29-db15c13687c0
| -rwxr-xr-x | lib/puppet/type/user.rb | 14 | ||||
| -rwxr-xr-x | test/types/tc_user.rb | 6 |
2 files changed, 16 insertions, 4 deletions
diff --git a/lib/puppet/type/user.rb b/lib/puppet/type/user.rb index 43374d1f4..c0e82a2e3 100755 --- a/lib/puppet/type/user.rb +++ b/lib/puppet/type/user.rb @@ -65,12 +65,24 @@ module Puppet def should=(gid) method = :getgrgid - if gid.is_a?(String) + case gid + when String if gid =~ /^[-0-9]+$/ gid = Integer(gid) else method = :getgrnam end + when Integer + unless gid >= 0 + raise Puppet::Error, "GIDs must be positive" + end + when Symbol + unless gid == :auto or gid == :notfound + raise Puppet::DevError, "Invalid GID %s" % gid + end + # these are treated specially by sync() + @should = gid + return end # FIXME this should really check to see if we already have a diff --git a/test/types/tc_user.rb b/test/types/tc_user.rb index c3b518542..057cd40e0 100755 --- a/test/types/tc_user.rb +++ b/test/types/tc_user.rb @@ -72,7 +72,7 @@ class TestUser < TestPuppet else def missing?(user) begin - obj = Etc.getgrnam(user) + obj = Etc.getpwnam(user) return false rescue ArgumentError return true @@ -81,11 +81,11 @@ class TestUser < TestPuppet def current?(param, name) state = Puppet::Type::User.states.find { |st| - state.name == param + st.name == param } assert_nothing_raised { - obj = Etc.getgrnam(name) + obj = Etc.getpwnam(name) return obj.send(state.posixmethod) } |
