在我们的组织中,开发人员被授予拥有食谱的所有权。这些食谱最初是由操作人员编写的。我是一个 Java 人,而不是厨师/红宝石/操作专家。我的任务是调试食谱未从正确的数据包中读取的问题。
是否可以列出厨师节点上的所有可用数据包?我尝试过这样的事情,但它需要很长时间。
# find / -type f -not -name "*test*" -exec grep -IHnl data_bag {} \; | grep -v gems
我正在查看的代码是:
secret2 = Chef::EncryptedDataBagItem.load_secret(secret)
passwords = data_bag_item(id, item, secret2)
当 chef-client 在节点上运行时,它是否将所有 data_bag json 文件组合成 1 个数据结构。在编写食谱时,我是否必须指定要加载的 data_bag?
更新:
在我将搜索限制在厨师的目录之后,这个命令运行得非常快:
# find /run/chef /opt/chef /var/chef /etc/chef -type f -not -name "*test*" -exec grep -IHnl data_bag {} \; | grep -v gems
/var/chef/cache/cookbooks/users/resources/manage.rb
/var/chef/cache/cookbooks/users/CHANGELOG.md
/var/chef/cache/cookbooks/users/metadata.json
/var/chef/cache/cookbooks/users/README.md
/var/chef/cache/cookbooks/xyz_users/recipes/default.rb
/var/chef/cache/cookbooks/xyz_users/attributes/default.rb
/var/chef/cache/cookbooks/xyz_users/README.md
/var/chef/cache/cookbooks/xyz_users/.kitchen.yml
/var/chef/cache/cookbooks/xyz_base/.kitchen.yml
/var/chef/cache/cookbooks/splunk/recipes/mysqlmonitor.rb
/var/chef/cache/cookbooks/splunk/attributes/default.rb
/var/chef/cache/cookbooks/splunk/.kitchen.yml
/var/chef/cache/cookbooks/xyz_service/recipes/config.rb
/var/chef/cache/cookbooks/xyz_service/attributes/default.rb
/var/chef/cache/cookbooks/xyz_service/.kitchen.yml
/var/chef/cache/cookbooks/xyz_service/README.md
/var/chef/cache/cookbooks/xyz_service2/attributes/default.rb
/var/chef/cache/cookbooks/xyz_service2/recipes/certificates.rb
/var/chef/cache/cookbooks/xyz_service2/README.md
/var/chef/cache/cookbooks/xyz_service2/metadata.json
/var/chef/cache/cookbooks/xyz_nginx/.kitchen.yml
谢谢。