Re: [Puppet Users] recursive descent

2013-12-18 Thread Andy Spiegl
On 2013-12-18, 07:27, jcbollinger wrote:
> For example, you can keep the needed manifest code DRY and clear by
> using a variable to specify the sources:

Good idea, thanks!
 Andy.


-- 
 The foolish man seeks happiness in the distance,
 the wise grows it under his feet.  -- James Oppenheim

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/20131218163912.GA4246%40spiegl.de.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [Puppet Users] recursive descent

2013-12-18 Thread jcbollinger


On Wednesday, December 18, 2013 2:23:52 AM UTC-6, Andy Spiegl wrote:
>
> On 2013-12-17, 16:31, Ben Ford wrote: 
>
> > If you override something in a recursive directory, you're 
> > overriding everything. 
> I see, that makes sense. 
>
> > If you add source => 'puppet:///modules/nagios/var_lib_nagios/plugins' 
> then 
> > I suspect you'll get what you want. 
> You are right, that did it.  Thanks! 
>
> > I should also point out that this is unnecessary, as Puppet will 
> > automatically promote read permissions to read & execute permissions 
> > for directories. 
> No, not exactly as the mode definition is meant for the files in the 
> subdirectory.  There are executables in "bin" and "plugins". 
>
> So, what would be a better way of changing the mode of some files 
> within a directory resource with "recurse" activated?  Adding "source" 
> for all of them seems awkward... 
>
>
 
Sorry, Puppet does not do the kind of resource property merging that you 
seem to want.  As Ben wrote, when you have an explicit declaration of a 
File resource that otherwise would be managed via a recursive directory 
resource, the explicit declaration is the only one considered.  Consider 
that the sources of the /var/lib/nagios/{plugins,bin} directories needn't 
actually appear on the masters as subdirectories of the source for 
/var/lib/nagios -- expressing the sources explicitly is not awkward, it's 
appropriate.

There are a few things you could do to make this more palatable.  For 
example, you can keep the needed manifest code DRY and clear by using a 
variable to specify the sources:

  $nagios_source = 'puppet:///modules/nagios/var_lib_nagios'
  file { '/var/lib/nagios': 
ensure=> directory, 
source=> ${nagios_source}, 
recurse   => true, 
mode  => '0664', 
  } 
  file { '/var/lib/nagios/plugins': 
ensure=> directory, 
source=> "${nagios_source}/plugins", 
recurse   => true, 
mode  => '0775', 
  } 
  file { '/var/lib/nagios/bin': 
ensure=> directory, 
source=> "${nagios_source}/bin", 
recurse   => true, 
mode  => '0775', 
  } 


Alternatively, packages are sometimes better than recursive File resources 
for managing directory trees.

Or you could abandon managing file modes for the whole /var/lib/nagios tree 
via File resources, and do it instead via an Exec.


John

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/96a5ef72-2784-42ef-890f-f1f52c12fe66%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [Puppet Users] recursive descent

2013-12-18 Thread Andy Spiegl
On 2013-12-17, 16:31, Ben Ford wrote:

> If you override something in a recursive directory, you're
> overriding everything.
I see, that makes sense.

> If you add source => 'puppet:///modules/nagios/var_lib_nagios/plugins' then 
> I suspect you'll get what you want.
You are right, that did it.  Thanks!

> I should also point out that this is unnecessary, as Puppet will
> automatically promote read permissions to read & execute permissions
> for directories.
No, not exactly as the mode definition is meant for the files in the
subdirectory.  There are executables in "bin" and "plugins".

So, what would be a better way of changing the mode of some files
within a directory resource with "recurse" activated?  Adding "source"
for all of them seems awkward...

Thanks for your help!
 Andy.

-- 
 Suburbia is where the developer bulldozes out the trees,
 then names the streets after them.
   (Bill Vaughan)

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/20131218082352.GA25905%40spiegl.de.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [Puppet Users] recursive descent

2013-12-17 Thread Ben Ford

>
>
>   file { '/var/lib/nagios/plugins': 
>> ensure=> directory, 
>> recurse   => true, 
>> mode  => '0775', 
>>   } 
>
>
I should also point out that this is unnecessary, as Puppet will 
automatically promote read permissions to read & execute permissions for 
directories. If you simply remove the second file declarations from your 
code, you'll have the behavior that I think you're expecting.

http://docs.puppetlabs.com/references/latest/type.html#file-attribute-mode

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/f4d039a2-d13e-4a98-b9d2-80e9ebea0785%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [Puppet Users] recursive descent

