Class: PuppetDebugger::InputResponders::Stacktrace

Inherits:
PuppetDebugger::InputResponderPlugin show all
Defined in:
lib/plugins/puppet-debugger/input_responders/stacktrace.rb

Constant Summary collapse

COMMAND_WORDS =
%w[stacktrace].freeze
SUMMARY =
'Show the stacktrace for how we got here'
COMMAND_GROUP =
:tools

Instance Attribute Summary

Attributes inherited from PuppetDebugger::InputResponderPlugin

#debugger

Instance Method Summary collapse

Methods inherited from PuppetDebugger::InputResponderPlugin

command_completion, command_group, command_words, details, execute, #modules_paths, #puppet_debugger_lib_dir, summary

Instance Method Details

#run(_args = []) ⇒ Array

Returns - returns a array of pp files that are involved in the stacktrace.

Returns:

  • (Array)
    • returns a array of pp files that are involved in the stacktrace



12
13
14
15
# File 'lib/plugins/puppet-debugger/input_responders/stacktrace.rb', line 12

def run(_args = [])
  s = stacktrace
  s.empty? ? 'stacktrace not available'.warning : s.ai
end

#stacktraceArray

Returns - an array of files.

Returns:

  • (Array)
    • an array of files



18
19
20
# File 'lib/plugins/puppet-debugger/input_responders/stacktrace.rb', line 18

def stacktrace
  Puppet::Pops::PuppetStack.stacktrace.find_all { |line| !line.include?('unknown') }
end