summaryrefslogtreecommitdiff
path: root/cloudinit
diff options
context:
space:
mode:
authorScott Moser <smoser@ubuntu.com>2016-03-14 09:53:04 -0400
committerScott Moser <smoser@ubuntu.com>2016-03-14 09:53:04 -0400
commit14c88d8c28a044776d011ed507f8f6465ec3e2c7 (patch)
tree2416265247ea39db4abb625fa36436a815d90f47 /cloudinit
parent24bd640d20383116d1285361d7e86eda9e9d20e8 (diff)
parent8a929e66f2fe2aaed968ec23aeaf6d3b3c68cb65 (diff)
downloadvyos-cloud-init-14c88d8c28a044776d011ed507f8f6465ec3e2c7.tar.gz
vyos-cloud-init-14c88d8c28a044776d011ed507f8f6465ec3e2c7.zip
merge with trunk for dmidecode changes
Diffstat (limited to 'cloudinit')
-rw-r--r--cloudinit/util.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/cloudinit/util.py b/cloudinit/util.py
index 01dc7751..20916e53 100644
--- a/cloudinit/util.py
+++ b/cloudinit/util.py
@@ -2148,7 +2148,7 @@ def _read_dmi_syspath(key):
# uninitialized dmi values show as all \xff and /sys appends a '\n'.
# in that event, return a string of '.' in the same length.
if key_data == b'\xff' * (len(key_data) - 1) + b'\n':
- key_data = b'.' * (len(key_data) - 1) + b'\n'
+ key_data = b""
str_data = key_data.decode('utf8').strip()
LOG.debug("dmi data %s returned %s", dmi_key_path, str_data)
@@ -2168,6 +2168,9 @@ def _call_dmidecode(key, dmidecode_path):
cmd = [dmidecode_path, "--string", key]
(result, _err) = subp(cmd)
LOG.debug("dmidecode returned '%s' for '%s'", result, key)
+ result = result.strip()
+ if result.replace(".", "") == "":
+ return ""
return result
except (IOError, OSError) as _err:
LOG.debug('failed dmidecode cmd: %s\n%s', cmd, _err.message)