Fixed pep8 whining in module services
Added myself to copyright
This commit is contained in:
parent
65b5d67a08
commit
48b3699a0f
@ -5,6 +5,7 @@
|
|||||||
#
|
#
|
||||||
# Copyright 2014, Philip Müller <philm@manjaro.org>
|
# Copyright 2014, Philip Müller <philm@manjaro.org>
|
||||||
# Copyright 2014, Teo Mrnjavac <teo@kde.org>
|
# Copyright 2014, Teo Mrnjavac <teo@kde.org>
|
||||||
|
# Copyright 2017, Alf Gaida <agaida@siduction.org>
|
||||||
#
|
#
|
||||||
# Calamares is free software: you can redistribute it and/or modify
|
# Calamares is free software: you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
@ -23,7 +24,9 @@ import libcalamares
|
|||||||
|
|
||||||
|
|
||||||
def run():
|
def run():
|
||||||
""" Setup systemd services """
|
"""
|
||||||
|
Setup systemd services
|
||||||
|
"""
|
||||||
services = libcalamares.job.configuration['services']
|
services = libcalamares.job.configuration['services']
|
||||||
targets = libcalamares.job.configuration['targets']
|
targets = libcalamares.job.configuration['targets']
|
||||||
disable = libcalamares.job.configuration['disable']
|
disable = libcalamares.job.configuration['disable']
|
||||||
@ -35,37 +38,64 @@ def run():
|
|||||||
|
|
||||||
# enable services
|
# enable services
|
||||||
for svc in 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 ec != 0:
|
||||||
if svc['mandatory']:
|
if svc['mandatory']:
|
||||||
return "Cannot enable systemd service {}".format(svc['name']), \
|
return ("Cannot enable systemd service {}".format(svc['name']),
|
||||||
"systemctl enable call in chroot returned error code {}".format(ec)
|
"systemctl enable call in chroot returned error code "
|
||||||
|
"{}".format(ec)
|
||||||
|
)
|
||||||
else:
|
else:
|
||||||
libcalamares.utils.debug("Cannot enable systemd service {}".format(svc['name']))
|
libcalamares.utils.debug(
|
||||||
libcalamares.utils.debug("systemctl enable call in chroot returned error code {}".format(ec))
|
"Cannot enable systemd service {}".format(svc['name'])
|
||||||
|
)
|
||||||
|
libcalamares.utils.debug(
|
||||||
|
"systemctl enable call in chroot returned error code "
|
||||||
|
"{}".format(ec)
|
||||||
|
)
|
||||||
|
|
||||||
# enable targets
|
# enable targets
|
||||||
for tgt in 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 ec != 0:
|
||||||
if tgt['mandatory']:
|
if tgt['mandatory']:
|
||||||
return "Cannot enable systemd target {}".format(tgt['name']), \
|
return ("Cannot enable systemd target {}".format(tgt['name']),
|
||||||
"systemctl enable call in chroot returned error code {}".format(ec)
|
"systemctl enable call in chroot returned error code"
|
||||||
|
"{}".format(ec)
|
||||||
|
)
|
||||||
else:
|
else:
|
||||||
libcalamares.utils.debug("Cannot enable systemd target {}".format(tgt['name']))
|
libcalamares.utils.debug(
|
||||||
libcalamares.utils.debug("systemctl enable call in chroot returned error code {}".format(ec))
|
"Cannot enable systemd target {}".format(tgt['name'])
|
||||||
|
)
|
||||||
|
libcalamares.utils.debug(
|
||||||
|
"systemctl enable call in chroot returned error code "
|
||||||
|
"{}".format(ec)
|
||||||
|
)
|
||||||
|
|
||||||
for dbl in disable:
|
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 ec != 0:
|
||||||
if dbl['mandatory']:
|
if dbl['mandatory']:
|
||||||
return "Cannot disable systemd service {}".format(dbl['name']), \
|
return ("Cannot disable systemd service"
|
||||||
"systemctl disable call in chroot returned error code {}".format(ec)
|
"{}".format(dbl['name']),
|
||||||
|
"systemctl disable call in chroot returned error code"
|
||||||
|
"{}".format(ec))
|
||||||
else:
|
else:
|
||||||
libcalamares.utils.debug("Cannot disable systemd service {}".format(dbl['name']))
|
libcalamares.utils.debug(
|
||||||
libcalamares.utils.debug("systemctl disable call in chroot returned error code {}".format(ec))
|
"Cannot disable systemd service {}".format(dbl['name'])
|
||||||
|
)
|
||||||
|
libcalamares.utils.debug(
|
||||||
|
"systemctl disable call in chroot returned error code "
|
||||||
|
"{}".format(ec)
|
||||||
|
)
|
||||||
|
|
||||||
return None
|
return None
|
||||||
|
Loading…
Reference in New Issue
Block a user