I'm trying to install Java using my Chef cookbook via Kitchen + Vagrant. The operating system is CentOS 7.3.
Because I had some conflicts with filesystem-3.2-21.el7.x86_64 caused by the Java version, I decided to force the installation.
So I decided to follow the next example from the official chef documentation:
Install a package with options
package 'debian-archive-keyring' do action :install options '--force-yes' end
I converted it to:
package "bf-sun-java" do version node['java_version'] action :install options '--force-yes' end but I got the following error:
STDERR: Command line error: no such option:
--force-yes
Why is --force-yes mentioned in that example if Chef doesn't recognize it?
1 Answer
The option --force-yes is an option for apt package manager. The options option in package resource only allows you to pass options that the package manager of the OS understand. For example in Centos I could write options '--setopt=timeout=360', which is an option for yum and it works.
Also, take a look at what does --force-yes actually do in apt man page.
Installing and maintaining Java with Chef might be sometimes painful, so I'd recommend using the Java cookbook, which works like a charm.
1