summaryrefslogtreecommitdiff
path: root/cloudinit/sources/DataSourceNoCloud.py
diff options
context:
space:
mode:
authorVladimir Pouzanov <farcaller@google.com>2017-05-02 16:08:34 +0100
committerScott Moser <smoser@ubuntu.com>2017-06-06 10:18:20 -0600
commit802e7cb2da8e2d0225525160e6edd6b58b275b8c (patch)
tree38e28b5f92ae00f63a8bc13deff7d7627ef6f95c /cloudinit/sources/DataSourceNoCloud.py
parent543e25cda6235d18adb6485e4266944d59e1979d (diff)
downloadvyos-cloud-init-802e7cb2da8e2d0225525160e6edd6b58b275b8c.tar.gz
vyos-cloud-init-802e7cb2da8e2d0225525160e6edd6b58b275b8c.zip
NoCloud: support seed of nocloud from smbios information
This allows the user to seed NoCloud in a trivial way from qemu/libvirt, by using a stock image and passing a single command line flag. No custom command line, no filesystem modification, no bootstrap disk image. This is particularly handy now that Ec2 backend is discouraged from use under bug 1660385. LP: #1691772
Diffstat (limited to 'cloudinit/sources/DataSourceNoCloud.py')
-rw-r--r--cloudinit/sources/DataSourceNoCloud.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/cloudinit/sources/DataSourceNoCloud.py b/cloudinit/sources/DataSourceNoCloud.py
index c68f6b8c..e641244d 100644
--- a/cloudinit/sources/DataSourceNoCloud.py
+++ b/cloudinit/sources/DataSourceNoCloud.py
@@ -43,6 +43,18 @@ class DataSourceNoCloud(sources.DataSource):
'network-config': None}
try:
+ # Parse the system serial label from dmi. If not empty, try parsing
+ # like the commandline
+ md = {}
+ serial = util.read_dmi_data('system-serial-number')
+ if serial and load_cmdline_data(md, serial):
+ found.append("dmi")
+ mydata = _merge_new_seed(mydata, {'meta-data': md})
+ except Exception:
+ util.logexc(LOG, "Unable to parse dmi data")
+ return False
+
+ try:
# Parse the kernel command line, getting data passed in
md = {}
if load_cmdline_data(md):