Proposal - Distro specific changes for Kolab 3

Aeneas Jaißle <[email protected]>
Newsgroups gmane.comp.kde.devel.kolab
Organization SeWiKom GmbH
Message-ID <1880469.pSA2VX0ltb__1338.19188126854$1369229848$gmane$org@aen1.ajaissle.de>
Hi everybody,

I'd like to enhance Kolab's distribution support and make live for (us) packagers easier.

For that, I put a layer between paths, service names, user and groups (= between all that could differ on another distribution).

This layer eventually is a settings.py, that
1) Loads default settings
2) Selects and loads (optional) distribution specific settings, overwriting the default settings
3) Loads (optional) custom settings, overwriting default and distribution specific settings

I'd use something similar to the following (as I have to get used to python, there might be some errors):

import platform
from pykolab.settings_default import *

distribution = platform.linux_distribution()
if distribution[0] = 'openSUSE':
   from pykolab.settings_suse import *
elif distribution[0] = 'Fedora':
    from pykolab.settings_fedora import *
elif distribution[0] = 'Mageia':
    from pykolab.settings_mageia import *
elif distribution[0] = 'Debian':
    from pykolab.settings_debian import *
...
else:
    log.error(_("Unknown or unsupported distribution, falling back to default"))

from pykolab.settings_custom import *


Settings are also stored in python files. settings_default.py would have something like
    s_cyrus-imapd = 'cyrus-imapd.service'
    s_kolabd = 'kolabd.service'
    s_postfix = 'postfix.service'
    s_amavisd = 'amavisd.service'
    s_clamd = 'clamd.service'
    s_wallace = 'wallace.service'
    s_mysqld = 'mysqld.service'
    s_httpd = 'httpd.service'
    if service_type = 'systemd':
        bin_systemctl = '/bin/systemctl'

While settings_suse.py only has
    s_httpd = 'apache2.service'
    service_type = 'systemd'

Services would be called 
    def s_restart_httpd:
        subprocess.call([bin_systemctl, s_httpd, 'restart'])

setup_roundcubemail.py:
from pykolab.settings import *
...
s_restart_httpd

pykolab would only load the settings, packagers would adjust everything once inside their settings_dist.py (having everything in one place) and add their distribution to settings.py. They would only have to change settings, if these differ from the defaults. Users could further customize their installation, changing settings in settings_custom.py.


Is something like this wanted upstream? Would this be the rights way to do (in python)? Feedback welcome!

- Aeneas

_______________________________________________
Kolab-devel mailing list
[email protected]
https://www.intevation.de/mailman/listinfo/kolab-devel
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.