Reputation: 527
I have the following chef attribute that i'm trying to convert to YAML for test-kitchen:
default['attr1']['attr2'] = {
"setting1" => {
"key1" => "value1",
"key2" => "value2",
"key3" => false
},
};
What would this look like in YAML so test-kitchen will override it properly? I want to override the false value to true for specific test-kitchen drivers.
There is a similar SO question: Adding Attributes to Test Kitchen but the attribute i'm trying to convert is more complicated (i.e the value is not a simple string).
Upvotes: 0
Views: 136
Reputation: 4223
Should be
attr1:
attr2:
setting1:
key1: value1
key2: value2
key3: false
Upvotes: 2
Reputation: 15784
My best idea, use irb:
irb(main):001:0> h={
irb(main):002:1* "setting1" => {
irb(main):003:2* "key1" => "value1",
irb(main):004:2* "key2" => "value2",
irb(main):005:2* "key3" => false
irb(main):006:2> },
irb(main):007:1* }
=> {"setting1"=>{"key1"=>"value1", "key2"=>"value2", "key3"=>false}}
irb(main):010:0> require 'yaml'
=> true
irb(main):011:0> h.to_yaml
=> "---\nsetting1:\n key1: value1\n key2: value2\n key3: false\n"
Disclaimer: I'm not using test-kitchen nor yaml usually, so it may or may not work.
Upvotes: 1