diff options
author | danielsdeleo <dan@chef.io> | 2015-09-25 15:27:04 -0700 |
---|---|---|
committer | danielsdeleo <dan@chef.io> | 2015-09-25 15:27:04 -0700 |
commit | 73b0f10117549f74a001354b71596aa4b6106131 (patch) | |
tree | 68e87407aabfa2e5452172d5ae8018c35ded3cf9 | |
parent | a37c95afa90666574e6335f8212e0f8fcd4b6f4c (diff) | |
download | chef-73b0f10117549f74a001354b71596aa4b6106131.tar.gz |
Create empty config context for chefdkchefdk-empty-config-context
Allows `knife` and such to parse config files with `chefdk.settting` in
them without error.
-rw-r--r-- | chef-config/lib/chef-config/config.rb | 8 | ||||
-rw-r--r-- | chef-config/spec/unit/config_spec.rb | 8 |
2 files changed, 16 insertions, 0 deletions
diff --git a/chef-config/lib/chef-config/config.rb b/chef-config/lib/chef-config/config.rb index 2405b127f3..069f0ed6c0 100644 --- a/chef-config/lib/chef-config/config.rb +++ b/chef-config/lib/chef-config/config.rb @@ -690,6 +690,14 @@ module ChefConfig default :watchdog_timeout, 2 * (60 * 60) # 2 hours end + # Add an empty and non-strict config_context for chefdk. This lets the user + # have code like `chefdk.generator_cookbook "/path/to/cookbook"` in their + # config.rb, and it will be ignored by tools like knife and ohai. ChefDK + # itself can define the config options it accepts and enable strict mode, + # and that will only apply when running `chef` commands. + config_context :chefdk do + end + # Chef requires an English-language UTF-8 locale to function properly. We attempt # to use the 'locale -a' command and search through a list of preferences until we # find one that we can use. On Ubuntu systems we should find 'C.UTF-8' and be diff --git a/chef-config/spec/unit/config_spec.rb b/chef-config/spec/unit/config_spec.rb index bc35fbee69..d99ff428fb 100644 --- a/chef-config/spec/unit/config_spec.rb +++ b/chef-config/spec/unit/config_spec.rb @@ -561,6 +561,14 @@ RSpec.describe ChefConfig::Config do end end + describe "allowing chefdk configuration outside of chefdk" do + + it "allows arbitrary settings in the chefdk config context" do + expect { ChefConfig::Config.chefdk.generator_cookbook("/path") }.to_not raise_error + end + + end + describe "Treating deprecation warnings as errors" do context "when using our default RSpec configuration" do |