summaryrefslogtreecommitdiff
path: root/lib/chef/application.rb
diff options
context:
space:
mode:
authordanielsdeleo <dan@chef.io>2016-01-26 13:32:29 -0800
committerdanielsdeleo <dan@chef.io>2016-01-27 12:38:54 -0800
commit05d98b354ab995fefd9ef6bc6d3e19bb5f960ad5 (patch)
treebf75f47b1b87ddbfddcb9100a803716eca1b65fe /lib/chef/application.rb
parent6defab990c91e07361cc27a41d506338ca915527 (diff)
downloadchef-05d98b354ab995fefd9ef6bc6d3e19bb5f960ad5.tar.gz
Force config file setting to absolute path in chef-client
Diffstat (limited to 'lib/chef/application.rb')
-rw-r--r--lib/chef/application.rb7
1 files changed, 7 insertions, 0 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?