通过Chef中的node属性传递整数值 [英] Passing an integer value through a node attribute in chef

查看:107
本文介绍了通过Chef中的node属性传递整数值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I am new to chef. Please let me know how can I pass an integer value as a node attribute (chef-client -j).

尝试了json输入,但无法转换哈希值转换为整数。
例如:如果我要传递-j count: 1,则需要以整数值而不是散列的形式输出到输出节点['count']。

Tried with json input, but I was not able to convert the hash value into an integer. For example : If I am passing my -j count:"1" , I need to the output node['count'] in integer value and not in hash.

有人可以帮助我在Chef中将其转换为整数值吗?或者我可以通过其他方法将整数输入发送给Chef吗?

Can someone help me in converting it into integer value in Chef or is there any other way I can send my integer input to the chef?

推荐答案

您可以使用-json属性,只需确保提供的json是有效的json文件或有效的json字符串即可。

you can provide any (primitive) node attribute in the chef-client execution using the --json-attribute, just make sure that the json you provide is a valid json file or a valid json string.

尝试以下操作:

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

这篇关于通过Chef中的node属性传递整数值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