diff options
Diffstat (limited to 'lib/puppet/file_serving')
-rw-r--r-- | lib/puppet/file_serving/configuration.rb | 6 | ||||
-rw-r--r-- | lib/puppet/file_serving/mount/file.rb | 10 | ||||
-rw-r--r-- | lib/puppet/file_serving/mount/modules.rb | 8 | ||||
-rw-r--r-- | lib/puppet/file_serving/mount/plugins.rb | 8 |
4 files changed, 16 insertions, 16 deletions
diff --git a/lib/puppet/file_serving/configuration.rb b/lib/puppet/file_serving/configuration.rb index 3140455c7..a247f53dd 100644 --- a/lib/puppet/file_serving/configuration.rb +++ b/lib/puppet/file_serving/configuration.rb @@ -32,7 +32,7 @@ class Puppet::FileServing::Configuration # Find the right mount. Does some shenanigans to support old-style module # mounts. - def find_mount(mount_name, node) + def find_mount(mount_name, environment) # Reparse the configuration if necessary. readconfig @@ -40,7 +40,7 @@ class Puppet::FileServing::Configuration return mount end - if mounts["modules"].environment(node).module(mount_name) + if environment.module(mount_name) Puppet::Util::Warnings.warnonce "DEPRECATION NOTICE: Found module '%s' without using the 'modules' mount; please prefix path with 'modules/'" % mount_name return mounts["modules"] end @@ -72,7 +72,7 @@ class Puppet::FileServing::Configuration raise(ArgumentError, "Cannot find file: Invalid path '%s'" % mount_name) unless mount_name =~ %r{^[-\w]+$} - return nil unless mount = find_mount(mount_name, request.node) + return nil unless mount = find_mount(mount_name, request.environment) if mount.name == "modules" and mount_name != "modules" # yay backward-compatibility path = "%s/%s" % [mount_name, path] diff --git a/lib/puppet/file_serving/mount/file.rb b/lib/puppet/file_serving/mount/file.rb index 9053ee18c..bf7ddda45 100644 --- a/lib/puppet/file_serving/mount/file.rb +++ b/lib/puppet/file_serving/mount/file.rb @@ -15,7 +15,7 @@ class Puppet::FileServing::Mount::File < Puppet::FileServing::Mount end end - def complete_path(relative_path, node = nil) + def complete_path(relative_path, node) full_path = path(node) raise ArgumentError.new("Mounts without paths are not usable") unless full_path @@ -31,8 +31,8 @@ class Puppet::FileServing::Mount::File < Puppet::FileServing::Mount end # Return an instance of the appropriate class. - def find(short_file, options = {}) - complete_path(short_file, options[:node]) + def find(short_file, request) + complete_path(short_file, request.node) end # Return the path as appropriate, expanding as necessary. @@ -63,8 +63,8 @@ class Puppet::FileServing::Mount::File < Puppet::FileServing::Mount @path = path end - def search(path, options = {}) - return nil unless path = complete_path(path, options[:node]) + def search(path, request) + return nil unless path = complete_path(path, request.node) return [path] end diff --git a/lib/puppet/file_serving/mount/modules.rb b/lib/puppet/file_serving/mount/modules.rb index bf0bad02b..a7b6d9eee 100644 --- a/lib/puppet/file_serving/mount/modules.rb +++ b/lib/puppet/file_serving/mount/modules.rb @@ -4,16 +4,16 @@ require 'puppet/file_serving/mount' # modules for files. Yay. class Puppet::FileServing::Mount::Modules < Puppet::FileServing::Mount # Return an instance of the appropriate class. - def find(path, options = {}) + def find(path, request) module_name, relative_path = path.split("/", 2) - return nil unless mod = environment(options[:node]).module(module_name) + return nil unless mod = request.environment.module(module_name) mod.file(relative_path) end - def search(path, options = {}) + def search(path, request) module_name, relative_path = path.split("/", 2) - return nil unless mod = environment(options[:node]).module(module_name) + return nil unless mod = request.environment.module(module_name) return nil unless path = mod.file(relative_path) return [path] diff --git a/lib/puppet/file_serving/mount/plugins.rb b/lib/puppet/file_serving/mount/plugins.rb index 02b838c84..c860e52a7 100644 --- a/lib/puppet/file_serving/mount/plugins.rb +++ b/lib/puppet/file_serving/mount/plugins.rb @@ -5,18 +5,18 @@ require 'puppet/file_serving/mount' # many directories into one. class Puppet::FileServing::Mount::Plugins < Puppet::FileServing::Mount # Return an instance of the appropriate class. - def find(relative_path, environment) - return nil unless mod = environment.modules.find { |mod| mod.plugin(relative_path) } + def find(relative_path, request) + return nil unless mod = request.environment.modules.find { |mod| mod.plugin(relative_path) } path = mod.plugin(relative_path) return path end - def search(relative_path, environment) + def search(relative_path, request) # We currently only support one kind of search on plugins - return # them all. - paths = environment.modules.find_all { |mod| mod.plugins? }.collect { |mod| mod.plugin_directory } + paths = request.environment.modules.find_all { |mod| mod.plugins? }.collect { |mod| mod.plugin_directory } return nil if paths.empty? return paths end |