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.



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

def initialize(options)
  @module_name = options[:module_name]
  @suggestions = options[:suggestions] || []
  @action      = options[:action]
  super "Could not #{@action} '#{@module_name}'; module is not installed"
end

Instance Method Details

#multilineObject



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

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