diff options
author | danielsdeleo <dan@getchef.com> | 2015-03-24 18:14:57 -0700 |
---|---|---|
committer | danielsdeleo <dan@getchef.com> | 2015-03-25 08:13:34 -0700 |
commit | 93c669196f53d21cf2b973b014c2cde4e0c3313a (patch) | |
tree | 59bd141848d7036167cdc6522491f24ae788bb9d /lib | |
parent | a6fbf127d3eeb38d73fa4b9aec98ef34cf897f85 (diff) | |
download | chef-93c669196f53d21cf2b973b014c2cde4e0c3313a.tar.gz |
Handle cookbook artfact format differences when fetching cookbookspolicyfile-erchef-integration
Cookbook artifacts differ in these ways:
* the name field is the cookbook name instead of name+version
* there is no "cookbook_name" field
* cookbook artifacts don't have a json_class when downloaded from the
server
* there is an identifier field
Diffstat (limited to 'lib')
-rw-r--r-- | lib/chef/cookbook/remote_file_vendor.rb | 2 | ||||
-rw-r--r-- | lib/chef/policy_builder/policyfile.rb | 6 |
2 files changed, 6 insertions, 2 deletions
diff --git a/lib/chef/cookbook/remote_file_vendor.rb b/lib/chef/cookbook/remote_file_vendor.rb index 2ddce31001..9d895b168e 100644 --- a/lib/chef/cookbook/remote_file_vendor.rb +++ b/lib/chef/cookbook/remote_file_vendor.rb @@ -30,7 +30,7 @@ class Chef def initialize(manifest, rest) @manifest = manifest - @cookbook_name = @manifest[:cookbook_name] + @cookbook_name = @manifest[:cookbook_name] || @manifest[:name] @rest = rest end diff --git a/lib/chef/policy_builder/policyfile.rb b/lib/chef/policy_builder/policyfile.rb index f85d72f121..0c7c07f9f3 100644 --- a/lib/chef/policy_builder/policyfile.rb +++ b/lib/chef/policy_builder/policyfile.rb @@ -370,7 +370,7 @@ class Chef def artifact_manifest_for(cookbook_name, lock_data) identifier = lock_data["identifier"] rel_url = "cookbook_artifacts/#{cookbook_name}/#{identifier}" - http_api.get(rel_url) + inflate_cbv_object(http_api.get(rel_url)) rescue Exception => e message = "Error loading cookbook #{cookbook_name} with identifier #{identifier} from #{rel_url}: #{e.class} - #{e.message}" err = Chef::Exceptions::CookbookNotFound.new(message) @@ -378,6 +378,10 @@ class Chef raise err end + def inflate_cbv_object(raw_manifest) + Chef::CookbookVersion.from_cb_artifact_data(raw_manifest) + end + end end end |