mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Merge pull request #48440 from mmulqueen/patch-1
Make core.py tolerant of invalid chars in DMI data
This commit is contained in:
commit
111908f519
1 changed files with 2 additions and 2 deletions
|
@ -947,7 +947,7 @@ def _virtual(osdata):
|
|||
if os.path.isfile('/sys/devices/virtual/dmi/id/product_name'):
|
||||
try:
|
||||
with salt.utils.files.fopen('/sys/devices/virtual/dmi/id/product_name', 'r') as fhr:
|
||||
output = salt.utils.stringutils.to_unicode(fhr.read())
|
||||
output = salt.utils.stringutils.to_unicode(fhr.read(), errors='replace')
|
||||
if 'VirtualBox' in output:
|
||||
grains['virtual'] = 'VirtualBox'
|
||||
elif 'RHEV Hypervisor' in output:
|
||||
|
@ -2288,7 +2288,7 @@ def _hw_data(osdata):
|
|||
if os.path.exists(contents_file):
|
||||
try:
|
||||
with salt.utils.files.fopen(contents_file, 'r') as ifile:
|
||||
grains[key] = ifile.read().strip()
|
||||
grains[key] = salt.utils.stringutils.to_unicode(ifile.read().strip(), errors='replace')
|
||||
if key == 'uuid':
|
||||
grains['uuid'] = grains['uuid'].lower()
|
||||
except (IOError, OSError) as err:
|
||||
|
|
Loading…
Add table
Reference in a new issue