summaryrefslogtreecommitdiff
path: root/lib/chef/knife.rb
diff options
context:
space:
mode:
authordanielsdeleo <dan@opscode.com>2013-01-14 15:12:39 -0800
committerdanielsdeleo <dan@opscode.com>2013-01-14 17:28:02 -0800
commitb09dd3272d2557c4722120f89b212bfe72ed7ec3 (patch)
tree2bcf1e7833bae0de73ba6c664c14fe11085d6005 /lib/chef/knife.rb
parent2887e0fe804bd21c8b1d1456837d42ec655a0331 (diff)
downloadchef-b09dd3272d2557c4722120f89b212bfe72ed7ec3.tar.gz
[CHEF-3497] don't configure in Knife#initialize
Config changes a ton of global state and is based on the state of the machine it runs on (most importantly, the user's config file). Running configure_chef in the initializer makes unit tests extremely fragile
Diffstat (limited to 'lib/chef/knife.rb')
-rw-r--r--lib/chef/knife.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/chef/knife.rb b/lib/chef/knife.rb
index a3c4970545..15ad38e25e 100644
--- a/lib/chef/knife.rb
+++ b/lib/chef/knife.rb
@@ -164,6 +164,7 @@ class Chef
subcommand_class.options = options.merge!(subcommand_class.options)
subcommand_class.load_deps
instance = subcommand_class.new(args)
+ instance.configure_chef
instance.run_with_pretty_exceptions
end
@@ -263,8 +264,6 @@ class Chef
command_name_words = self.class.snake_case_name.split('_')
- configure_chef
- configure_from_file_settings! if allow_auto_knife_config?
# Mixlib::CLI ignores the embedded name_args
@name_args = parse_options(argv)
@name_args.delete(command_name_words.join('-'))
@@ -275,6 +274,7 @@ class Chef
command_name_words = command_name_words.join('_')
@name_args.reject! { |name_arg| command_name_words == name_arg }
+
if config[:help]
msg opt_parser
exit 1