changeset 239:70938f01be8f

added a "--soft" option to the "restart-bridges" command Signed-off-by: Charly COSTE <changaco@changaco.net>
author Charly COSTE <changaco@changaco.net>
date Mon, 08 Mar 2010 11:08:59 +0100
parents a6c37733357a
children ebd67e3e4866
files commands.py
diffstat 1 files changed, 10 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/commands.py
+++ b/commands.py
@@ -257,16 +257,23 @@ def restart_bot(bot, command, args_array
 def restart_bridges(bot, command, args_array, bridge):
 	parser = ArgumentParser(prog=command)
 	parser.add_argument('bridge_id', nargs='+')
+	parser.add_argument('--soft', default=False, action='store_true')
 	try:
 		args = parser.parse_args(args_array)
 	except Exception as e:
 		return '\n'+e.args[1]
 	
 	found_bridges, ret = _find_bridges(bot, args.bridge_id)
-	for found_bridge in found_bridges:
-		found_bridge.restart()
 	
-	return ret+'Bridges restarted.'
+	if args.soft:
+		for found_bridge in found_bridges:
+			found_bridge.soft_restart()
+		return ret+'Bridges softly restarted.'
+	
+	else:
+		for found_bridge in found_bridges:
+			found_bridge.restart()
+		return ret+'Bridges restarted.'
 
 
 def stop_bot(bot, command, args_array, bridge):