[c-c reset-admin-pwd] don't crash on unknown option, and silently ignore 'adapter' which may be present in pre 3.10 sources file stable
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Thu, 04 Nov 2010 10:58:29 +0100
branchstable
changeset 6670 e22bd5eb6ffd
parent 6669 e4532c6acf34
child 6671 c34fa947df07
[c-c reset-admin-pwd] don't crash on unknown option, and silently ignore 'adapter' which may be present in pre 3.10 sources file
server/serverconfig.py
--- a/server/serverconfig.py	Wed Nov 03 10:12:16 2010 +0100
+++ b/server/serverconfig.py	Thu Nov 04 10:58:29 2010 +0100
@@ -297,7 +297,12 @@
                 _sconfig = SourceConfiguration(
                     self, options=SOURCE_TYPES['native'].options)
                 for attr, val in sconfig.items():
-                    _sconfig.set_option(attr, val)
+                    try:
+                        _sconfig.set_option(attr, val)
+                    except lgconfig.OptionError:
+                        # skip adapter, may be present on pre 3.10 instances
+                        if attr != 'adapter':
+                            self.error('skip unknown option %s in sources file')
                 sconfig = _sconfig
             print >> stream, '[%s]' % section
             print >> stream, generate_source_config(sconfig)