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
11 def initialize(target)
12   @target = target
13 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
17 def prepare(module_name, version)
18   return if @target.directory?
19 
20   begin
21     @target.mkpath
22     Puppet.notice _("Created target directory %{dir}") % { dir: @target }
23   rescue SystemCallError => orig_error
24     raise converted_to_friendly_error(module_name, version, orig_error)
25   end
26 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
35 def converted_to_friendly_error(module_name, version, orig_error)
36   return orig_error if not ERROR_MAPPINGS.include?(orig_error.class)
37 
38   ERROR_MAPPINGS[orig_error.class].new(orig_error,
39     :requested_module  => module_name,
40     :requested_version => version,
41     :directory         => @target.to_s)
42 end