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

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



149
150
151
152
153
154
# File 'lib/puppet/module_tool/errors/shared.rb', line 149

def initialize(options)
  @module_name = options[:module_name]
  @suggestions = options[:suggestions] || []
  @action      = options[:action]
  super _("Could not %{action} '%{module_name}'; module is not installed") % { 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.



156
157
158
159
160
161
162
163
164
165
166
167
# File 'lib/puppet/module_tool/errors/shared.rb', line 156

def multiline
  message = []
  message << _("Could not %{action} module '%{module_name}'") % { action: @action, module_name: @module_name }
  message << _("  Module '%{module_name}' is not installed") % { module_name: @module_name }
  message += @suggestions.map do |suggestion|
    # TRANSLATORS `puppet module %{action} %{suggestion}` is a command line and should not be translated
    _("    You may have meant `puppet module %{action} %{suggestion}`") % { action: @action, suggestion: suggestion }
  end
  # TRANSLATORS `puppet module install` is a command line and should not be translated
  message << _("    Use `puppet module install` to install this module") if @action == :upgrade
  message.join("\n")
end