Clear package cache?


#1

Hello,

I have a recipe that installs a yum repository and then immediately
attempts to install packages from that repository. Unfortunately, I’m
receiving errors that the package I’m trying to install isn’t available.

Chef output: https://gist.github.com/d0d1316453b3a4cc7d91

However, I have no problem installing the package manually.

System output: https://gist.github.com/2f4ef87eba8bb6d7c5de

I attempted to add the following to the recipe (in between the
repository’s installation and the package’s installation):

execute “yum clean all” do
action :run
end

But continued to receive the same error message. Has anyone
experienced this before?


#2

Lee,
Create an execute resource and notify it from the template that creates the
yum repo:

execute “yum clean all” do
action :nothing
end

template “/etc/yum.repos.d/random_name.repo” do
notifies :run, resources(:execute => “yum clean all”), :immediately
end

You can also take a look at the APT cookbook since it does something very
similar (for “apt-get update”):
http://github.com/opscode/cookbooks/tree/master/apt/

They both create an execute resource in the compile phase that is notified
and run during the execution phase

Seth


Opscode, Inc.
Seth Chisamore, Technical Evangelist
T: (404) 348-0505 E: schisamo@opscode.com
Twitter, IRC, Github: schisamo

On Wed, Oct 27, 2010 at 11:49 PM, Lee Huffman lee.huffman@blueboxgrp.comwrote:

Hello,

I have a recipe that installs a yum repository and then immediately
attempts to install packages from that repository. Unfortunately, I’m
receiving errors that the package I’m trying to install isn’t available.

Chef output: https://gist.github.com/d0d1316453b3a4cc7d91

However, I have no problem installing the package manually.

System output: https://gist.github.com/2f4ef87eba8bb6d7c5de

I attempted to add the following to the recipe (in between the repository’s
installation and the package’s installation):

execute “yum clean all” do
action :run
end

But continued to receive the same error message. Has anyone experienced
this before?


#3

Thanks a lot, Seth. I was able to resolve this with your suggestion
and a couple other tweaks.

Appreciate the help!

On Oct 27, 2010, at 9:01 PM, Seth Chisamore wrote:

Lee,
Create an execute resource and notify it from the template that
creates the yum repo:

execute “yum clean all” do
action :nothing
end

template “/etc/yum.repos.d/random_name.repo” do
notifies :run, resources(:execute => “yum clean all”), :immediately
end

You can also take a look at the APT cookbook since it does something
very similar (for “apt-get update”):
http://github.com/opscode/cookbooks/tree/master/apt/

They both create an execute resource in the compile phase that is
notified and run during the execution phase

Seth


Opscode, Inc.
Seth Chisamore, Technical Evangelist
T: (404) 348-0505 E: schisamo@opscode.com
Twitter, IRC, Github: schisamo

On Wed, Oct 27, 2010 at 11:49 PM, Lee Huffman <lee.huffman@blueboxgrp.com

wrote:
Hello,

I have a recipe that installs a yum repository and then immediately
attempts to install packages from that repository. Unfortunately,
I’m receiving errors that the package I’m trying to install isn’t
available.

Chef output: https://gist.github.com/d0d1316453b3a4cc7d91

However, I have no problem installing the package manually.

System output: https://gist.github.com/2f4ef87eba8bb6d7c5de

I attempted to add the following to the recipe (in between the
repository’s installation and the package’s installation):

execute “yum clean all” do
action :run
end

But continued to receive the same error message. Has anyone
experienced this before?


#4

I’m curious what else you did; care to share?

btm

On Oct 28, 2010 2:31 PM, “Lee Huffman” lee.huffman@blueboxgrp.com wrote:

Thanks a lot, Seth. I was able to resolve this with your suggestion and a
couple other tweaks.

Appreciate the help!

On Oct 27, 2010, at 9:01 PM, Seth Chisamore wrote: > Lee, > Create an
execute resource and notify…


#5

Hey Bryan,

I was specifying the architecture with the package names, like so:

packages = %w{ovzkernel.x86_64 vzctl.x86_64 vzctl-lib.x86_64
vzquota.x86_64}
packages.each do |pkg|
package pkg
end

Which works on the command line, but Chef is apparently not a fan. I
ended up with this:

packages = %w{ovzkernel vzctl vzctl-lib vzquota}
packages.each do |pkg|
yum_package pkg do
arch "x86_64"
action :install
end
end

Hope this helps!

On Oct 28, 2010, at 1:20 PM, Bryan McLellan wrote:

I’m curious what else you did; care to share?

btm

On Oct 28, 2010 2:31 PM, “Lee Huffman” lee.huffman@blueboxgrp.com
wrote:

Thanks a lot, Seth. I was able to resolve this with your suggestion
and a couple other tweaks.

Appreciate the help!
On Oct 27, 2010, at 9:01 PM, Seth Chisamore wrote: > Lee, > Create
an execute resource and notify…