diff options
author | Noah Kantrowitz <noah@coderanger.net> | 2018-08-21 04:39:49 -0700 |
---|---|---|
committer | Noah Kantrowitz <noah@coderanger.net> | 2018-08-21 04:39:49 -0700 |
commit | 6fef2c0b62dd5e21b7b7fcb02b9a2639632662b9 (patch) | |
tree | 6bb4a5e46f5f0704e2a2e7313fb4e0a712969b8c | |
parent | 516ac6f892b0068fbfa450b0d18ae958303ac8ca (diff) | |
download | chef-6fef2c0b62dd5e21b7b7fcb02b9a2639632662b9.tar.gz |
Only try to set the default keys if there is a default value to set.
Signed-off-by: Noah Kantrowitz <noah@coderanger.net>
-rw-r--r-- | chef-config/lib/chef-config/workstation_config_loader.rb | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/chef-config/lib/chef-config/workstation_config_loader.rb b/chef-config/lib/chef-config/workstation_config_loader.rb index 65940102fc..af0c438ca1 100644 --- a/chef-config/lib/chef-config/workstation_config_loader.rb +++ b/chef-config/lib/chef-config/workstation_config_loader.rb @@ -225,12 +225,14 @@ module ChefConfig Config[:node_name] ||= Etc.getlogin # If we don't have a key (path or inline) check user.pem and $node_name.pem. unless Config.key?(:client_key) || Config.key?(:client_key_contents) - Config[:client_key] = find_default_key(["#{Config[:node_name]}.pem", "user.pem"]) + key_path = find_default_key(["#{Config[:node_name]}.pem", "user.pem"]) + Config[:client_key] = key_path if key_path end # Similarly look for a validation key file, though this should be less # common these days. unless Config.key?(:validation_key) || Config.key?(:validation_key_contents) - Config[:validation_key] = find_default_key(["#{Config[:validation_client_name]}.pem", "validator.pem", "validation.pem"]) + key_path = find_default_key(["#{Config[:validation_client_name]}.pem", "validator.pem", "validation.pem"]) + Config[:validation_key] = key_path if key_path end end |