summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2016-02-23 14:25:41 +0100
committerJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2016-03-02 15:27:23 +0100
commit8c25f0ca377068dd53833df017ec37432d78f204 (patch)
tree29a2f34b360483c4096dc8d3990428dbf9929856
parentc4b8e2b09a566aed14a21b861daf362c5d55586f (diff)
downloadpykolab-8c25f0ca377068dd53833df017ec37432d78f204.tar.gz
Fix the systemd unit file for clamd@.service if needed
Summary: Resolves T997 Test Plan: # Install a Kolab server on CentOS 7 # Set up Kolab # Expect a running instance of the clamd@amavisd service Reviewers: #pykolab_developers, vanmeeuwen Reviewed By: #pykolab_developers, vanmeeuwen Maniphest Tasks: T997 Differential Revision: https://git.kolab.org/D86
-rw-r--r--pykolab/setup/setup_mta.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/pykolab/setup/setup_mta.py b/pykolab/setup/setup_mta.py
index f2883a7..d7f070c 100644
--- a/pykolab/setup/setup_mta.py
+++ b/pykolab/setup/setup_mta.py
@@ -442,6 +442,20 @@ result_format = "shared+%%s"
myaugeas.save()
myaugeas.close()
+ if os.path.isfile('/usr/lib/systemd/system/clamd@.service'):
+ from ConfigParser import SafeConfigParser
+ unitfile = SafeConfigParser()
+ unitfile.optionxform = str
+ unitfile.read('/usr/lib/systemd/system/clamd@.service')
+ if not unitfile.has_section('Install'):
+ unitfile.add_section('Install')
+
+ if not unitfile.has_option('Install', 'WantedBy'):
+ unitfile.set('Install', 'WantedBy', 'multi-user.target')
+
+ with open('/etc/systemd/system/clamd@.service', 'wb') as f:
+ unitfile.write(f)
+
amavisservice = 'amavisd.service'
clamavservice = 'clamd@amavisd.service'
if os.path.isfile('/usr/lib/systemd/system/amavis.service'):