Exception: Puppet::ModuleTool::Errors::VersionAlreadyInstalledError Private

Inherits:
UpgradeError show all
Defined in:
lib/puppet/module_tool/errors/upgrader.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 collapse

Attributes inherited from Error

#original

Instance Method Summary collapse

Methods inherited from ModuleToolError

#v, #vstring

Constructor Details

#initialize(options) ⇒ VersionAlreadyInstalledError

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 VersionAlreadyInstalledError.



14
15
16
17
18
19
20
21
22
# File 'lib/puppet/module_tool/errors/upgrader.rb', line 14

def initialize(options)
  @module_name       = options[:module_name]
  @requested_version = options[:requested_version]
  @installed_version = options[:installed_version]
  @dependency_name   = options[:dependency_name]
  @newer_versions    = options[:newer_versions]
  @possible_culprits = options[:possible_culprits]
  super _("Could not upgrade '%{module_name}'; more recent versions not found") % { module_name: @module_name }
end

Instance Attribute Details

#newer_versionsObject (readonly)

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.



12
13
14
# File 'lib/puppet/module_tool/errors/upgrader.rb', line 12

def newer_versions
  @newer_versions
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.



24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/puppet/module_tool/errors/upgrader.rb', line 24

def multiline
  message = []
  message << _("Could not upgrade module '%{module_name}' (%{version})") % { module_name: @module_name, version: vstring }
  if @newer_versions.empty?
    message << _("  The installed version is already the latest version matching %{version}") % { version: vstring }
  else
    message << _("  There are %{count} newer versions") % { count: @newer_versions.length }
    message << _("    No combination of dependency upgrades would satisfy all dependencies")
    unless @possible_culprits.empty?
      message << _("    Dependencies will not be automatically upgraded across major versions")
      message << _("    Upgrading one or more of these modules may permit the upgrade to succeed:")
      @possible_culprits.each do |name|
        message << "    - #{name}"
      end
    end
  end
  # TRANSLATORS `puppet module upgrade --force` is a command line option that should not be translated
  message << _("    Use `puppet module upgrade --force` to upgrade only this module")
  message.join("\n")
end