Which Class called my Class?

I have a script that queries servers in our environment to assist with
patch-levels etc… I am having an issue and need to backtrace which
class called my class.

What I currently have
print “\nCollectData Failed 2: in needDate != yes & package == none
#{hostName}\n”

What I would like to have
print “\nCollectData Failed 2: in needDate != yes & package == none
#{hostName}, called from #{callingClass}\n”

collectdata.rb:class CollectData
collectdata.rb: print “\nCollectData
Failed 1: in package != none and needDate == no #{hostName}\n”
collectdata.rb: print “\nCollectData
Failed 2: in needDate != yes & package == none #{hostName}\n”
collectdata.rb: print “\nCollectData
Failed 3: in needDate == yes #{hostName}\n”
collectdata.rb: print “\nCollectData
Failed: #{hostName}\n”
rpmlist.rb: rpmInfo =
CollectData.new(hostName)
rpmmysql.rb: rpmInfo2 =
CollectData.new(hostName,package.signature)

This message is private and confidential. If you have received it in
error, please notify the sender and remove it from your system.

Zach B. wrote:

I have a script that queries servers in our environment to assist with
patch-levels etc… I am having an issue and need to backtrace which
class called my class.

What I currently have
print “\nCollectData Failed 2: in needDate != yes & package == none
#{hostName}\n”

What I would like to have
print “\nCollectData Failed 2: in needDate != yes & package == none
#{hostName}, called from #{callingClass}\n”

If I understand correctly what you want, try using the command +caller+
to get what you want. It returns an array with current stack trace.

TPR.