Sie sind auf Seite 1von 3

C.

Troubleshooting and Debugging - Puppet Types and Providers [Book]

1 of 3

https://www.safaribooksonline.com/library/view/puppet-types-and/97...

When developing Puppet types and providers, its not uncommon to run into bugs that are hard
to trace and debug. There are a few options in Puppet that will simplify the troubleshooting
process. The option --trace will provide the Ruby stacktrace when Puppet execution fails. This
will give you a file and line number to provide additional insight into the problem at hand.
The Puppet.debug('message') method can be used in conjunction with the Puppet --debug flag to output troubleshooting messages to the console. This is helpful to output variables
and ensure that certain methods are invoked as expected. But its often far more helpful to dive
directly into a debugger. The ruby-debug gem gives you the ability to interactively troubleshoot
by breaking at a specific line in the code:

require 'ruby-debug'; debugger

The post_mortem option allows ruby-debug to enter into an interactive session when an exception occurs:

Lets update our


method:

Now when we manage a


when the method

14-08-2016 01:49

C. Troubleshooting and Debugging - Puppet Types and Providers [Book]

https://www.safaribooksonline.com/library/view/puppet-types-and/97...

You are previewing Puppet Types and Providers .

2 of 3

Tour
PREV

B. Modules

Explore

Pricing

Enterprise

Puppet Types and Providers

Sign In

Start Free Trial


NEXT

Colophon

14-08-2016 01:49

C. Troubleshooting and Debugging - Puppet Types and Providers [Book]

https://www.safaribooksonline.com/library/view/puppet-types-and/97...

You are previewing Puppet Types and Providers .

3 of 3

Tour
PREV

B. Modules

Explore

Pricing

Enterprise

Puppet Types and Providers

Sign In

Start Free Trial


NEXT

Colophon

14-08-2016 01:49

Das könnte Ihnen auch gefallen