class Puppet::ModuleTool::InstallDirectory

Control the install location for modules.

Constants

ERROR_MAPPINGS

Attributes

target[R]

Public Class Methods

new(target) click to toggle source
   # File lib/puppet/module_tool/install_directory.rb
12 def initialize(target)
13   @target = target
14 end

Public Instance Methods

prepare(module_name, version) click to toggle source

prepare the module install location. This will create the location if needed.

   # File lib/puppet/module_tool/install_directory.rb
18 def prepare(module_name, version)
19   return if @target.directory?
20 
21   begin
22     @target.mkpath
23     Puppet.notice _("Created target directory %{dir}") % { dir: @target }
24   rescue SystemCallError => orig_error
25     raise converted_to_friendly_error(module_name, version, orig_error)
26   end
27 end

Private Instance Methods

converted_to_friendly_error(module_name, version, orig_error) click to toggle source
   # File lib/puppet/module_tool/install_directory.rb
36 def converted_to_friendly_error(module_name, version, orig_error)
37   return orig_error if not ERROR_MAPPINGS.include?(orig_error.class)
38 
39   ERROR_MAPPINGS[orig_error.class].new(orig_error,
40     :requested_module  => module_name,
41     :requested_version => version,
42     :directory         => @target.to_s)
43 end