diff options
author | danielsdeleo <dan@getchef.com> | 2015-03-24 17:53:56 -0700 |
---|---|---|
committer | danielsdeleo <dan@getchef.com> | 2015-03-25 08:13:34 -0700 |
commit | a6fbf127d3eeb38d73fa4b9aec98ef34cf897f85 (patch) | |
tree | a0eeadd9ae0a6bb4887b1c8f80e28e25952c7d7e /lib/chef/cookbook_version.rb | |
parent | 7ebb11ce0dbdec76562eb1008a8d85faad0cdaf4 (diff) | |
download | chef-a6fbf127d3eeb38d73fa4b9aec98ef34cf897f85.tar.gz |
Update policyfile URLs and cookbook artifact data format per RFC
Diffstat (limited to 'lib/chef/cookbook_version.rb')
-rw-r--r-- | lib/chef/cookbook_version.rb | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/lib/chef/cookbook_version.rb b/lib/chef/cookbook_version.rb index b8f32a61bb..8d302eeec2 100644 --- a/lib/chef/cookbook_version.rb +++ b/lib/chef/cookbook_version.rb @@ -78,6 +78,16 @@ class Chef attr_accessor :chef_server_rest + # The `identifier` field is used for cookbook_artifacts, which are + # organized on the chef server according to their content. If the + # policy_mode option to CookbookManifest is set to true it will include + # this field in the manifest Hash and in the upload URL. + # + # This field may be removed or have different behavior in the future, don't + # use it in 3rd party code. + # @api private + attr_accessor :identifier + # The first root path is the primary cookbook dir, from which metadata is loaded def root_dir root_paths[0] @@ -458,6 +468,15 @@ class Chef cookbook_version end + def self.from_cb_artifact_data(o) + cookbook_version = new(o["name"]) + # We want the Chef::Cookbook::Metadata object to always be inflated + cookbook_version.metadata = Chef::Cookbook::Metadata.from_hash(o["metadata"]) + cookbook_version.manifest = o + cookbook_version.identifier = o["identifier"] + cookbook_version + end + # @deprecated This method was used by the Ruby Chef Server and is no longer # needed. There is no replacement. def generate_manifest_with_urls(&url_generator) |