From f7eba5ca8aaaccd6b88f40c5c6f30715bd185069 Mon Sep 17 00:00:00 2001 From: Scott Moser Date: Tue, 28 Feb 2012 18:48:58 -0500 Subject: DataSourceNoCloud: fix local cloud sources other than from devices The purely local non-device (vfat/iso9660) sources were broken by the last set of changes here. This restores them to functional. If the seed is from a device, then the default behavior is to be 'net' mode. For seed via cmdline, the user can specify 'ds=nocloud-net' and for seed via filesystem seed dir, they can just populate the other directory. To make it easier, when attaching a seed device, the user does not need to specify 'dsmode' of 'net' in the metadata file. They still can, but that is the default. It seems that that is more likely to be what is desired. LP: #942695 --- cloudinit/DataSourceNoCloud.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'cloudinit/DataSourceNoCloud.py') diff --git a/cloudinit/DataSourceNoCloud.py b/cloudinit/DataSourceNoCloud.py index 1e28edbd..62ecc088 100644 --- a/cloudinit/DataSourceNoCloud.py +++ b/cloudinit/DataSourceNoCloud.py @@ -44,7 +44,7 @@ class DataSourceNoCloud(DataSource.DataSource): def get_data(self): defaults = { - "instance-id": "nocloud", "dsmode": "net" + "instance-id": "nocloud", "dsmode": self.dsmode } found = [] @@ -80,6 +80,14 @@ class DataSourceNoCloud(DataSource.DataSource): util.read_seeded) md = util.mergedict(newmd, md) ud = newud + + # for seed from a device, the default mode is 'net'. + # that is more likely to be what is desired. + # If they want dsmode of local, then they must + # specify that. + if 'dsmode' not in md: + md['dsmode'] = "net" + log.debug("using data from %s" % dev) found.append(dev) break -- cgit v1.2.3