Search code examples
puppet

Difference between include and chaining classes using arrows in Puppet


What is the difference between

class A {

}

class B {
  Class['B'] -> Class['A']
}

and

class A {

}

class B {
  require a
}

To my understanding they should be the same - establishing that 'A' is executed before 'B', but only the second form seems to do that.


Solution

  • -> (ordering arrow; a hyphen and a greater-than sign) — Applies the resource on the left before the resource on the right.

    So in your first example:

    Class['B'] -> Class['A']
    

    means apply B before A.

    In second example, the require function causes A to become a dependency of B. Simplifying apply A before B.