403Webshell
Server IP : 104.21.14.103  /  Your IP : 18.188.254.131
Web Server : LiteSpeed
System : Linux business53.web-hosting.com 4.18.0-553.lve.el8.x86_64 #1 SMP Mon May 27 15:27:34 UTC 2024 x86_64
User : giankuin ( 1871)
PHP Version : 7.4.33
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/pops/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/pops//puppet_stack.rb
require_relative '../../puppet/thread_local'

module Puppet
  module Pops
    # Utility class for keeping track of the "Puppet stack", ie the file
    # and line numbers of Puppet Code that created the current context.
    #
    # To use this make a call with:
    #
    # ```rb
    # Puppet::Pops::PuppetStack.stack(file, line, receiver, message, args)
    # ```
    #
    # To get the stack call:
    #
    # ```rb
    # Puppet::Pops::PuppetStack.stacktrace
    # ```
    #
    # or
    #
    # ```rb
    # Puppet::Pops::PuppetStack.top_of_stack
    # ```
    #
    # To support testing, a given file that is an empty string, or nil
    # as well as a nil line number are supported. Such stack frames
    # will be represented with the text `unknown` and `0ยด respectively.
    module PuppetStack
      @stack = Puppet::ThreadLocal.new { Array.new }

      def self.stack(file, line, obj, message, args, &block)
        file = 'unknown' if (file.nil? || file == '')
        line = 0 if line.nil?

        result = nil
        @stack.value.unshift([file, line])
        begin
          if block_given?
            result = obj.send(message, *args, &block)
          else
            result = obj.send(message, *args)
          end
        ensure
          @stack.value.shift()
        end
        result
      end

      def self.stacktrace
        @stack.value.dup
      end

      # Returns an Array with the top of the puppet stack, or an empty
      # Array if there was no such entry.
      def self.top_of_stack
        @stack.value.first || []
      end
    end
  end
end

Youez - 2016 - github.com/yon3zu
LinuXploit