summaryrefslogtreecommitdiff
path: root/lib/chef
diff options
context:
space:
mode:
authorJohn Keiser <jkeiser@opscode.com>2013-10-16 10:20:04 -0700
committerdanielsdeleo <dan@opscode.com>2013-10-16 13:53:37 -0700
commita2e417039fd2850a4bc722c2ec2db9c9c36fca73 (patch)
tree8854170f0ef959ff653d1175baae6d9ad81ac061 /lib/chef
parent6f8ca6c27c0987fdfbbbb8e19cac69fa6a389c9e (diff)
downloadchef-a2e417039fd2850a4bc722c2ec2db9c9c36fca73.tar.gz
Flip config_missing? to return true when missing
Diffstat (limited to 'lib/chef')
-rw-r--r--lib/chef/application.rb2
-rw-r--r--lib/chef/config_fetcher.rb12
-rw-r--r--lib/chef/knife.rb2
3 files changed, 7 insertions, 9 deletions
diff --git a/lib/chef/application.rb b/lib/chef/application.rb
index 164afd5510..c1fc3a78a4 100644
--- a/lib/chef/application.rb
+++ b/lib/chef/application.rb
@@ -25,8 +25,6 @@ require 'chef/platform'
require 'mixlib/cli'
require 'tmpdir'
require 'rbconfig'
-require 'pathname'
-require 'chef/chef_fs/path_utils'
class Chef::Application
include Mixlib::CLI
diff --git a/lib/chef/config_fetcher.rb b/lib/chef/config_fetcher.rb
index 2400dc6897..80a313590b 100644
--- a/lib/chef/config_fetcher.rb
+++ b/lib/chef/config_fetcher.rb
@@ -46,26 +46,26 @@ class Chef
end
def config_missing?
- return true if remote_config?
+ return false if remote_config?
# Check if the config file exists, and check if it is underneath the config file jail
begin
- real_config_file = Pathname.new(config_file).realpath.to_s
+ real_config_file = Pathname.new(config_location).realpath.to_s
rescue Errno::ENOENT
- return false
+ return true
end
# If realpath succeeded, the file exists
- return true if !config_file_jail
+ return false if !config_file_jail
begin
real_jail = Pathname.new(config_file_jail).realpath.to_s
rescue Errno::ENOENT
Chef::Log.warn("Config file jail #{config_file_jail} does not exist: will not load any config file.")
- return false
+ return true
end
- Chef::ChefFS::PathUtils.descendant_of?(real_config_file, real_jail)
+ !Chef::ChefFS::PathUtils.descendant_of?(real_config_file, real_jail)
end
def http
diff --git a/lib/chef/knife.rb b/lib/chef/knife.rb
index 5d455f9b24..a7b2b27985 100644
--- a/lib/chef/knife.rb
+++ b/lib/chef/knife.rb
@@ -412,7 +412,7 @@ class Chef
# Don't try to load a knife.rb if it wasn't specified.
if config[:config_file]
fetcher = Chef::ConfigFetcher.new(config[:config_file], Chef::Config.config_file_jail)
- if fetcher.config_missing?(config[:config_file])
+ if fetcher.config_missing?
ui.error("Specified config file #{config[:config_file]} does not exist#{Chef::Config.config_file_jail ? " or is not under config file jail #{Chef::Config.config_file_jail}" : ""}!")
exit 1
end