def valid(self):
"""
- Return True / False if valid
+ Return True / False if valid. If returns True, self.unknown is
+ set to either True or False, and can be checked if we have
+ positive validity (fingerprint known at server) or negative
+ validity (fingerprint not known at server, but not really an
+ error).
"""
try:
self.poll()
- except urllib2.HTTPError:
+ self.unknown = False
+ except urllib2.HTTPError, e:
+ # We can't really say anything about the validity of
+ # fingerprints not found -- but the artifact can still
+ # exist, so it is not possible to definitely say they are
+ # valid or not.
+ if e.code == 404:
+ self.unknown = True
+ return True
+
return False
return True
if not self.valid():
log.info("Unknown to jenkins.")
return False
+ if self.unknown:
+ # not request error, but unknown to jenkins
+ return True
if not self._data["original"] is None:
if self._data["original"]["name"] == job:
if self._data["original"]["number"] == build:
stream = fn_urlopen(url)
result = eval(stream.read())
except urllib2.HTTPError, e:
+ if e.code == 404:
+ raise
log.warn("Error reading %s" % url)
log.exception(e)
raise
import logging
import time
+import urllib2
log = logging.getLogger( __name__ )
if attempt > 0:
log.info( "Result obtained after attempt %i" % attemptno )
return result
+ except urllib2.HTTPError, e:
+ if e.code == 404:
+ raise
+
+ log.exception(e)
except Exception, e:
if type(e) in IGNORE_EXCEPTIONS:
# Immediatly raise in some cases.