From 0242f107813056bcbf3ae53890c814f8771172ce Mon Sep 17 00:00:00 2001 From: James Tanner Date: Mon, 2 Dec 2013 11:56:38 -0500 Subject: [PATCH] Fixes #4796 handle unicodedecode errors from dmidecode output --- system/setup | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/system/setup b/system/setup index 7b0fd70e80b..353cf6f6d39 100755 --- a/system/setup +++ b/system/setup @@ -632,7 +632,13 @@ class LinuxHardware(Hardware): (rc, out, err) = module.run_command('%s -s %s' % (dmi_bin, v)) if rc == 0: # Strip out commented lines (specific dmidecode output) - self.facts[k] = ''.join([ line for line in out.split('\n') if not line.startswith('#') ]) + thisvalue = ''.join([ line for line in out.split('\n') if not line.startswith('#') ]) + try: + json.dumps(thisvalue) + except UnicodeDecodeError: + thisvalue = "NA" + + self.facts[k] = thisvalue else: self.facts[k] = 'NA' else: