From 02cfc44af55f719235a58ca9cc23f7d29e49cd3c Mon Sep 17 00:00:00 2001 From: luke Date: Sat, 16 Dec 2006 23:59:31 +0000 Subject: Simplifying the splitpath method a bit, altho it is still strangely slow git-svn-id: https://reductivelabs.com/svn/puppet/trunk@1943 980ebf18-57e1-0310-9a29-db15c13687c0 --- lib/puppet/server/fileserver.rb | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/lib/puppet/server/fileserver.rb b/lib/puppet/server/fileserver.rb index 53c60cdbe..2b91c8811 100755 --- a/lib/puppet/server/fileserver.rb +++ b/lib/puppet/server/fileserver.rb @@ -372,20 +372,12 @@ class Server mount = nil path = nil if dir =~ %r{/(\w+)/?} - mount = $1 - path = dir.sub(%r{/#{mount}/?}, '') + tmp = $1 + path = dir.sub(%r{/#{tmp}/?}, '') - unless @mounts.include?(mount) - raise FileServerError, "Fileserver module '%s' not mounted" % mount + unless mount = @mounts[tmp] + raise FileServerError, "Fileserver module '%s' not mounted" % tmp end - - unless @mounts[mount].valid? - raise FileServerError, - "Fileserver error: Mount '%s' does not have a path set" % mount - end - - # And now replace the name with the actual object. - mount = @mounts[mount] else raise FileServerError, "Fileserver error: Invalid path '%s'" % dir end -- cgit