summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorScott Moser <smoser@ubuntu.com>2016-03-14 09:25:50 -0400
committerScott Moser <smoser@ubuntu.com>2016-03-14 09:25:50 -0400
commitf8fe3182ac5e6b7b3b4a81e034e87bfd1327f82b (patch)
tree5733356cc604dda1b3a8b0ae1c5320399a8a55d9
parent03f80fa62eb85270a7a96850c5e689a1c4bc0049 (diff)
downloadvyos-cloud-init-f8fe3182ac5e6b7b3b4a81e034e87bfd1327f82b.tar.gz
vyos-cloud-init-f8fe3182ac5e6b7b3b4a81e034e87bfd1327f82b.zip
change where we handle the translation
-rw-r--r--cloudinit/util.py7
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)