mirror of
https://github.com/vincentmli/bpfire.git
synced 2026-04-28 11:43:25 +02:00
35 lines
889 B
Diff
35 lines
889 B
Diff
From e2b6025dea547bf8de4bd2b8056f2a8227c635f5 Mon Sep 17 00:00:00 2001
|
|
From: Michael Tremer <michael.tremer@ipfire.org>
|
|
Date: Wed, 13 Jun 2018 20:56:41 +0200
|
|
Subject: [PATCH 1/2] Don't crash when /proc/cpuinfo doesn't have any
|
|
information
|
|
|
|
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
|
|
---
|
|
src/fireinfo/cpu.py | 9 +++++----
|
|
1 file changed, 5 insertions(+), 4 deletions(-)
|
|
|
|
diff --git a/src/fireinfo/cpu.py b/src/fireinfo/cpu.py
|
|
index 541575a..dc76caf 100644
|
|
--- a/src/fireinfo/cpu.py
|
|
+++ b/src/fireinfo/cpu.py
|
|
@@ -108,10 +108,11 @@ class CPU(object):
|
|
"""
|
|
Return the model string of this CPU.
|
|
"""
|
|
- try:
|
|
- return self.__cpuinfo["model_name"]
|
|
- except KeyError:
|
|
- return self.__cpuinfo["Processor"]
|
|
+ for key in ("model_name", "Processor"):
|
|
+ try:
|
|
+ return self.__cpuinfo[key]
|
|
+ except KeyError:
|
|
+ pass
|
|
|
|
@property
|
|
def vendor(self):
|
|
--
|
|
2.12.2
|
|
|