Passing an integer value through a node attribute

2019-08-16 01:04发布

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条回答
虎瘦雄心在
2楼-- · 2019-08-16 01:32

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}'
查看更多
登录 后发表回答