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}") % { action: @action, module_name: @module_name, source: @source }
  else
    super _("Could not %{action} '%{module_name}'; no releases matching '%{version}' are available from %{source}") % { action: @action, module_name: @module_name, version: @requested_version, source: @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}' (%{version})") % { action: @action, module_name: @module_name, version: vstring }

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

  message.join("\n")
end