gpt4 book ai didi

Python Pychef : Not able to search attributes using class chef. 搜索

转载 作者:行者123 更新时间:2023-12-01 07:16:25 34 4
gpt4 key购买 nike

我正在尝试获取我的 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/

34 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com