I am trying to configure a YAML file in this format:
jobs: - name: A - schedule: "0 0/5 * 1/1 * ? *" - type: mongodb.cluster - config: - host: mongodb://localhost:27017/admin?replicaSet=rs - minSecondaries: 2 - minOplogHours: 100 - maxSecondaryDelay: 120 - name: B - schedule: "0 0/5 * 1/1 * ? *" - type: mongodb.cluster - config: - host: mongodb://localhost:27017/admin?replicaSet=rs - minSecondaries: 2 - minOplogHours: 100 - maxSecondaryDelay: 120
The idea is that I can read the contents inside the job element, and have a series of different job configs which can be parsed.
however, yamllint.com tells me that this is illegal YAML due to mapping values are not allowed in this context at line 2
where line 2
is the jobs:
line.
What am I doing wrong?
Flow mappings in YAML represent the unordered collection of key value pairs. They are also called as mapping node. Note that keys should be maintained unique. If there is a duplication of keys in flow mapping structure, it will generate an error.
YAML syntaxYAML has features that come from Perl, C, XML, HTML, and other programming languages. YAML is also a superset of JSON, so JSON files are valid in YAML. YAML uses Python-style indentation to indicate nesting. Tab characters are not allowed, so whitespaces are used instead.
This is valid YAML:
jobs: - name: A schedule: "0 0/5 * 1/1 * ? *" type: mongodb.cluster config: host: mongodb://localhost:27017/admin?replicaSet=rs minSecondaries: 2 minOplogHours: 100 maxSecondaryDelay: 120 - name: B schedule: "0 0/5 * 1/1 * ? *" type: mongodb.cluster config: host: mongodb://localhost:27017/admin?replicaSet=rs minSecondaries: 2 minOplogHours: 100 maxSecondaryDelay: 120
Note, that every '-' starts new element in the sequence. Also, indentation of keys in the map should be exactly same.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With