38 lines
1.1 KiB
Diff
38 lines
1.1 KiB
Diff
From 08c37d8d5b5476a9ecf128eebe9aed1c033b1b08 Mon Sep 17 00:00:00 2001
|
|
From: John Kacur <jkacur@redhat.com>
|
|
Date: Thu, 27 Aug 2020 15:41:07 -0400
|
|
Subject: [PATCH] rteval: Parse cpuinfo correctly when model name has a colon
|
|
|
|
The function cpuinfo() splits fields in /proc/cpuinfo with a colon ':'
|
|
|
|
This can cause a
|
|
ValueError: too many values to unpack (expected 2)
|
|
|
|
This is easily fixed by setting the maximum number of splits to 1
|
|
|
|
Signed-off-by: John Kacur <jkacur@redhat.com>
|
|
---
|
|
rteval/misc.py | 6 ++++--
|
|
1 file changed, 4 insertions(+), 2 deletions(-)
|
|
|
|
diff --git a/rteval/misc.py b/rteval/misc.py
|
|
index a43a8964e061..6184c9286f11 100644
|
|
--- a/rteval/misc.py
|
|
+++ b/rteval/misc.py
|
|
@@ -69,8 +69,10 @@ def cpuinfo():
|
|
info = {}
|
|
for l in open('/proc/cpuinfo'):
|
|
l = l.strip()
|
|
- if not l: continue
|
|
- key,val = [ i.strip() for i in l.split(':')]
|
|
+ if not l:
|
|
+ continue
|
|
+ # Split a maximum of one time. In case a model name has ':' in it
|
|
+ key, val = [i.strip() for i in l.split(':', 1)]
|
|
if key == 'processor':
|
|
core = val
|
|
info[core] = {}
|
|
--
|
|
2.26.2
|
|
|