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
This commit is contained in:
parent
c496750d93
commit
62fa2d499f
|
@ -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.
|
||||
|
|
|
@ -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,
|
||||
|
|
Loading…
Reference in New Issue