server/serverctl.py
changeset 10077 1a28c0b0a0b4
parent 10010 3dd66bdbfe8e
child 10123 c390c444de06
--- a/server/serverctl.py	Thu Mar 20 10:41:22 2014 +0100
+++ b/server/serverctl.py	Wed Mar 26 14:45:33 2014 +0100
@@ -1105,9 +1105,14 @@
 
 db_options = (
     ('db',
-     {'short': 'd', 'type' : 'named', 'metavar' : 'key1:value1,key2:value2',
+     {'short': 'd', 'type' : 'named', 'metavar' : '[section1.]key1:value1,[section2.]key2:value2',
       'default': None,
-      'help': 'set <key> to <value> in "source" configuration file.',
+      'help': '''set <key> in <section> to <value> in "source" configuration file. If <section> is not specified, it defaults to "system".
+
+Beware that changing admin.login or admin.password using this command
+will NOT update the database with new admin credentials.  Use the
+reset-admin-pwd command instead.
+''',
       }),
     )
 
@@ -1121,10 +1126,14 @@
         appcfg = ServerConfiguration.config_for(appid)
         srccfg = appcfg.read_sources_file()
         for key, value in self.config.db.iteritems():
+            if '.' in key:
+                section, key = key.split('.', 1)
+            else:
+                section = 'system'
             try:
-                srccfg['system'][key] = value
+                srccfg[section][key] = value
             except KeyError:
-                raise ConfigurationError('unknown configuration key "%s" for source' % key)
+                raise ConfigurationError('unknown configuration key "%s" in section "%s" for source' % (key, section))
         admcfg = Configuration(options=USER_OPTIONS)
         admcfg['login'] = srccfg['admin']['login']
         admcfg['password'] = srccfg['admin']['password']