Chefonic way to do apt-get update

Hi,

what is the chef way for running apt-get update in a recipe?

for now I am using:

execute “apt_update” do
command "apt-get update"
action :run
end

I'm not sure what you're goal is with that, but if it's just to ensure that it's run regularly, check out the Opscode apt cookbook: GitHub - sous-chefs/apt: Development repository for the apt cookbook

It ensures that apt-get update is run at least once per day.

--
Larry Wright
Argonaut Labs, LLC

On Saturday, June 30, 2012 at 8:21 AM, David Montgomery wrote:

Hi,

what is the chef way for running apt-get update in a recipe?

for now I am using:

execute "apt_update" do
command "apt-get update"
action :run
end

Nothing wrong with an execute, but the apt cookbook will do this for you as
mentioned.

Then within any other resource def you can use notifies like:

notifies :run, resources(:execute => "apt-get update"), :immediately

Notice that it's calling 'apt-get update' (no dash) and not
'apt-get-update' (with dash), which is also defined in by the apt
cookbook.

-sme

On Sat, Jun 30, 2012 at 6:21 AM, David Montgomery <davidmontgomery@gmail.com

wrote:

Hi,

what is the chef way for running apt-get update in a recipe?

for now I am using:

execute "apt_update" do
command "apt-get update"
action :run
end