[Puppet Users] Re: Resource ordering of Execs not working as expected (SOLVED)

2014-09-22 Thread Jake Lundberg
Hrm, well, with your help, I got this to work in the order I was expecting. 
  I think I had a few problems here.

1.  My original ordering was:
 File['Config'] -> Exec['stop'] -> Package['foo'] -> Exec['start'] 

I changed this to:
 File['Config'] ~> Exec['stop'] -> Package['foo'] ~> Exec['start'] 

It helps when I RTFM on using ~> for notifications instead of -> for pure 
ordering.

2.  When I wasn't using that ordering syntax, I had:

  exec { "stop":
path=> 
"/usr/local/sbin/:/usr/local/jdk/bin:/bin:/sbin:/usr/sbin:/usr/bin",
command => '/usr/local/sbin/control.sh stop',
refreshonly => true,
logoutput   => true,
subscribe   => File['Config'],
require => File['/usr/local/sbin/control.sh'"]
  }

This is because there are cases when the foo::config is created, but foo is 
not (meaning the control files are not created).   I figured this would 
create the proper order, but it doesn't seem to have.   

3.  Using different types of configuration patterns.  I kept flipping 
between using subscribe/notify and ->/~> ordering syntax and most likely 
screwed something up in the interim.   I eventually made a mistake and got 
some dependency cycle issues which actually helped quite a bit in figuring 
out my error in logic.

BTW, "refreshonly => true" is still set on both execs and is working 
properly.   

Thank you for the help!!!
Jake

On Monday, September 22, 2014 7:44:34 AM UTC-7, jcbollinger wrote:
>
>
>
> On Friday, September 19, 2014 12:59:34 PM UTC-5, Jake Lundberg wrote:
>>
>> Puppet 3.6.2
>>
>> First, I understand that Execs try not to run multiple times if called 
>> many times by many resources and typically wait until they've all been 
>> "collected" from all resources
>>
>
>
> Not exactly.  Execs run at most twice per Puppet run.  They run at most 
> once if they are refreshonly or if they do not receive any events from 
> other resources.  (If they are refreshonly then they run *only* if they 
> receive an event from another resource.)  When they run relative to when 
> other resources are applied (and whether resources send them events) is 
> shaped by resource relationships, just as with all other resource types.
>
> ObYoda: "Do... or do not.  There is no 'try'."
>
>  
>
>> , but I have a specific case where I need different Execs to run in a 
>> particular order based on a set of resources that change.   
>>
>>
>
> That's what resource relationships are for.  Cristian has showed you how.  
> If that doesn't seem to be working for you then it would help us help you 
> if you present a complete -- but simple -- example that demonstrates your 
> problem.
>
>
> 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/7a4f2132-2f53-47bf-afb1-80e5d25988d5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[Puppet Users] Re: Resource ordering of Execs not working as expected

2014-09-22 Thread jcbollinger


On Friday, September 19, 2014 12:59:34 PM UTC-5, Jake Lundberg wrote:
>
> Puppet 3.6.2
>
> First, I understand that Execs try not to run multiple times if called 
> many times by many resources and typically wait until they've all been 
> "collected" from all resources
>


Not exactly.  Execs run at most twice per Puppet run.  They run at most 
once if they are refreshonly or if they do not receive any events from 
other resources.  (If they are refreshonly then they run *only* if they 
receive an event from another resource.)  When they run relative to when 
other resources are applied (and whether resources send them events) is 
shaped by resource relationships, just as with all other resource types.

ObYoda: "Do... or do not.  There is no 'try'."

 

> , but I have a specific case where I need different Execs to run in a 
> particular order based on a set of resources that change.   
>
>

That's what resource relationships are for.  Cristian has showed you how.  
If that doesn't seem to be working for you then it would help us help you 
if you present a complete -- but simple -- example that demonstrates your 
problem.


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/9a9f750a-3cf8-4d62-90ed-409c0d10d22e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.