From 979bee2c9ee477ea495c5df4f420d5ca2123a840 Mon Sep 17 00:00:00 2001 From: Scott Moser Date: Fri, 17 Feb 2012 11:00:39 -0500 Subject: DataSourceConfigDrive: update interfaces (and ifup) only on local Previously, the 'ifup --all' and update of /etc/network/interfaces was done only if the specified 'dsmode' (which defaults to 'pass') was either 'pass' or *this* dsmode. That meant that it would be updated once on DataSourceConfigDrive and on DataSourceConfigDriveNet. This changes that to only happen on local. --- cloudinit/DataSourceConfigDrive.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/cloudinit/DataSourceConfigDrive.py b/cloudinit/DataSourceConfigDrive.py index af776e08..f44344a2 100644 --- a/cloudinit/DataSourceConfigDrive.py +++ b/cloudinit/DataSourceConfigDrive.py @@ -72,13 +72,16 @@ class DataSourceConfigDrive(DataSource.DataSource): md = util.mergedict(md, defaults) - if 'interfaces' in md and md['dsmode'] in (self.dsmode, "pass"): + # update interfaces and ifup only on the local datasource + # this way the DataSourceConfigDriveNet doesn't do it also. + if 'network-interfaces' in md and self.dsmode == "local": if md['dsmode'] == "pass": log.info("updating network interfaces from configdrive") else: log.debug("updating network interfaces from configdrive") - util.write_file("/etc/network/interfaces", md['network-interfaces']) + util.write_file("/etc/network/interfaces", + md['network-interfaces']) try: (out, err) = util.subp(['ifup', '--all']) if len(out) or len(err): -- cgit v1.2.3