def describe_412_error(error_description)
explanation = ""
error_reasons = extract_412_error_message
if !error_reasons.respond_to?(:key?)
explanation << error_reasons.to_s
else
if error_reasons.key?("non_existent_cookbooks") && !Array(error_reasons["non_existent_cookbooks"]).empty?
explanation << "The following cookbooks are required by the client but don't exist on the server:\n"
Array(error_reasons["non_existent_cookbooks"]).each do |cookbook|
explanation << "* #{cookbook}\n"
end
explanation << "\n"
end
if error_reasons.key?("cookbooks_with_no_versions") && !Array(error_reasons["cookbooks_with_no_versions"]).empty?
explanation << "The following cookbooks exist on the server, but there is no version that meets\nthe version constraints in this environment:\n"
Array(error_reasons["cookbooks_with_no_versions"]).each do |cookbook|
explanation << "* #{cookbook}\n"
end
explanation << "\n"
end
end
error_description.section("Missing Cookbooks:", explanation)
error_description.section("Expanded Run List:", expanded_run_list_ul)
end