]>
Commit | Line | Data |
---|---|---|
1 | From e2b6025dea547bf8de4bd2b8056f2a8227c635f5 Mon Sep 17 00:00:00 2001 | |
2 | From: Michael Tremer <michael.tremer@ipfire.org> | |
3 | Date: Wed, 13 Jun 2018 20:56:41 +0200 | |
4 | Subject: [PATCH 1/2] Don't crash when /proc/cpuinfo doesn't have any | |
5 | information | |
6 | ||
7 | Signed-off-by: Michael Tremer <michael.tremer@ipfire.org> | |
8 | --- | |
9 | src/fireinfo/cpu.py | 9 +++++---- | |
10 | 1 file changed, 5 insertions(+), 4 deletions(-) | |
11 | ||
12 | diff --git a/src/fireinfo/cpu.py b/src/fireinfo/cpu.py | |
13 | index 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 | -- | |
33 | 2.12.2 | |
34 |