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 2021/06/01 12:24:07 UTC

[kibble-scanners] branch master updated: Account for various connection hiccups that can happen

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


The following commit(s) were added to refs/heads/master by this push:
     new 2a8c00d  Account for various connection hiccups that can happen
2a8c00d is described below

commit 2a8c00de493d4f9fbab8abd633622f08880b8e78
Author: Daniel Gruno <hu...@apache.org>
AuthorDate: Tue Jun 1 14:24:01 2021 +0200

    Account for various connection hiccups that can happen
---
 src/plugins/scanners/jira.py | 21 ++++++++++++++++-----
 1 file changed, 16 insertions(+), 5 deletions(-)

diff --git a/src/plugins/scanners/jira.py b/src/plugins/scanners/jira.py
index 1d6bcf7..e996b7c 100644
--- a/src/plugins/scanners/jira.py
+++ b/src/plugins/scanners/jira.py
@@ -290,9 +290,9 @@ def scan(KibbleBit, source):
             KibbleBit.pprint("JIRA at %s requires authentication, but none was found! Bailing." % source['sourceURL'])
             source['steps']['issues'] = {
                 'time': time.time(),
-                'status': 'Parsing JIRA changes...',
-                'running': True,
-                'good': True
+                'status': 'JIRA endpoint requires auth, but none was provided!',
+                'running': False,
+                'good': False
             }
             KibbleBit.updateSource(source)
             return
@@ -325,7 +325,18 @@ def scan(KibbleBit, source):
         latestURL = "%s/rest/api/2/search?jql=project=%s+order+by+createdDate+DESC&fields=id,key&maxResults=1" % (u, instance)
         js = None
         
-        js = plugins.utils.jsonapi.get(latestURL, auth = creds)
+        try:
+            js = plugins.utils.jsonapi.get(latestURL, auth = creds)
+        except requests.exceptions.ConnectionError as err:
+            KibbleBit.pprint("Connection error, skipping this ticket for now!")
+            source['steps']['issues'] = {
+                 'time': time.time(),
+                 'status': 'Connection error occurred while scanning',
+                 'running': False,
+                 'good': False
+             }
+             KibbleBit.updateSource(source)
+             return
         if 'issues' in js and len(js['issues']) == 1:
             key = js['issues'][0]['key']
             m = re.search(r"-(\d+)$", key)
@@ -377,4 +388,4 @@ def scan(KibbleBit, source):
             'good': True
         }
         KibbleBit.updateSource(source)
-    
\ No newline at end of file
+