From: Michael Tremer Date: Wed, 13 Jun 2018 18:56:41 +0000 (+0200) Subject: Don't crash when /proc/cpuinfo doesn't have any information X-Git-Tag: v2.2.0~14 X-Git-Url: http://git.ipfire.org/?p=oddments%2Ffireinfo.git;a=commitdiff_plain;h=e2b6025dea547bf8de4bd2b8056f2a8227c635f5 Don't crash when /proc/cpuinfo doesn't have any information Signed-off-by: Michael Tremer --- 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):