summaryrefslogtreecommitdiffstats
path: root/pykolab
diff options
context:
space:
mode:
authorJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2012-11-13 12:24:45 +0000
committerJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2012-11-13 12:24:45 +0000
commit9aca9a2600b5185797008340ba8f8aae6caf183b (patch)
treea805cea383107714b0d67d5da4f5ff37352a6ac9 /pykolab
parent2da271bbddb4bcae94c2ddf1ab1686bba7847020 (diff)
downloadpykolab-9aca9a2600b5185797008340ba8f8aae6caf183b.tar.gz
Fix indentation
Diffstat (limited to 'pykolab')
-rw-r--r--pykolab/setup/setup_imap.py18
-rw-r--r--pykolab/setup/setup_kolabd.py2
-rw-r--r--pykolab/setup/setup_ldap.py17
-rw-r--r--pykolab/setup/setup_mta.py42
-rw-r--r--pykolab/setup/setup_mysql.py2
-rw-r--r--pykolab/setup/setup_roundcube.py18
-rw-r--r--pykolab/setup/setup_syncroton.py2
-rw-r--r--pykolab/setup/setup_zpush.py2
8 files changed, 58 insertions, 45 deletions
diff --git a/pykolab/setup/setup_imap.py b/pykolab/setup/setup_imap.py
index bd33a5b..d5fe6c9 100644
--- a/pykolab/setup/setup_imap.py
+++ b/pykolab/setup/setup_imap.py
@@ -131,12 +131,14 @@ def execute(*args, **kw):
fp.close()
if os.path.isfile('/etc/default/kolab-saslauthd'):
- myaugeas = Augeas()
- setting = os.path.join('/files/etc/default/kolab-saslauthd','START')
- if not myaugeas.get(setting) == 'yes':
- myaugeas.set(setting,'yes')
- myaugeas.save()
- myaugeas.close()
+ myaugeas = Augeas()
+ setting = os.path.join('/files/etc/default/kolab-saslauthd','START')
+
+ if not myaugeas.get(setting) == 'yes':
+ myaugeas.set(setting,'yes')
+ myaugeas.save()
+
+ myaugeas.close()
if os.path.isfile('/bin/systemctl'):
subprocess.call(['systemctl', 'restart', 'cyrus-imapd.service'])
@@ -145,8 +147,8 @@ def execute(*args, **kw):
subprocess.call(['service', 'cyrus-imapd', 'restart'])
subprocess.call(['service', 'kolab-saslauthd', 'restart'])
elif os.path.isfile('/usr/sbin/service'):
- subprocess.call(['/usr/sbin/service','cyrus-imapd','restart'])
- subprocess.call(['/usr/sbin/service','kolab-saslauthd','restart'])
+ subprocess.call(['/usr/sbin/service','cyrus-imapd','restart'])
+ subprocess.call(['/usr/sbin/service','kolab-saslauthd','restart'])
else:
log.error(_("Could not start the cyrus-imapd and kolab-saslauthd services."))
diff --git a/pykolab/setup/setup_kolabd.py b/pykolab/setup/setup_kolabd.py
index df05043..47d1cae 100644
--- a/pykolab/setup/setup_kolabd.py
+++ b/pykolab/setup/setup_kolabd.py
@@ -67,7 +67,7 @@ def execute(*args, **kw):
elif os.path.isfile('/sbin/service'):
subprocess.call(['/sbin/service', 'kolabd', 'restart'])
elif os.path.isfile('/usr/sbin/service'):
- subprocess.call(['/usr/sbin/service','kolab-server','restart'])
+ subprocess.call(['/usr/sbin/service','kolab-server','restart'])
else:
log.error(_("Could not start the kolab server service."))
diff --git a/pykolab/setup/setup_ldap.py b/pykolab/setup/setup_ldap.py
index b3136dc..430bfae 100644
--- a/pykolab/setup/setup_ldap.py
+++ b/pykolab/setup/setup_ldap.py
@@ -237,13 +237,14 @@ ServerAdminPwd = %(admin_pass)s
os.close(fp)
if os.path.isfile("/usr/sbin/setup-ds-admin.pl"):
- setup_ds_admin = "/usr/sbin/setup-ds-admin.pl"
-# elif os.path.isfile("/usr/sbin/setup-ds-admin"):
-# setup_ds_admin = "/usr/sbin/setup-ds-admin"
+ setup_ds_admin = "/usr/sbin/setup-ds-admin.pl"
+ #elif os.path.isfile("/usr/sbin/setup-ds-admin"):
+ #setup_ds_admin = "/usr/sbin/setup-ds-admin"
elif os.path.isfile("/usr/sbin/setup-ds"):
- setup_ds_admin = "/usr/sbin/setup-ds"
+ setup_ds_admin = "/usr/sbin/setup-ds"
else:
- log.error(_("No directory server setup tool available."))
+ log.error(_("No directory server setup tool available."))
+ sys.exit(1)
command = [
setup_ds_admin,
@@ -306,9 +307,9 @@ ServerAdminPwd = %(admin_pass)s
elif os.path.isfile('/sbin/service'):
subprocess.call(['/sbin/service', 'dirsrv', 'restart'])
elif os.path.isfile('/usr/sbin/service'):
- subprocess.call(['/usr/sbin/service','dirsrv','stop'])
- time.sleep(20)
- subprocess.call(['/usr/sbin/service','dirsrv','start'])
+ subprocess.call(['/usr/sbin/service','dirsrv','stop'])
+ time.sleep(20)
+ subprocess.call(['/usr/sbin/service','dirsrv','start'])
else:
log.error(_("Could not start the directory server service."))
diff --git a/pykolab/setup/setup_mta.py b/pykolab/setup/setup_mta.py
index b841621..058abb3 100644
--- a/pykolab/setup/setup_mta.py
+++ b/pykolab/setup/setup_mta.py
@@ -210,11 +210,11 @@ result_attribute = mail
}
if not os.path.isfile('/etc/postfix/main.cf'):
- if os.path.isfile('/usr/share/postfix/main.cf.debian'):
- shutil.copy(
- '/usr/share/postfix/main.cf.debian',
- '/etc/postfix/main.cf'
- )
+ if os.path.isfile('/usr/share/postfix/main.cf.debian'):
+ shutil.copy(
+ '/usr/share/postfix/main.cf.debian',
+ '/etc/postfix/main.cf'
+ )
myaugeas = Augeas()
@@ -289,10 +289,11 @@ result_attribute = mail
fp.close()
t = Template(template_definition, searchList=[amavisd_settings])
+
if os.path.isdir('/etc/amavisd'):
- fp = open('/etc/amavisd/amavisd.conf', 'w')
- elif os.path.isdir('/etc/amavis'):
- fp = open('/etc/amavis/amavisd.conf', 'w')
+ fp = open('/etc/amavisd/amavisd.conf', 'w')
+ elif os.path.isdir('/etc/amavis'):
+ fp = open('/etc/amavis/amavisd.conf', 'w')
fp.write(t.__str__())
fp.close()
@@ -306,19 +307,20 @@ result_attribute = mail
# while really it isn't required.
else:
log.info(_("Not writing out any configuration for Amavis."))
+
# On debian wheezy amavisd-new expects '/etc/mailname' - possibly remediable through
# the #1080 enhancement mentioned above, but here's a quick fix.
f = open('/etc/mailname','w')
- f.writelines(conf.get('kolab', 'primary_domain'))
- f.close()
+ f.writelines(conf.get('kolab', 'primary_domain'))
+ f.close()
if os.path.isfile('/etc/default/spamassassin'):
- myaugeas = Augeas()
- setting = os.path.join('/files/etc/default/spamassassin','ENABLED')
- if not myaugeas.get(setting) == '1':
- myaugeas.set(setting,'1')
- myaugeas.save()
- myaugeas.close()
+ myaugeas = Augeas()
+ setting = os.path.join('/files/etc/default/spamassassin','ENABLED')
+ if not myaugeas.get(setting) == '1':
+ myaugeas.set(setting,'1')
+ myaugeas.save()
+ myaugeas.close()
if os.path.isfile('/bin/systemctl'):
subprocess.call(['systemctl', 'restart', 'postfix.service'])
@@ -331,10 +333,10 @@ result_attribute = mail
subprocess.call(['service', 'clamd.amavisd', 'restart'])
subprocess.call(['service', 'wallace', 'restart'])
elif os.path.isfile('/usr/sbin/service'):
- subprocess.call(['/usr/sbin/service','postfix','restart'])
- subprocess.call(['/usr/sbin/service','amavis','restart'])
- subprocess.call(['/usr/sbin/service','clamav-daemon','restart'])
- subprocess.call(['/usr/sbin/service','wallace','restart'])
+ subprocess.call(['/usr/sbin/service','postfix','restart'])
+ subprocess.call(['/usr/sbin/service','amavis','restart'])
+ subprocess.call(['/usr/sbin/service','clamav-daemon','restart'])
+ subprocess.call(['/usr/sbin/service','wallace','restart'])
else:
log.error(_("Could not start the postfix, clamav and amavisd services services."))
diff --git a/pykolab/setup/setup_mysql.py b/pykolab/setup/setup_mysql.py
index 9c73047..c956eeb 100644
--- a/pykolab/setup/setup_mysql.py
+++ b/pykolab/setup/setup_mysql.py
@@ -44,7 +44,7 @@ def execute(*args, **kw):
elif os.path.isfile('/sbin/service'):
subprocess.call(['/sbin/service', 'mysqld', 'restart'])
elif os.path.isfile('/usr/sbin/service'):
- subprocess.call(['/usr/sbin/service','mysql','restart'])
+ subprocess.call(['/usr/sbin/service','mysql','restart'])
else:
log.error(_("Could not start the MySQL database service."))
diff --git a/pykolab/setup/setup_roundcube.py b/pykolab/setup/setup_roundcube.py
index e242e04..f3ab1b9 100644
--- a/pykolab/setup/setup_roundcube.py
+++ b/pykolab/setup/setup_roundcube.py
@@ -122,10 +122,14 @@ def execute(*args, **kw):
_("Successfully compiled template %r, writing out to %r") % (template_file, want_file),
level=8
)
+
+ fp = None
if os.path.isdir('/etc/roundcubemail'):
- fp = open('/etc/roundcubemail/%s' % (want_file), 'w')
+ fp = open('/etc/roundcubemail/%s' % (want_file), 'w')
elif os.path.isdir('/etc/roundcube'):
- fp = open('/etc/roundcube/%s' % (want_file), 'w')
+ fp = open('/etc/roundcube/%s' % (want_file), 'w')
+
+ if not fp == None:
fp.write(t.__str__())
fp.close()
@@ -143,9 +147,13 @@ def execute(*args, **kw):
schema_files.append(schema_filepath)
if os.path.isdir('/usr/share/roundcubemail'):
- rcpath = '/usr/share/roundcubemail/'
+ rcpath = '/usr/share/roundcubemail/'
elif os.path.isdir('/usr/share/roundcube'):
- rcpath = '/usr/share/roundcube/'
+ rcpath = '/usr/share/roundcube/'
+ else:
+ log.error(_("Roundcube installation path not found."))
+ return
+
for root, directories, filenames in os.walk(rcpath + 'plugins/calendar/drivers/kolab/'):
for filename in filenames:
if filename.startswith('mysql') and filename.endswith('.sql'):
@@ -188,7 +196,7 @@ def execute(*args, **kw):
elif os.path.isfile('/sbin/service'):
subprocess.call(['/sbin/service', 'httpd', 'restart'])
elif os.path.isfile('/usr/sbin/service'):
- subprocess.call(['/usr/sbin/service','apache2','restart'])
+ subprocess.call(['/usr/sbin/service','apache2','restart'])
else:
log.error(_("Could not start the webserver server service."))
diff --git a/pykolab/setup/setup_syncroton.py b/pykolab/setup/setup_syncroton.py
index 46d5190..c14682e 100644
--- a/pykolab/setup/setup_syncroton.py
+++ b/pykolab/setup/setup_syncroton.py
@@ -61,7 +61,7 @@ def execute(*args, **kw):
elif os.path.isfile('/sbin/service'):
subprocess.call(['/sbin/service', 'httpd', 'restart'])
elif os.path.isfile('/usr/sbin/service'):
- subprocess.call(['/usr/sbin/service','apache2','restart'])
+ subprocess.call(['/usr/sbin/service','apache2','restart'])
else:
log.error(_("Could not start the webserver server service."))
diff --git a/pykolab/setup/setup_zpush.py b/pykolab/setup/setup_zpush.py
index b1ba921..4c84d3a 100644
--- a/pykolab/setup/setup_zpush.py
+++ b/pykolab/setup/setup_zpush.py
@@ -93,7 +93,7 @@ def execute(*args, **kw):
elif os.path.isfile('/sbin/service'):
subprocess.call(['/sbin/service', 'httpd', 'restart'])
elif os.path.isfile('/usr/sbin/service'):
- subprocess.call(['/usr/sbin/service','apache2','restart'])
+ subprocess.call(['/usr/sbin/service','apache2','restart'])
else:
log.error(_("Could not start the webserver server service."))