diff options
-rw-r--r-- | lib/chef/knife.rb | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/lib/chef/knife.rb b/lib/chef/knife.rb index fb8582b65a..d8b0a169b6 100644 --- a/lib/chef/knife.rb +++ b/lib/chef/knife.rb @@ -164,7 +164,6 @@ 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 @@ -264,6 +263,8 @@ class Chef command_name_words = self.class.snake_case_name.split('_') + configure_chef + configure_from_file_settings! # Mixlib::CLI ignores the embedded name_args @name_args = parse_options(argv) @name_args.delete(command_name_words.join('-')) @@ -292,6 +293,14 @@ class Chef exit(1) end + def configure_from_file_settings! + if(Chef::Config[:knife]) + self.class.options.keys.each do |key| + config[key] = Chef::Config[:knife][key] if Chef::Config[:knife].has_key?(key) + end + end + end + def configure_chef unless config[:config_file] candidate_configs = [] |