我正在尝试获取我的 Chef 服务器上具有特定名称的 Recipe 的节点列表。
nodes_list = Search('node', 'cookbooks:<cookbook_name')
for row in nodes_list:
print(row['ipaddress'])
它不返回任何结果。我如何搜索其中包含特定 Recipe 名称的节点。
最佳答案
您可以使用 bash 单行 for 循环来完成此操作:
for nodes in $(knife node list); do knife node show $nodes -r; done
如果您只想查看具有特定 Recipe 的节点:
for nodes in $(knife node list); do knife node show $nodes -r | grep COOKBOOK; done
关于Python Pychef : Not able to search attributes using class chef. 搜索,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57923640/