18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
# File 'lib/redhat_access/sos_reports/generator.rb', line 18
def self.create_report case_num
command = SOS_COMMAND
unless case_num.nil?
unless is_valid_case_number case_num raise ArgumentError.new "case number must be an integer"
else
command = command + " --ticket-number=#{case_num}"
end
end
begin
Open3.popen3(command) do |stdin, stdout, stderr, wait_thr|
report_location = ''
if wait_thr.value == 0
stdout.readlines.each do |line|
if line.include? "tar.xz"
report_location = line break
end
end
else
end
sos_file_name = report_location.strip
puts "SOS file created : " + sos_file_name
sos_file_name
end
rescue => exception
Rails.logger.error("Error Creating SOS report: #{$!}")
raise exception
end
end
|