On Wed, 13 Dec 2017, at 16:31, Henrik Lindberg wrote:
> On 13/12/17 14:46, Tobias Koeck wrote:
> > Hi,
> >
> > I am wondering what the difference between a Resource Default statement like
> >
> > |Exec { path => '/usr/bin:/bin:/usr/sbin:/sbin', environment =>
> > 'RUBYLIB=/opt/puppetlabs/puppet/lib/ruby/site_ruby/2.1.0/', logoutput =>
> > true, timeout => 180, }
> >
> >
>
> What the others said is not quite accurate.
>
> This sets the defaults for all Exec resources that are declared in the
> same scope, or in any scope that is included from this scope. This is
> known as Dynamic Scoping and it is a horribly bad idea that is removed
> from modern puppet for everything except Resource Defaults (what the
> example construct is known as). The less you use this the better.
There's been a very unfortunate puppet 5 behaviour change here:
class bar {
notify{"three": }
}
class foo {
include bar
notify{"one": }
Notify{message => "default"}
notify{"two": }
}
include foo
In 4 this would do as you say, both would use "default", but in 5...
Notice: three
Notice: /Stage[main]/Bar/Notify[three]/message: defined 'message' as
'three'
Notice: one
Notice: /Stage[main]/Foo/Notify[one]/message: defined 'message' as
'one'
Notice: default
Notice: /Stage[main]/Foo/Notify[two]/message: defined 'message' as
'default'
The positioning of the 'include' here would also change the behavior of
the 'three' resource
Bug or feature? Don't care personally, no-one should use this awful
feature.
Though I thought we killed the dynamic scope stuff wrt this :(