vmm.cfg: a few re-renamed configuration options. v0.6.x
authorPascal Volk <neverseen@users.sourceforge.net>
Thu, 14 Jan 2010 06:18:34 +0000
branchv0.6.x
changeset 168 fd496561acc6
parent 167 bb58aedefa3a
child 169 a72908248153
vmm.cfg: a few re-renamed configuration options. old new -------------------------------------------------- account.password_len -> account.password_length domain.force_del -> domain.force_deletion misc.base_dir -> misc.base_directory misc.dovecot_vers -> misc.dovecot_version
VirtualMailManager/Config.py
VirtualMailManager/VirtualMailManager.py
update_config.py
vmm
vmm.cfg
--- a/VirtualMailManager/Config.py	Wed Jan 13 00:55:50 2010 +0000
+++ b/VirtualMailManager/Config.py	Thu Jan 14 06:18:34 2010 +0000
@@ -44,7 +44,7 @@
                 ['delete_directory', 'false'],
                 ['directory_mode', 448],
                 ['disk_usage', 'false'],
-                ['password_len', 8],
+                ['password_length', 8],
                 ['random_password', 'false'],
                 ['smtp', 'true'],
                 ['pop3', 'true'],
@@ -55,7 +55,7 @@
                 ['auto_postmaster', 'true'],
                 ['delete_directory', 'false'],
                 ['directory_mode', 504],
