Exception: Puppet::ModuleTool::Errors::NoVersionsSatisfyError 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) ⇒ NoVersionsSatisfyError

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



5
6
7
8
9
10
11
12
13
14
# File 'lib/puppet/module_tool/errors/shared.rb', line 5

def initialize(options)
  @requested_name    = options[:requested_name]
  @requested_version = options[:requested_version]
  @installed_version = options[:installed_version]
  @conditions        = options[:conditions]
  @action            = options[:action]
  @unsatisfied       = options[:unsatisfied]

  super _("Could not %{action} '%{module_name}' (%{version}); no version satisfies all dependencies") % { action: @action, module_name: @requested_name, version: vstring }
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.



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/puppet/module_tool/errors/shared.rb', line 16

def multiline
  message = []
  message << _("Could not %{action} module '%{module_name}' (%{version})") % { action: @action, module_name: @requested_name, version: vstring }

  if @unsatisfied
    message << _("  The requested version cannot satisfy one or more of the following installed modules:")
    if @unsatisfied[:current_version]
      message << _("    %{name}, installed: %{current_version}, expected: %{constraints}") % { name: @unsatisfied[:name], current_version: @unsatisfied[:current_version], constraints: @unsatisfied[:constraints][@unsatisfied[:name]] }
    else
      @unsatisfied[:constraints].each do |mod, range|
        message << _("    %{mod}, expects '%{name}': %{range}") % { mod: mod, name: @requested_name, range: range }
      end
    end
    message << _("")
  else
    message << _("  The requested version cannot satisfy all dependencies")
  end

  # TRANSLATORS `puppet module %{action} --ignore-dependencies` is a command line and should not be translated
  message << _("  Use `puppet module %{action} '%{module_name}' --ignore-dependencies` to %{action} only this module") % { action: @action, module_name: @requested_name }
  message.join("\n")
end