diff options
author | Scott Moser <smoser@ubuntu.com> | 2016-03-14 09:25:50 -0400 |
---|---|---|
committer | Scott Moser <smoser@ubuntu.com> | 2016-03-14 09:25:50 -0400 |
commit | f8fe3182ac5e6b7b3b4a81e034e87bfd1327f82b (patch) | |
tree | 5733356cc604dda1b3a8b0ae1c5320399a8a55d9 /cloudinit/util.py | |
parent | 03f80fa62eb85270a7a96850c5e689a1c4bc0049 (diff) | |
download | vyos-cloud-init-f8fe3182ac5e6b7b3b4a81e034e87bfd1327f82b.tar.gz vyos-cloud-init-f8fe3182ac5e6b7b3b4a81e034e87bfd1327f82b.zip |
change where we handle the translation
Diffstat (limited to 'cloudinit/util.py')
-rw-r--r-- | cloudinit/util.py | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/cloudinit/util.py b/cloudinit/util.py index caae17ce..f84f120e 100644 --- a/cloudinit/util.py +++ b/cloudinit/util.py @@ -2168,6 +2168,8 @@ def _call_dmidecode(key, dmidecode_path): cmd = [dmidecode_path, "--string", key] (result, _err) = subp(cmd) LOG.debug("dmidecode returned '%s' for '%s'", result, key) + if result.replace(".", "") == "": + return "" return result except (IOError, OSError) as _err: LOG.debug('failed dmidecode cmd: %s\n%s', cmd, _err.message) @@ -2193,10 +2195,7 @@ def read_dmi_data(key): dmidecode_path = which('dmidecode') if dmidecode_path: - ret = _call_dmidecode(key, dmidecode_path) - if ret is not None and ret.replace(".", "") == "": - return "" - return ret + return _call_dmidecode(key, dmidecode_path) LOG.warn("did not find either path %s or dmidecode command", DMI_SYS_PATH) |