Stefan Wiederoder
2008-May-30 12:16 UTC
[Puppet Users] triggering exec after file transfer
Hello puppet-users, my task is to roll-out an application archive and then (if the local file is not present or has the wrong md5 sum) to extract it (but only then!). Is the following code correct, I just want to make sure that the extraction is triggered by the file command. # transfer application archive file { "/var/adm/application_1_0.tar.gz" : source => "puppet://puppetmaster.xyz/ application_1_0.tar.gz", owner => root, group => root, mode => 755, checksum => md5 } # extract archive exec { "/bin/zcat /var/adm/application_1_0.tar.gz | ( cd /opt; tar xvf - )": cwd => "/root", path => ["/bin", "/usr/bin", "/usr/sbin"], subscribe => File["/var/adm/application_1_0.tar.gz"], refreshonly => true } thanks for your help , Stefan --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com To unsubscribe from this group, send email to puppet-users-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en -~----------~----~----~----~------~----~------~--~---
Phillip Scholz
2008-May-30 13:20 UTC
[Puppet Users] Re: triggering exec after file transfer
Hi Stefan, using refreshonly prohibites execution until this element is notified. So using this would be correct: # extract archive exec { "/bin/zcat /var/adm/application_1_0.tar.gz | ( cd /opt; tar xvf - )": cwd => "/root", path => ["/bin", "/usr/bin", "/usr/sbin"], subscribe => File["/var/adm/application_1_0.tar.gz"], refreshonly => true, alias => "extractapplication", # just for some shortening the notify } But to have the exec executed you need to notify it:> file { "/var/adm/application_1_0.tar.gz" : > source => > "puppet://puppetmaster.xyz/application_1_0.tar.gz", > owner => root, > group => root, > mode => 755, > checksum => md5 > notify => Exec["extractapplication"], > } >hope this helps. Phillip --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com To unsubscribe from this group, send email to puppet-users-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en -~----------~----~----~----~------~----~------~--~---
David Schmitt
2008-May-30 14:47 UTC
[Puppet Users] Re: triggering exec after file transfer
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Friday 30 May 2008, Phillip Scholz wrote:> Hi Stefan, > > using refreshonly prohibites execution until this element is notified. > So using this would be correct: > > # extract archive > exec { "/bin/zcat /var/adm/application_1_0.tar.gz | ( cd /opt; > tar xvf - )":> subscribe => File["/var/adm/application_1_0.tar.gz"],> } > > But to have the exec executed you need to notify it: > > file { "/var/adm/application_1_0.tar.gz" :> > notify => Exec["extractapplication"],The subscribe and the notify do exactly the same, only from different directions. Much worse IMHO is, that the tar will never delete file which are not present in the current version of the tarball but were in earlier ones. Also, changing the version number will lead to maintenance headaches ("Where else did I use this name?") Regards, DavidS - -- The primary freedom of open source is not the freedom from cost, but the free- dom to shape software to do what you want. This freedom is /never/ exercised without cost, but is available /at all/ only by accepting the very different costs associated with open source, costs not in money, but in time and effort. - -- http://www.schierer.org/~luke/log/20070710-1129/on-forks-and-forking -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (GNU/Linux) iD8DBQFIQBNu/Pp1N6Uzh0URAm0kAKCc56H/YP5sy4iE6GiYpK4UzJCKsgCfdTdR IJ46SJC2NyHGGY1GEQpHce0=b807 -----END PGP SIGNATURE----- --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com To unsubscribe from this group, send email to puppet-users-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en -~----------~----~----~----~------~----~------~--~---
On 5/30/2008 9:47 AM, David Schmitt wrote:> The subscribe and the notify do exactly the same, only from different > directions. Much worse IMHO is, that the tar will never delete file > which are not present in the current version of the tarball but were > in earlier ones.Would it also filebucket the old .tar.gz files? That could be a hassle, too. You might consider migrating to stow or native package management tools. I''ve got some writeups on that at the following: - rsync, stow, and puppet: http://preview.tinyurl.com/3n5npl - roll your own Debian packages: http://preview.tinyurl.com/4xpsbx - roll your own Solaris packages: http://preview.tinyurl.com/3f73sc -- Mike Renfro / R&D Engineer, Center for Manufacturing Research, 931 372-3601 / Tennessee Technological University --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com To unsubscribe from this group, send email to puppet-users-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en -~----------~----~----~----~------~----~------~--~---