[migration] do not crash if the conf file is already migrated (closes #2361061)
authorAurelien Campeas <aurelien.campeas@logilab.fr>
Wed, 16 May 2012 09:57:57 +0200
changeset 8410 eb6a607a0067
parent 8409 79534887943e
child 8411 9ac2400cdf82
[migration] do not crash if the conf file is already migrated (closes #2361061)
misc/migration/3.15.0_common.py
--- a/misc/migration/3.15.0_common.py	Tue May 15 14:44:45 2012 +0200
+++ b/misc/migration/3.15.0_common.py	Wed May 16 09:57:57 2012 +0200
@@ -1,2 +1,7 @@
-undo_actions = config.cfgfile_parser.get('MAIN', 'undo-support', False)
-config.global_set_option('undo-enabled', bool(undo_actions))
+import ConfigParser
+try:
+    undo_actions = config.cfgfile_parser.get('MAIN', 'undo-support', False)
+except ConfigParser.NoOptionError:
+    pass # this conf. file was probably already migrated
+else:
+    config.global_set_option('undo-enabled', bool(undo_actions))