summaryrefslogtreecommitdiff
path: root/src/obsync
diff options
context:
space:
mode:
authorKyle Marsh <kyle.marsh@dreamhost.com>2012-01-04 14:14:17 -0800
committerKyle Marsh <kyle.marsh@dreamhost.com>2012-01-04 14:14:17 -0800
commit5cebc740112d8c383a6e1ed7021632bbe0011d57 (patch)
tree8a57262f34c22c1c676611e4e933013f5cb0a0a0 /src/obsync
parenta5d99add611272153aa28c4c1efdef2c66e05b30 (diff)
downloadceph-5cebc740112d8c383a6e1ed7021632bbe0011d57.tar.gz
obsync: make obsync run without cloudfiles installed
Cloudfiles probably shouldn't be a requirement for running obsync, so this commit makes it optional.
Diffstat (limited to 'src/obsync')
-rwxr-xr-xsrc/obsync/obsync13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/obsync/obsync b/src/obsync/obsync
index d4dc9ccd907..9536eab84db 100755
--- a/src/obsync/obsync
+++ b/src/obsync/obsync
@@ -23,7 +23,6 @@ from sys import stderr
from lxml import etree
import base64
import boto
-import cloudfiles
import errno
import hashlib
import mimetypes
@@ -38,6 +37,11 @@ import time
import traceback
import xattr
+try:
+ import cloudfiles
+except ImportError:
+ cloudfiles = None
+
# Command-line options
global opts
@@ -82,6 +86,9 @@ DST_CONSISTENCY Set to 'eventual' if the destination is eventually consistent
If these environment variables are not given, we will fall back on libboto
defaults.
+
+Note: if python-cloudfiles is not installed, swift stores will not be able
+to be synced.
"""
###### Constants #######
ACL_XATTR = "rados.acl"
@@ -1062,6 +1069,8 @@ try:
if (not opts.src_host):
raise ObsyncArgumentParsingException("src-host is required for s3 stores!")
if (opts.src_type == 'swift'):
+ if not cloudfiles:
+ raise ObsyncArgumentParsingException("cloudfiles library not found. Swift syncing unavailable")
if (not opts.src_authurl):
raise ObsyncArgumentParsingException("src-authurl is required for swift stores!")
if (opts.src_host):
@@ -1084,6 +1093,8 @@ try:
if (not opts.dst_host):
raise ObsyncArgumentParsingException("dst-host is required for s3 stores!")
if (opts.dst_type == 'swift'):
+ if not cloudfiles:
+ raise ObsyncArgumentParsingException("cloudfiles library not found. Swift syncing unavailable")
if (not opts.dst_authurl):
raise ObsyncArgumentParsingException("dst-authurl is required for swift stores!")
if (opts.dst_host):