我已经将 Chef 文件从我的 Chef 服务器复制到本地客户端节点,在 ~/.chef
下,我在 ~/.chef/environments
下有所有环境,例如development.rb
, production.rb
等
当我从 ~/.chef/
下运行 chef-client -z -E development -r 'recipe[cookbook_foo::recipe_bar]'
时,我收到此错误:
================================================================================
Error expanding the run_list:
================================================================================
Unexpected API Request Failure:
-------------------------------
Object not found: http://localhost:8889/environments/development
如果我在没有 -E development
的情况下运行命令,一切正常。但是,我需要传递环境名称,因为该 Chef Recipe 中使用了 #{node.chef_environment}
变量。 Google 没有就此问题向我提供答案:/
我正在使用 Chef 客户端 11.16.4
有什么想法吗?
最佳答案
不幸的是,零号 Chef 不理解.rb
DSL 文件。您需要将环境文件转换为 .json
才能将它们与 Chef Zero 一起使用。
关于chef-infra - 如何为 Chef 本地模式指定 chef_environment (chef-client -z),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27989483/