Handle missing report from CiBoT
authorFrederic Massart <fred@moodle.com>
Thu, 11 Aug 2016 08:46:55 +0000 (16:46 +0800)
committerFrederic Massart <fred@moodle.com>
Thu, 11 Aug 2016 08:46:56 +0000 (16:46 +0800)
CSS information is no more returned, causing the command to
fail early. When the information is not returned we now automatically
assume that it was a success.

mdk/commands/precheck.py

index 889286a..0451c82 100644 (file)
@@ -129,15 +129,10 @@ class PrecheckCommand(Command):
         }
 
         for key in mapping:
-            try:
-                details = infos.get(key)
-            except KeyError:
-                logging.debug("Unknown key '%s', ignoring...", key)
-                continue
-
-            result = details.get('result', None)
+            details = infos.get(key, {})
+            result = details.get('result', CI.SUCCESS)  # At times we don't receive the result, in which case we assume success.
             symbol = ' ' if result == CI.SUCCESS else ('!' if result == CI.WARNING else 'X')
-            print '  [{}] {:<20}({} errors, {} warnings)'.format(symbol, mapping.get(key, key), details.get('errors', '?'), details.get('warnings', '?'))
+            print '  [{}] {:<20}({} errors, {} warnings)'.format(symbol, mapping.get(key, key), details.get('errors', '0'), details.get('warnings', '0'))
 
         logging.info('')
         logging.info('More details at: %s', infos.get('url'))