summaryrefslogtreecommitdiffstats
path: root/fedora-easy-karma.py
diff options
context:
space:
mode:
authorTill Maas <opensource@till.name>2013-07-07 23:01:55 +0200
committerTill Maas <opensource@till.name>2013-07-07 23:01:55 +0200
commit629c43a1818e4a35037ad3e6818cdbb22cd20c2d (patch)
tree26d54fae694615aa192ed91de794648bae526e19 /fedora-easy-karma.py
parent9fb2168067f9ea32c167beae6125259dafae4ff3 (diff)
downloadfedora-easy-karma-629c43a1818e4a35037ad3e6818cdbb22cd20c2d.tar.gz
fedora-easy-karma-629c43a1818e4a35037ad3e6818cdbb22cd20c2d.tar.xz
fedora-easy-karma-629c43a1818e4a35037ad3e6818cdbb22cd20c2d.zip
BodhiClient adjustments wrt retries
- set retries - except errors from BodhiClient.query()
Diffstat (limited to 'fedora-easy-karma.py')
-rwxr-xr-xfedora-easy-karma.py32
1 files changed, 27 insertions, 5 deletions
diff --git a/fedora-easy-karma.py b/fedora-easy-karma.py
index 87265d7..3872050 100755
--- a/fedora-easy-karma.py
+++ b/fedora-easy-karma.py
@@ -266,7 +266,7 @@ class FedoraEasyKarma(object):
fas_username = os.environ["LOGNAME"]
self.options.fas_username = fas_username
- bc = BodhiClient(username=self.options.fas_username, useragent="Fedora Easy Karma/GIT")
+ bc = BodhiClient(username=self.options.fas_username, useragent="Fedora Easy Karma/GIT", retries=self.options.retries)
my = yum.YumBase()
my.preconf.debuglevel = 0
@@ -309,16 +309,34 @@ class FedoraEasyKarma(object):
print "Cannot access bodhi cache file: %s" % cachefile_name
sys.exit(ioe.errno)
else:
- self.info("Getting list of packages in updates-testing...")
+ self.info("Waiting for Bodhi for a list of packages in updates-testing (%s)..." % release)
self.debug("starting bodhi query")
- # probably raises some exceptions
- testing_updates = bc.query(release=release, status="testing", limit=1000)["updates"]
+ try:
+ testing_updates = bc.query(release=release, status="testing", limit=1000)
+ # There is no clear indication which Exceptions bc.query() might
+ # throw, therefore catch all (python-fedora-0.3.32.3-1.fc19)
+ except Exception as e:
+ print "Cannot query Bodhi: {0}".format(e)
+ sys.exit(1)
+ else:
+ testing_updates = testing_updates["updates"]
+
# can't query for requestless as of python-fedora 0.3.18
# (request=None results in no filtering by request)
testing_updates = [x for x in testing_updates if not x["request"]]
+
# extend list of updates with updates that are going to testing to
# support manually installed rpms from koji
- testing_updates.extend(bc.query(release=release, status="pending", request="testing", limit=1000)["updates"])
+ try:
+ pending_updates = bc.query(release=release, status="pending", request="testing", limit=1000)
+ # There is no clear indication which Exceptions bc.query() might
+ # throw, therefore catch all (python-fedora-0.3.32.3-1.fc19)
+ except Exception as e:
+ print "Cannot query Bodhi: {0}".format(e)
+ sys.exit(1)
+ else:
+ testing_updates.extend(pending_updates["updates"])
+ del pending_updates
if self.options.bodhi_update_cache:
try:
@@ -498,9 +516,12 @@ class FedoraEasyKarma(object):
def send_comment(self, bc, update, comment, karma):
+ orig_retries = bc.retries
+ bc.retries = 1
for retry in range(0, self.options.retries + 1):
try:
res = bc.comment(update["title"], comment, karma=karma)
+ bc.retries = orig_retries
return (True, res)
except fedora.client.AuthError, e:
self.warning("Authentication error")
@@ -508,6 +529,7 @@ class FedoraEasyKarma(object):
except fedora.client.ServerError, e:
self.warning("Server error: %s" % str(e))
+ bc.retries = orig_retries
return (False, 'too many errors')