VirtualMailManager/Config.py
branchv0.6.x
changeset 166 b152ad5c7071
parent 162 0ac9ef587769
child 168 fd496561acc6
equal deleted inserted replaced
165:7e50e4c49ed7 166:b152ad5c7071
    24         filename -- path to the configuration file
    24         filename -- path to the configuration file
    25         """
    25         """
    26         ConfigParser.__init__(self)
    26         ConfigParser.__init__(self)
    27         self.__cfgFileName = filename
    27         self.__cfgFileName = filename
    28         self.__cfgFile = None
    28         self.__cfgFile = None
    29         self.__VMMsections = ['database', 'maildir', 'services', 'domdir',
    29         self.__VMMsections = ('account', 'bin', 'database', 'domain',
    30                 'bin', 'misc', 'config']
    30                               'maildir', 'misc', 'config')
    31         self.__changes = False
    31         self.__changes = False
    32         self.__missing = {}
    32         self.__missing = {}
    33         self.__dbopts = [
    33         self.__dbopts = [
    34                 ['host', 'localhot'],
    34                 ['host', 'localhot'],
    35                 ['user', 'vmm'],
    35                 ['user', 'vmm'],
    37                 ['name', 'mailsys']
    37                 ['name', 'mailsys']
    38                 ]
    38                 ]
    39         self.__mdopts = [
    39         self.__mdopts = [
    40                 ['name', 'Maildir'],
    40                 ['name', 'Maildir'],
    41                 ['folders', 'Drafts:Sent:Templates:Trash'],
    41                 ['folders', 'Drafts:Sent:Templates:Trash'],
    42                 ['mode', 448],
       
    43                 ['diskusage', 'false'],
       
    44                 ['delete', 'false']
       
    45                 ]
    42                 ]
    46         self.__serviceopts = [
    43         self.__accountopts = [
       
    44                 ['delete_directory', 'false'],
       
    45                 ['directory_mode', 448],
       
    46                 ['disk_usage', 'false'],
       
    47                 ['password_len', 8],
       
    48                 ['random_password', 'false'],
    47                 ['smtp', 'true'],
    49                 ['smtp', 'true'],
    48                 ['pop3', 'true'],
    50                 ['pop3', 'true'],
    49                 ['imap', 'true'],
    51                 ['imap', 'true'],
    50                 ['sieve', 'true']
    52                 ['sieve', 'true']
    51                 ]
    53                 ]
    52         self.__domdopts = [
    54         self.__domdopts = [
    53                 ['base', '/srv/mail'],
    55                 ['auto_postmaster', 'true'],
    54                 ['mode', 504],
    56                 ['delete_directory', 'false'],
    55                 ['delete', 'false']
    57                 ['directory_mode', 504],
       
    58                 ['force_del', 'false'],
    56                 ]
    59                 ]
    57         self.__binopts = [
    60         self.__binopts = [
    58                 ['dovecotpw', '/usr/sbin/dovecotpw'],
    61                 ['dovecotpw', '/usr/sbin/dovecotpw'],
    59                 ['du', '/usr/bin/du'],
    62                 ['du', '/usr/bin/du'],
    60                 ['postconf', '/usr/sbin/postconf']
    63                 ['postconf', '/usr/sbin/postconf']
    61                 ]
    64                 ]
    62         self.__miscopts = [
    65         self.__miscopts = [
    63                 ['passwdscheme', 'PLAIN'],
    66                 ['base_dir', '/srv/mail'],
       
    67                 ['dovecot_vers', '11'],
    64                 ['gid_mail', 8],
    68                 ['gid_mail', 8],
    65                 ['forcedel', 'false'],
    69                 ['password_scheme', 'PLAIN'],
    66                 ['transport', 'dovecot:'],
    70                 ['transport', 'dovecot:'],
    67                 ['dovecotvers', '11']
       
    68                 ]
    71                 ]
    69 
    72 
    70     def load(self):
    73     def load(self):
    71         """Loads the configuration, read only.
    74         """Loads the configuration, read only.
    72 
    75 
   165         missing = []
   168         missing = []
   166         if section == 'database':
   169         if section == 'database':
   167             opts = self.__dbopts
   170             opts = self.__dbopts
   168         elif section == 'maildir':
   171         elif section == 'maildir':
   169             opts = self.__mdopts
   172             opts = self.__mdopts
   170         elif section == 'services':
   173         elif section == 'account':
   171             opts = self.__serviceopts
   174             opts = self.__accountopts
   172         elif section == 'domdir':
   175         elif section == 'domain':
   173             opts = self.__domdopts
   176             opts = self.__domdopts
   174         elif section == 'bin':
   177         elif section == 'bin':
   175             opts = self.__binopts
   178             opts = self.__binopts
   176         elif section == 'misc':
   179         elif section == 'misc':
   177             opts = self.__miscopts
   180             opts = self.__miscopts