lib/chef/policy_builder/expand_node_object.rb
# Sync_cookbooks eagerly loads all files except files and
# templates.  It returns the cookbook_hash -- the return result
# from /environments/#{node.chef_environment}/cookbook_versions,
# which we will use for our run_context.
#
# === Returns
# Hash:: The hash of cookbooks with download URLs as given by the server
Sync_cookbooks eagerly loads all files except files and
templates.  It returns the cookbook_hash -- the return result
from /environments/#{node.chef_environment}/cookbook_versions,
which we will use for our run_context.

Returns
Hash:: The hash of cookbooks with download URLs as given by the server
Sync_cookbooks eagerly loads all files except files and templates . It returns the cookbook_hash -- the return result from / environments / # { node . chef_environment } / cookbook_versions which we will use for our run_context . Returns Hash :: The hash of cookbooks with download URLs as given by the server
def sync_cookbooks
        Chef::Log.debug("Synchronizing cookbooks")
        begin
          events.cookbook_resolution_start(@expanded_run_list_with_versions)
          cookbook_hash = api_service.post("environments/#{node.chef_environment}/cookbook_versions",
                                         {:run_list => @expanded_run_list_with_versions})
        rescue Exception => e
          events.cookbook_resolution_failed(@expanded_run_list_with_versions, e)
          raise
        else
          events.cookbook_resolution_complete(cookbook_hash)
        end
        synchronizer = Chef::CookbookSynchronizer.new(cookbook_hash, events)
        if temporary_policy?
          synchronizer.remove_obsoleted_files = false
        end
        synchronizer.sync_cookbooks
        Chef::Config[:cookbook_path] = File.join(Chef::Config[:file_cache_path], "cookbooks")
        cookbook_hash
      end
def sync_cookbooks Chef :: Log . debug ( "Synchronizing cookbooks" ) begin events . cookbook_resolution_start ( @expanded_run_list_with_versions ) cookbook_hash = api_service . post ( "environments/#{node.chef_environment}/cookbook_versions" , { :run_list => @expanded_run_list_with_versions } ) rescue Exception => e events . cookbook_resolution_failed ( @expanded_run_list_with_versions , e ) raise else events . cookbook_resolution_complete ( cookbook_hash ) end synchronizer = Chef :: CookbookSynchronizer . new ( cookbook_hash , events ) if temporary_policy? synchronizer . remove_obsoleted_files = false end synchronizer . sync_cookbooks Chef :: Config [ :cookbook_path ] = File . join ( Chef :: Config [ :file_cache_path ] , "cookbooks" ) cookbook_hash end
Sync_cookbooks eagerly loads all files except files and
templates.
Sync_cookbooks eagerly loads all files except files and templates .
# TODO: wrap/munge exception to provide helpful error output # register the file cache path in the cookbook path so that CookbookLoader actually picks up the synced cookbooks