summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rwxr-xr-xlib/puppet/network/handler/fileserver.rb1
-rw-r--r--lib/puppet/type/pfile.rb43
-rwxr-xr-xlib/puppet/type/pfile/source.rb11
3 files changed, 38 insertions, 17 deletions
diff --git a/lib/puppet/network/handler/fileserver.rb b/lib/puppet/network/handler/fileserver.rb
index 7726019ba..051f6747b 100755
--- a/lib/puppet/network/handler/fileserver.rb
+++ b/lib/puppet/network/handler/fileserver.rb
@@ -102,6 +102,7 @@ class Puppet::Network::Handler
self.mount(dir, name)
end
}
+ self.mount(nil, MODULES)
else
@passedconfig = false
readconfig(false) # don't check the file the first time.
diff --git a/lib/puppet/type/pfile.rb b/lib/puppet/type/pfile.rb
index 800fc7436..148cf4b52 100644
--- a/lib/puppet/type/pfile.rb
+++ b/lib/puppet/type/pfile.rb
@@ -976,6 +976,18 @@ module Puppet
obj
end
+ def localfileserver
+ unless defined? @@localfileserver
+ args = {
+ :Local => true,
+ :Mount => { "/" => "localhost" },
+ :Config => false
+ }
+ @@localfileserver = Puppet::Network::Handler.handler(:fileserver).new(args)
+ end
+ @@localfileserver
+ end
+
def uri2obj(source)
sourceobj = FileSource.new
path = nil
@@ -996,25 +1008,24 @@ module Puppet
case uri.scheme
when "file":
- unless defined? @@localfileserver
- @@localfileserver = Puppet::Network::Handler.handler(:fileserver).new(
- :Local => true,
- :Mount => { "/" => "localhost" },
- :Config => false
- )
- #@@localfileserver.mount("/", "localhost")
- end
- sourceobj.server = @@localfileserver
+ sourceobj.server = localfileserver
path = "/localhost" + uri.path
when "puppet":
- args = { :Server => uri.host }
- if uri.port
- args[:Port] = uri.port
- end
- # FIXME We should cache a copy of this server
- #sourceobj.server = Puppet::Network::NetworkClient.new(args)
+ # FIXME: We should cache clients by uri.host + uri.port
+ # not by the full source path
unless @clients.include?(source)
- @clients[source] = Puppet::Network::Client.file.new(args)
+ host = uri.host
+ host ||= Puppet[:server] unless Puppet[:name] == "puppet"
+ if host.nil?
+ server = localfileserver
+ else
+ args = { :Server => host }
+ if uri.port
+ args[:Port] = uri.port
+ end
+ server = Puppet::Network::Client.file.new(args)
+ end
+ @clients[source] = server
end
sourceobj.server = @clients[source]
diff --git a/lib/puppet/type/pfile/source.rb b/lib/puppet/type/pfile/source.rb
index e186047d0..2b5ce92ff 100755
--- a/lib/puppet/type/pfile/source.rb
+++ b/lib/puppet/type/pfile/source.rb
@@ -22,7 +22,16 @@ module Puppet
source => \"puppet://server/module/sendmail.cf\"
}
}
-
+
+ Currently, only the ``puppet`` scheme is supported for source
+ URL's. Puppet will connect to the file server running on
+ ``server`` to retrieve the contents of the file. If the
+ ``server`` part is empty, the behavior of the command-line
+ interpreter (``puppet``) and the client demon (``puppetd``) differs
+ slightly: ``puppet`` will look such a file up on the module path
+ on the local host, whereas ``puppetd`` will connect to the
+ puppet server that it received the manifest from.
+
See the `FileServingConfiguration fileserver configuration documentation`:trac: for information on how to configure
and use file services within Puppet.