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.
This commit is contained in:
parent
5f6e0073a9
commit
f4dc46cb05
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user