Exception: Puppet::ModuleTool::Errors::NoVersionMatchesError

Inherits:
UninstallError show all
Defined in:
lib/puppet/module_tool/errors/uninstaller.rb

Instance Attribute Summary

Attributes inherited from Error

#original

Instance Method Summary collapse

Methods inherited from ModuleToolError

#v, #vstring

Constructor Details

#initialize(options) ⇒ NoVersionMatchesError


6
7
8
9
10
11
# File 'lib/puppet/module_tool/errors/uninstaller.rb', line 6

def initialize(options)
  @module_name = options[:module_name]
  @modules     = options[:installed_modules]
  @version     = options[:version_range]
  super _("Could not uninstall '%{module_name}'; no installed version matches") % { module_name: @module_name }
end

Instance Method Details

#multilineObject


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

def multiline
  message = []
  message << _("Could not uninstall module '%{module_name}' (%{version})") % { module_name: @module_name, version: v(@version) }
  message << _("  No installed version of '%{module_name}' matches (%{version})") % { module_name: @module_name, version: v(@version) }
  message += @modules.map do |mod|
    _("    '%{module_name}' (%{version}) is installed in %{path}") % { module_name: mod[:name], version: v(mod[:version]), path: mod[:path] }
  end
  message.join("\n")
end