From 6208fe41e4e73d1f14fd4afc152565c8908684a2 Mon Sep 17 00:00:00 2001 From: Joshua Harlow Date: Wed, 19 Sep 2012 18:40:20 -0700 Subject: Fix the ifup so that if a list of devices is provided then each interface is brought up individually instead of using the '--all' which isn't on rhel. The default debian behavior will be to use this still though as it overrides the new bring up interfaces function for this case. --- cloudinit/distros/debian.py | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'cloudinit/distros/debian.py') diff --git a/cloudinit/distros/debian.py b/cloudinit/distros/debian.py index 5b4aa9f8..777c8530 100644 --- a/cloudinit/distros/debian.py +++ b/cloudinit/distros/debian.py @@ -56,6 +56,12 @@ class Distro(distros.Distro): def _write_network(self, settings): net_fn = self._paths.join(False, "/etc/network/interfaces") util.write_file(net_fn, settings) + return [] + + def _bring_up_interfaces(self, device_names): + if not device_names: + device_names = ['--all'] + return distros.Distro._bring_up_interfaces(self, device_names) def set_hostname(self, hostname): out_fn = self._paths.join(False, "/etc/hostname") -- cgit v1.2.3 From e055c795581c2846aa6ae128de8cfd0b2c5d3f32 Mon Sep 17 00:00:00 2001 From: Joshua Harlow Date: Thu, 20 Sep 2012 15:55:52 -0700 Subject: Instead of special casing the empty list we are going to check for the 'all' entry and if that exists then only fire off one call (since debian supports this). --- cloudinit/distros/debian.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'cloudinit/distros/debian.py') diff --git a/cloudinit/distros/debian.py b/cloudinit/distros/debian.py index 777c8530..88f4e978 100644 --- a/cloudinit/distros/debian.py +++ b/cloudinit/distros/debian.py @@ -56,12 +56,17 @@ class Distro(distros.Distro): def _write_network(self, settings): net_fn = self._paths.join(False, "/etc/network/interfaces") util.write_file(net_fn, settings) - return [] + return ['all'] def _bring_up_interfaces(self, device_names): - if not device_names: - device_names = ['--all'] - return distros.Distro._bring_up_interfaces(self, device_names) + use_all = False + for d in device_names: + if d == 'all': + use_all = True + if use_all: + return distros.Distro._bring_up_interface(self, '--all') + else: + return distros.Distro._bring_up_interfaces(self, device_names) def set_hostname(self, hostname): out_fn = self._paths.join(False, "/etc/hostname") -- cgit v1.2.3