diff options
author | Javier Jardon <jjardon@gnome.org> | 2015-03-23 23:27:11 +0000 |
---|---|---|
committer | Javier Jardón <jjardon@gnome.org> | 2015-03-24 00:10:26 +0000 |
commit | bb3fa0e026b1bab96b4bbbcb1920efcf5f995f37 (patch) | |
tree | b6857696af2b389bf11a047177fa353f7c2ab7dc | |
parent | 500943a125a1b21c08adcc400a86569693aebfa4 (diff) | |
download | definitions-bb3fa0e026b1bab96b4bbbcb1920efcf5f995f37.tar.gz |
simple-network: only try to rename "10-dhcp.network" if it actually exist
Change-Id: I1521c0bdec4d7a6812f8988a2349e66b08161de8
-rwxr-xr-x | simple-network.configure | 14 |
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""" |