Exception: Puppet::ModuleTool::Errors::NoVersionsSatisfyError

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) ⇒ NoVersionsSatisfyError

Returns a new instance of NoVersionsSatisfyError.


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

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


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

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