# HG changeset patch # User David Douard # Date 1395841533 -3600 # Node ID 1a28c0b0a0b4ea9d19f0ad79792d870cc4c0cdeb # Parent 136b5f995f8e3ded71dc053e485d1ec45851522f [c-c configure] make it possible to specify the section for sources configuration (closes #3477678) diff -r 136b5f995f8e -r 1a28c0b0a0b4 server/serverctl.py --- 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 to in "source" configuration file.', + 'help': '''set in
to in "source" configuration file. If
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']