gerrit_cq.py: Add check to ensure missing emails are handled

Currently the exonerator is not handling messages without emails, which
does appear to be happening, therefore we need to check for email before
handling the message.

BUG=chromium:985435
TEST='deploy to prod; watch logs'

Change-Id: Ib2fa56d4b981e9dab977acc3ccb586084b1d279e
Reviewed-on: https://chromium-review.googlesource.com/1709236
Tested-by: Mike Nichols <mikenichols@chromium.org>
Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com>
Legacy-Commit-Queue: Commit Bot <commit-bot@chromium.org>
Reviewed-by: Mike Nichols <mikenichols@chromium.org>
Reviewed-by: Dhanya Ganesh <dhanyaganesh@chromium.org>
Reviewed-by: David Burger <dburger@chromium.org>
diff --git a/exonerator/gerrit_cq.py b/exonerator/gerrit_cq.py
index 3f97b90..5faf58f 100644
--- a/exonerator/gerrit_cq.py
+++ b/exonerator/gerrit_cq.py
@@ -136,7 +136,7 @@
   """
   for message in reversed(change_details['messages']):
     if '-Commit-Queue' in message['message']:
-      return (message['real_author']['email']
+      return (message['real_author'].get('email', '')
               == constants.CHROMEOS_COMMIT_BOT_EMAIL)
 
   logging.error('No Commit-Queue removal message was found for change %s.'
@@ -156,7 +156,7 @@
   """
   commit_bot_messages = [
       m for m in change_details['messages']
-      if m['real_author']['email'] == constants.CHROMEOS_COMMIT_BOT_EMAIL
+      if m['real_author'].get('email', '') == constants.CHROMEOS_COMMIT_BOT_EMAIL
   ]
 
   last_two_messages = itertools.islice(reversed(commit_bot_messages), 2)