From 3263891aa4fefe817f7e4800dc04615ed433aa58 Mon Sep 17 00:00:00 2001 From: Stephan Kulow Date: Fri, 19 Jul 2019 15:42:35 +0200 Subject: [PATCH] rabbit-openqa: Catch exceptions as PUT to openqa might result in 404 --- gocd/rabbit-openqa.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/gocd/rabbit-openqa.py b/gocd/rabbit-openqa.py index 2ed401ad..cbc158d6 100755 --- a/gocd/rabbit-openqa.py +++ b/gocd/rabbit-openqa.py @@ -14,7 +14,7 @@ from osclib.conf import Config from osclib.stagingapi import StagingAPI from lxml import etree as ET from openqa_client.client import OpenQA_Client -from openqa_client.exceptions import ConnectionError +from openqa_client.exceptions import ConnectionError, RequestError from urllib.error import HTTPError, URLError from urllib.parse import quote_plus @@ -209,7 +209,10 @@ class Listener(PubSubConsumer): # notify openQA to sync the projects - the plugin will check itself it # the project is to be synced. For now we notify about every 'images' repo if payload['repo'] == 'images': - self.openqa.openqa_request('PUT', 'obs_rsync', str(payload['project']), 'runs') + try: + self.openqa.openqa_request('PUT', 'obs_rsync/{}/runs'.format(payload['project']), retries=0) + except RequestError as e: + self.logger.info("Got exception on syncing repository: {}".format(e)) def on_openqa_job(self, iso): self.logger.debug('openqa_job_change %s', iso)