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

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


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

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

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.


54
55
56
57
58
59
60
61
62
63
64
# File 'lib/puppet/module_tool/errors/shared.rb', line 54

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 '%{requested_version}' are available from %{source}") % { requested_version: @requested_version, source: @source }
  end
  message.join("\n")
end