2013-12-17 Thread Ben Ford
If you override something in a recursive directory, you're overriding 
everything. The subdirectories are being managed explicitly by the resource 
managing them, not by a combination of it and the parent. Look inline below:

On Tuesday, December 17, 2013 11:12:21 AM UTC-8, Andy Spiegl wrote:
>
> > > 
> http://christian.hofstaedtler.name/blog/2008/11/puppet-managing-directories-recursively.html
>  
>
> I thought I had understood recursive directory management.  It worked 
> fine until I switched to puppet v3 (Debian 3.3.2-1puppetla to be exact) 
> Since then, files in subdirs aren't copied anymore. 
>
> An example: 
>   File { 
> owner => "nagios", 
> group => "nagios", 
> mode  => '0644', 
>   } 
>   file { '/var/lib/nagios': 
> ensure=> directory, 
> source=> 'puppet:///modules/nagios/var_lib_nagios', 
> recurse   => true, 
>   } 
>


Manages /var/lib/nagios with recurse true.
 

  file { '/var/lib/nagios/plugins': 
> ensure=> directory, 
> recurse   => true, 
> mode  => '0775', 
>   } 
>


Completely takes precedence over File['/var/lib/nagios'] and manages 
'/var/lib/nagios/plugins' telling Puppet that all you care about is that 
it's a directory with mode 775. Notice that you no longer have a source for 
this subdirectory, so it's explicitly not managed.

If you add source => 'puppet:///modules/nagios/var_lib_nagios/plugins' then 
I suspect you'll get what you want.

 

>   file { '/var/lib/nagios/bin': 
> ensure=> directory, 
> recurse   => true, 
> mode  => '0775', 
>   } 
>
>  lama:~/.../puppet/modules/nagios> ls -la files/var_lib_nagios 
>  total 8 
>  drwxrwxr-x 2 andy users 4096 2013-11-15 15:56:23 bin/ 
>  drwxrwxr-x 2 andy users 4096 2013-11-25 12:01:14 plugins/ 
>
> Why aren't these directories copied to /var/lib/nagios? 
> I tried setting recurselimit to '2' but that didn't help either. 
>
> Thanks for any hint! 
>  Andy. 
>
>
> -- 
>  A mathematician is a machine for converting coffee into theorems. 
>  (Alfred Renyi) 
>

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/80da2632-5cc6-453f-96f6-c01d1e9b85a1%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [Puppet Users] recursive descent

2013-12-17 Thread Andy Spiegl
> > http://christian.hofstaedtler.name/blog/2008/11/puppet-managing-directories-recursively.html

I thought I had understood recursive directory management.  It worked
fine until I switched to puppet v3 (Debian 3.3.2-1puppetla to be exact)
Since then, files in subdirs aren't copied anymore.

An example:
  File {
owner => "nagios",
group => "nagios",
mode  => '0644',
  }
  file { '/var/lib/nagios':
ensure=> directory,
source=> 'puppet:///modules/nagios/var_lib_nagios',
recurse   => true,
  }
  file { '/var/lib/nagios/plugins':
ensure=> directory,
recurse   => true,
mode  => '0775',
  }
  file { '/var/lib/nagios/bin':
ensure=> directory,
recurse   => true,
mode  => '0775',
  }

 lama:~/.../puppet/modules/nagios> ls -la files/var_lib_nagios
 total 8
 drwxrwxr-x 2 andy users 4096 2013-11-15 15:56:23 bin/
 drwxrwxr-x 2 andy users 4096 2013-11-25 12:01:14 plugins/

Why aren't these directories copied to /var/lib/nagios?
I tried setting recurselimit to '2' but that didn't help either.

Thanks for any hint!
 Andy.


-- 
 A mathematician is a machine for converting coffee into theorems.  (Alfred 
Renyi)

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/20131217191221.GA31279%40spiegl.de.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [Puppet Users] recursive descent

2013-12-12 Thread Stuart Cracraft
Sure does John.

Thanks for your interest!

Do we know when the Puppet 3.0 book is coming out?

It's showing as a very, very long delay at Amazon...

On Thursday, December 12, 2013 7:17:17 AM UTC-8, jcbollinger wrote:

>
>
> On Wednesday, December 11, 2013 4:38:02 PM UTC-6, Stuart Cracraft wrote:
>>
>>
>> http://christian.hofstaedtler.name/blog/2008/11/puppet-managing-directories-recursively.html
>>
>>
> Yes.  Do you still have a question here, or does that blog post answer the 
> question sufficiently for you? 
>
>
> John
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/2bf056f0-cf06-482f-becc-86465530bf3e%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [Puppet Users] recursive descent

2013-12-12 Thread jcbollinger


