You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kibble.apache.org by hu...@apache.org on 2018/09/09 14:04:16 UTC

[kibble-scanners] 01/02: fix key errors

This is an automated email from the ASF dual-hosted git repository.

humbedooh pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/kibble-scanners.git

commit fdd5984370cf064fe3774c06ec92c3d1eb13f2d6
Author: Daniel Gruno <hu...@apache.org>
AuthorDate: Sun Sep 9 16:03:18 2018 +0200

    fix key errors
    
    sometimes the assignee/reporter is set but no email address is
    available, so just try to get it non-fatally.
---
 src/plugins/scanners/jira.py | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/plugins/scanners/jira.py b/src/plugins/scanners/jira.py
index 46961ad..fd8209f 100644
--- a/src/plugins/scanners/jira.py
+++ b/src/plugins/scanners/jira.py
@@ -156,12 +156,12 @@ def scanTicket(KibbleBit, key, u, source, creds, openTickets):
         comments = 0
         if 'comment' in tjson['fields'] and tjson['fields']['comment']:
             comments = tjson['fields']['comment']['total']
-        assignee = tjson['fields']['assignee']['emailAddress'] if tjson['fields']['assignee'] else None
-        creator = tjson['fields']['reporter']['emailAddress'] if tjson['fields']['reporter'] else None
+        assignee = tjson['fields']['assignee'].get('emailAddress') if tjson['fields'].get('assignee') else None
+        creator = tjson['fields']['reporter'].get('emailAddress') if tjson['fields'].get('reporter') else None
         title = tjson['fields']['summary']
         if closer:
             #print("Parsing closer")
-            closerEmail = closer['emailAddress'].replace(" dot ", ".", 10).replace(" at ", "@", 1)
+            closerEmail = closer.get('emailAddress', 'unknown@kibble').replace(" dot ", ".", 10).replace(" at ", "@", 1)
             displayName = closer['displayName']
             if displayName and len(displayName) > 0:
                 # Add to people db