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:



208
209
210
211
# File 'lib/berkshelf/errors.rb', line 208

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

Instance Method Details

#to_sObject



213
214
215
216
217
218
219
220
221
222
223
# File 'lib/berkshelf/errors.rb', line 213

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