Reputation: 2409
I have a yaml file I want to look like this:
failoverconfig:
projectname: fairchild
unitconfig:
- subunit:
id: 8
- socket:
powerunit: power-1
powerport: 10
- socket:
powerunit: power-2
powerport: 2
- subunit:
id: 9
- socket:
powerunit: power-1
powerport: 10
- socket:
powerunit: power-2
powerport: 2
Basically there are multiple subunits that each have multiple sockets. Each socket has a powerunit and a powerport. I've checked my YAML syntax and it seems to be illegal. I don't fully understand why.
How do I fix it and get the data structure I want?
Upvotes: 1
Views: 3482
Reputation: 18823
Answering the question I came here for and that is in the title:
-
- a
- b
Upvotes: 3
Reputation: 106445
I believe what you want is something like this instead:
failoverconfig:
projectname: fairchild
unitconfig:
subunits:
- id: 8
sockets:
- powerunit: power-1
powerport: 10
- powerunit: power-2
powerport: 2
- id: 9
sockets:
- powerunit: power-1
powerport: 10
- powerunit: power-2
powerport: 2
Upvotes: 2