DataSourceNoCloud: record where seeds were read from
This just records in 'self.seedfrom' each of the locations that seed data was read from.
This commit is contained in:
parent
1a7dccb5f7
commit
57bddd410b
@ -48,14 +48,14 @@ class DataSourceNoCloud(DataSource.DataSource):
|
|||||||
"instance-id" : "nocloud"
|
"instance-id" : "nocloud"
|
||||||
}
|
}
|
||||||
|
|
||||||
found = False
|
found = [ ]
|
||||||
md = { }
|
md = { }
|
||||||
ud = ""
|
ud = ""
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# parse the kernel command line, getting data passed in
|
# parse the kernel command line, getting data passed in
|
||||||
if parse_cmdline_data(self.cmdline_id, md):
|
if parse_cmdline_data(self.cmdline_id, md):
|
||||||
found = True
|
found.append("cmdline")
|
||||||
except:
|
except:
|
||||||
util.logexc(cloudinit.log,util.WARN)
|
util.logexc(cloudinit.log,util.WARN)
|
||||||
return False
|
return False
|
||||||
@ -65,12 +65,12 @@ class DataSourceNoCloud(DataSource.DataSource):
|
|||||||
if util.read_optional_seed(seedret,base=self.seeddir + "/"):
|
if util.read_optional_seed(seedret,base=self.seeddir + "/"):
|
||||||
md = util.mergedict(md,seedret['meta-data'])
|
md = util.mergedict(md,seedret['meta-data'])
|
||||||
ud = seedret['user-data']
|
ud = seedret['user-data']
|
||||||
found = True
|
found.append(self.seeddir)
|
||||||
cloudinit.log.debug("using seeded cache data in %s" % self.seeddir)
|
cloudinit.log.debug("using seeded cache data in %s" % self.seeddir)
|
||||||
|
|
||||||
# there was no indication on kernel cmdline or data
|
# there was no indication on kernel cmdline or data
|
||||||
# in the seeddir suggesting this handler should be used.
|
# in the seeddir suggesting this handler should be used.
|
||||||
if not found:
|
if len(found) == 0:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
# the special argument "seedfrom" indicates we should
|
# the special argument "seedfrom" indicates we should
|
||||||
@ -94,9 +94,10 @@ class DataSourceNoCloud(DataSource.DataSource):
|
|||||||
|
|
||||||
# values in the command line override those from the seed
|
# values in the command line override those from the seed
|
||||||
md = util.mergedict(md,md_seed)
|
md = util.mergedict(md,md_seed)
|
||||||
self.seed = seedfrom
|
found.append(seedfrom)
|
||||||
|
|
||||||
md = util.mergedict(md,defaults)
|
md = util.mergedict(md,defaults)
|
||||||
|
self.seed = ",".join(found)
|
||||||
self.metadata = md;
|
self.metadata = md;
|
||||||
self.userdata_raw = ud
|
self.userdata_raw = ud
|
||||||
return True
|
return True
|
||||||
|
Loading…
x
Reference in New Issue
Block a user