]> git.ipfire.org Git - ipfire-2.x.git/blame - src/patches/fireinfo-Don-t-crash-when-proc-cpuinfo-doesn-t-have-any-infor.patch
Merge branch 'ipsec' into next
[ipfire-2.x.git] / src / patches / fireinfo-Don-t-crash-when-proc-cpuinfo-doesn-t-have-any-infor.patch
CommitLineData
011204d9
MT
1From e2b6025dea547bf8de4bd2b8056f2a8227c635f5 Mon Sep 17 00:00:00 2001
2From: Michael Tremer <michael.tremer@ipfire.org>
3Date: Wed, 13 Jun 2018 20:56:41 +0200
4Subject: [PATCH 1/2] Don't crash when /proc/cpuinfo doesn't have any
5 information
6
7Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
8---
9 src/fireinfo/cpu.py | 9 +++++----
10 1 file changed, 5 insertions(+), 4 deletions(-)
11
12diff --git a/src/fireinfo/cpu.py b/src/fireinfo/cpu.py
13index 541575a..dc76caf 100644
14--- a/src/fireinfo/cpu.py
15+++ b/src/fireinfo/cpu.py
16@@ -108,10 +108,11 @@ class CPU(object):
17 """
18 Return the model string of this CPU.
19 """
20- try:
21- return self.__cpuinfo["model_name"]
22- except KeyError:
23- return self.__cpuinfo["Processor"]
24+ for key in ("model_name", "Processor"):
25+ try:
26+ return self.__cpuinfo[key]
27+ except KeyError:
28+ pass
29
30 @property
31 def vendor(self):
32--
332.12.2
34