bin/tl in testlab-0.2.0 vs bin/tl in testlab-0.2.1
- old
+ new
@@ -130,10 +130,36 @@
end
end
end
+desc 'Manage routes'
+command :route do |c|
+
+ c.desc 'Add routes to lab networks'
+ c.command :add do |add|
+ add.action do |global_options,options,args|
+ @testlab.nodes.each do |node|
+ node.route_setup(:add)
+ @testlab.ui.stdout.puts("Added routes successfully!".green.bold)
+ @testlab.ui.stdout.puts %x(netstat -nr | grep '#{node.ip}').strip
+ end
+ end
+ end
+
+ c.desc 'Delete routes to lab networks'
+ c.command :del do |del|
+ del.action do |global_options,options,args|
+ @testlab.nodes.each do |node|
+ node.route_setup(:del)
+ @testlab.ui.stdout.puts("Deleted routes successfully!".red.bold)
+ @testlab.ui.stdout.puts %x(netstat -nr | grep '#{node.ip}').strip
+ end
+ end
+ end
+end
+
pre do |global,command,options,args|
# Pre logic here
# Return true to proceed; false to abort and not call the
# chosen command
# Use skips_pre before a command to skip this block
@@ -157,10 +183,15 @@
end
on_error do |exception|
# Error logic here
# return false to skip default error handling
- puts(["EXCEPTION:".red.bold, exception.inspect.red].join(' '))
+ @ui.stderr.puts(["EXCEPTION:".red.bold, exception.inspect.red].join(' '))
+
+ @logger.fatal { exception.inspect }
+ exception.backtrace.each do |line|
+ @logger.logdev.write("#{line}\n")
+ end
false
end
exit run(ARGV)