通过 Chef 中的节点属性传递整数值

Passing an integer value through a node attribute in chef

我是厨师新手。请让我知道如何将整数值作为节点属性传递 (chef-client -j)。

尝试使用 json 输入,但无法将哈希值转换为整数。 例如:如果我传递我的 -j count:"1" ,我需要输出 node['count'] 的整数值而不是散列值。

有人可以帮助我在 Chef 中将其转换为整数值,还是有任何其他方法可以将我的整数输入发送给 Chef?

您可以使用 --json-attribute 在 chef-client 执行中提供任何(原始)节点属性,只需确保您提供的 json 是有效的 json文件或有效的 json 字符串。

试试这个:

$ chef-client -j '{"count": 1}'