diff options
author | Marc A. Paradise <marc.paradise@gmail.com> | 2021-02-04 12:43:19 -0500 |
---|---|---|
committer | Marc A. Paradise <marc.paradise@gmail.com> | 2021-02-04 12:43:19 -0500 |
commit | bb3732db3cc09fb2502392c12cc2737385bce688 (patch) | |
tree | 53e74273e03ea3dbfe145421fb353533a881d2fd | |
parent | a53c4c4db03e8cf1050af76f285d0d00b0088143 (diff) | |
download | chef-mp/testing-cb-load.tar.gz |
Add debug kernel.puts to trace load of a cookbook. Not for mergemp/testing-cb-load
Signed-off-by: Marc A. Paradise <marc.paradise@gmail.com>
-rw-r--r-- | lib/chef/chef_fs/chef_fs_data_store.rb | 4 | ||||
-rw-r--r-- | lib/chef/chef_fs/file_system.rb | 2 | ||||
-rw-r--r-- | lib/chef/chef_fs/file_system/repository/chef_repository_file_system_cookbook_dir.rb | 3 | ||||
-rw-r--r-- | lib/chef/cookbook/cookbook_version_loader.rb | 2 | ||||
-rw-r--r-- | lib/chef/http.rb | 3 | ||||
-rw-r--r-- | lib/chef/policy_builder/expand_node_object.rb | 16 |
6 files changed, 30 insertions, 0 deletions
diff --git a/lib/chef/chef_fs/chef_fs_data_store.rb b/lib/chef/chef_fs/chef_fs_data_store.rb index eeeb96e38b..662d15dd8c 100644 --- a/lib/chef/chef_fs/chef_fs_data_store.rb +++ b/lib/chef/chef_fs/chef_fs_data_store.rb @@ -261,6 +261,7 @@ class Chef end def get(path, request = nil) + Kernel.puts "*** GET start - #{path}" if use_memory_store?(path) @memory_store.get(path) @@ -309,6 +310,7 @@ class Chef # GET /cookbooks/NAME/VERSION or /cookbook_artifacts/NAME/IDENTIFIER elsif %w{cookbooks cookbook_artifacts}.include?(path[0]) && path.length == 3 with_entry(path) do |entry| + Kernel.puts "GET #{["cookbooks", path].flatten} entry: #{entry}" cookbook_type = path[0] result = nil begin @@ -344,12 +346,14 @@ class Chef end end + Kernel.puts "*** GET COMPLETE" Chef::JSONCompat.to_json_pretty(result) end else with_entry(path) do |entry| + Kernel.puts "*** GET COMPLETE via read" entry.read rescue Chef::ChefFS::FileSystem::NotFoundError => e raise ChefZero::DataStore::DataNotFoundError.new(to_zero_path(e.entry), e) diff --git a/lib/chef/chef_fs/file_system.rb b/lib/chef/chef_fs/file_system.rb index 73c3f0090a..26e659c731 100644 --- a/lib/chef/chef_fs/file_system.rb +++ b/lib/chef/chef_fs/file_system.rb @@ -92,6 +92,7 @@ class Chef # Chef::ChefFS::FileSystem.resolve_path(root_path, 'cookbooks/java/recipes/default.rb') # def self.resolve_path(entry, path) + Kernel.puts "resolve_path #{entry} #{path}" return entry if path.length == 0 return resolve_path(entry.root, path) if path[0, 1] == "/" && entry.root != entry @@ -103,6 +104,7 @@ class Chef Chef::ChefFS::PathUtils.split(path).each do |part| result = result.child(part) end + Kernel.puts "resolve_path COMPLETE #{result} #{path}" result end diff --git a/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_cookbook_dir.rb b/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_cookbook_dir.rb index 0bb1ba1cac..7f05e4d5c9 100644 --- a/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_cookbook_dir.rb +++ b/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_cookbook_dir.rb @@ -88,11 +88,14 @@ class Chef # Customizations of base class def chef_object + Kernel.puts "BEGIN chef_object" cb = cookbook_version unless cb Chef::Log.error("Cookbook #{file_path} empty.") + Kernel.puts "ERROR chef_object" raise "Cookbook #{file_path} empty." end + Kernel.puts "END chef_object" cb rescue => e Chef::Log.error("Could not read #{path_for_printing} into a Chef object: #{e}") diff --git a/lib/chef/cookbook/cookbook_version_loader.rb b/lib/chef/cookbook/cookbook_version_loader.rb index faed509321..5274b7640e 100644 --- a/lib/chef/cookbook/cookbook_version_loader.rb +++ b/lib/chef/cookbook/cookbook_version_loader.rb @@ -49,6 +49,8 @@ class Chef def initialize(path, chefignore = nil) @cookbook_path = File.expand_path( path ) # cookbook_path from which this was loaded + Kernel.puts "LOADER INITIALIZING with #{path} expanded to #{@cookbook_path}" + @inferred_cookbook_name = File.basename( path ) @chefignore = chefignore @metadata = nil diff --git a/lib/chef/http.rb b/lib/chef/http.rb index 162998b7f3..11a1f426c3 100644 --- a/lib/chef/http.rb +++ b/lib/chef/http.rb @@ -376,6 +376,9 @@ class Chef headers = build_headers(method, url, base_headers, body) client = http_client(url) return_value = nil + + Kernel.puts "URL: #{url}" + if block_given? request, response = client.request(method, url, body, headers, &response_handler) else diff --git a/lib/chef/policy_builder/expand_node_object.rb b/lib/chef/policy_builder/expand_node_object.rb index 965e4defe6..3bdb50da88 100644 --- a/lib/chef/policy_builder/expand_node_object.rb +++ b/lib/chef/policy_builder/expand_node_object.rb @@ -78,21 +78,29 @@ class Chef run_context.events = events run_context.node = node + Kernel.puts "LOADING - cookbook_collection starting" cookbook_collection = if Chef::Config[:solo_legacy_mode] Chef::Cookbook::FileVendor.fetch_from_disk(Chef::Config[:cookbook_path]) cl = Chef::CookbookLoader.new(Chef::Config[:cookbook_path]) cl.load_cookbooks + Kernel.puts "LOADING - cookbook load complete, init COokbookCollection" Chef::CookbookCollection.new(cl) else + Kernel.puts "LOADING - from remote #{api_service}" Chef::Cookbook::FileVendor.fetch_from_remote(api_service) + Kernel.puts "LOADING - about to sync_cookbooks" cookbook_hash = sync_cookbooks + Kernel.puts "LOADING - cookbook sync complete, init COokbookCollection" Chef::CookbookCollection.new(cookbook_hash) end + Kernel.puts "LOADING - cookbook_collection commplete" cookbook_collection.validate! + Kernel.puts "LOADING - cookbook_collection validation complete" cookbook_collection.install_gems(events) + Kernel.puts "LOADING - cookbook_collection gem install complete" run_context.cookbook_collection = cookbook_collection # TODO: move this into the cookbook_compilation_start hook @@ -100,15 +108,18 @@ class Chef events.cookbook_compilation_start(run_context) + Kernel.puts "LOADING - load expanded run list start" run_context.load(@run_list_expansion) if specific_recipes specific_recipes.each do |recipe_file| run_context.load_recipe_file(recipe_file) end end + Kernel.puts "LOADING - load expanded run list complete" events.cookbook_compilation_complete(run_context) + Kernel.puts "LOADING - compilation complete" run_context end @@ -182,12 +193,17 @@ class Chef Chef::Log.trace("Synchronizing cookbooks") begin + Kernel.puts "sync_cookbooks: start" events.cookbook_resolution_start(@expanded_run_list_with_versions) + Kernel.puts "sync_cookbooks: post for cookbook_versions w/ runlist #{@expanded_run_list_with_versions}" cookbook_hash = api_service.post("environments/#{node.chef_environment}/cookbook_versions", { run_list: @expanded_run_list_with_versions }) + Kernel.puts "sync_cookbooks: post for cookbook_versions done" cookbook_hash = cookbook_hash.inject({}) do |memo, (key, value)| + Kernel.puts "sync_cookbooks: CookbookVersion.from_hash" memo[key] = Chef::CookbookVersion.from_hash(value) + Kernel.puts "sync_cookbooks: CookbookVersion.from_hash done" memo end rescue Exception => e |