summaryrefslogtreecommitdiff
path: root/lib/chef/knife.rb
diff options
context:
space:
mode:
authorChris Roberts <chrisroberts.code@gmail.com>2012-10-02 08:47:01 -0700
committerdanielsdeleo <dan@opscode.com>2013-01-11 16:04:24 -0800
commit962783a39ab3622afd4bd802bd04ffe6d066e737 (patch)
treeb6d69d5187e1be56f522ea7448b54482bee737ac /lib/chef/knife.rb
parentc755e414ff094404a0211f7ad15cc27cb6ad8833 (diff)
downloadchef-962783a39ab3622afd4bd802bd04ffe6d066e737.tar.gz
Allow knife.rb configuration file to provide any options for knife plugins
Diffstat (limited to 'lib/chef/knife.rb')
-rw-r--r--lib/chef/knife.rb11
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 = []