summaryrefslogtreecommitdiff
path: root/cloudinit/DataSourceNoCloud.py
diff options
context:
space:
mode:
authorScott Moser <smoser@ubuntu.com>2012-02-28 18:48:58 -0500
committerScott Moser <smoser@ubuntu.com>2012-02-28 18:48:58 -0500
commitf7eba5ca8aaaccd6b88f40c5c6f30715bd185069 (patch)
treed262f4b1aaef4ab3457f3faec4e7c4eac21eff5b /cloudinit/DataSourceNoCloud.py
parentdd628f06f9661ae3b9a72a95d744dfbb5244c173 (diff)
downloadvyos-cloud-init-f7eba5ca8aaaccd6b88f40c5c6f30715bd185069.tar.gz
vyos-cloud-init-f7eba5ca8aaaccd6b88f40c5c6f30715bd185069.zip
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
Diffstat (limited to 'cloudinit/DataSourceNoCloud.py')
-rw-r--r--cloudinit/DataSourceNoCloud.py10
1 files changed, 9 insertions, 1 deletions
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