Merge pull request #737 from siduction/pep8-networkcfg

Fixed pep8 whining in module networkcfg
This commit is contained in:
adriaandegroot 2017-06-05 12:25:37 -06:00 committed by GitHub
commit af303c9961

View File

@ -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
@ -26,11 +27,15 @@ import libcalamares
def run(): def run():
""" Setup network configuration """ """
Setup network configuration
"""
root_mount_point = libcalamares.globalstorage.value("rootMountPoint") root_mount_point = libcalamares.globalstorage.value("rootMountPoint")
source_nm = "/etc/NetworkManager/system-connections/" source_nm = "/etc/NetworkManager/system-connections/"
target_nm = os.path.join(root_mount_point, "etc/NetworkManager/system-connections/") target_nm = os.path.join(
root_mount_point, "etc/NetworkManager/system-connections/"
)
# Sanity checks. We don't want to do anything if a network # Sanity checks. We don't want to do anything if a network
# configuration already exists on the target # configuration already exists on the target
@ -49,7 +54,10 @@ def run():
try: try:
shutil.copy(source_network, target_network) shutil.copy(source_network, target_network)
except FileNotFoundError: except FileNotFoundError:
libcalamares.utils.debug("Can't copy network configuration files in {}".format(source_network)) libcalamares.utils.debug(
"Can't copy network configuration files in "
+ "{}".format(source_network)
)
except FileExistsError: except FileExistsError:
pass pass
@ -60,11 +68,15 @@ def run():
try: try:
os.remove(target_resolv) os.remove(target_resolv)
except Exception as err: except Exception as err:
libcalamares.utils.debug("Couldn't remove {}: {}".format(target_resolv, err)) libcalamares.utils.debug(
"Couldn't remove {}: {}".format(target_resolv, err)
)
try: try:
shutil.copy(source_resolv, target_resolv) shutil.copy(source_resolv, target_resolv)
except Exception as err: except Exception as err:
libcalamares.utils.debug("Can't copy resolv.conf from {}: {}".format(source_resolv, err)) libcalamares.utils.debug(
"Can't copy resolv.conf from {}: {}".format(source_resolv, err)
)
return None return None