On Wednesday, November 6, 2013 9:01:17 AM UTC-6, Martin Langhoff wrote:
>
> On Wed, Nov 6, 2013 at 9:55 AM, jcbollinger
> <[email protected]<javascript:>>
> 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 [email protected].
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.