From 65e9f6f45c669b186eee004ce1cd676b8dd434ae Mon Sep 17 00:00:00 2001 From: Javier Jardon Date: Mon, 23 Mar 2015 23:14:05 +0000 Subject: simple-network: separate creation of directory and file path Change-Id: Ic715815bbad3ef1ee9ab457b62a194eaef45744c --- morphlib/exts/simple-network.configure | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'morphlib/exts/simple-network.configure') diff --git a/morphlib/exts/simple-network.configure b/morphlib/exts/simple-network.configure index 61113325..42bf1b82 100755 --- a/morphlib/exts/simple-network.configure +++ b/morphlib/exts/simple-network.configure @@ -106,7 +106,10 @@ class SimpleNetworkConfigurationExtension(cliapp.Application): """Generate /etc/network/interfaces file""" iface_file = self.generate_iface_file(stanzas) - with open(os.path.join(args[0], "etc/network/interfaces"), "w") as f: + + directory_path = os.path.join(args[0], "etc", "network") + file_path = os.path.join(directory_path, "interfaces") + with open(file_path, "w") as f: f.write(iface_file) def generate_iface_file(self, stanzas): @@ -147,10 +150,11 @@ class SimpleNetworkConfigurationExtension(cliapp.Application): if iface_file is None: continue - path = os.path.join(args[0], "etc", "systemd", "network", - "%s-%s.network" % (i, stanza['name'])) + directory_path = os.path.join(args[0], "etc", "systemd", "network") + file_path = os.path.join(directory_path, + "%s-%s.network" % (i, stanza['name'])) - with open(path, "w") as f: + with open(file_path, "w") as f: f.write(iface_file) def generate_networkd_file(self, stanza): -- cgit v1.2.1