Hi, I''ve been using the excellent - http://reductivelabs.com/trac/puppet/wiki/Recipes/AmazonWebService s3get recipe for a while. This allows me to call s3get on a file in a bucket from Amazon S3. The problem I have is that I can''t see a way for an exec or package type to wait (require) while the download is completed so I can complete tasks within one poll. The s3get define basically calls an exec, is it possible to have a before in this exec that takes a parameter? i.e. s3get { "ant/$antdist": cwd => "/tmp", name => "$antdist", expires => "90", bucket => "talis-distros", before => "install_this", } define s3get ($bucket=$DEFAULTS3BUCKET, $cwd="/tmp", $expires=30, $before="null") { exec { "s3get-$name" : cwd => $cwd, creates => "$cwd/$name", command => s3getcurl($bucket, $title, $name, $expires), before => Exec["$before"], path => ["/usr/bin", "/usr/sbin"], } } I''ve only just thought of that before hack hence why I haven''t tried it yet. Anyone else had a similar problem/solution? Thanks, Matt --~--~---------~--~----~------------~-------~--~----~ 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 Friday 17 April 2009 06:52:50 Matt wrote:> This allows me to call s3get on a file in a bucket from Amazon S3. The > problem I have is that I can''t see a way for an exec or package type to > wait (require) while the download is completed so I can complete tasks > within one poll.Why can''t you just use a require for this? Presumably the require will have its own logic to determine whether or not it needs to run. BTW, I''ve made an S3-related script for my own use you may find handy: https://code.launchpad.net/~eythian/+junk/ec2facts (the name is misleading, after the EC2 code I added stuff to interact with S3 to it :) -- Robin <robin@kallisti.net.nz> JabberID: <eythian@jabber.kallisti.net.nz> http://www.kallisti.net.nz/blog ||| http://identi.ca/eythian PGP Key 0xA99CEB6D = 5957 6D23 8B16 EFAB FEF8 7175 14D3 6485 A99C EB6D
The s3get function is unable to take a require as it does not support it. However, I was able to put a require on the underlying Exec and just pass in a variable to it, so that did work :-) Thanks for the link BTW, the Ec2 facters could be very handy. 2009/4/16 Robin Sheat <robin@kallisti.net.nz>> On Friday 17 April 2009 06:52:50 Matt wrote: > > This allows me to call s3get on a file in a bucket from Amazon S3. The > > problem I have is that I can''t see a way for an exec or package type to > > wait (require) while the download is completed so I can complete tasks > > within one poll. > > Why can''t you just use a require for this? Presumably the require will have > its own logic to determine whether or not it needs to run. > > BTW, I''ve made an S3-related script for my own use you may find handy: > https://code.launchpad.net/~eythian/+junk/ec2facts<https://code.launchpad.net/%7Eeythian/+junk/ec2facts> > (the name is misleading, after the EC2 code I added stuff to interact with > S3 > to it :) > > -- > Robin <robin@kallisti.net.nz> JabberID: <eythian@jabber.kallisti.net.nz> > http://www.kallisti.net.nz/blog ||| http://identi.ca/eythian > > PGP Key 0xA99CEB6D = 5957 6D23 8B16 EFAB FEF8 7175 14D3 6485 A99C EB6D > >--~--~---------~--~----~------------~-------~--~----~ 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 Friday 17 April 2009 19:44:53 Matt wrote:> The s3get function is unable to take a require as it does not support it. > However, I was able to put a require on the underlying Exec and just pass > in a variable to it, so that did work :-)If you have a look at the sample .pp file I included, you''ll see how to make require work right (at least, I think it''s right - it works :) in a custom define. -- Robin <robin@kallisti.net.nz> JabberID: <eythian@jabber.kallisti.net.nz> http://www.kallisti.net.nz/blog ||| http://identi.ca/eythian PGP Key 0xA99CEB6D = 5957 6D23 8B16 EFAB FEF8 7175 14D3 6485 A99C EB6D
Ah, is it this bit you''re referring to? 41 if $require { 42 Exec ["S3 file $name"] { 43 require +> $require, 44 } 45 } So that basically adds a require to the exec {} if $require exists. $require exists if you specify require => File["packages directory"], when calling the define. It''s a cleaner way then how i''ve done it. Will try that. Cheers, Matt 2009/4/17 Robin Sheat <robin@kallisti.net.nz>> > On Friday 17 April 2009 19:44:53 Matt wrote: > > The s3get function is unable to take a require as it does not support it. > > However, I was able to put a require on the underlying Exec and just pass > > in a variable to it, so that did work :-) > > If you have a look at the sample .pp file I included, you''ll see how to make > require work right (at least, I think it''s right - it works :) in a custom > define. > > -- > Robin <robin@kallisti.net.nz> JabberID: <eythian@jabber.kallisti.net.nz> > http://www.kallisti.net.nz/blog ||| http://identi.ca/eythian > > PGP Key 0xA99CEB6D = 5957 6D23 8B16 EFAB FEF8 7175 14D3 6485 A99C EB6D >--~--~---------~--~----~------------~-------~--~----~ 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 Friday 17 April 2009 23:24:28 Matt wrote:> Ah, is it this bit you''re referring to?That''s the one, yeah. Credit where it''s due, it''s in the docs, but it took me a while to spot. -- Robin <robin@kallisti.net.nz> JabberID: <eythian@jabber.kallisti.net.nz> http://www.kallisti.net.nz/blog ||| http://identi.ca/eythian PGP Key 0xA99CEB6D = 5957 6D23 8B16 EFAB FEF8 7175 14D3 6485 A99C EB6D