]> git.ipfire.org Git - oddments/fireinfo.git/commitdiff
Don't crash when /proc/cpuinfo doesn't have any information
authorMichael Tremer <michael.tremer@ipfire.org>
Wed, 13 Jun 2018 18:56:41 +0000 (20:56 +0200)
committerMichael Tremer <michael.tremer@ipfire.org>
Wed, 13 Jun 2018 18:56:41 +0000 (20:56 +0200)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/fireinfo/cpu.py

index 541575af6bbb33e5e58cd0010d1b22662ffdd4ae..dc76caf9f1f10bcfea551e6a5cb3955ed2050289 100644 (file)
@@ -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):