Debugging Ruby
There are two supported ways to debug Ruby code with puppetserver
—ruby-debug and Pry. Both of these will implement a Read Eval Print Loop (REPL). A REPL allows you to type commands and have them evaluated in real time. When working with puppetserver
, this gives you the power to inspect the puppetserver
process while it is compiling a catalog or processing a report. Both ruby-debug and Pry are installed as Ruby gems. To use them with puppetserver
, you have to install them by using the puppetserver gem
command. I prefer to use Pry. So, I will show you how to use Pry in this example. We'll inspect calls to the hiera
function by using Pry. To start, install Pry for use within puppetserver
, as follows:
[root@puppet ~]# puppetserver gem ...
Get Troubleshooting Puppet now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.