server/serverconfig.py
changeset 8988 6cd912702239
parent 8708 78a99960286a
child 8989 8742f4bf029f
equal deleted inserted replaced
8986:f094b72d3a6c 8988:6cd912702239
   331         stream = open(sourcesfile, 'w')
   331         stream = open(sourcesfile, 'w')
   332         for section in ('admin', 'system'):
   332         for section in ('admin', 'system'):
   333             sconfig = sourcescfg[section]
   333             sconfig = sourcescfg[section]
   334             if isinstance(sconfig, dict):
   334             if isinstance(sconfig, dict):
   335                 # get a Configuration object
   335                 # get a Configuration object
   336                 assert section == 'system'
   336                 assert section == 'system', '%r is not system' % section
   337                 _sconfig = SourceConfiguration(
   337                 _sconfig = SourceConfiguration(
   338                     self, options=SOURCE_TYPES['native'].options)
   338                     self, options=SOURCE_TYPES['native'].options)
   339                 for attr, val in sconfig.items():
   339                 for attr, val in sconfig.items():
   340                     try:
   340                     try:
   341                         _sconfig.set_option(attr, val)
   341                         _sconfig.set_option(attr, val)
   342                     except lgconfig.OptionError:
   342                     except lgconfig.OptionError:
   343                         # skip adapter, may be present on pre 3.10 instances
   343                         # skip adapter, may be present on pre 3.10 instances
   344                         if attr != 'adapter':
   344                         if attr != 'adapter':
   345                             self.error('skip unknown option %s in sources file')
   345                             self.error('skip unknown option %s in sources file' % attr)
   346                 sconfig = _sconfig
   346                 sconfig = _sconfig
   347             stream.write('[%s]\n%s\n' % (section, generate_source_config(sconfig)))
   347             stream.write('[%s]\n%s\n' % (section, generate_source_config(sconfig)))
   348         restrict_perms_to_user(sourcesfile)
   348         restrict_perms_to_user(sourcesfile)
   349 
   349 
   350     def pyro_enabled(self):
   350     def pyro_enabled(self):