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

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



171
172
173
174
175
176
177
# File 'lib/puppet/module_tool/errors/shared.rb', line 171

def initialize(options)
  @module_name = options[:module_name]
  @modules     = options[:installed_modules]
  @action      = options[:action]
  # TRANSLATORS "module path" refers to a set of directories where modules may be installed
  super _("Could not %{action} '%{module_name}'; module appears in multiple places in the module path") % { action: @action, module_name: @module_name }
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.



179
180
181
182
183
184
185
186
187
188
189
190
# File 'lib/puppet/module_tool/errors/shared.rb', line 179

def multiline
  message = []
  message << _("Could not %{action} module '%{module_name}'") % { action: @action, module_name: @module_name }
  message << _("  Module '%{module_name}' appears multiple places in the module path") % { module_name: @module_name }
  message += @modules.map do |mod|
    # TRANSLATORS This is repeats as separate lines as a list under "Module '%{module_name}' appears multiple places in the module path"
    _("    '%{module_name}' (%{version}) was found in %{path}") % { module_name: @module_name, version: v(mod.version), path: mod.modulepath }
  end
  # TRANSLATORS `--modulepath` is command line option and should not be translated
  message << _("    Use the `--modulepath` option to limit the search to specific directories")
  message.join("\n")
end