summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLuke Kanies <luke@madstop.com>2005-08-23 17:13:26 +0000
committerLuke Kanies <luke@madstop.com>2005-08-23 17:13:26 +0000
commita8fff85769df71bf7ba79e2fd2d236475b6bd0fc (patch)
tree1943847e67c7cff3548d0c350c297ecba906cccf
parentf68fe0045d3519d545d8e63b7ee470ece74fcc3f (diff)
downloadpuppet-a8fff85769df71bf7ba79e2fd2d236475b6bd0fc.tar.gz
puppet-a8fff85769df71bf7ba79e2fd2d236475b6bd0fc.tar.xz
puppet-a8fff85769df71bf7ba79e2fd2d236475b6bd0fc.zip
ignoring remote file owner when not running as root
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@580 980ebf18-57e1-0310-9a29-db15c13687c0
-rw-r--r--lib/puppet/type/pfile.rb90
1 files changed, 15 insertions, 75 deletions
diff --git a/lib/puppet/type/pfile.rb b/lib/puppet/type/pfile.rb
index ddfb2aae3..a81e727c8 100644
--- a/lib/puppet/type/pfile.rb
+++ b/lib/puppet/type/pfile.rb
@@ -626,76 +626,6 @@ module Puppet
be used instead of `copy`."
@name = :source
- def desc2hash(line, params)
- args = {}
-
- values = line.split("\t").collect { |value|
- if value =~ /^[0-9]+$/
- value.to_i
- else
- value
- end
- }
-
- params.zip(values).each { |param, value|
- args[param] = value
- }
-
- if args[:type] == "directory"
- args.delete(:checksum)
- end
- args
- end
-
- def hash2child(hash, source, recurse)
- # "/" == self
- if hash[:name] == "/"
- if hash[:type] == "directory"
- else
- self[:source] = source
- end
- hash.each { |param, value|
- next if param == :name
- next if param == :type
-
- unless self.state(param)
- self[param] = value
- end
- }
- if source =~ /Filesourcetest/
- p self
- end
- # we can now skip this object, and the rest is
- # pretty much related to children
- return
- end
-
- name = File.join(self.name, hash[:name])
- if child = @children.find { |child|
- child.name == name }
- else # the child does not yet exist
- #hash.delete(:name)
- sum = nil
- if hash[:type] == "directory"
- hash[:create] = "directory"
- hash[:source] = @parameters[:source] + hash[:name]
- hash[:recurse] = recurse
- else
- hash[:source] = source + hash[:name]
- #sum = hash[:checksum]
- #hash.delete(:checksum)
- end
- hash.delete(:type)
-
- name = hash[:name].sub(/^\//, '') # rm leading /
- hash.delete(:name)
-
- Puppet.warning "Found new file %s under %s" %
- [name.inspect, self.name]
- self.newchild(name, hash)
- end
- end
-
def describe
source = @source
@@ -706,13 +636,20 @@ module Puppet
desc = server.describe(path)
args = {}
- Puppet::Type::PFile::PINPARAMS.zip(desc.split("\t")).each { |param, value|
+ Puppet::Type::PFile::PINPARAMS.zip(
+ desc.split("\t")
+ ).each { |param, value|
if value =~ /^[0-9]+$/
value = value.to_i
end
args[param] = value
}
+ # we can't manage ownership as root, so don't even try
+ unless Process.uid == 0
+ args.delete(:owner)
+ end
+
return args
end
@@ -1577,10 +1514,13 @@ module Puppet
case uri.scheme
when "file":
- sourceobj.server = Puppet::Server::FileServer.new(
- :Local => true
- )
- sourceobj.server.mount("/", "localhost")
+ unless defined? @@localfileserver
+ @@localfileserver = Puppet::Server::FileServer.new(
+ :Local => true
+ )
+ @@localfileserver.mount("/", "localhost")
+ end
+ sourceobj.server = @@localfileserver
path = "/localhost" + uri.path
when "puppet":
args = { :Server => uri.host }