-                ['force_del', 'false'],
+                ['force_deletion', 'false'],
                 ]
         self.__binopts = [
                 ['dovecotpw', '/usr/sbin/dovecotpw'],
@@ -63,8 +63,8 @@
                 ['postconf', '/usr/sbin/postconf']
                 ]
         self.__miscopts = [
-                ['base_dir', '/srv/mail'],
-                ['dovecot_vers', '11'],
+                ['base_directory', '/srv/mail'],
+                ['dovecot_version', '11'],
                 ['gid_mail', 8],
                 ['password_scheme', 'PLAIN'],
                 ['transport', 'dovecot:'],
--- a/VirtualMailManager/VirtualMailManager.py	Wed Jan 13 00:55:50 2010 +0000
+++ b/VirtualMailManager/VirtualMailManager.py	Thu Jan 14 06:18:34 2010 +0000
@@ -83,16 +83,16 @@
 
     def __chkenv(self):
         """"""
-        if not os.path.exists(self.__Cfg.get('misc', 'base_dir')):
+        basedir = self.__Cfg.get('misc', 'base_directory')
+        if not os.path.exists(basedir):
             old_umask = os.umask(0006)
-            os.makedirs(self.__Cfg.get('misc', 'base_dir'), 0771)
-            os.chown(self.__Cfg.get('misc', 'base_dir'), 0,
-                    self.__Cfg.getint('misc', 'gid_mail'))
+            os.makedirs(basedir, 0771)
+            os.chown(basedir, 0, self.__Cfg.getint('misc', 'gid_mail'))
             os.umask(old_umask)
-        elif not os.path.isdir(self.__Cfg.get('misc', 'base_dir')):
+        elif not os.path.isdir(basedir):
             raise VMMException(_(u'“%s” is not a directory.\n\
-(vmm.cfg: section "misc", option "base_dir")') %
-                self.__Cfg.get('misc', 'base_dir'), ERR.NO_SUCH_DIRECTORY)
+(vmm.cfg: section "misc", option "base_directory")') %
+                                 basedir, ERR.NO_SUCH_DIRECTORY)
         for opt, val in self.__Cfg.items('bin'):
             if not os.path.exists(val):
                 raise VMMException(_(u'“%(binary)s” doesn\'t exist.\n\
@@ -237,7 +237,7 @@
             transport = self.__Cfg.get('misc', 'transport')
         self.__dbConnect()
         return Domain(self.__dbh, domainname,
-                self.__Cfg.get('misc', 'base_dir'), transport)
+                self.__Cfg.get('misc', 'base_directory'), transport)
 
     def __getDiskUsage(self, directory):
         """Estimate file space usage for the given directory.
@@ -270,7 +270,7 @@
     def __domDirMake(self, domdir, gid):
         os.umask(0006)
         oldpwd = os.getcwd()
-        basedir = self.__Cfg.get('misc', 'base_dir')
+        basedir = self.__Cfg.get('misc', 'base_directory')
         domdirdirs = domdir.replace(basedir+'/', '').split('/')
 
         os.chdir(basedir)
@@ -348,7 +348,7 @@
         if gid > 0:
             if not self.__isdir(domdir):
                 return
-            basedir = self.__Cfg.get('misc', 'base_dir')
+            basedir = self.__Cfg.get('misc', 'base_directory')
             domdirdirs = domdir.replace(basedir+'/', '').split('/')
             domdirparent = os.path.join(basedir, domdirdirs[0])
             if basedir.count('..') or domdir.count('..'):
@@ -487,7 +487,8 @@
         dom = self.__getDomain(domainname)
         gid = dom.getID()
         domdir = dom.getDir()
-        if self.__Cfg.getboolean('domain', 'force_del') or force == 'delall':
+        if self.__Cfg.getboolean('domain', 'force_deletion')\
+        or force == 'delall':
             dom.delete(True, True)
         elif force == 'deluser':
             dom.delete(delUser=True)
@@ -589,7 +590,7 @@
             password = self._readpass()
             acc.setPassword(self.__pwhash(password))
         acc.save(self.__Cfg.get('maildir', 'name'),
-                self.__Cfg.getint('misc', 'dovecot_vers'),
+                self.__Cfg.getint('misc', 'dovecot_version'),
                 self.__Cfg.getboolean('account', 'smtp'),
                 self.__Cfg.getboolean('account', 'pop3'),
                 self.__Cfg.getboolean('account', 'imap'),
@@ -643,7 +644,7 @@
             raise VMMException(_(u'Invalid argument: “%s”') % details,
                     ERR.INVALID_AGUMENT)
         acc = self.__getAccount(emailaddress)
-        info = acc.getInfo(self.__Cfg.getint('misc', 'dovecot_vers'))
+        info = acc.getInfo(self.__Cfg.getint('misc', 'dovecot_version'))
         if self.__Cfg.getboolean('account', 'disk_usage')\
         or details in ['du', 'full']:
             info['disk usage'] = self.__getDiskUsage('%(maildir)s' % info)
@@ -682,7 +683,7 @@
    in a future release.\n\
    Please use the service name “sieve” instead.'))
         acc = self.__getAccount(emailaddress)
-        acc.disable(self.__Cfg.getint('misc', 'dovecot_vers'), service)
+        acc.disable(self.__Cfg.getint('misc', 'dovecot_version'), service)
 
     def userEnable(self, emailaddress, service=None):
         if service == 'managesieve':
@@ -692,7 +693,7 @@
    in a future release.\n\
    Please use the service name “sieve” instead.'))
         acc = self.__getAccount(emailaddress)
-        acc.enable(self.__Cfg.getint('misc', 'dovecot_vers'), service)
+        acc.enable(self.__Cfg.getint('misc', 'dovecot_version'), service)
 
     def relocatedAdd(self, emailaddress, targetaddress):
         relocated = self.__getRelocated(emailaddress, targetaddress)
--- a/update_config.py	Wed Jan 13 00:55:50 2010 +0000
+++ b/update_config.py	Thu Jan 14 06:18:34 2010 +0000
@@ -76,7 +76,7 @@
     if cp.has_section('domdir'):
         for src, dst in (('domdir.mode',   'domain.directory_mode'),
                          ('domdir.delete', 'domain.delete_directory'),
-                         ('domdir.base',   'misc.base_dir')):
+                         ('domdir.base',   'misc.base_directory')):
             move_option(cp, src, dst)
         cp.remove_section('domdir')
     if cp.has_section('services'):
@@ -86,12 +86,12 @@
     for src, dst in (('maildir.mode',      'account.directory_mode'),
                      ('maildir.diskusage', 'account.disk_usage'),
                      ('maildir.delete',    'account.delete_directory'),
-                     ('misc.forcedel',     'domain.force_del'),
+                     ('misc.forcedel',     'domain.force_deletion'),
                      ('misc.passwdscheme', 'misc.password_scheme'),
-                     ('misc.dovecotvers',  'misc.dovecot_vers')):
+                     ('misc.dovecotvers',  'misc.dovecot_version')):
         move_option(cp, src, dst)
     for dst, val in (('account.random_password', 'false'),
-                     ('account.password_len',    '8'),
+                     ('account.password_length', '8'),
                      ('domain.auto_postmaster',  'true')):
         add_option(cp, dst, val)
 
--- a/vmm	Wed Jan 13 00:55:50 2010 +0000
+++ b/vmm	Thu Jan 14 06:18:34 2010 +0000
@@ -77,7 +77,7 @@
 
 def _getOrder():
     order = ()
-    if vmm.cfgGetInt('misc', 'dovecot_vers') > 11:
+    if vmm.cfgGetInt('misc', 'dovecot_version') > 11:
         sieve_name = u'sieve'
     else:
         sieve_name = u'managesieve'
--- a/vmm.cfg	Wed Jan 13 00:55:50 2010 +0000
+++ b/vmm.cfg	Thu Jan 14 06:18:34 2010 +0000
@@ -38,7 +38,7 @@
 ; octal 0770 -> decimal 504
 directory_mode = 504
 ; Force deletion of accounts and aliases when deleting a domain (Boolean)
-force_del = false
+force_deletion = false
 
 #
 # Account settings
@@ -55,7 +55,7 @@
 ; useradd subcommand? (Boolean)
 random_password = false
 ; How many characters to include in the generated passwords? (Int)
-password_len = 8
+password_length = 8
 ; Allow smtp by default? (Boolean)
 smtp = true
 ; Allow pop3 by default? (Boolean)
@@ -81,7 +81,7 @@
 #
 [misc]
 ; The base directory for all domains/accounts (String)
-base_dir = /srv/mail
+base_directory = /srv/mail
 ; Password scheme to use (see also: dovecotpw -l) (String)
 password_scheme = PLAIN
 ; numeric group ID of group mail (mail_privileged_group from dovecot.conf) (Int)
@@ -90,7 +90,7 @@
 transport = dovecot:
 ; the concatenated major and minor version number from `dovecot --version` (Int)
 ; e.g. 1.0.15 -> 10; 1.1.18 -> 11; 1.2.3 -> 12
-dovecot_vers = 11
+dovecot_version = 11
 
 #
 # Configuration state