diff --git a/src/modules/services/main.py b/src/modules/services/main.py index e195faff4..03d82554a 100644 --- a/src/modules/services/main.py +++ b/src/modules/services/main.py @@ -5,6 +5,7 @@ # # Copyright 2014, Philip Müller # Copyright 2014, Teo Mrnjavac +# Copyright 2017, Alf Gaida # # Calamares is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -23,7 +24,9 @@ import libcalamares def run(): - """ Setup systemd services """ + """ + Setup systemd services + """ services = libcalamares.job.configuration['services'] targets = libcalamares.job.configuration['targets'] disable = libcalamares.job.configuration['disable'] @@ -35,37 +38,64 @@ def run(): # enable services for svc in services: - ec = libcalamares.utils.target_env_call(['systemctl', 'enable', '{}.service'.format(svc['name'])]) + ec = libcalamares.utils.target_env_call( + ['systemctl', 'enable', '{}.service'.format(svc['name'])] + ) if ec != 0: if svc['mandatory']: - return "Cannot enable systemd service {}".format(svc['name']), \ - "systemctl enable call in chroot returned error code {}".format(ec) + return ("Cannot enable systemd service {}".format(svc['name']), + "systemctl enable call in chroot returned error code " + "{}".format(ec) + ) else: - libcalamares.utils.debug("Cannot enable systemd service {}".format(svc['name'])) - libcalamares.utils.debug("systemctl enable call in chroot returned error code {}".format(ec)) + libcalamares.utils.debug( + "Cannot enable systemd service {}".format(svc['name']) + ) + libcalamares.utils.debug( + "systemctl enable call in chroot returned error code " + "{}".format(ec) + ) # enable targets for tgt in targets: - ec = libcalamares.utils.target_env_call(['systemctl', 'enable', '{}.target'.format(tgt['name'])]) + ec = libcalamares.utils.target_env_call( + ['systemctl', 'enable', '{}.target'.format(tgt['name'])] + ) if ec != 0: if tgt['mandatory']: - return "Cannot enable systemd target {}".format(tgt['name']), \ - "systemctl enable call in chroot returned error code {}".format(ec) + return ("Cannot enable systemd target {}".format(tgt['name']), + "systemctl enable call in chroot returned error code" + "{}".format(ec) + ) else: - libcalamares.utils.debug("Cannot enable systemd target {}".format(tgt['name'])) - libcalamares.utils.debug("systemctl enable call in chroot returned error code {}".format(ec)) + libcalamares.utils.debug( + "Cannot enable systemd target {}".format(tgt['name']) + ) + libcalamares.utils.debug( + "systemctl enable call in chroot returned error code " + "{}".format(ec) + ) for dbl in disable: - ec = libcalamares.utils.target_env_call(['systemctl', 'disable', '{}.service'.format(dbl['name'])]) + ec = libcalamares.utils.target_env_call( + ['systemctl', 'disable', '{}.service'.format(dbl['name'])] + ) if ec != 0: if dbl['mandatory']: - return "Cannot disable systemd service {}".format(dbl['name']), \ - "systemctl disable call in chroot returned error code {}".format(ec) + return ("Cannot disable systemd service" + "{}".format(dbl['name']), + "systemctl disable call in chroot returned error code" + "{}".format(ec)) else: - libcalamares.utils.debug("Cannot disable systemd service {}".format(dbl['name'])) - libcalamares.utils.debug("systemctl disable call in chroot returned error code {}".format(ec)) + libcalamares.utils.debug( + "Cannot disable systemd service {}".format(dbl['name']) + ) + libcalamares.utils.debug( + "systemctl disable call in chroot returned error code " + "{}".format(ec) + ) return None