summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAntoine Musso <hashar@free.fr>2014-06-04 22:55:23 +0200
committerAntoine Musso <hashar@free.fr>2014-06-18 15:35:35 +0200
commit62fa2d499f4fe0d645f455f02685e29d9d0f78a5 (patch)
treedaf4d586c36c688a7ac2c0dd859adcb3023362eb
parentc496750d93ab525a42f05f7c38c717e4cdefaa9f (diff)
downloadzuul-62fa2d499f4fe0d645f455f02685e29d9d0f78a5.tar.gz
Make swiftclient an optional dependency
I can not use the switclient on my installation and need a way to prevent the swiftclient import entirely. The only usage of the swiftclient module is to establish a connection which only happen if there is a [swift] section in the configuration. Moving the import from the top of the file next to its only usage would make sure my installs never has to get swiftclient installed. Change-Id: Ie2ef84f86f9f57796a85758147ba87d8b22c3e55
-rw-r--r--doc/source/zuul.rst10
-rw-r--r--zuul/lib/swift.py2
2 files changed, 8 insertions, 4 deletions
diff --git a/doc/source/zuul.rst b/doc/source/zuul.rst
index fec719878..122a6056b 100644
--- a/doc/source/zuul.rst
+++ b/doc/source/zuul.rst
@@ -182,8 +182,11 @@ swift
"""""
To send (optional) swift upload instructions this section must be
-present. Multiple destinations can be defined in the :ref:`jobs`
-section of the layout.
+present. Multiple destinations can be defined in the :ref:`jobs` section
+of the layout.
+
+If you are sending the temp-url-key or fetching the x-storage-url, you
+will need the python-swiftclient module installed.
**X-Account-Meta-Temp-Url-Key** (optional)
This is the key used to sign the HMAC message. If you do not set a
@@ -194,12 +197,13 @@ section of the layout.
you have set up the appropriate credentials in ``authurl`` below.
This isn't necessary if you know and have set your
X-Account-Meta-Temp-Url-Key.
+ If set, Zuul requires the python-swiftclient module.
``default: true``
**X-Storage-Url** (optional)
The storage URL is the destination to upload files into. If you do
not set this the ``authurl`` credentials are used to fetch the url
- from swift.
+ from swift and Zuul will requires the python-swiftclient module.
**authurl** (optional)
The (keystone) Auth URL for swift.
diff --git a/zuul/lib/swift.py b/zuul/lib/swift.py
index c5d540c77..15e2fe6c3 100644
--- a/zuul/lib/swift.py
+++ b/zuul/lib/swift.py
@@ -19,7 +19,6 @@ from time import time
import os
import random
import string
-import swiftclient
import urlparse
@@ -110,6 +109,7 @@ class Swift(object):
if self.config.has_option('swift', os_option):
os_options[os_option] = self.config.get('swift', os_option)
+ import swiftclient
self.connection = swiftclient.client.Connection(
authurl=authurl, user=user, key=key, retries=retries,
preauthurl=preauthurl, preauthtoken=preauthtoken, snet=snet,