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

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

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Instance Attribute Summary

Attributes inherited from Error

#original

Instance Method Summary collapse

Methods inherited from ModuleToolError

#v, #vstring

Constructor Details

#initialize(options) ⇒ InstallConflictError

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of InstallConflictError.


68
69
70
71
72
73
74
75
# File 'lib/puppet/module_tool/errors/shared.rb', line 68

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

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.


77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
# File 'lib/puppet/module_tool/errors/shared.rb', line 77

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 @metadata
    message << _("    Currently, '%{current_name}' (%{current_version}) is installed to that directory") % { current_name: @metadata["name"], current_version: v(@metadata["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