summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorluke <luke@980ebf18-57e1-0310-9a29-db15c13687c0>2006-11-09 22:50:34 +0000
committerluke <luke@980ebf18-57e1-0310-9a29-db15c13687c0>2006-11-09 22:50:34 +0000
commit10634d69c654686d05f34a39e1ba1c603a13a3cb (patch)
treed23064e13d0c7a9783c21427b1e31ad9dc5aa3a6
parent349e2aabe04a770e277b1a0a36cf180610f7f5b3 (diff)
downloadpuppet-10634d69c654686d05f34a39e1ba1c603a13a3cb.tar.gz
puppet-10634d69c654686d05f34a39e1ba1c603a13a3cb.tar.xz
puppet-10634d69c654686d05f34a39e1ba1c603a13a3cb.zip
Fixing #324. Mkusers was not specifically ignoring the root user, and it is now.
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@1851 980ebf18-57e1-0310-9a29-db15c13687c0
-rw-r--r--lib/puppet/config.rb3
-rwxr-xr-xtest/other/config.rb42
2 files changed, 45 insertions, 0 deletions
diff --git a/lib/puppet/config.rb b/lib/puppet/config.rb
index 5725bcd93..9a381585a 100644
--- a/lib/puppet/config.rb
+++ b/lib/puppet/config.rb
@@ -411,6 +411,9 @@ class Config
# If a user and/or group is set, then make sure we're
# managing that object
if obj.respond_to? attr and name = obj.send(attr)
+ # Skip root or wheel
+ next if %w{root wheel}.include?(name.to_s)
+
# Skip owners and groups we've already done, but tag
# them with our section if necessary
if done[type].include?(name)
diff --git a/test/other/config.rb b/test/other/config.rb
index 3b8c08ff8..1ce82c19d 100755
--- a/test/other/config.rb
+++ b/test/other/config.rb
@@ -853,6 +853,48 @@ inttest = 27
assert_equal("footest", config[:blocktest2])
assert_equal("footest", testing)
end
+
+ def test_no_modify_root
+ config = mkconfig
+ config.setdefaults(:yay,
+ :mydir => {:default => tempfile(),
+ :mode => 0644,
+ :owner => "root",
+ :group => "root",
+ :desc => "yay"
+ },
+ :mkusers => [false, "yay"]
+ )
+
+ assert_nothing_raised do
+ config.use(:yay)
+ end
+
+ # Now enable it so they'll be added
+ config[:mkusers] = true
+
+ comp = config.to_component
+ comp.each do |c|
+ puts c.ref
+ end
+
+ Puppet::Type.type(:user).each do |u|
+ assert(u.name != "root", "Tried to manage root user")
+ end
+ Puppet::Type.type(:group).each do |u|
+ assert(u.name != "root", "Tried to manage root group")
+ assert(u.name != "wheel", "Tried to manage wheel group")
+ end
+
+# assert(yay, "Did not find yay component")
+# yay.each do |c|
+# puts c.ref
+# end
+# assert(! yay.find { |o| o.class.name == :user and o.name == "root" },
+# "Found root user")
+# assert(! yay.find { |o| o.class.name == :group and o.name == "root" },
+# "Found root group")
+ end
end
# $Id$