summaryrefslogtreecommitdiff
path: root/cloudinit/util.py
diff options
context:
space:
mode:
authorSankar Tanguturi <stanguturi@stanguturi-rhel>2016-03-17 14:30:46 -0700
committerSankar Tanguturi <stanguturi@stanguturi-rhel>2016-03-17 14:30:46 -0700
commitf1f0619010ec59b0ad2641e6d2faf0ae2ce8a09f (patch)
tree4719aaa98096cb1b062b29768888eb1fa3785fc8 /cloudinit/util.py
parent13a32d7599a939370ee0bc0e7257da2c59b4bd61 (diff)
parent56402e91e95960f54a39eb18cbda391f00f95b6e (diff)
downloadvyos-cloud-init-f1f0619010ec59b0ad2641e6d2faf0ae2ce8a09f.tar.gz
vyos-cloud-init-f1f0619010ec59b0ad2641e6d2faf0ae2ce8a09f.zip
- Merged with trunk.
Diffstat (limited to 'cloudinit/util.py')
-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)