diff options
author | S.Cavallo <smcavallo@hotmail.com> | 2018-05-10 15:44:51 -0400 |
---|---|---|
committer | S.Cavallo <smcavallo@hotmail.com> | 2018-05-10 15:44:51 -0400 |
commit | 7703ef2581ea3b230d797d0c9362d76aa90930b4 (patch) | |
tree | 5abc8ba046622d2b8baebeaefff28a5c42eba863 /chef-config | |
parent | c94f90370bf38020d7773f0226090a40f5fae75b (diff) | |
download | chef-7703ef2581ea3b230d797d0c9362d76aa90930b4.tar.gz |
refactoring to support inline tables
Signed-off-by: S.Cavallo <smcavallo@hotmail.com>
Diffstat (limited to 'chef-config')
-rw-r--r-- | chef-config/lib/chef-config/workstation_config_loader.rb | 8 | ||||
-rw-r--r-- | chef-config/spec/unit/workstation_config_loader_spec.rb | 7 |
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 |