summaryrefslogtreecommitdiff
path: root/cloudinit/sources/DataSourceEc2.py
diff options
context:
space:
mode:
authorScott Moser <smoser@brickies.net>2017-07-17 13:48:19 -0400
committerScott Moser <smoser@brickies.net>2017-07-25 14:12:57 -0400
commitebdbf30c0274f078f7a66f6dc9efc8a22a220757 (patch)
treedb61042b66ff3c6ee0e701e7010a3199ec63f248 /cloudinit/sources/DataSourceEc2.py
parent0ef61b289472665f4e3059a24a8b9b91246f06ee (diff)
downloadvyos-cloud-init-ebdbf30c0274f078f7a66f6dc9efc8a22a220757.tar.gz
vyos-cloud-init-ebdbf30c0274f078f7a66f6dc9efc8a22a220757.zip
tests: Add initial tests for EC2 and improve a docstring.
EC2 was the original, but this adds some initial tests for that datasource. Also updates a docstring for an internal method.
Diffstat (limited to 'cloudinit/sources/DataSourceEc2.py')
-rw-r--r--cloudinit/sources/DataSourceEc2.py14
1 files changed, 10 insertions, 4 deletions
diff --git a/cloudinit/sources/DataSourceEc2.py b/cloudinit/sources/DataSourceEc2.py
index 9e2fdc0a..4ec9592f 100644
--- a/cloudinit/sources/DataSourceEc2.py
+++ b/cloudinit/sources/DataSourceEc2.py
@@ -316,10 +316,16 @@ def identify_platform():
def _collect_platform_data():
- # returns a dictionary with all lower case values:
- # uuid: system-uuid from dmi or /sys/hypervisor
- # uuid_source: 'hypervisor' (/sys/hypervisor/uuid) or 'dmi'
- # serial: dmi 'system-serial-number' (/sys/.../product_serial)
+ """Returns a dictionary of platform info from dmi or /sys/hypervisor.
+
+ Keys in the dictionary are as follows:
+ uuid: system-uuid from dmi or /sys/hypervisor
+ uuid_source: 'hypervisor' (/sys/hypervisor/uuid) or 'dmi'
+ serial: dmi 'system-serial-number' (/sys/.../product_serial)
+
+ On Ec2 instances experimentation is that product_serial is upper case,
+ and product_uuid is lower case. This returns lower case values for both.
+ """
data = {}
try:
uuid = util.load_file("/sys/hypervisor/uuid").strip()