On Wednesday, December 11, 2013 4:38:02 PM UTC-6, Stuart Cracraft wrote:
>
>
> http://christian.hofstaedtler.name/blog/2008/11/puppet-managing-directories-recursively.html
>
>
Yes.  Do you still have a question here, or does that blog post answer the 
question sufficiently for you? 


John

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/fd378100-96aa-4fa6-8caf-54919a0f40e1%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [Puppet Users] recursive descent

2013-12-11 Thread Stuart Cracraft
http://christian.hofstaedtler.name/blog/2008/11/puppet-managing-directories-recursively.html

On Wednesday, December 11, 2013 2:36:05 PM UTC-8, Stuart Cracraft wrote:
>
> The tree has to already exist. 
>
> One would think having the ability
> to instantiate a tree from a seedling would be useful. 
>
> Sent from my iPhone
>
> On Dec 11, 2013, at 2:25 PM, Stuart Cracraft  wrote:
>
>
> I want to recursively descend infinitely through a directory tree in 
> regards to ensuring:
>
>   (a) owner, group, permission
>   (b) existence of the full path, all the leaves, out to the final leaf, 
> e.g.
>/somedir/somesubdir/{file1,file2,file3,somesubdirtoo} and so forth
>
> This could be done trivially with an exec but is not 
> pure-Puppet-ecosystem, obviously.
>
> So my questions are, from a Puppet-puritan-perspective:
>
>   is there a way to do (a)
>   is there a way to do (b)
>   is there a way to do (a)+(b)
>
> and last:
>
>   is there a way to do (a)+(b) in a reasonable period of time for a 
> shallow tree of few leaves
>
> Yours in squirrelhood,
>
> Stuart
>
>
>  -- 
> You received this message because you are subscribed to a topic in the 
> Google Groups "Puppet Users" group.
> To unsubscribe from this topic, visit 
> https://groups.google.com/d/topic/puppet-users/Hf6ReeSy2mE/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to 
> puppet-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/puppet-users/b9c95f80-9ae3-439b-a451-17327291524d%40googlegroups.com
> .
> For more options, visit https://groups.google.com/groups/opt_out.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/a0f42acd-6ac7-497f-a218-24c91cc397a5%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [Puppet Users] recursive descent

2013-12-11 Thread Stuart Cracraft
The tree has to already exist. 

One would think having the ability
to instantiate a tree from a seedling would be useful. 

Sent from my iPhone

> On Dec 11, 2013, at 2:25 PM, Stuart Cracraft  wrote:
> 
> 
> I want to recursively descend infinitely through a directory tree in regards 
> to ensuring:
> 
>   (a) owner, group, permission
>   (b) existence of the full path, all the leaves, out to the final leaf, e.g.
>/somedir/somesubdir/{file1,file2,file3,somesubdirtoo} and so forth
> 
> This could be done trivially with an exec but is not pure-Puppet-ecosystem, 
> obviously.
> 
> So my questions are, from a Puppet-puritan-perspective:
> 
>   is there a way to do (a)
>   is there a way to do (b)
>   is there a way to do (a)+(b)
> 
> and last:
> 
>   is there a way to do (a)+(b) in a reasonable period of time for a shallow 
> tree of few leaves
> 
> Yours in squirrelhood,
> 
> Stuart
> 
> 
> -- 
> You received this message because you are subscribed to a topic in the Google 
> Groups "Puppet Users" group.
> To unsubscribe from this topic, visit 
> https://groups.google.com/d/topic/puppet-users/Hf6ReeSy2mE/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to 
> puppet-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/puppet-users/b9c95f80-9ae3-439b-a451-17327291524d%40googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/5B231871-F82E-4DBA-9562-1F93B486A6DA%40me.com.
For more options, visit https://groups.google.com/groups/opt_out.


[Puppet Users] recursive descent

2013-12-11 Thread Stuart Cracraft

I want to recursively descend infinitely through a directory tree in 
regards to ensuring:

  (a) owner, group, permission
  (b) existence of the full path, all the leaves, out to the final leaf, 
e.g.
   /somedir/somesubdir/{file1,file2,file3,somesubdirtoo} and so forth

This could be done trivially with an exec but is not pure-Puppet-ecosystem, 
obviously.

So my questions are, from a Puppet-puritan-perspective:

  is there a way to do (a)
  is there a way to do (b)
  is there a way to do (a)+(b)

and last:

  is there a way to do (a)+(b) in a reasonable period of time for a shallow 
tree of few leaves

Yours in squirrelhood,

Stuart


-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/b9c95f80-9ae3-439b-a451-17327291524d%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.