summaryrefslogtreecommitdiff
path: root/chef-config
diff options
context:
space:
mode:
Diffstat (limited to 'chef-config')
-rw-r--r--chef-config/lib/chef-config/workstation_config_loader.rb8
-rw-r--r--chef-config/spec/unit/workstation_config_loader_spec.rb7
2 files changed, 9 insertions, 6 deletions
diff --git a/chef-config/lib/chef-config/workstation_config_loader.rb b/chef-config/lib/chef-config/workstation_config_loader.rb
index 76b829b42e..f92563e338 100644
--- a/chef-config/lib/chef-config/workstation_config_loader.rb
+++ b/chef-config/lib/chef-config/workstation_config_loader.rb
@@ -156,10 +156,10 @@ module ChefConfig
Config.chef_server_url = creds.fetch("chef_server_url") if creds.key?("chef_server_url")
Config.validation_client_name = creds.fetch("validation_client_name") if creds.key?("validation_client_name")
- creds.each do |cred|
- knife_setting = /knife\[:(\w+)\]/.match(cred[0])
- if knife_setting
- Config.knife[knife_setting[1].to_sym] = cred[1]
+ creds.each do |key, value|
+ next if key != "knife"
+ value.each do | k, v |
+ Config.knife[k.to_sym] = v
end
end
diff --git a/chef-config/spec/unit/workstation_config_loader_spec.rb b/chef-config/spec/unit/workstation_config_loader_spec.rb
index 9d294061c3..f8c04bb724 100644
--- a/chef-config/spec/unit/workstation_config_loader_spec.rb
+++ b/chef-config/spec/unit/workstation_config_loader_spec.rb
@@ -394,8 +394,11 @@ RSpec.describe ChefConfig::WorkstationConfigLoader do
node_name = 'barney'
client_key = "barney_rubble.pem"
chef_server_url = "https://api.chef.io/organizations/bedrock"
-"knife[:ssh_user]" = 'knife_ssh_user'
-"knife[:secret_file]" = "/home/barney/.chef/encrypted_data_bag_secret.pem"
+knife = {
+ secret_file = "/home/barney/.chef/encrypted_data_bag_secret.pem"
+}
+[default.knife]
+ssh_user = "knife_ssh_user"
EOH
content
end