【发布时间】:2020-06-09 02:41:07
【问题描述】:
我正在尝试通过使用自定义属性来安装带有 Chef 的“包”资源的多个包。 当我尝试时:
package %w(python3 python3-pip) do
action :install
end
上面的代码对我来说很好,但是在尝试使用自定义属性时相同的代码会出错。
请看-
我的食谱代码:
package %w(node['python']['pkg_name'] node['python-pip']['pkg_name']) do
action :install
end
属性代码:
default['python']['pkg_name'] = 'python3'
default['python-pip']['pkg_name'] = 'python3-pip'
错误日志:
Compiling Cookbooks...
Converging 3 resources
Recipe: odoo_setup::odoo_linux
* apt_update[update_ubuntu_pkg_lib] action update
* directory[/var/lib/apt/periodic] action create (up to date)
* directory[/etc/apt/apt.conf.d] action create (up to date)
* file[/etc/apt/apt.conf.d/15update-stamp] action create_if_missing (up to date)
* execute[apt-get -q update] action run
- execute ["apt-get", "-q", "update"]
- force update new lists of packages
* apt_package[node['python']['pkg_name'], node['python-pip']['pkg_name']] action install
* No candidate version available for node['python']['pkg_name'], node['python-pip']['pkg_name']
================================================================================
Error executing action `install` on resource 'apt_package[node['python']['pkg_name'], node['python-pip']['pkg_name']]'
================================================================================
Chef::Exceptions::Package
-------------------------
No candidate version available for node['python']['pkg_name'], node['python-pip']['pkg_name']
Resource Declaration:
---------------------
# In /tmp/kitchen/cache/cookbooks/odoo_setup/recipes/odoo_linux.rb
32: package %w(node['python']['pkg_name'] node['python-pip']['pkg_name']) do
33: # package node['python']['pkg_name'] do
34: action :install
35: end
36:
【问题讨论】:
-
我们需要将实际代码和实际错误视为可以复制/粘贴的文本,而不是图像。
-
对不起,我不知道如何在 Stackoverflow 上发布问题!我使用 Git 提出问题。
-
我已经编辑了我的问题并添加了有关我的问题的更多详细信息。
标签: chef-infra chef-recipe chef-attributes