gpt4 book ai didi

云初始化验证器

转载 作者:行者123 更新时间:2023-12-01 11:14:29 24 4
gpt4 key购买 nike

想知道是否有人知道可以验证类似于 this 的 cloud-init 配置的验证器.我们试过了,它给出了一堆不适用的错误,例如,它无法识别 package_update这是一个标准关键字,可以找到 here例如在官方文档中。因此,我们正在寻找一个可以工作并识别官方 documentation 中的关键字的验证器。 .

enter image description here

最佳答案

我最近也打了这个,并找到了一个很好的方法。

在 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 上的许多其他命令 super 有用。

嗯,经过进一步检查,它似乎没有发现很多类型的错误,但是 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.

关于云初始化验证器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54427198/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com