Commit 9ed0d1a4 authored by Florent Didier's avatar Florent Didier

[dev] wiki_generator.rb: add different exit codes when exception occurs

parent 6d4d139d
......@@ -63,5 +63,16 @@ generator = CPUParametersGenerator.new("Generated/CPUParameters")
options = WikiGenerator::parse_options
if (options)
exit(WikiGenerator::exec(generator, options))
ret = 2
begin
ret = WikiGenerator::exec(generator, options)
rescue MediawikiApi::ApiError => e
puts e, e.backtrace
ret = 3
rescue StandardError => e
puts e, e.backtrace
ret = 4
ensure
exit(ret)
end
end
......@@ -67,5 +67,16 @@ generator = DiskReservationGenerator.new("Generated/DiskReservation")
options = WikiGenerator::parse_options
if (options)
exit(WikiGenerator::exec(generator, options))
ret = 2
begin
ret = WikiGenerator::exec(generator, options)
rescue MediawikiApi::ApiError => e
puts e, e.backtrace
ret = 3
rescue StandardError => e
puts e, e.backtrace
ret = 4
ensure
exit(ret)
end
end
......@@ -275,10 +275,13 @@ if (options)
ret = 2
begin
ret = WikiGenerator::exec(generator, options)
rescue MediawikiApi::ApiError => e
puts e, e.backtrace
ret = 3
rescue StandardError => e
puts "Error with node: #{generator.instance_variable_get(:@node)}"
puts e, e.backtrace
ret = 3
ret = 4
ensure
exit(ret)
end
......
......@@ -228,6 +228,17 @@ generator = OarPropertiesGenerator.new("Generated/OAR_Properties")
options = WikiGenerator::parse_options
if (options)
exit(WikiGenerator::exec(generator, options))
ret = 2
begin
ret = WikiGenerator::exec(generator, options)
rescue MediawikiApi::ApiError => e
puts e, e.backtrace
ret = 3
rescue StandardError => e
puts e, e.backtrace
ret = 4
ensure
exit(ret)
end
end
......@@ -252,11 +252,21 @@ if __FILE__ == $0
options = WikiGenerator::parse_options
if (options)
ret=2
begin
ret = true
generators = options[:sites].map{ |site| SiteHardwareGenerator.new(site.capitalize + ':Hardware', site) }
generators.each{ |generator|
ret &= WikiGenerator::exec(generator, options)
}
rescue MediawikiApi::ApiError => e
puts e, e.backtrace
ret = 3
rescue StandardError => e
puts e, e.backtrace
ret = 4
ensure
exit(ret)
end
end
end
......@@ -35,10 +35,20 @@ end
options = WikiGenerator::parse_options
if (options)
ret = 2
begin
ret = true
generators = options[:sites].map{ |site| SiteNetworkGenerator.new('Generated/' + site.capitalize + 'Network', site) }
generators.each{ |generator|
ret &= WikiGenerator::exec(generator, options)
}
rescue MediawikiApi::ApiError => e
puts e, e.backtrace
ret = 3
rescue StandardError => e
puts e, e.backtrace
ret = 4
ensure
exit(ret)
end
end
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment