[Pkg-puppet-devel] [SCM] Puppet packaging for Debian branch, upstream, updated. 0.25.5-639-g8f94f35
test branch
puppet-dev at googlegroups.com
Wed Jul 14 10:34:31 UTC 2010
The following commit has been merged in the upstream branch:
commit 2396ebac9021eaa4a2983e60902c04cc9e0db0ee
Author: Markus Roberts <Markus at reality.com>
Date: Wed Jun 9 17:47:39 2010 -0700
Use the 'root' feature rather than directly checking the uid
Jesse fixed all these but David and others moved them and introduced some more so...
diff --git a/lib/puppet/provider/file/posix.rb b/lib/puppet/provider/file/posix.rb
index 6d6e231..43b745d 100644
--- a/lib/puppet/provider/file/posix.rb
+++ b/lib/puppet/provider/file/posix.rb
@@ -42,7 +42,7 @@ Puppet::Type.type(:file).provide :posix do
return true if uid == current
end
- unless Puppet::Util::SUIDManager.uid == 0
+ unless Puppet.features.root?
warnonce "Cannot manage ownership unless running as root"
return true
end
diff --git a/lib/puppet/provider/file/win32.rb b/lib/puppet/provider/file/win32.rb
index 8eeef44..b19bd0c 100644
--- a/lib/puppet/provider/file/win32.rb
+++ b/lib/puppet/provider/file/win32.rb
@@ -29,7 +29,7 @@ Puppet::Type.type(:file).provide :win32 do
return true if uid == current
end
- unless Puppet::Util::SUIDManager.uid == 0
+ unless Puppet.features.root?
warnonce "Cannot manage ownership unless running as root"
return true
end
diff --git a/lib/puppet/type/file/source.rb b/lib/puppet/type/file/source.rb
index cf861a0..aaf9169 100755
--- a/lib/puppet/type/file/source.rb
+++ b/lib/puppet/type/file/source.rb
@@ -104,7 +104,7 @@ module Puppet
# if a value has not already been provided.
[:owner, :mode, :group, :checksum].each do |metadata_method|
param_name = (metadata_method == :checksum) ? :content : metadata_method
- next if metadata_method == :owner and Puppet::Util::SUIDManager.uid != 0
+ next if metadata_method == :owner and !Puppet.features.root?
next if metadata_method == :checksum and metadata.ftype == "directory"
if resource[param_name].nil? or resource[param_name] == :absent
diff --git a/spec/unit/indirector/ldap.rb b/spec/unit/indirector/ldap.rb
index 2c4060c..44df2b5 100755
--- a/spec/unit/indirector/ldap.rb
+++ b/spec/unit/indirector/ldap.rb
@@ -136,7 +136,7 @@ describe Puppet::Indirector::Ldap do
end
describe "when reconnecting to ldap" do
- confine "Not running on culain as root" => (Puppet::Util::SUIDManager.uid == 0 and Facter.value("hostname") == "culain")
+ confine "Not running on culain as root" => (Puppet.features.root? and Facter.value("hostname") == "culain")
it "should reconnect to ldap when connections are lost"
end
diff --git a/spec/unit/type/file/source.rb b/spec/unit/type/file/source.rb
index b9bb222..536cb63 100755
--- a/spec/unit/type/file/source.rb
+++ b/spec/unit/type/file/source.rb
@@ -148,7 +148,7 @@ describe Puppet::Type.type(:file).attrclass(:source) do
end
it "should copy the metadata's owner, group, checksum, and mode to the resource if they are not set on the resource" do
- Puppet::Util::SUIDManager.expects(:uid).returns 0
+ Puppet.features.expects(:root?).returns true
@source.copy_source_values
@@ -176,7 +176,7 @@ describe Puppet::Type.type(:file).attrclass(:source) do
describe "and puppet is not running as root" do
it "should not try to set the owner" do
- Puppet::Util::SUIDManager.expects(:uid).returns 100
+ Puppet.features.expects(:root?).returns false
@source.copy_source_values
@resource[:owner].should be_nil
diff --git a/test/puppet/defaults.rb b/test/puppet/defaults.rb
index d53c232..bab6644 100755
--- a/test/puppet/defaults.rb
+++ b/test/puppet/defaults.rb
@@ -40,7 +40,7 @@ class TestPuppetDefaults < Test::Unit::TestCase
# we don't want user defaults in /, or root defaults in ~
def testDefaultsInCorrectRoots
notval = nil
- if Puppet::Util::SUIDManager.uid == 0
+ if Puppet.features.root?
notval = Regexp.new(File.expand_path("~"))
else
notval = /^\/var|^\/etc/
diff --git a/test/ral/providers/group.rb b/test/ral/providers/group.rb
index 8e62d7b..cedbf13 100755
--- a/test/ral/providers/group.rb
+++ b/test/ral/providers/group.rb
@@ -179,7 +179,7 @@ class TestGroupProvider < Test::Unit::TestCase
}
end
- if Puppet::Util::SUIDManager.uid == 0
+ if Puppet.features.root?
def test_mkgroup
gobj = nil
comp = nil
diff --git a/test/ral/providers/user.rb b/test/ral/providers/user.rb
index 03e3ec8..9abf850 100755
--- a/test/ral/providers/user.rb
+++ b/test/ral/providers/user.rb
@@ -418,7 +418,7 @@ class TestUserProvider < Test::Unit::TestCase
assert_equal(main.sort, list.sort, "Group list is not equal")
end
- if Puppet::Util::SUIDManager.uid == 0
+ if Puppet.features.root?
def test_simpleuser
name = "pptest"
diff --git a/test/ral/type/exec.rb b/test/ral/type/exec.rb
index 27a3de4..98d1114 100755
--- a/test/ral/type/exec.rb
+++ b/test/ral/type/exec.rb
@@ -294,7 +294,7 @@ class TestExec < Test::Unit::TestCase
assert_events([:executed_command], comp)
end
- if Puppet::Util::SUIDManager.uid == 0
+ if Puppet.features.root?
# Verify that we can execute commands as a special user
def mknverify(file, user, group = nil, id = true)
File.umask(0022)
diff --git a/test/ral/type/file.rb b/test/ral/type/file.rb
index 462e8f8..431a302 100755
--- a/test/ral/type/file.rb
+++ b/test/ral/type/file.rb
@@ -109,7 +109,7 @@ class TestFile < Test::Unit::TestCase
end
end
- if Puppet::Util::SUIDManager.uid == 0
+ if Puppet.features.root?
def test_createasuser
dir = tmpdir()
diff --git a/test/util/settings.rb b/test/util/settings.rb
index e94778e..272ced9 100755
--- a/test/util/settings.rb
+++ b/test/util/settings.rb
@@ -359,7 +359,7 @@ yay = /a/path
user = nonrootuser()
group = nonrootgroup()
- if Puppet::Util::SUIDManager.uid == 0
+ if Puppet.features.root?
args[:owner] = user.name
args[:group] = group.name
end
@@ -375,7 +375,7 @@ yay = /a/path
assert_equal(mode, filemode(path), "Modes are not equal")
# OS X is broken in how it chgrps files
- if Puppet::Util::SUIDManager.uid == 0
+ if Puppet.features.root?
assert_equal(user.uid, File.stat(path).uid, "UIDS are not equal")
case Facter["operatingsystem"].value
@@ -399,7 +399,7 @@ yay = /a/path
user = nonrootuser()
group = nonrootgroup()
- if Puppet::Util::SUIDManager.uid == 0
+ if Puppet.features.root?
args[:owner] = user.name
args[:group] = group.name
end
@@ -414,7 +414,7 @@ yay = /a/path
# OS X and *BSD is broken in how it chgrps files
- if Puppet::Util::SUIDManager.uid == 0
+ if Puppet.features.root?
assert_equal(user.uid, File.stat(path).uid, "UIDS are not equal")
case Facter["operatingsystem"].value
--
Puppet packaging for Debian
More information about the Pkg-puppet-devel
mailing list