Package resource - install multiple packages together?

I’m trying to figure out a way to use the package resource to install several packages together, all from files (I’m using CentOS, so the underlying mechanism is yum).

The problem I’m having is that a few of the packages have circular dependencies. So I cannot use the trivial approach:

packages.each do |pkg|
package “#{pkg}” do
action :install
source "#{dir}/#{dirname}/#{pkg}-*.#{arch}.rpm"
end
end

Is there a way to do something like this instead:

package “mypackages” do

action :install

source ["#{dir}/#{dirname}/#{pkg1}-.#{arch}.rpm", "#{dir}/#{dirname}/#{pkg2}-.#{arch}.rpm" ]
end

Thanks!

You can use rpm_package resource to control how local packages are installed.
Or an execute like this:

execute "install-my-local-rpms" do
command "rpm -I #{dir}/#{packages.join(' ')}" # assuming packages are an array
action :run
not_if "rpm -q <some_very_important_local_package_name>"
end

But I would recommend creating a local yum repository server, and use it for these packages and dependencies.

On Nov 15, 2012, at 11:49 AM, Kevin Keane (subscriptions) wrote:

I'm trying to figure out a way to use the package resource to install several packages together, all from files (I'm using CentOS, so the underlying mechanism is yum).

The problem I'm having is that a few of the packages have circular dependencies. So I cannot use the trivial approach:

packages.each do |pkg|
package "#{pkg}" do
action :install
source "#{dir}/#{dirname}/#{pkg}-*.#{arch}.rpm"
end
end

Is there a way to do something like this instead:

package "mypackages" do
action :install
source ["#{dir}/#{dirname}/#{pkg1}-.#{arch}.rpm", "#{dir}/#{dirname}/#{pkg2}-.#{arch}.rpm" ]
end
Thanks!

--
Vladimir Girnet
Infrastructure Engineer
Tacit Knowledge