summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/puppet/file_serving/base.rb8
-rw-r--r--lib/puppet/file_serving/content.rb1
-rw-r--r--lib/puppet/file_serving/terminus_helper.rb2
-rw-r--r--lib/puppet/indirector/direct_file_server.rb10
-rw-r--r--lib/puppet/indirector/file_server.rb2
-rw-r--r--lib/puppet/indirector/module_files.rb2
6 files changed, 9 insertions, 16 deletions
diff --git a/lib/puppet/file_serving/base.rb b/lib/puppet/file_serving/base.rb
index 1cfd0bc4c..94e337b99 100644
--- a/lib/puppet/file_serving/base.rb
+++ b/lib/puppet/file_serving/base.rb
@@ -7,8 +7,6 @@ require 'puppet/file_serving'
# The base class for Content and Metadata; provides common
# functionality like the behaviour around links.
class Puppet::FileServing::Base
- attr_accessor :key
-
# Does our file exist?
def exist?
begin
@@ -21,8 +19,6 @@ class Puppet::FileServing::Base
# Return the full path to our file. Fails if there's no path set.
def full_path
- raise(ArgumentError, "You must set a path to get a file's path") unless self.path
-
if relative_path.nil? or relative_path == ""
path
else
@@ -30,8 +26,8 @@ class Puppet::FileServing::Base
end
end
- def initialize(key, options = {})
- @key = key
+ def initialize(path, options = {})
+ self.path = path
@links = :manage
options.each do |param, value|
diff --git a/lib/puppet/file_serving/content.rb b/lib/puppet/file_serving/content.rb
index 64f000eaa..f13fcaa72 100644
--- a/lib/puppet/file_serving/content.rb
+++ b/lib/puppet/file_serving/content.rb
@@ -25,7 +25,6 @@ class Puppet::FileServing::Content < Puppet::FileServing::Base
# This stat can raise an exception, too.
raise(ArgumentError, "Cannot read the contents of links unless following links") if stat().ftype == "symlink"
- p full_path
@content = ::File.read(full_path())
end
@content
diff --git a/lib/puppet/file_serving/terminus_helper.rb b/lib/puppet/file_serving/terminus_helper.rb
index e5da0e29f..bde0bd389 100644
--- a/lib/puppet/file_serving/terminus_helper.rb
+++ b/lib/puppet/file_serving/terminus_helper.rb
@@ -11,7 +11,7 @@ module Puppet::FileServing::TerminusHelper
def path2instances(request, path)
args = [:links, :ignore, :recurse].inject({}) { |hash, param| hash[param] = request.options[param] if request.options[param]; hash }
Puppet::FileServing::Fileset.new(path, args).files.collect do |file|
- inst = model.new(File.join(request.key, file), :path => path, :relative_path => file)
+ inst = model.new(path, :relative_path => file)
inst.links = request.options[:links] if request.options[:links]
inst
end
diff --git a/lib/puppet/indirector/direct_file_server.rb b/lib/puppet/indirector/direct_file_server.rb
index b3b4886f3..bcda92366 100644
--- a/lib/puppet/indirector/direct_file_server.rb
+++ b/lib/puppet/indirector/direct_file_server.rb
@@ -12,16 +12,14 @@ class Puppet::Indirector::DirectFileServer < Puppet::Indirector::Terminus
include Puppet::FileServing::TerminusHelper
def find(request)
- uri = key2uri(request.key)
- return nil unless FileTest.exists?(uri.path)
- instance = model.new(request.key, :path => uri.path)
+ return nil unless FileTest.exists?(request.key)
+ instance = model.new(request.key)
instance.links = request.options[:links] if request.options[:links]
return instance
end
def search(request)
- uri = key2uri(request.key)
- return nil unless FileTest.exists?(uri.path)
- path2instances(request, uri.path)
+ return nil unless FileTest.exists?(request.key)
+ path2instances(request, request.key)
end
end
diff --git a/lib/puppet/indirector/file_server.rb b/lib/puppet/indirector/file_server.rb
index b0df7ff5d..476fc5b23 100644
--- a/lib/puppet/indirector/file_server.rb
+++ b/lib/puppet/indirector/file_server.rb
@@ -25,7 +25,7 @@ class Puppet::Indirector::FileServer < Puppet::Indirector::Terminus
# Find our key using the fileserver.
def find(request)
return nil unless path = find_path(request)
- result = model.new(request.key, :path => path)
+ result = model.new(path)
result.links = request.options[:links] if request.options[:links]
return result
end
diff --git a/lib/puppet/indirector/module_files.rb b/lib/puppet/indirector/module_files.rb
index 40dd06941..7c5cf278f 100644
--- a/lib/puppet/indirector/module_files.rb
+++ b/lib/puppet/indirector/module_files.rb
@@ -30,7 +30,7 @@ class Puppet::Indirector::ModuleFiles < Puppet::Indirector::Terminus
def find(request)
return nil unless path = find_path(request)
- result = model.new(request.key, :path => path)
+ result = model.new(path)
result.links = request.options[:links] if request.options[:links]
return result
end