I''m almost afraid to ask because this probably sticks out like a sore thumb on the wiki somewhere, and I''m just not seeing it. But I have a bunch of files with the same owner/mode. Is there a way to somehow collapse these, so that all I repeat is the file name? Example: file { "/opt/test/1": owner => "jtan", group => "jtan", mode => "0600"; "/opt/test/2": owner => "jtan", group => "jtan", mode => "0600"; "/opt/test/3": owner => "jtan", group => "jtan", mode => "0600"; } Thanks, johnn
something like this seems correct: file { [ "foo", "bar", "foobar" ]: ... Johnny Tan wrote:> I''m almost afraid to ask because this probably sticks out > like a sore thumb on the wiki somewhere, and I''m just not > seeing it. > > But I have a bunch of files with the same owner/mode. Is > there a way to somehow collapse these, so that all I repeat > is the file name? > > Example: > > file { > "/opt/test/1": > owner => "jtan", > group => "jtan", > mode => "0600"; > "/opt/test/2": > owner => "jtan", > group => "jtan", > mode => "0600"; > "/opt/test/3": > owner => "jtan", > group => "jtan", > mode => "0600"; > } > > > Thanks, > johnn > _______________________________________________ > Puppet-users mailing list > Puppet-users@madstop.com > https://mail.madstop.com/mailman/listinfo/puppet-users >
matthew.malthouse@guardian.co.uk
2007-Dec-14 08:33 UTC
Re: multiple files with same attributes
puppet-users-bounces@madstop.com wrote on 13/12/2007 23:17:06:> I''m almost afraid to ask because this probably sticks out > like a sore thumb on the wiki somewhere, and I''m just not > seeing it. > > But I have a bunch of files with the same owner/mode. Is > there a way to somehow collapse these, so that all I repeat > is the file name? > > Example: > > file { > "/opt/test/1": > owner => "jtan", > group => "jtan", > mode => "0600"; > "/opt/test/2": > owner => "jtan", > group => "jtan", > mode => "0600"; > "/opt/test/3": > owner => "jtan", > group => "jtan", > mode => "0600"; > }file { [ "/opt/test/1", "/opt/test/2", "/opt/test/3" ]: owner => "jtan", group => "jtan", mode => "0600" } Matthew ------------------------------------------------------------------ Visit Guardian Unlimited - the UK''s most popular newspaper website http://guardian.co.uk http://observer.co.uk ------------------------------------------------------------------ The Newspaper Marketing Agency Opening Up Newspapers http://www.nmauk.co.uk ------------------------------------------------------------------ This e-mail and all attachments are confidential and may also be privileged. If you are not the named recipient, please notify the sender and delete the e-mail and all attachments immediately. Do not disclose the contents to another person. You may not use the information for any purpose, or store, or copy, it in any way. Guardian News & Media Limited is not liable for any computer viruses or other material transmitted with or as part of this e-mail. You should employ virus checking software. Guardian News & Media Limited A member of Guardian Media Group PLC Registered Office Number 1 Scott Place, Manchester M3 3GG Registered in England Number 908396
On 2007-12-14, at 00:17, Johnny Tan wrote:> eeing it. > > But I have a bunch of files with the same owner/mode. Is > there a way to somehow collapse these, so that all I repeat > is the file name? > > Example: > > file { > "/opt/test/1": > owner => "jtan", > group => "jtan", > mode => "0600"; > "/opt/test/2": > owner => "jtan", > group => "jtan", > mode => "0600"; > "/opt/test/3": > owner => "jtan", > group => "jtan", > mode => "0600"; > }Other possibility: File { owner => "jtan", group => "jtan", mode => "0600" } somewhere in your manifests (in main scope?). You will define default settings for all files you manage. --- Grzegorz Marszałek graf0@post.pl
Adam Kosmin wrote:> something like this seems correct: > > file { [ "foo", "bar", "foobar" ]: > ...Thanks Adam, Matthew, and Grzegorz. johnn
On Dec 13, 2007 4:17 PM, Johnny Tan <linuxweb@gmail.com> wrote:> I''m almost afraid to ask because this probably sticks out > like a sore thumb on the wiki somewhere, and I''m just not > seeing it.Not like a sore thumb, no. I added an example for custom defined types under ''Arrays'' on the Language Tutorial some time ago. I added another block for native types today based on this thread. http://reductivelabs.com/trac/puppet/wiki/LanguageTutorial#arrays
Be mindful of setting mode in a default definition, the mode setting is pretty dumb at the moment and it''s easy to end up with a bunch of directories mode 644 if you aren''t paying attention to the scope you defined File in. On 12/14/07, Joshua Timberman <joshua.timberman@gmail.com> wrote:> > On Dec 13, 2007 4:17 PM, Johnny Tan <linuxweb@gmail.com> wrote: > > I''m almost afraid to ask because this probably sticks out > > like a sore thumb on the wiki somewhere, and I''m just not > > seeing it. > > Not like a sore thumb, no. I added an example for custom defined types > under ''Arrays'' on the Language Tutorial some time ago. I added another > block for native types today based on this thread. > > http://reductivelabs.com/trac/puppet/wiki/LanguageTutorial#arrays > _______________________________________________ > Puppet-users mailing list > Puppet-users@madstop.com > https://mail.madstop.com/mailman/listinfo/puppet-users >-- stickm@gmail.com -==< Stick >==- _______________________________________________ Puppet-users mailing list Puppet-users@madstop.com https://mail.madstop.com/mailman/listinfo/puppet-users
Grzegorz Marsza³ek wrote:> Other possibility: > > File { owner => "jtan", group => "jtan", mode => "0600" }Ah, actually, I may have to go this route after all. Because the sources of my files would each be different. The additional benefit of using this default is that it also sets the attributes for directories, and then I just have to override the modes with 755 (or of course, not even put the mode in the default, instead specifying it per resource). I always saw the "Resource Defaults" section on the page that Joshua just posted, and it never clicked as to what use I would put it to. Now of course it''s blindingly obvious :). Thanks all. johnn
On Dec 14, 2007, at 9:52 AM, Chris MacLeod wrote:> Be mindful of setting mode in a default definition, the mode > setting is pretty dumb at the moment and it''s easy to end up with a > bunch of directories mode 644 if you aren''t paying attention to the > scope you defined File in.Really? Directories should automatically add execute bits for every read bit that exists. If you are ending up with directories that are readable but not executable, that''s a bug. -- One of the keys to happiness is a bad memory. -- Rita Mae Brown --------------------------------------------------------------------- Luke Kanies | http://reductivelabs.com | http://madstop.com
On 12/14/07, Luke Kanies <luke@madstop.com> wrote:> > On Dec 14, 2007, at 9:52 AM, Chris MacLeod wrote: > > > Be mindful of setting mode in a default definition, the mode > > setting is pretty dumb at the moment and it''s easy to end up with a > > bunch of directories mode 644 if you aren''t paying attention to the > > scope you defined File in. > > Really? Directories should automatically add execute bits for every > read bit that exists. If you are ending up with directories that are > readable but not executable, that''s a bug.I''ll test it and report back (and file if nessessary) but I remember ripping out a bunch of defaults mode settings I was doing b/c I was getting undesired results. C -- stickm@gmail.com -==< Stick >==- _______________________________________________ Puppet-users mailing list Puppet-users@madstop.com https://mail.madstop.com/mailman/listinfo/puppet-users
Ok, I was wrong, I must have had something funky in my manifests. So when setting resource defaults (specifically for the ''file'' type), if the read-bit is enabled in defaults any resulting directory that inherits those defaults will get the execute bit as well. Where''s a good place to add that to the wiki? http://reductivelabs.com/trac/puppet/wiki/LanguageTutorial#resource-defaults or under the type reference for the file type? On 12/14/07, Chris MacLeod <stickm@gmail.com> wrote:> > > > On 12/14/07, Luke Kanies <luke@madstop.com> wrote: > > > > On Dec 14, 2007, at 9:52 AM, Chris MacLeod wrote: > > > > > Be mindful of setting mode in a default definition, the mode > > > setting is pretty dumb at the moment and it''s easy to end up with a > > > bunch of directories mode 644 if you aren''t paying attention to the > > > scope you defined File in. > > > > Really? Directories should automatically add execute bits for every > > read bit that exists. If you are ending up with directories that are > > readable but not executable, that''s a bug. > > > > > > I''ll test it and report back (and file if nessessary) but I remember > ripping out a bunch of defaults mode settings I was doing b/c I was > getting undesired results. > > > C > > > -- > stickm@gmail.com > -==< Stick >==--- stickm@gmail.com -==< Stick >==- _______________________________________________ Puppet-users mailing list Puppet-users@madstop.com https://mail.madstop.com/mailman/listinfo/puppet-users