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") ...@@ -63,5 +63,16 @@ generator = CPUParametersGenerator.new("Generated/CPUParameters")
options = WikiGenerator::parse_options options = WikiGenerator::parse_options
if (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 end
...@@ -67,5 +67,16 @@ generator = DiskReservationGenerator.new("Generated/DiskReservation") ...@@ -67,5 +67,16 @@ generator = DiskReservationGenerator.new("Generated/DiskReservation")
options = WikiGenerator::parse_options options = WikiGenerator::parse_options
if (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 end
...@@ -275,10 +275,13 @@ if (options) ...@@ -275,10 +275,13 @@ if (options)
ret = 2 ret = 2
begin begin
ret = WikiGenerator::exec(generator, options) ret = WikiGenerator::exec(generator, options)
rescue MediawikiApi::ApiError => e
puts e, e.backtrace
ret = 3
rescue StandardError => e rescue StandardError => e
puts "Error with node: #{generator.instance_variable_get(:@node)}" puts "Error with node: #{generator.instance_variable_get(:@node)}"
puts e, e.backtrace puts e, e.backtrace
ret = 3 ret = 4
ensure ensure
exit(ret) exit(ret)
end end
......
...@@ -228,6 +228,17 @@ generator = OarPropertiesGenerator.new("Generated/OAR_Properties") ...@@ -228,6 +228,17 @@ generator = OarPropertiesGenerator.new("Generated/OAR_Properties")
options = WikiGenerator::parse_options options = WikiGenerator::parse_options
if (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 end
...@@ -252,11 +252,21 @@ if __FILE__ == $0 ...@@ -252,11 +252,21 @@ if __FILE__ == $0
options = WikiGenerator::parse_options options = WikiGenerator::parse_options
if (options) if (options)
ret = true ret=2
generators = options[:sites].map{ |site| SiteHardwareGenerator.new(site.capitalize + ':Hardware', site) } begin
generators.each{ |generator| ret = true
ret &= WikiGenerator::exec(generator, options) generators = options[:sites].map{ |site| SiteHardwareGenerator.new(site.capitalize + ':Hardware', site) }
} generators.each{ |generator|
exit(ret) 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
end end
...@@ -35,10 +35,20 @@ end ...@@ -35,10 +35,20 @@ end
options = WikiGenerator::parse_options options = WikiGenerator::parse_options
if (options) if (options)
ret = true ret = 2
generators = options[:sites].map{ |site| SiteNetworkGenerator.new('Generated/' + site.capitalize + 'Network', site) } begin
generators.each{ |generator| ret = true
ret &= WikiGenerator::exec(generator, options) generators = options[:sites].map{ |site| SiteNetworkGenerator.new('Generated/' + site.capitalize + 'Network', site) }
} generators.each{ |generator|
exit(ret) 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
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