summaryrefslogtreecommitdiff
path: root/pykolab
diff options
context:
space:
mode:
authorJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2012-05-03 14:01:57 (GMT)
committerJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2012-05-03 14:01:57 (GMT)
commitd9375d2be9348831f588b6cf8c074a6e43a592df (patch)
tree262ddac094b65b44b5ce9b11b2e961e50d64ffb4 /pykolab
parentc34d64f3b56353c2c46ffccbf423a40627fe4f3c (diff)
downloadpykolab-d9375d2be9348831f588b6cf8c074a6e43a592df.tar.gz
Add deploying master.cf
Diffstat (limited to 'pykolab')
-rw-r--r--pykolab/setup/setup_mta.py26
1 files changed, 26 insertions, 0 deletions
diff --git a/pykolab/setup/setup_mta.py b/pykolab/setup/setup_mta.py
index b3d5175..10f97f1 100644
--- a/pykolab/setup/setup_mta.py
+++ b/pykolab/setup/setup_mta.py
@@ -221,5 +221,31 @@ result_attribute = mail
myaugeas.save()
+ postfix_master_settings = {
+ }
+
+ template_file = None
+
+ if os.path.isfile('/etc/kolab/templates/master.cf.tpl'):
+ template_file = '/etc/kolab/templates/master.cf.tpl'
+ elif os.path.isfile('/usr/share/kolab/templates/master.cf.tpl'):
+ template_file = '/usr/share/kolab/templates/master.cf.tpl'
+ elif os.path.isfile(os.path.abspath(os.path.join(__file__, '..', '..', '..', 'share', 'templates', 'master.cf.tpl'))):
+ template_file = os.path.abspath(os.path.join(__file__, '..', '..', '..', 'share', 'templates', 'master.cf.tpl'))
+
+ if not template_file == None:
+ fp = open(template_file, 'r')
+ template_definition = fp.read()
+ fp.close()
+
+ t = Template(template_definition, searchList=[imapd_settings])
+ fp = open('/etc/postfix/master.cf', 'w')
+ fp.write(t.__str__())
+ fp.close()
+
+ else:
+ log.error(_("Could not write out Postfix configuration file /etc/postfix/master.cf"))
+ return
+
subprocess.call(['service', 'postfix', 'restart'])