summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPedro Alvarez <pedro.alvarez@codethink.co.uk>2015-03-25 13:34:16 +0000
committerGerrit Code Review <gerrit@baserock.org>2015-03-25 13:34:16 +0000
commit6131882da2514df431585ede061e550011d59b1b (patch)
treeb6857696af2b389bf11a047177fa353f7c2ab7dc
parent0ece4fccf15057312f22b7b55a76d42e04e54c14 (diff)
parent51718ee5c5381a50deb039fd98567bede2279295 (diff)
downloaddefinitions-6131882da2514df431585ede061e550011d59b1b.tar.gz
Merge "simple-network: only try to rename "10-dhcp.network" if it actually exist"
-rwxr-xr-xsimple-network.configure14
1 files changed, 8 insertions, 6 deletions
diff --git a/simple-network.configure b/simple-network.configure
index 130b96c9..1ba94e86 100755
--- a/simple-network.configure
+++ b/simple-network.configure
@@ -81,12 +81,14 @@ class SimpleNetworkConfigurationExtension(cliapp.Application):
"""
file_path = os.path.join(args[0], "etc", "systemd", "network",
"10-dhcp.network")
- try:
- os.rename(file_path, file_path + ".morph")
- self.status(msg="Renaming networkd file from systemd chunk: %(f)s \
- to %(f)s.morph", f=file_path)
- except OSError:
- pass
+
+ if os.path.isfile(file_path):
+ try:
+ os.rename(file_path, file_path + ".morph")
+ self.status(msg="Renaming networkd file from systemd chunk: \
+ %(f)s to %(f)s.morph", f=file_path)
+ except OSError:
+ pass
def generate_default_network_config(self, args):
"""Generate default network config: DHCP in all the interfaces"""