On 13/12/17 17:40, R.I.Pienaar wrote:


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 :(


Unfortunately that was not a deliberate change. It just means that the testing for how defaults are supposed to work has holes in it. I don't want it back though, and we have no error reports regarding this. I hope it stays that way and that we can drop the resource defaults or make them sane.

- henrik

--

Visit my Blog "Puppet on the Edge"
http://puppet-on-the-edge.blogspot.se/

--
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/p0rmap%24kra%241%40blaine.gmane.org.
For more options, visit https://groups.google.com/d/optout.

Reply via email to