如何为 Chef 本地模式指定 Chef_environment (chef-client -z)

Kip*_*ras 3 chef-infra chef-zero

我已将厨师文件从我的厨师服务器复制到本地客户端节点,在 下~/.chef,我拥有~/.chef/environments、 例如development.rbproduction.rb等下的所有环境。

当我chef-client -z -E development -r 'recipe[cookbook_foo::recipe_bar]'从下面运行时~/.chef/,我收到此错误:

================================================================================
Error expanding the run_list:
================================================================================

Unexpected API Request Failure:
-------------------------------
Object not found: http://localhost:8889/environments/development
Run Code Online (Sandbox Code Playgroud)

如果我在没有运行命令的情况下-E development一切正常。但是,我需要传递环境名称,因为#{node.chef_environment}该厨师食谱中使用了变量。谷歌没有向我提供有关此问题的答案:/

我使用的是厨师客户端 11.16.4

有任何想法吗?

cod*_*ger 5

不幸的是,Chef Zero 无法理解.rbDSL 文件。您需要将环境文件转换为.json与 Chef Zero 一起使用。