Exception: Puppet::ModuleTool::Errors::NotInstalledError

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

Returns a new instance of NotInstalledError.



116
117
118
119
120
121
# File 'lib/puppet/module_tool/errors/shared.rb', line 116

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



123
124
125
126
127
128
129
130
131
132
# File 'lib/puppet/module_tool/errors/shared.rb', line 123

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|
    _("    You may have meant `puppet module %{action} %{suggestion}`") % { action: @action, suggestion: suggestion }
  end
  message << _("    Use `puppet module install` to install this module") if @action == :upgrade
  message.join("\n")
end