Exception: Puppet::ModuleTool::Errors::NoCandidateReleasesError

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

Returns a new instance of NoCandidateReleasesError.



25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/puppet/module_tool/errors/shared.rb', line 25

def initialize(options)
  @module_name       = options[:module_name]
  @requested_version = options[:requested_version]
  @installed_version = options[:installed_version]
  @source            = options[:source]
  @action            = options[:action]

  if @requested_version == :latest
    super "Could not #{@action} '#{@module_name}'; no releases are available from #{@source}"
  else
    super "Could not #{@action} '#{@module_name}'; no releases matching '#{@requested_version}' are available from #{@source}"
  end
end

Instance Method Details

#multilineObject



39
40
41
42
43
44
45
46
47
48
49
50
51
# File 'lib/puppet/module_tool/errors/shared.rb', line 39

def multiline
  message = []
  message << "Could not #{@action} '#{@module_name}' (#{vstring})"

  if @requested_version == :latest
    message << "  No releases are available from #{@source}"
    message << "    Does '#{@module_name}' have at least one published release?"
  else
    message << "  No releases matching '#{@requested_version}' are available from #{@source}"
  end

  message.join("\n")
end