Puppet Function: pry

Defined in:
vendor_modules/stdlib/lib/puppet/parser/functions/pry.rb
Function type:
Ruby 3.x API

Summary

This function invokes a pry debugging session in the current scope object.

Overview

pry()Any

This is useful for debugging manifest code at specific points during a compilation.

Examples:

*Usage*


`pry()`

Returns:

  • (Any)

    debugging information



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'vendor_modules/stdlib/lib/puppet/parser/functions/pry.rb', line 7

newfunction(:pry, type: :statement, doc: <<-DOC
  @summary
    This function invokes a pry debugging session in the current scope object.
  This is useful for debugging manifest code at specific points during a compilation.

  @return
    debugging information

  @example **Usage**

    `pry()`

  DOC
) do |arguments|
  begin
    require 'pry'
  rescue LoadError
    raise(Puppet::Error, "pry(): Requires the 'pry' rubygem to use, but it was not found")
  end
  #
  ## Run `catalog` to see the contents currently compiling catalog
  ## Run `cd catalog` and `ls` to see catalog methods and instance variables
  ## Run `@resource_table` to see the current catalog resource table
  #
  if $stdout.isatty
    binding.pry # rubocop:disable Lint/Debugger
  else
    Puppet.warning 'pry(): cowardly refusing to start the debugger on a daemonized server'
  end
end