Closed bkahlerventer closed 5 days ago
when config file is indented with 4 spaces instead of 2 the file loads, no problem. if indentation is done with 2 spaces, config refuses to load with error.
I found success this way
- node:
id: foo
- control-service:
service: control
filename: /tmp/foo.sock
- tcp-peer:
address: localhost:2222
redial: true
- log-level: debug
The way the current config works is its using yaml-like syntax so there are some strange behaviors with it.
I have a PR out right now to use traditional yaml syntax for our configuations here: https://github.com/ansible/receptor/pull/1043
The current configuration file is valid YAML, not just "YAML-like" syntax, I think. If we convert the YAML to JSON, we should be able to understand the difference in meaning caused by the indentation.
This is invalid configuration and JSONed version:
- control-service:
service: control
filename: /tmp/foo.sock
[
{
"control-service": null,
"service": "control",
"filename": "/tmp/foo.sock"
}
]
This is valid configuration and JSONed version:
- control-service:
service: control
filename: /tmp/foo.sock
[
{
"control-service": {
"service": "control",
"filename": "/tmp/foo.sock"
}
}
]
In the invalid configuration, all three keys are at the same level.
In the valid configuration, service
and filename
are child elements of the control-service
key.
Since service
and filename
are settings related to control-service
, it is more appropriate for them to be child elements.
However, the indentation in the example in the documentation is indeed incorrect and should be fixed: https://ansible.readthedocs.io/projects/receptor/en/latest/getting_started_guide/creating_a_basic_network.html
I will check again doing indentation with 2 spaces, but initial tests show it MUST BE 4 spaces or errors show up.
no matter the content of the config file for receptor, I always get: