summaryrefslogtreecommitdiffstats
path: root/pykolab
diff options
context:
space:
mode:
authorJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2012-10-05 15:51:46 +0100
committerJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2012-10-05 15:52:44 +0100
commitd211a6e58afe537d9d4b8fbcd3d8c82ce54a39f0 (patch)
tree88260fbaf28b2053b7621503842bb7f2ca944804 /pykolab
parentb92d2972edcd5ec3325c91aec8a0b197e3e3403d (diff)
downloadpykolab-d211a6e58afe537d9d4b8fbcd3d8c82ce54a39f0.tar.gz
Skip Amavis configuration if no file /etc/amavisd/amavisd.conf exists
Diffstat (limited to 'pykolab')
-rw-r--r--pykolab/setup/setup_mta.py47
1 files changed, 28 insertions, 19 deletions
diff --git a/pykolab/setup/setup_mta.py b/pykolab/setup/setup_mta.py
index f9202d3..e6a019c 100644
--- a/pykolab/setup/setup_mta.py
+++ b/pykolab/setup/setup_mta.py
@@ -266,26 +266,35 @@ result_attribute = mail
template_file = None
- if os.path.isfile('/etc/kolab/templates/amavisd.conf.tpl'):
- template_file = '/etc/kolab/templates/amavisd.conf.tpl'
- elif os.path.isfile('/usr/share/kolab/templates/amavisd.conf.tpl'):
- template_file = '/usr/share/kolab/templates/amavisd.conf.tpl'
- elif os.path.isfile(os.path.abspath(os.path.join(__file__, '..', '..', '..', 'share', 'templates', 'amavisd.conf.tpl'))):
- template_file = os.path.abspath(os.path.join(__file__, '..', '..', '..', 'share', 'templates', 'amavisd.conf.tpl'))
-
- if not template_file == None:
- fp = open(template_file, 'r')
- template_definition = fp.read()
- fp.close()
-
- t = Template(template_definition, searchList=[amavisd_settings])
- fp = open('/etc/amavisd/amavisd.conf', 'w')
- fp.write(t.__str__())
- fp.close()
-
+ # On RPM installations, Amavis configuration is contained within a single file.
+ if os.path.isfile("/etc/amavsid/amavisd.conf"):
+ if os.path.isfile('/etc/kolab/templates/amavisd.conf.tpl'):
+ template_file = '/etc/kolab/templates/amavisd.conf.tpl'
+ elif os.path.isfile('/usr/share/kolab/templates/amavisd.conf.tpl'):
+ template_file = '/usr/share/kolab/templates/amavisd.conf.tpl'
+ elif os.path.isfile(os.path.abspath(os.path.join(__file__, '..', '..', '..', 'share', 'templates', 'amavisd.conf.tpl'))):
+ template_file = os.path.abspath(os.path.join(__file__, '..', '..', '..', 'share', 'templates', 'amavisd.conf.tpl'))
+
+ if not template_file == None:
+ fp = open(template_file, 'r')
+ template_definition = fp.read()
+ fp.close()
+
+ t = Template(template_definition, searchList=[amavisd_settings])
+ fp = open('/etc/amavisd/amavisd.conf', 'w')
+ fp.write(t.__str__())
+ fp.close()
+
+ else:
+ log.error(_("Could not write out Amavis configuration file /etc/amavisd/amavisd.conf"))
+ return
+
+ # On APT installations, /etc/amavis/conf.d/ is a directory with many more files.
+ #
+ # Somebody could work on enhancement request #1080 to configure LDAP lookups,
+ # while really it isn't required.
else:
- log.error(_("Could not write out Amavis configuration file /etc/amavisd/amavisd.conf"))
- return
+ log.info(_("Not writing out any configuration for Amavis."))
if os.path.isfile('/bin/systemctl'):
subprocess.call(['systemctl', 'restart', 'postfix.service'])