在资源 'yum_package[g++]' 上执行操作“install”时出错

Error executing action `install` on resource 'yum_package[g++]'

我正在尝试使用已配置的 Chef 食谱启动实例,但出现此错误:

================================================================================
Error executing action `install` on resource 'yum_package[g++]'
================================================================================

Chef::Exceptions::Package
-------------------------
No candidate version available for g++

Resource Declaration:
---------------------
# In /var/chef/runs/1bb2ddbe-8793-4eef-b5c8-4bbfccc7dcf6/local-mode-cache/cache/cookbooks/cassandra-php-driver-cookbook/recipes/setup.rb

4:     package pkg do
5:         :install
6:     end
7: end

Compiled Resource:
------------------
# Declared in /var/chef/runs/1bb2ddbe-8793-4eef-b5c8-4bbfccc7dcf6/local-mode-cache/cache/cookbooks/cassandra-php-driver-cookbook/recipes/setup.rb:4:in `block in from_file'

yum_package("g++") do
package_name "g++"
action [:install]
retries 0
retry_delay 2
default_guard_interpreter :default
declared_type :package
cookbook_name "cassandra-php-driver-cookbook"
recipe_name "setup"
flush_cache {:before=>false, :after=>false}
end

Platform:
---------
x86_64-linux

[2016-12-16T14:23:21+00:00] INFO: Running queued delayed notifications before re-raising exception
[2016-12-16T14:23:21+00:00] ERROR: Running exception handlers
[2016-12-16T14:23:21+00:00] ERROR: Exception handlers complete
[2016-12-16T14:23:21+00:00] FATAL: Stacktrace dumped to /var/chef/runs/1bb2ddbe-8793-4eef-b5c8-4bbfccc7dcf6/local-mode-cache/cache/chef-stacktrace.out
[2016-12-16T14:23:21+00:00] FATAL: Please provide the contents of the stacktrace.out file if you file a bug report
[2016-12-16T14:23:21+00:00] ERROR: yum_package[g++] (cassandra-php-driver-cookbook::setup line 4) had an error: Chef::Exceptions::Package: No candidate version available for g++
[2016-12-16T14:23:21+00:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)

在我的食谱中,我有一个名为 cassandra-php-driver 的目录,它有属性文件夹,我有文件 default.rb,我把所有要安装的包都放在那里。 有人可以帮忙吗?

根据上面的评论总结,你不能在基于 Debian 的机器上使用 yum_package。通常不要直接使用 yum_packageapt_package 除非你需要其中之一的特定功能,只需使用 package.