diff options
author | Scott Moser <smoser@ubuntu.com> | 2015-01-22 12:14:02 -0500 |
---|---|---|
committer | Scott Moser <smoser@ubuntu.com> | 2015-01-22 12:14:02 -0500 |
commit | 78915c97c18d678db10e0fde0d9306823c5f4610 (patch) | |
tree | fa98132617a50bcad3ab9a9e9e962ce1a2263bdd /cloudinit/sources/DataSourceSmartOS.py | |
parent | 8d453d2a4da4492857a4487b14fe7b11a014115b (diff) | |
parent | de32623e6b34e3648958f1a08ef721ed9a03f2f8 (diff) | |
download | vyos-cloud-init-78915c97c18d678db10e0fde0d9306823c5f4610.tar.gz vyos-cloud-init-78915c97c18d678db10e0fde0d9306823c5f4610.zip |
remove dependency on dmidecode on linux
on linux we can read dmi information from /sys rather than using
dmidecode binary, and thus removing a dependency.
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, |