Passing an integer value through a node attribute in chef

南楼画角 提交于 2020-01-16 09:05:13

问题


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

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.

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?


回答1:


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.

try this:

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


来源:https://stackoverflow.com/questions/56060541/passing-an-integer-value-through-a-node-attribute-in-chef

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!