Changeset 8b1769 in indico


Ignore:
Timestamp:
02/18/10 15:21:06 (3 years ago)
Author:
Pedro Ferreira <jose.pedro.ferreira@…>
Branches:
master, burotel, hello-world-walkthrough, ipv6, new-webex, prov-dual-interface, v0.97-series, v0.98-series, v0.98.2, v0.98.3, v0.98b1, v0.98b2, v0.99, 051b2622c51afb171a1dedb46a0df4fbb0cbd02e, 43311dd25516d54f5852ee459948998035e08952
Children:
24a4db
Parents:
91d2ae
Message:

[FIX] setup.py - merging config files

  • solved problem with dictionaries;
  • fixes #202;
File:
1 edited

Legend:

Unmodified
Added
Removed
  • indico/MaKaC/consoleScripts/installBase.py

    r9def33 r8b1769  
    9191    new_values.update(mixinValues) 
    9292 
     93 
    9394    # We have to preserve options not currently present in the bundled indico.conf because they 
    9495    # may belong to a plugin. This functionality can lead to forget adding new options to 
     
    103104    # We update a current copy of indico.conf with the new values 
    104105    new_contents = open(new_conf).read() 
     106 
    105107    for k in new_values: 
    106108        if new_values[k].__class__ == str: 
     
    125127 
    126128        elif new_values[k].__class__ == dict: 
    127             regexp = re.compile('^(%s[ ]*=[ ]*)[\{]{1}([^\}]+)[\}]{1}' % k, re.MULTILINE) 
     129            regexp = re.compile('^(%s[ ]*=[ ]*)[\{](.+)[\}$]' % k, re.MULTILINE) 
    128130            if regexp.search(new_contents): 
    129131                new_contents = re.sub(regexp, "\\g<1>%s" % str(result_values[k]), new_contents) 
     
    141143 
    142144    # We write unknown options to the end of the file, they may not be just outdated options but plugins' 
     145 
    143146    open(existing_conf, 'w').write(new_contents) 
    144147 
     
    485488        del targetDirs['db'] 
    486489 
     490    print "Creating directories for resources... ", 
    487491    # Create the directories where the resources will be installed 
    488492    createDirs(targetDirs) 
     493    print "done!" 
    489494 
    490495    # target configuration file (may exist or not) 
    491496    newConf = os.path.join(targetDirs['etc'],'indico.conf') 
    492497    # source configuration file (package) 
    493     sourceConf = os.path.join(sourceDirs['etc'], 'indico.conf') 
     498    sourceConf = os.path.join(sourceDirs['etc'], 'indico.conf.sample') 
    494499 
    495500    # if there is a source config 
     
    499504            shutil.copy(sourceConf, newConf) 
    500505        else: 
     506            print "Upgrading indico.conf...", 
    501507            # upgrade the existing one 
    502             upgrade_indico_conf(sourceConf, newConf) 
     508            upgrade_indico_conf(newConf, sourceConf) 
     509            print "done!" 
    503510 
    504511    # change MaKaCConfig.py to include the config 
Note: See TracChangeset for help on using the changeset viewer.