Cloud-init 验证器
Cloud-init validator
想知道是否有人知道可以验证类似于 this. We tried it and it gives a bunch of errors that are not applicable e.g., it does not recognize package_update
which is a standard keyword that can be found here in the official documentation for example. So we are looking for a validator that works and recognizes the keywords in the official documentation 的 cloud-init 配置的验证器。
我最近也打了这个,找到了一个很好的方法。
在 Ubuntu 中,您可以使用以下内容来验证文件是否正确解析。
cloud-init devel schema --config-file bob.txt
如果文件有效或无效,这会给您以下通知
:~$ sudo cloud-init devel schema --config-file bob.txt
Valid cloud-config file bob.txt
$ nano bob.txt #edited the yaml to make it invalid
:~$ sudo cloud-init devel schema --config-file bob.txt
Cloud config schema errors: format-l2.c1: File bob.txt is not valid yaml. while parsing a block mapping
in "<byte string>", line 2, column 1:
package_upgrade: true
^
expected <block end>, but found '-'
in "<byte string>", line 6, column 1:
- 'curl -fsSL https://get.docker ...
^
虽然您使用云初始化文件 cloud-init status --wait
和 cli
上的许多其他命令都非常有用。
嗯,在进一步检查中,它似乎没有发现很多类型的错误,但 Cloud Init docs 将其列为正在进行的工作。
cloud-init devel schema: A #cloud-config format and schema validator. It accepts a cloud-config yaml file and annotates potential schema errors locally without the need for deployment. Schema validation is work in progress and supports a subset of cloud-config modules.
想知道是否有人知道可以验证类似于 this. We tried it and it gives a bunch of errors that are not applicable e.g., it does not recognize package_update
which is a standard keyword that can be found here in the official documentation for example. So we are looking for a validator that works and recognizes the keywords in the official documentation 的 cloud-init 配置的验证器。
我最近也打了这个,找到了一个很好的方法。
在 Ubuntu 中,您可以使用以下内容来验证文件是否正确解析。
cloud-init devel schema --config-file bob.txt
如果文件有效或无效,这会给您以下通知
:~$ sudo cloud-init devel schema --config-file bob.txt
Valid cloud-config file bob.txt
$ nano bob.txt #edited the yaml to make it invalid
:~$ sudo cloud-init devel schema --config-file bob.txt
Cloud config schema errors: format-l2.c1: File bob.txt is not valid yaml. while parsing a block mapping
in "<byte string>", line 2, column 1:
package_upgrade: true
^
expected <block end>, but found '-'
in "<byte string>", line 6, column 1:
- 'curl -fsSL https://get.docker ...
^
虽然您使用云初始化文件 cloud-init status --wait
和 cli
上的许多其他命令都非常有用。
嗯,在进一步检查中,它似乎没有发现很多类型的错误,但 Cloud Init docs 将其列为正在进行的工作。
cloud-init devel schema: A #cloud-config format and schema validator. It accepts a cloud-config yaml file and annotates potential schema errors locally without the need for deployment. Schema validation is work in progress and supports a subset of cloud-config modules.