Re: [Puppet Users] Re: File() or Exec() temporary override?

2013-11-07 Thread jcbollinger


On Wednesday, November 6, 2013 9:01:17 AM UTC-6, Martin Langhoff wrote:

 On Wed, Nov 6, 2013 at 9:55 AM, jcbollinger 
 john.bo...@stjude.orgjavascript: 
 wrote: 
  .  If that's not viable, then something close to the idea you proposed 
  should be possible: 

 By should be possible, do you mean that you know or think that Puppet 
 supports it? 



I mean I believe the code I presented will accomplish your objective.

 

  node 'fqdn' { # I work for RL :-) 
include rl_users 
include rl_base 
include rl_webserver 
File| title == '/etc/httpd/conf.d/foo.conf' | { 
  ensure = 'present', 
  content = undef 
  # override other properties to undef (no quotes) 
  # as needed. 
} 
  } 

 Does this syntax work, and does it elegantly override any other File 
 stanzas that point to that file path? Does content=undef override 
 'source' or do I need to also say source-undef ? 



There can be only one declaration for any resource.  There can be multiple 
overrides, but the result is undefined (evaluation-order dependent, to be 
precise) if any two override the same property of the same underlying 
resource.

 

 If that actually works, what other types support this trick? 


It is an application of general-purpose features of Puppet DSL, mainly 
resource collectors 
(http://docs.puppetlabs.com/puppet/3/reference/lang_collectors.html) and 
overriding / amending properties of declared resources 
(http://docs.puppetlabs.com/puppet/2.7/reference/lang_resources.html#adding-or-modifying-attributes).
  
Use of the special 'undef' value in such context is documented in the 
related section on amending resource properties via class inheritance 
(http://docs.puppetlabs.com/puppet/3/reference/lang_classes.html#inheritance).

In other words, that approach should work with all resource types, 
including defined types.  It does not work with classes, however, even 
though classes can be declared via a syntax that looks like a resource 
declaration.  For this and other reasons, it is best to take the view that 
classes are not resources.


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/7c1efc26-288d-405e-8b74-69466ee40333%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[Puppet Users] Re: File() or Exec() temporary override?

2013-11-06 Thread jcbollinger


On Tuesday, November 5, 2013 9:11:38 AM UTC-6, Martin Langhoff wrote:

 Hi Puppeteers, 

 When you have complex/rich classes, and large numbers of machines/VMs, 
 sometimes there is a machine that needs a temporary override on a 
 file. 

 Is there a way to say something like... ? 

   node 'fqdn' { # I work for RL :-) 
   include rl_users 
   include rl_base 
   include rl_webserver # defines /etc/httpd/conf.d/foo.conf 
   ignore File['/etc/httpd/conf.d/foo.conf'] 
   } 

 or something conceptually equivalent? 

 I know of a couple inelegant options: I can disable puppet on that VM 
 for the duration, or comment out the relevant class. 

 A more precise override/ignore is of course better, as other 
 components of the configuration are still applied correctly. 



You could consider just shutting down or deactivating the puppet agent on 
the affected machine for the duration of the override.  For example, run

puppet agent --disable

there and afterward run

puppet agent --enable

.  If that's not viable, then something close to the idea you proposed 
should be possible:

node 'fqdn' { # I work for RL :-) 
  include rl_users 
  include rl_base 
  include rl_webserver
  File| title == '/etc/httpd/conf.d/foo.conf' | {
ensure = 'present',
content = undef
# override other properties to undef (no quotes)
# as needed.
  }
}


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/51512008-1240-4fe1-af23-0938f4e7c0ff%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [Puppet Users] Re: File() or Exec() temporary override?

2013-11-06 Thread Martin Langhoff
On Wed, Nov 6, 2013 at 9:55 AM, jcbollinger john.bollin...@stjude.org wrote:
 .  If that's not viable, then something close to the idea you proposed
 should be possible:

By should be possible, do you mean that you know or think that Puppet
supports it?

 node 'fqdn' { # I work for RL :-)
   include rl_users
   include rl_base
   include rl_webserver
   File| title == '/etc/httpd/conf.d/foo.conf' | {
 ensure = 'present',
 content = undef
 # override other properties to undef (no quotes)
 # as needed.
   }
 }

Does this syntax work, and does it elegantly override any other File
stanzas that point to that file path? Does content=undef override
'source' or do I need to also say source-undef ?

If that actually works, what other types support this trick?

thanks,




m
-- 
 martin.langh...@gmail.com
 -  ask interesting questions
 - don't get distracted with shiny stuff  - working code first
 ~ http://docs.moodle.org/en/User:Martin_Langhoff

-- 
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/CACPiFCKrnLdT9XpQ6uXa6%2BVqBPXWTM8UohdTuhLRR0y6sn1ShQ%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.