Exception: Berkshelf::CookbookValidationFailure

Inherits:
BerkshelfError
  • Object
show all
Defined in:
lib/berkshelf/errors.rb

Instance Method Summary collapse

Methods inherited from BerkshelfError

status_code

Constructor Details

#initialize(location, cached_cookbook) ⇒ CookbookValidationFailure

Returns a new instance of CookbookValidationFailure.

Parameters:



221
222
223
224
# File 'lib/berkshelf/errors.rb', line 221

def initialize(location, cached_cookbook)
  @location = location
  @cached_cookbook = cached_cookbook
end

Instance Method Details

#to_sObject



226
227
228
229
230
231
232
233
234
235
236
# File 'lib/berkshelf/errors.rb', line 226

def to_s
  [
    "The cookbook downloaded from #{@location.to_s}:",
    "  #{@cached_cookbook.cookbook_name} (#{@cached_cookbook.version})",
    "",
    "does not satisfy the version constraint:",
    "  #{@cached_cookbook.cookbook_name} (#{@location.version_constraint})",
    "",
    "This occurs when the Chef Server has a cookbook with a missing/mis-matched version number in its `metadata.rb`",
  ].join("\n")
end