diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/chef/application.rb | 7 | ||||
-rw-r--r-- | lib/chef/chef_fs/chef_fs_data_store.rb | 6 | ||||
-rw-r--r-- | lib/chef/chef_fs/file_system/repository/chef_repository_file_system_cookbook_artifact_dir.rb | 2 | ||||
-rw-r--r-- | lib/chef/config_fetcher.rb | 8 | ||||
-rw-r--r-- | lib/chef/run_lock.rb | 2 |
5 files changed, 17 insertions, 8 deletions
diff --git a/lib/chef/application.rb b/lib/chef/application.rb index a4d4fc209d..659c4b2f4d 100644 --- a/lib/chef/application.rb +++ b/lib/chef/application.rb @@ -90,6 +90,13 @@ class Chef # Parse the config file def load_config_file config_fetcher = Chef::ConfigFetcher.new(config[:config_file]) + + # Some config settings are derived relative to the config file path; if + # given as a relative path, this is computed relative to cwd, but + # chef-client will later chdir to root, so we need to get the absolute path + # here. + config[:config_file] = config_fetcher.expanded_path + if config[:config_file].nil? Chef::Log.warn("No config file found or specified on command line, using command line options.") elsif config_fetcher.config_missing? diff --git a/lib/chef/chef_fs/chef_fs_data_store.rb b/lib/chef/chef_fs/chef_fs_data_store.rb index 59c2699cca..729b01fdcc 100644 --- a/lib/chef/chef_fs/chef_fs_data_store.rb +++ b/lib/chef/chef_fs/chef_fs_data_store.rb @@ -333,13 +333,7 @@ class Chef end end - # Cookbook artifacts act as if certain things aren't set if they are empty - # (e.g. "definitions" and "libraries" are not set if they are empty, but - # "recipes" is) if cookbook_type == "cookbook_artifacts" - result.delete_if do |key,value| - (value == [] && key != "recipes") - end result["metadata"] = result["metadata"].to_hash result["metadata"].delete_if do |key,value| value == [] || diff --git a/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_cookbook_artifact_dir.rb b/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_cookbook_artifact_dir.rb index dbff973f17..0aab6382be 100644 --- a/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_cookbook_artifact_dir.rb +++ b/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_cookbook_artifact_dir.rb @@ -26,7 +26,7 @@ class Chef # Override from parent def cookbook_version loader = Chef::Cookbook::CookbookVersionLoader.new(file_path, parent.chefignore) - cookbook_name, dash, identifier = name.rpartition("-") + cookbook_name, _dash, identifier = name.rpartition("-") # KLUDGE: We shouldn't have to use instance_variable_set loader.instance_variable_set(:@cookbook_name, cookbook_name) loader.load_cookbooks diff --git a/lib/chef/config_fetcher.rb b/lib/chef/config_fetcher.rb index ac6bdc2249..13f9fc3825 100644 --- a/lib/chef/config_fetcher.rb +++ b/lib/chef/config_fetcher.rb @@ -12,6 +12,14 @@ class Chef @config_location = config_location end + def expanded_path + if config_location.nil? || remote_config? + config_location + else + File.expand_path(config_location) + end + end + def fetch_json config_data = read_config begin diff --git a/lib/chef/run_lock.rb b/lib/chef/run_lock.rb index 42b99440bc..0d94afd15d 100644 --- a/lib/chef/run_lock.rb +++ b/lib/chef/run_lock.rb @@ -72,7 +72,7 @@ class Chef end end end - rescue Timeout::Error => e + rescue Timeout::Error exit_from_timeout end else |