Hi, I''ve been using puppet to manage a small Linux network fairly successfully for a while now - thanks. I''ve hit a spot of bother in managing some files, though. There are a number of folders in /usr/local that I want to manage efficiently using puppet - for example /usr/local/share/templates. I want to copy the contents of a number of source folders on the puppet fileserver into that folder (with the ability to omit some source folders on some PCs). The simplest way of specifying this would seem to be ... ==================file { "/usr/local/share/pixmaps": source => "puppet://server/puppetfiles/FindFilesEdit/usr-local-share-pixmaps", group => root, mode => 664, owner => root, purge => false, recurse => true } file { "/usr/local/share/pixmaps": source => "puppet://server/puppetfiles/FontBrowse/usr-local-share-pixmaps", group => root, mode => 664, owner => root, purge => false, recurse => true } file { "/usr/local/share/pixmaps": source => "puppet://server/puppetfiles/MultiFileWidget/usr-local-share-pixmaps", group => root, mode => 664, owner => root, purge => false, recurse => true } ==================.... however this failed because it is not possible to manage the same folder from multiple places. At the moment I am listing each file to be copied individually, but this is getting tiresome and is obviously rather error-prone. The provision of a function to list the contents of a folder recursively would enable this to be achieved long-hand (probably also needing a means of differentiating between files, folders and links). However puppet seems not to provide that facility at the moment - unless there''s a standard ruby function that I know nothing of. I''d be grateful for any suggestions as to how to achieve my aims with the current puppet. cheers, John Dubery
On Jan 1, 2007, at 11:36 AM, John Dubery wrote:> Hi, > > I''ve been using puppet to manage a small Linux network fairly > successfully > for a while now - thanks. > > I''ve hit a spot of bother in managing some files, though. > > There are a number of folders in /usr/local that I want to manage > efficiently > using puppet - for example /usr/local/share/templates. I want to > copy the > contents of a number of source folders on the puppet fileserver > into that > folder (with the ability to omit some source folders on some PCs). > > The simplest way of specifying this would seem to be ...[snip]> .... however this failed because it is not possible to manage the > same folder > from multiple places.Each directory contains files that you want copied directly into the directory, right? That is, you''re not copying things into dir/A, dir/ B, etc.? Yeah, currently that''s disappointingly difficult, although I can think of a solution (one that requires development). Right now, if you specify multiple sources, then the first valid source is used, but it should be relatively straightforward to provide an attribute to choose between the first valid source or overlaying all sources. Hmmm. I wondered how difficult it would be to add this functionality, and it turns out it''s quite simple. So, I created a ''sourcematch'' parameter to file (I''m quite willing to rename, so if someone has a better recommendation for the parameter name, please let me know), so that you can specify whether you want files to copy from all valid sources, or just the first matched one. The default is to only copy from the first valid source (which is the current functionality, so it should be backwards compatible), but you should be able to get the functionality you want with something like the following code: file { "/usr/local/share/pixmaps": source => ["puppet://.../One", "puppet://.../Two"], sourcematch => all } Valid values to sourcematch are ''first'' (the default) and ''all''. If you choose ''all'', then Puppet will copy all remote files into the specified directory. Note that when there are conflicting files (i.e., the same file in multiple sources) then the first source still wins, so order can still matter when sourcematch == all. This functionality is already in subversion, and will be available in the next release.> At the moment I am listing each file to be copied individually, but > this is > getting tiresome and is obviously rather error-prone. > > The provision of a function to list the contents of a folder > recursively > would enable this to be achieved long-hand (probably also needing a > means > of differentiating between files, folders and links). However > puppet seems > not to provide that facility at the moment - unless there''s a > standard ruby > function that I know nothing of.There''s not, and this functionality is unlikely to appear.> I''d be grateful for any suggestions as to how to achieve my aims > with the > current puppet.Hopefully the ''sourcematch'' parameter will suffice. It''d be great if you could test it before the next release and let me know if it will work for you. -- The easiest way to figure the cost of living is to take your income and add ten percent. --------------------------------------------------------------------- Luke Kanies | http://reductivelabs.com | http://madstop.com
Hi, The sourceselect (all / first) parameter (as I''m pleased to see it has now been named) should answer my need I think - thanks. I''ve just got the code (svn rev.2035) to work in a trivial example - I hope to try it in a production level run soon. Is rev.2035 a good revision to use, or should I get a more recent (or older?) one that''s known to be more reliable? Any idea when the revision including this addition will be released? cheers John ==========================================================================Original message: From: luke at madstop.com (Luke Kanies) Date: Tue, 2 Jan 2007 01:40:04 -0600 Subject: [Puppet-users] File configuration difficulty --------------------------------------------------------------------------- On Jan 1, 2007, at 11:36 AM, John Dubery wrote:> Hi, > > I''ve been using puppet to manage a small Linux network fairly > successfully > for a while now - thanks. > > I''ve hit a spot of bother in managing some files, though. > > There are a number of folders in /usr/local that I want to manage > efficiently > using puppet - for example /usr/local/share/templates. I want to > copy the > contents of a number of source folders on the puppet fileserver > into that > folder (with the ability to omit some source folders on some PCs). > > The simplest way of specifying this would seem to be ...[snip]> .... however this failed because it is not possible to manage the > same folder > from multiple places.Each directory contains files that you want copied directly into the directory, right? That is, you''re not copying things into dir/A, dir/ B, etc.? Yeah, currently that''s disappointingly difficult, although I can think of a solution (one that requires development). Right now, if you specify multiple sources, then the first valid source is used, but it should be relatively straightforward to provide an attribute to choose between the first valid source or overlaying all sources. Hmmm. I wondered how difficult it would be to add this functionality, and it turns out it''s quite simple. So, I created a ''sourcematch'' parameter to file (I''m quite willing to rename, so if someone has a better recommendation for the parameter name, please let me know), so that you can specify whether you want files to copy from all valid sources, or just the first matched one. The default is to only copy from the first valid source (which is the current functionality, so it should be backwards compatible), but you should be able to get the functionality you want with something like the following code: file { "/usr/local/share/pixmaps": source => ["puppet://.../One", "puppet://.../Two"], sourcematch => all } Valid values to sourcematch are ''first'' (the default) and ''all''. If you choose ''all'', then Puppet will copy all remote files into the specified directory. Note that when there are conflicting files (i.e., the same file in multiple sources) then the first source still wins, so order can still matter when sourcematch == all. This functionality is already in subversion, and will be available in the next release.> At the moment I am listing each file to be copied individually, but > this is > getting tiresome and is obviously rather error-prone. > > The provision of a function to list the contents of a folder > recursively > would enable this to be achieved long-hand (probably also needing a > means > of differentiating between files, folders and links). However > puppet seems > not to provide that facility at the moment - unless there''s a > standard ruby > function that I know nothing of.There''s not, and this functionality is unlikely to appear.> I''d be grateful for any suggestions as to how to achieve my aims > with the > current puppet.Hopefully the ''sourcematch'' parameter will suffice. It''d be great if you could test it before the next release and let me know if it will work for you. -- The easiest way to figure the cost of living is to take your income and add ten percent. --------------------------------------------------------------------- Luke Kanies | http://reductivelabs.com | http://madstop.com
On Jan 4, 2007, at 1:02 PM, John Dubery wrote:> Hi, > > The sourceselect (all / first) parameter (as I''m pleased to see it > has now > been named) should answer my need I think - thanks.Great.> I''ve just got the code (svn rev.2035) to work in a trivial example > - I hope > to try it in a production level run soon. > > Is rev.2035 a good revision to use, or should I get a more recent > (or older?) > one that''s known to be more reliable?I''m getting very near release, so either use the latest from subversion, or wait a couple of days until the release is out.> Any idea when the revision including this addition will be released?Today? Tomorrow? This''d all go a lot faster if everyone weren''t making feature requests right in the middle of the release process. :) -- Nonreciprocal Laws of Expectations: Negative expectations yield negative results. Positive expectations yield negative results. --------------------------------------------------------------------- Luke Kanies | http://reductivelabs.com | http://madstop.com
Hi, On giving the sourceselect parameter further hassle (i.e. using it more), I''ve found an issue (at least for how I''m trying to use it). Sourceselect=all seems not to work below the top level directory being copied. For examples, I''ll assume the following bit of manifest: file { "/somewhere": source => ["puppet://server/a", "puppet://server/b"], sourceselect => all, recurse => true } It''s fine with the following source tree ... /server/ |- a/ | |- afile1 | |- adir/ | | |-afile2 |- b/ | |- bfile1 | |- bdir/ | | |-bfile2 However if /server/a and /server/b have subfolders with the same name but different contents, then only the subfolder+contents from a is copied. For example ... /server/ |- a/ | |- afile1 | |- commondir/ | | |- afile2 |- b/ | |- bfile1 | |- commondir/ | | |- bfile2 .... in this case /server/b/commondir/bfile2 is not copied even though it is not a repeat of a file in /server/a/... . This may seem picky, but it prevents (for example) the perfectly reasonable scenario of ... file { "/usr/local/share/icons": source => ["puppet://server/puppetfiles/app1/icons", "puppet://server/puppetfiles/app2/icons", "puppet://server/puppetfiles/app3/icons"], sourceselect => all, recurse => true } .... given the layers of common directory structure that will exist under the icons folders. (And the assumption that puppet is a sensible means of putting the files there in the first place.) The only workaround I can think of is to specify a folder low enough in the structure that there are no common-name subfolders - which is a pity. Any other suggestions? cheers, John Dubery ==========================================================================Original message: From: "Luke Kanies" <luke@madstop.com> Sender: puppet-users-bounces@madstop.com Reply to: "Puppet User Discussion" <puppet-users@madstop.com> To: "Puppet User Discussion" <puppet-users@madstop.com> Date: Thu, 4 Jan 2007 13:50:45 -0600 Subject: Re: [Puppet-users] File configuration difficulty --------------------------------------------------------------------------- On Jan 4, 2007, at 1:02 PM, John Dubery wrote:> Hi, > > The sourceselect (all / first) parameter (as I''m pleased to see it > has now > been named) should answer my need I think - thanks.Great.> I''ve just got the code (svn rev.2035) to work in a trivial example > - I hope > to try it in a production level run soon. > > Is rev.2035 a good revision to use, or should I get a more recent > (or older?) > one that''s known to be more reliable?I''m getting very near release, so either use the latest from subversion, or wait a couple of days until the release is out.> Any idea when the revision including this addition will be released?Today? Tomorrow? This''d all go a lot faster if everyone weren''t making feature requests right in the middle of the release process. :) -- Nonreciprocal Laws of Expectations: Negative expectations yield negative results. Positive expectations yield negative results. --------------------------------------------------------------------- Luke Kanies | http://reductivelabs.com | http://madstop.com _______________________________________________ Puppet-users mailing list Puppet-users@madstop.com https://mail.madstop.com/mailman/listinfo/puppet-users
On Jan 19, 2007, at 6:23 AM, John Dubery wrote: [snip]> The only workaround I can think of is to specify a folder low > enough in the > structure that there are no common-name subfolders - which is a > pity. Any other suggestions?This looks like a bug in how sourceselect is implemented. Can you file it as such, with your example included? -- Humphrey''s Law of the Efficacy of Prayer: In a dangerous world there will always be more people around whose prayers for their own safety have been answered than those whose prayers have not. --------------------------------------------------------------------- Luke Kanies | http://reductivelabs.com | http://madstop.com