Puppet require - failure handling

58 views
Skip to first unread message

Johan Martinez

unread,
Jan 5, 2014, 4:08:03 AM1/5/14
to puppet...@googlegroups.com

If I define a wordpress class with require functions as below:

class wordpress { require apache require mysql ... }

Then would it run even if apache or mysql classes fail for some reason? Also, if apache class returns an error, would mysql class run get triggered or Puppet would exit after apache class error?

-jM

Jose Luis Ledesma

unread,
Jan 5, 2014, 5:37:30 AM1/5/14
to puppet...@googlegroups.com
There is not after or before when puppet applies a manifest if there are not dependencies explicitly declared. In the example you have written mysql and apache will be applied in no particular order between them, but will be implemented both before any other resource in the WordPress class.

If you want mysql or apache implemented before the other, you can chain classes:

Class['mysql']=>Class['apache']

This will apply mysql before apache, and only will implement apache if mysql goes OK.

Andreas Ntaflos

unread,
Jan 5, 2014, 10:42:58 AM1/5/14
to puppet...@googlegroups.com
On 2014-01-05 11:37, Jose Luis Ledesma wrote:
> There is not after or before when puppet applies a manifest if there are not dependencies explicitly declared. In the example you have written mysql and apache will be applied in no particular order between them, but will be implemented both before any other resource in the WordPress class.
>
> If you want mysql or apache implemented before the other, you can chain classes:
>
> Class['mysql']=>Class['apache']

To be syntactically correct that should be

Class['mysql'] -> Class['apache']

with a -> and not a =>.

Andreas

signature.asc

Jose Luis Ledesma

unread,
Jan 5, 2014, 11:50:49 AM1/5/14
to puppet...@googlegroups.com
Right! I wrote it from the mobile :s

neubyr

unread,
Jan 5, 2014, 2:05:01 PM1/5/14
to puppet...@googlegroups.com

That explains how resource ordering works. Is it the same way with require statement? For example, if apache or mysql class fails on the node, would wordpress class run be attempted? 



On Sun, Jan 5, 2014 at 8:50 AM, Jose Luis Ledesma <joseluis...@gmail.com> wrote:
Right! I wrote it from the mobile :s

--
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...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/f510902a-d745-4b5b-afa1-fc37388749fd%40googlegroups.com.

Jose Luis Ledesma

unread,
Jan 5, 2014, 2:27:50 PM1/5/14
to puppet...@googlegroups.com
Clases WordPress requiere both MySQL and apache, so no resource of WordPress will be "executed" if any of them fails

jcbollinger

unread,
Jan 6, 2014, 9:27:42 AM1/6/14
to puppet...@googlegroups.com


On Sunday, January 5, 2014 1:05:01 PM UTC-6, neubyr wrote:

That explains how resource ordering works. Is it the same way with require statement? For example, if apache or mysql class fails on the node, would wordpress class run be attempted? 



Resource and class ordering are the same thing.  One framework governs them both.  You can even order resources relative to classes.  Furthermore, a 'require' statement is exactly equivalent to an 'include' statement plus one or more relationship declarations.  That is this

class wordpress {
  require 'apache'
}


is exactly equivalent to

class wordpress {
  include 'apache'
  Class['apache'] -> Class['wordpress']
}



John

Johan Martinez

unread,
Jan 7, 2014, 3:45:59 AM1/7/14
to puppet...@googlegroups.com

Thanks Jose!
Reply all
Reply to author
Forward
0 new messages