update_config.py
branchv0.6.x
changeset 436 d296a020f440
parent 366 d6573da35b5f
child 459 033a0436894f
equal deleted inserted replaced
435:ee6f8ac06197 436:d296a020f440
     8 from time import time
     8 from time import time
     9 from ConfigParser import ConfigParser
     9 from ConfigParser import ConfigParser
    10 from shutil import copy2
    10 from shutil import copy2
    11 from VirtualMailManager.constants.VERSION import VERSION
    11 from VirtualMailManager.constants.VERSION import VERSION
    12 
    12 
       
    13 try:
       
    14     import psycopg2
       
    15 except ImportError:
       
    16     has_psycopg2 = False
       
    17 else:
       
    18     has_psycopg2 = True
    13 
    19 
    14 def get_config_file():
    20 def get_config_file():
    15     f = None
    21     f = None
    16     for d in ('/root', '/usr/local/etc', '/etc'):
    22     for d in ('/root', '/usr/local/etc', '/etc'):
    17         tmp = os.path.join(d, 'vmm.cfg')
    23         tmp = os.path.join(d, 'vmm.cfg')
   108                      ('misc.forcedel',     'domain.force_deletion'),
   114                      ('misc.forcedel',     'domain.force_deletion'),
   109                      ('misc.passwdscheme', 'misc.password_scheme'),
   115                      ('misc.passwdscheme', 'misc.password_scheme'),
   110                      ('misc.dovecotvers',  'misc.dovecot_version')):
   116                      ('misc.dovecotvers',  'misc.dovecot_version')):
   111         move_option(cp, src, dst)
   117         move_option(cp, src, dst)
   112     cp.remove_section('maildir')
   118     cp.remove_section('maildir')
   113     add_option(cp, 'database.module', 'pyPgSQL')
   119     if not has_psycopg2:
       
   120         add_option(cp, 'database.module', 'pyPgSQL')
   114     set_dovecot_version(cp)
   121     set_dovecot_version(cp)
   115 
   122 
   116 
   123 
   117 # def main():
   124 # def main():
   118 if __name__ == '__main__':
   125 if __name__ == '__main__':