Plugin Stanza does not parse JSON correctly
- Dominant language
- Go
- Stars
- 17k
- Forks
- 2.1k
- Avg merge
- 1d 9h
- Merged PRs (30d)
- 105
Description
If filing a bug please include the following:
### Nomad version
v0.10.4
### Operating system and Environment details
Ubuntu 18.04 in AWS
### Issue
With a JSON configuration file, the `plugin` stanza triggers an error on start unless all hashes are nested in arrays.
Config we expect to work:
```
"plugin": {
"docker": {
"config": {
"auth": {
"config": "/root/.docker/config.json"
},
"gc": {
"image": true,
"image_delay": "1h",
"container": true
}
}
}
}
```
Error:
```
loading /etc/nomad.d/default.json: At -: root.plugin[0].config: not an object type for map (*ast.LiteralType)
```
Config which does work:
```
"plugin": [
{
"docker": [
{
"config": [
{
"auth": [
{
"config": "/root/.docker/config.json"
}
],
"gc": [
{
"container": true,
"image": true,
"image_delay": "1h"
}
]
}
]
}
]
}
]
```
### Reproduction steps
Attempt to start Nomad with a JSON config that includes the plugin stanza.
Note, other JSON stanzas are parsing correctly, e.g. the `client` stanza in the same file does not require that nested hashes be wrapped in `[]`:
```
"client": {
"enabled": true,
"node_class": "generic",
"max_kill_timeout": "300s",
"options": {
"driver.raw_exec.enable": true
},
"reserved": {
"cpu": 1024,
"disk": 2048,
"memory": 1024,
"reserved_ports": "22,25,53,123,514,4646-4648,48484,49968,8200-8302,8400,8500,8600,8953"
}
}
```
Contributor guide
No contributing guide indexed for this repository
Research direction
Reproduce Nomad startup with the issue's first JSON configuration, then trace the plugin stanza parsing entry point and compare it with the working array form. Done means nested JSON objects in the plugin stanza are accepted like the client stanza, with a regression test covering the reported configuration.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go, json
- Domain
- infrastructure
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100