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

Returns a new instance of InstallConflictError.



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

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

Instance Method Details

#multilineObject



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

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 %{dir}") % { name: @dependency[:name], version: v(@dependency[:version]), dir: @directory }
  else
    message << _("  Installation would overwrite %{dir}") % { dir: @directory }
  end

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

  if @dependency
    message << _("    Use `puppet module install --ignore-dependencies` to install only this module")
  else
    message << _("    Use `puppet module install --force` to install this module anyway")
  end

  message.join("\n")
end