diff options
author | Thom May <thom@chef.io> | 2017-03-21 10:31:40 +0000 |
---|---|---|
committer | Thom May <thom@chef.io> | 2017-04-04 07:18:09 +0100 |
commit | 8f62f18a24e3213ef4b2f13a5abf0135bf6c2429 (patch) | |
tree | 7e3073c1b9a7aeb1fd54b08a191ad3bfcf0674f0 /lib/chef/policy_builder | |
parent | e3b9e67a880bcd658517f90a6add837c0e026798 (diff) | |
download | chef-8f62f18a24e3213ef4b2f13a5abf0135bf6c2429.tar.gz |
RFC 67: Remove cookbook segments
This implements RFC 67, which removes cookbook segments, and moves to a
single list of all the files contained in a cookbook. This allows us to
move forward with better audit modes and also proper shipping of ohai
plugins.
Signed-off-by: Thom May <thom@chef.io>
Diffstat (limited to 'lib/chef/policy_builder')
-rw-r--r-- | lib/chef/policy_builder/expand_node_object.rb | 3 | ||||
-rw-r--r-- | lib/chef/policy_builder/policyfile.rb | 13 |
2 files changed, 9 insertions, 7 deletions
diff --git a/lib/chef/policy_builder/expand_node_object.rb b/lib/chef/policy_builder/expand_node_object.rb index dbed44a002..26f39e8b73 100644 --- a/lib/chef/policy_builder/expand_node_object.rb +++ b/lib/chef/policy_builder/expand_node_object.rb @@ -239,7 +239,8 @@ class Chef end def api_service - @api_service ||= Chef::ServerAPI.new(config[:chef_server_url]) + @api_service ||= Chef::ServerAPI.new(config[:chef_server_url], + { version_class: Chef::CookbookManifestVersions }) end def config diff --git a/lib/chef/policy_builder/policyfile.rb b/lib/chef/policy_builder/policyfile.rb index f0009eac6c..f84e1dc68e 100644 --- a/lib/chef/policy_builder/policyfile.rb +++ b/lib/chef/policy_builder/policyfile.rb @@ -149,7 +149,7 @@ class Chef # # @return [Chef::RunContext] def setup_run_context(specific_recipes = nil) - Chef::Cookbook::FileVendor.fetch_from_remote(http_api) + Chef::Cookbook::FileVendor.fetch_from_remote(api_service) sync_cookbooks cookbook_collection = Chef::CookbookCollection.new(cookbooks_to_sync) cookbook_collection.validate! @@ -267,7 +267,7 @@ class Chef # @api private def policy - @policy ||= http_api.get(policyfile_location) + @policy ||= api_service.get(policyfile_location) rescue Net::HTTPServerException => e raise ConfigurationError, "Error loading policyfile from `#{policyfile_location}': #{e.class} - #{e.message}" end @@ -452,8 +452,9 @@ class Chef end # @api private - def http_api - @api_service ||= Chef::ServerAPI.new(config[:chef_server_url]) + def api_service + @api_service ||= Chef::ServerAPI.new(config[:chef_server_url], + { version_class: Chef::CookbookManifestVersions }) end # @api private @@ -496,7 +497,7 @@ class Chef def compat_mode_manifest_for(cookbook_name, lock_data) xyz_version = lock_data["dotted_decimal_identifier"] rel_url = "cookbooks/#{cookbook_name}/#{xyz_version}" - inflate_cbv_object(http_api.get(rel_url)) + inflate_cbv_object(api_service.get(rel_url)) rescue Exception => e message = "Error loading cookbook #{cookbook_name} at version #{xyz_version} from #{rel_url}: #{e.class} - #{e.message}" err = Chef::Exceptions::CookbookNotFound.new(message) @@ -507,7 +508,7 @@ class Chef def artifact_manifest_for(cookbook_name, lock_data) identifier = lock_data["identifier"] rel_url = "cookbook_artifacts/#{cookbook_name}/#{identifier}" - inflate_cbv_object(http_api.get(rel_url)) + inflate_cbv_object(api_service.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) |