From b95d38bf367a53234451a9c0ed0dae73ff56ab6c Mon Sep 17 00:00:00 2001 From: Joshua Hesketh Date: Wed, 14 May 2014 14:58:33 -0700 Subject: [PATCH] Add in check for successful swift setup If the swift credentials are wrong zuul will crash. This change adds in a check incase setting up swift access fails. A signed URL will still be processed but will likely be wrong. A warning is logged. Change-Id: I6716e06ef3e42914c90d5857abab799e39d8089d --- zuul/lib/swift.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/zuul/lib/swift.py b/zuul/lib/swift.py index 8f926adf81..2cbd05e862 100644 --- a/zuul/lib/swift.py +++ b/zuul/lib/swift.py @@ -14,6 +14,7 @@ import hmac from hashlib import sha1 +import logging from time import time import os import random @@ -23,6 +24,8 @@ import urlparse class Swift(object): + log = logging.getLogger("zuul.lib.swift") + def __init__(self, config): self.config = config self.connection = False @@ -35,7 +38,13 @@ class Swift(object): for x in range(20) ) - self.connect() + self.storage_url = '' + + try: + self.connect() + except Exception as e: + self.log.warning("Unable to set up swift. Signed storage URL is " + "likely to be wrong. %s" % e) def connect(self): if self.config.has_section('swift'):