Issue
I'm making a simple recipe that apt-get upgrades the whole system.
include_recipe "apt"
execute "apt-get upgrade -y" do
command "apt-get upgrade -y"
action :nothing
end
but it never gets run:
chef-solo -j node.json -W
Recipe: up2date::default
* execute[apt-get upgrade -y] action nothing[2012-11-12T13:05:04+01:00]
INFO: Processing execute[apt-get upgrade -y]
action nothing (up2date::default line 12) (up to date)
Can't understand why ?
Is there a better/cleaner way ?
Solution
If you are including "apt" recipe you don't have to create execute[apt-get upgrade -y] resource. Or if you don't want to include "apt" recipe, then use
execute "apt-get upgrade -y" do
command "apt-get upgrade -y"
action :run
end
But as run is default action, and name is default command, that can be shortened to
execute "apt-get upgrade -y"
Answered By - Draco Ater Answer Checked By - Willingham (WPSolving Volunteer)