Re: [Puppet Users] Re: Puppet Class execution order

2011-06-15 Thread Ken Barber
So resource order is working in the following example:

class one {
  notify{class_one: message = class one}
}

class two {
  notify{class_two: message = class two}
}

class { two: require = Class[one] }
class { one: }

kbarber:~ ken$ puppet apply -v tmp/executeorder.pp
info: Applying configuration version '1308143980'
notice: class one
notice: /Stage[main]/One/Notify[class_one]/message: defined 'message'
as 'class one'
notice: class two
notice: /Stage[main]/Two/Notify[class_two]/message: defined 'message'
as 'class two'
notice: Finished catalog run in 0.01 seconds

Even using the chained resource example you gave:

Class[one]-Class[two]

Now ... something to be careful of ... if you change the notify's and
make then notices you get:

kbarber:~ ken$ puppet apply -v tmp/executeorder.pp
notice: Scope(Class[Two]): two
notice: Scope(Class[One]): one
info: Applying configuration version '1308144128'
notice: Finished catalog run in 0.01 seconds
kbarber:~ ken$

This is because parse order is different to resource execution order.
Perhaps this is what you are seeing? Be mindful that code parsing
occurs on the server and generally follows the normal top
down/evaluation rules that most languages follow. Resource execution
is done after catalog creation time and happens on the client - this
is where your ordering specified with requires/chained resources kicks
in. Notify is a resource - so suffers client side ordering. Notice is
a function - so suffers parse order. Does that make sense?

By 'requiring' classes - you are requiring the class and all
_resources_ inside them. This won't change parse order though :-).

Can you post some more complete examples with some snippets of your
problem so we can all analyze your problem in detail perhaps?

ken.

On Wed, Jun 15, 2011 at 3:00 AM, Larry Ludwig larry...@gmail.com wrote:
 Sorry the typo:
 My examples should read:
 class { 'two': require = Class['one'] }

 class {'two: require = Exec['withinclassone'] }

 --
 You received this message because you are subscribed to the Google Groups
 Puppet Users group.
 To view this discussion on the web visit
 https://groups.google.com/d/msg/puppet-users/-/HIBnBYkxst4J.
 To post to this group, send email to puppet-users@googlegroups.com.
 To unsubscribe from this group, send email to
 puppet-users+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/puppet-users?hl=en.


-- 
You received this message because you are subscribed to the Google Groups 
Puppet Users group.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.



Re: [Puppet Users] Re: Puppet Class execution order

2011-06-15 Thread Larry Ludwig
Thanks Ken,

Let me look further into the classes and see what's exactly happening.

-- 
You received this message because you are subscribed to the Google Groups 
Puppet Users group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/puppet-users/-/E0R0CzeeXwoJ.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.



[Puppet Users] Re: Puppet Class execution order

2011-06-14 Thread Larry Ludwig
Sorry the typo:

My examples should read:

class { 'two': require = Class['one'] }

class {'two: require = Exec['withinclassone'] }

-- 
You received this message because you are subscribed to the Google Groups 
Puppet Users group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/puppet-users/-/HIBnBYkxst4J.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.