summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorNeil Williams <codehelp@debian.org>2015-09-13 16:20:55 +0100
committerNeil Williams <codehelp@debian.org>2015-09-13 16:20:55 +0100
commit2d2b836cfd79136f2e26155225d69b5c49d24c4b (patch)
treee42da69ee6d9449c8b2829cee324fd008a68cdaf /bin
parentd3d393bce9a2142826d4645c1e16ee9c4e475841 (diff)
downloadvmdebootstrap-2d2b836cfd79136f2e26155225d69b5c49d24c4b.tar.gz
Simplify the networking checks
Diffstat (limited to 'bin')
-rwxr-xr-xbin/vmdebootstrap17
1 files changed, 9 insertions, 8 deletions
diff --git a/bin/vmdebootstrap b/bin/vmdebootstrap
index 0aecd6f..231472f 100755
--- a/bin/vmdebootstrap
+++ b/bin/vmdebootstrap
@@ -504,19 +504,20 @@ class VmDebootstrap(cliapp.Application): # pylint: disable=too-many-public-meth
base = self.handlers[Base.name]
base.message('Setting up networking')
distro = self.handlers[Codenames.name]
+ ifc_file = os.path.join(rootdir, 'etc', 'network', 'interfaces')
ifc_d = os.path.join(rootdir, 'etc', 'network', 'interfaces.d')
- if not os.path.exists(ifc_d):
- os.mkdir(ifc_d)
- # unconditionally write for wheezy (which became oldstable on 04/25/2015)
+
+ # unconditionally write for wheezy (which became oldstable on 2015.04.25)
if distro.was_oldstable(datetime.date(2015, 4, 26)):
- with open(os.path.join(rootdir, 'etc', 'network', 'interfaces'), 'w') as netfile:
+ with open(ifc_file, 'w') as netfile:
netfile.write('source /etc/network/interfaces.d/*\n')
-
- elif not os.path.exists(os.path.join(rootdir, 'etc', 'network', 'interfaces')):
- iface_path = os.path.join(rootdir, 'etc', 'network', 'interfaces')
+ elif not os.path.exists(ifc_file):
with open(iface_path, 'w') as netfile:
netfile.write('source-directory /etc/network/interfaces.d\n')
- ethpath = os.path.join(rootdir, 'etc', 'network', 'interfaces.d', 'setup')
+
+ if not os.path.exists(ifc_d):
+ os.mkdir(ifc_d)
+ ethpath = os.path.join(ifc_d, 'setup')
with open(ethpath, 'w') as eth:
eth.write('auto lo\n')
eth.write('iface lo inet loopback\n')