Exception: Puppet::ModuleTool::Errors::InstallConflictError

Inherits:
ModuleToolError show all
Defined in:
lib/puppet/module_tool/errors/shared.rb

Instance Attribute Summary

Attributes inherited from Error

#original

Instance Method Summary collapse

Methods inherited from ModuleToolError

#v, #vstring

Constructor Details

#initialize(options) ⇒ InstallConflictError


53
54
55
56
57
58
59
60
# File 'lib/puppet/module_tool/errors/shared.rb', line 53

def initialize(options)
  @requested_module  = options[:requested_module]
  @requested_version = v(options[:requested_version])
  @dependency        = options[:dependency]
  @directory         = options[:directory]
            = options[:metadata]
  super _("'%{module_name}' (%{version}) requested; installation conflict") % { module_name: @requested_module, version: @requested_version }
end

Instance Method Details

#multilineObject


62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
# File 'lib/puppet/module_tool/errors/shared.rb', line 62

def multiline
  message = []
  message << _("Could not install module '%{module_name}' (%{version})") % { module_name: @requested_module, version: @requested_version }

  if @dependency
    message << _("  Dependency '%{name}' (%{version}) would overwrite %{directory}") % { name: @dependency[:name], version: v(@dependency[:version]), directory: @directory }
  else
    message << _("  Installation would overwrite %{directory}") % { directory: @directory }
  end

  if 
    message << _("    Currently, '%{current_name}' (%{current_version}) is installed to that directory") % { current_name: ["name"], current_version: v(["version"]) }
  end

  if @dependency
    #TRANSLATORS `puppet module install --ignore-dependencies` is a command line and should not be translated
    message << _("    Use `puppet module install --ignore-dependencies` to install only this module")
  else
    #TRANSLATORS `puppet module install --force` is a command line and should not be translated
    message << _("    Use `puppet module install --force` to install this module anyway")
  end
  message.join("\n")
end