Closed renard closed 5 years ago
Oh, it's a bad example in readme, and i'll remove it later.
Till now, !include
constructor can NOT be used at the TOP level, unless it's the only one node in whole YAML document.
so:
!include include.d/1.yml
is correct
!include include.d/1.yml
# any other node
is WRONG
but
1: !include include.d/1.yml
2: !include include.d/2.yml
foo: boo
is correct
I get the same problem when doing:
thing: !include include.d/1.yml
name: !include include.d/name.yml
Is that expected?
I get the same problem when doing:
thing: !include include.d/1.yml name: !include include.d/name.yml
Is that expected?
No, it's not a valide YAML, i think.
Because the include
constructor can not include YAML files literally -- it loads anoter YAML file, and parses it to a python object, then put it into original YAML document.
So, the above YAML snippet will be taken as:
thing: <included and parsed object>
name: <another included and parsed object>
which is invalid.
BTW, if want to include literally, a template engine maybe better.
Here is my setup:
The python script (from the README):
0.yml
:1.yml
:It seems that mixing toplevel include and other value is not (yet?) supported.
I got this error: