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
diff --git a/zuul/lib/swift.py b/zuul/lib/swift.py
index 8f926ad..2cbd05e 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 @@
class Swift(object):
+ log = logging.getLogger("zuul.lib.swift")
+
def __init__(self, config):
self.config = config
self.connection = False
@@ -35,7 +38,13 @@
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'):