grandpa
2009-Jul-25 01:09 UTC
[Puppet Users] Array input of dirs, ensuring their existence
Hi. I''m VERY new to puppet (had quite a bit of fun for a few days!). I''m trying to set up a variable amount of watch dirs - i.e when something happens execute a command. I''ve defined watch::config ( $command, $paths, $watchType="recursive", $events="default" ) - the specifics aren''t that important. This has been working ok with $paths just being $path. Now that I''ve switched to an array of paths, I''m having some trouble ensuring that all paths exist (if they don''t the watch fails). I''m unsure how to got about this... With one path I could easily ensure it''s existence, but with a variable amount I just don''t know. There are, afaik, no looping in puppet (except for erb but that won''t do it). Perhaps I''m going about this the wrong way... Any tips? --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Trevor Vaughan
2009-Jul-26 00:47 UTC
[Puppet Users] Re: Array input of dirs, ensuring their existence
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 What exactly are you trying to do? If this is a Linux system, I would use Puppet to set up some Inotify functionality using something like fsniper: http://projects.l3ib.org/trac/fsniper Trevor On 07/24/2009 09:09 PM, grandpa wrote:> Hi. > > I''m VERY new to puppet (had quite a bit of fun for a few days!). > > I''m trying to set up a variable amount of watch dirs - i.e when > something happens execute a command. > > I''ve defined watch::config ( $command, $paths, $watchType="recursive", > $events="default" ) - the specifics aren''t that > important. > > This has been working ok with $paths just being $path. Now that I''ve > switched to an array of paths, > I''m having some trouble ensuring that all paths exist (if they don''t > the watch fails). I''m unsure how to > got about this... > > With one path I could easily ensure it''s existence, but with a > variable amount I just don''t know. There > are, afaik, no looping in puppet (except for erb but that won''t do > it). Perhaps I''m going about this the wrong way... > > Any tips? > > >-----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (GNU/Linux) iEYEARECAAYFAkprp7UACgkQyjMdFR1108CkxwCgtOmiqnUJEUu8HGf4SJOr+tQz DGQAoJLa+WQTUfZL4maSE0WhE1dBd8+t =T/m5 -----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 -~----------~----~----~----~------~----~------~--~---
David Schmitt
2009-Jul-27 06:41 UTC
[Puppet Users] Re: Array input of dirs, ensuring their existence
grandpa wrote:> I''m VERY new to puppet (had quite a bit of fun for a few days!).Great, welcome to the community!> I''m trying to set up a variable amount of watch dirs - i.e when > something happens execute a command. > > I''ve defined watch::config ( $command, $paths, $watchType="recursive", > $events="default" ) - the specifics aren''t that > important. > > This has been working ok with $paths just being $path. Now that I''ve > switched to an array of paths, > I''m having some trouble ensuring that all paths exist (if they don''t > the watch fails). I''m unsure how to > got about this... > > With one path I could easily ensure it''s existence, but with a > variable amount I just don''t know. There > are, afaik, no looping in puppet (except for erb but that won''t do > it). Perhaps I''m going about this the wrong way... > > Any tips?Resources can take arrays as "title": | $paths = [ "/foo", "/bar" ] | file { $paths: ensure => directory } Be aware though, that File doesn''t manage the parent directories. If you need that too, I think there is a recipe on the wiki using mkdir -p in a define. Regards, DavidS --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
grandpa
2009-Aug-15 10:18 UTC
[Puppet Users] Re: Array input of dirs, ensuring their existence
To continue and close this one, I''m using iwatch right now which internally uses inotify, though I find iwatch to be a bit slow at times and can''t keep up with lots of fs changes. Together with iwatch I''m using csync2 to keep a few servers in sync. This is working fine so far. What I was actually wondering about was puppet syntax and not really so much about how to setup watch paths. I''ve found a way to do what I needed using erb and iwatch''s xml config file. I guess though that David Schmitts suggestion was what I was looking for. Thanks! On Jul 27, 8:41 am, David Schmitt <da...@dasz.at> wrote:> grandpawrote: > > I''m VERY new to puppet (had quite a bit of fun for a few days!). > > Great, welcome to the community! > > > > > > > I''m trying to set up a variable amount of watch dirs - i.e when > > something happens execute a command. > > > I''ve defined watch::config ( $command, $paths, $watchType="recursive", > > $events="default" ) - the specifics aren''t that > > important. > > > This has been working ok with $paths just being $path. Now that I''ve > > switched to an array of paths, > > I''m having some trouble ensuring that all paths exist (if they don''t > > the watch fails). I''m unsure how to > > got about this... > > > With one path I could easily ensure it''s existence, but with a > > variable amount I just don''t know. There > > are, afaik, no looping in puppet (except for erb but that won''t do > > it). Perhaps I''m going about this the wrong way... > > > Any tips? > > Resources can take arrays as "title": > > | $paths = [ "/foo", "/bar" ] > | file { $paths: ensure => directory } > > Be aware though, that File doesn''t manage the parent directories. If you > need that too, I think there is a recipe on the wiki using mkdir -p in a > define. > > Regards, DavidS--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---