Fail to apply a config that contains a zero-value datasource
bk201 opened this issue · comments
The code snippet generates an almost-empty config /tmp/sample.yaml
:
name: test
stages:
default:
- commands:
- echo hello
files: []
directories: []
if: ""
ensure_entities: []
delete_entities: []
dns:
nameservers: []
search: []
options: []
path: ""
hostname: ""
name: ""
sysctl: {}
authorized_keys: {}
node: ""
users: {}
modules: []
systemctl:
enable: []
disable: []
start: []
mask: []
environment: {}
environment_file: ""
datasource:
providers: []
path: ""
layout:
device: null
systemd_firstboot: {}
timesyncd: {}
If I apply the config with yip
, it will fail with the following output:
INFO[0000] yip version 0.9.4-gb3de05be3bcf822ebe9c2cc052d4e75892b70187 2021-07-13 05:36:40 UTC
INFO[0000] Executing /tmp/test.yaml
INFO[0000] Executing yip file name=test stage=default stages=1
INFO[0000] Processing stage step '' commands=1 delete_entities=0 entities=0 files=0 nameserver=0 step=
INFO[0000] Command output: hello
ERRO[0000] No metadata/userdata found. Bye
INFO[0000] Finished yip file execution stage=default stages=1 success=false
ERRO[0000] fatal error: 1 error occurred:
* No metadata/userdata found. Bye
I' not sure if it's because the check here doesn't work. The applying works If I change the datasource to:
datasource:
providers: null
path: ""
I want to programmingly generate a YIP configuration file to be used in cOS. It would be great that zero-value configs can be applied.
Good catch! Thanks for the detailed report. I am on it to fix it.