Created
October 23, 2014 10:13
-
-
Save sawanoboly/4c48904cb78f357034b8 to your computer and use it in GitHub Desktop.
monkey patch using Policyfile.rb for chef-zero
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use_policyfile true | |
require 'chef/policy_builder/policyfile' | |
class ::Chef | |
module PolicyBuilder | |
class Policyfile | |
class_eval do | |
def manifest_for(cookbook_name, lock_data) | |
xyz_version = lock_data["version"] | |
http_api.get("cookbooks/#{cookbook_name}/#{xyz_version}") | |
rescue Exception => e | |
message = "Error loading cookbook #{cookbook_name} at version #{xyz_version}: #{e.class} - #{e.message}" | |
err = Chef::Exceptions::CookbookNotFound.new(message) | |
err.set_backtrace(e.backtrace) | |
raise err | |
end | |
end | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment