Book Image

Troubleshooting Puppet

By : Thomas Uphill
Book Image

Troubleshooting Puppet

By: Thomas Uphill

Overview of this book

Table of Contents (14 chapters)

Explicit ordering


When you are trying to determine an error in the evaluation of your class, it can be helpful to use the chaining arrow syntax to force your resources to evaluate in the order that you specified. For instance, if you have an exec resource that is failing, you can create another exec resource that outputs the information used within your failing exec. For example, we have the following exec code:

file {'arrow':
  path => '/tmp/arrow',
  ensure => 'directory',
}
exec {'arrow_debug_before':
  command => 'echo debug_before',
  path => '/usr/bin:/bin',
}
exec {'arrow_example':
  command => 'echo arrow',
  path => '/usr/bin:/bin',
  require => File['arrow'],
}
exec {'arrow_debug_after':
  command => 'echo debug_after',
  path => '/usr/bin:/bin',
}

Now, when you apply this catalog, you will see that the arrow_before and arrow_after resources are not applied in the order that we were expecting:

[root@trouble ~]# puppet agent -t
Info: Retrieving pluginfacts...