Skip to content

Instantly share code, notes, and snippets.

@wpietri
Created September 10, 2013 21:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wpietri/6516165 to your computer and use it in GitHub Desktop.
Save wpietri/6516165 to your computer and use it in GitHub Desktop.
chef, the wrong way
twiki_tmp = "/tmp/twiki.tar.gz"
remote_file twiki_tmp do
source "http://softlayer-dal.dl.sourceforge.net/project/twiki/TWiki%20for%20all%20Platforms/TWiki-5.1.4/TWiki-5.1.4.tgz"
checksum "bcd8544c83eb388737e334cdc2c2734e79df63fd0a64610c144addb00bc0d70d"
end
execute "extract Twiki" do
command "tar -C /var/ -xzf " + twiki_tmp
creates "/var/twiki/COPYING"
end
execute "chown -R www-data:www-data /var/twiki"
@logikal
Copy link

logikal commented Sep 10, 2013

You'll want to do something like this:

twiki_tmp = "/tmp/twiki.tar.gz"

remote_file twiki_tmp do
  source "http://softlayer-dal.dl.sourceforge.net/project/twiki/TWiki%20for%20all%20Platforms/TWiki-5.1.4/TWiki-5.1.4.tgz"
  checksum "bcd8544c83eb388737e334cdc2c2734e79df63fd0a64610c144addb00bc0d70d"
end

execute "extract Twiki" do
  command "tar -C /var/ -xzf " + twiki_tmp
  creates "/var/twiki/COPYING"
  action :nothing
  subscribes :run, "remote_file[twiki_tmp]", :immediately
end

execute "chown -R www-data:www-data /var/twiki"

notice the action and subscribes in the execute block

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment