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

2.4k views Asked by At

I'm trying to start an instance with a configured chef cookbook, but I get this error:

================================================================================
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)

In my cookbook, I have a directory named cassandra-php-driver, that has attributes folder, where I have the file default.rb, there I put all the packages to install. Could anyone help please?

1

There are 1 answers

0
coderanger On BEST ANSWER

It summarize from the above comments, you can't use yum_package on a Debian-based machine. In general don't use yum_package and apt_package directly unless you need specific features from one of them, just use package.