Code review comment for lp:~andreserl/maas/maas_detect_ipmi_bug1064527

Revision history for this message
Gavin Panella (allenap) wrote :

[1]

+       f = open('/proc/cpuinfo', 'r')
+       cpu_info = f.readlines()
+       f.close()
+       for line in cpu_info:
+           if line.startswith('model name') and 'QEMU' in line:
+               return (False, None)

The idiomatic way to do this in recent Python versions is:

       with open('/proc/cpuinfo', 'r') as fd:
           for line in fd:
               if line.startswith('model name') and 'QEMU' in line:
                   return (False, None)

Same for the other copy-n-pasted version of this function :-/

review: Needs Fixing

« Back to merge proposal