Exception: Puppet::ModuleTool::Errors::AlreadyInstalledError Private

Inherits:
InstallError show all
Defined in:
lib/puppet/module_tool/errors/installer.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) ⇒ AlreadyInstalledError

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


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

def initialize(options)
  @module_name       = options[:module_name]
  @installed_version = v(options[:installed_version])
  @requested_version = v(options[:requested_version])
  @local_changes     = options[:local_changes]
  super _("'%{module_name}' (%{version}) requested; '%{module_name}' (%{installed_version}) already installed") % { module_name: @module_name, version: @requested_version, installed_version: @installed_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.


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

def multiline
  message = []
  message << _("Could not install module '%{module_name}' (%{version})") % { module_name: @module_name, version: @requested_version }
  message << _("  Module '%{module_name}' (%{installed_version}) is already installed") % { module_name: @module_name, installed_version: @installed_version }
  message << _("    Installed module has had changes made locally") unless @local_changes.empty?
  #TRANSLATORS `puppet module upgrade` is a command line and should not be translated
  message << _("    Use `puppet module upgrade` to install a different version")
  #TRANSLATORS `puppet module install --force` is a command line and should not be translated
  message << _("    Use `puppet module install --force` to re-install only this module")
  message.join("\n")
end