diff options
author | Lamont Granquist <lamont@scriptkiddie.org> | 2018-07-03 14:35:03 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-07-03 14:35:03 -0700 |
commit | d58df7b53ed79d81eee0340adf95aa364d6a9a6e (patch) | |
tree | 93ccc263ba4702acee53da10ac2ff5ae9145ec07 /spec/support | |
parent | 7910a42ca5999ae44c5b6b3dc256558b32b42481 (diff) | |
parent | f9e0314265a9f3200ad90eec5c7666ebce9afd6a (diff) | |
download | chef-d58df7b53ed79d81eee0340adf95aa364d6a9a6e.tar.gz |
Merge pull request #7390 from coderanger/yet-more-creds
knife config and a bunch of UX improvements
Diffstat (limited to 'spec/support')
-rw-r--r-- | spec/support/shared/integration/knife_support.rb | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/spec/support/shared/integration/knife_support.rb b/spec/support/shared/integration/knife_support.rb index 5058b7b278..87ce1bc0b0 100644 --- a/spec/support/shared/integration/knife_support.rb +++ b/spec/support/shared/integration/knife_support.rb @@ -24,7 +24,7 @@ require "chef/chef_fs/file_system_cache" module KnifeSupport DEBUG = ENV["DEBUG"] - def knife(*args, input: nil) + def knife(*args, input: nil, instance_filter: nil) # Allow knife('role from file roles/blah.json') rather than requiring the # arguments to be split like knife('role', 'from', 'file', 'roles/blah.json') # If any argument will have actual spaces in it, the long form is required. @@ -88,9 +88,15 @@ module KnifeSupport allow(File).to receive(:file?).and_call_original allow(File).to receive(:file?).with(File.expand_path("~/.chef/credentials")).and_return(false) + # Set a canary that is modified by the default null_config.rb config file. $__KNIFE_INTEGRATION_FAILSAFE_CHECK = "ole" + + # Allow tweaking the knife instance before configuration. + instance_filter.call(instance) if instance_filter + instance.configure_chef + # The canary is incorrect, meaning the normal null_config.rb didn't run. Something is wrong. unless $__KNIFE_INTEGRATION_FAILSAFE_CHECK == "ole ole" raise Exception, "Potential misconfiguration of integration tests detected. Aborting test." end |