diff options
author | Ben Howard <ben.howard@canonical.com> | 2015-01-14 12:24:09 -0700 |
---|---|---|
committer | Ben Howard <ben.howard@canonical.com> | 2015-01-14 12:24:09 -0700 |
commit | 28c8aa7270a04adea69065477b13cfc0dd244acc (patch) | |
tree | 76f2535102b42f25995e25a5829ede283510cf03 /cloudinit/sources/DataSourceSmartOS.py | |
parent | 62e9e73e3ed8467fc4d4d95f76ed0443c50f176c (diff) | |
download | vyos-cloud-init-28c8aa7270a04adea69065477b13cfc0dd244acc.tar.gz vyos-cloud-init-28c8aa7270a04adea69065477b13cfc0dd244acc.zip |
Drop reliance on dmidecode executable.
Diffstat (limited to 'cloudinit/sources/DataSourceSmartOS.py')
-rw-r--r-- | cloudinit/sources/DataSourceSmartOS.py | 25 |
1 files changed, 6 insertions, 19 deletions
diff --git a/cloudinit/sources/DataSourceSmartOS.py b/cloudinit/sources/DataSourceSmartOS.py index 2733a2f6..86b8775a 100644 --- a/cloudinit/sources/DataSourceSmartOS.py +++ b/cloudinit/sources/DataSourceSmartOS.py @@ -358,26 +358,13 @@ def query_data(noun, seed_device, seed_timeout, strip=False, default=None, def dmi_data(): - sys_uuid, sys_type = None, None - dmidecode_path = util.which('dmidecode') - if not dmidecode_path: - return False + sys_uuid = util.read_dmi_data("system-uuid") + sys_type = util.read_dmi_data("system-product-name") + + if not sys_uuid or not sys_type: + return None - sys_uuid_cmd = [dmidecode_path, "-s", "system-uuid"] - try: - LOG.debug("Getting hostname from dmidecode") - (sys_uuid, _err) = util.subp(sys_uuid_cmd) - except Exception as e: - util.logexc(LOG, "Failed to get system UUID", e) - - sys_type_cmd = [dmidecode_path, "-s", "system-product-name"] - try: - LOG.debug("Determining hypervisor product name via dmidecode") - (sys_type, _err) = util.subp(sys_type_cmd) - except Exception as e: - util.logexc(LOG, "Failed to get system UUID", e) - - return (sys_uuid.lower().strip(), sys_type.strip()) + return (sys_uuid.lower(), sys_type) def write_boot_content(content, content_f, link=None, shebang=False, |