71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
|
# File 'lib/onapp/engine/utils/diagnostics.rb', line 71
def self.run
require 'onapp/engine/utils/em'
Daemon::Utils::EM.run
Daemon::Logger.logger = Daemon::Logger.new($stdout)
available_commands = [
SupervisorCommandsDiagnostics,
DebugSupervisors,
DebugRegistry
]
loop do
puts "Available commands:\n#{available_commands.each_with_index.map { |cmd, i| "#{i}) #{cmd}" }.join("\n")}"
n = ask("Enter cmd")
if n.nil?
die("EOF! Exiting...")
else
n = n.to_i
end
if available_commands[n]
begin
available_commands[n].run
rescue => ex
puts "Exception!\n#{ex.class}: #{ex.message}\n#{ex.backtrace.join("\n")}"
end
else
puts "Unknown command #{n.inspect}"
end
end
end
|