Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Initial prefix support

  • Loading branch information...
commit 91f8adbbb38c3575cf89f87d5f9e0d9e19f572d3 1 parent 2ce68ba
Kevin Landreth authored
Showing with 12 additions and 7 deletions.
  1. +12 −7 slbackup.py
View
19 slbackup.py
@@ -140,6 +140,7 @@ def __init__(self, options):
self.excludes = []
self.source = options.get('source')
self.container = options.get('container')
+ self.prefix = options.get('prefix', '')
self.auth_url = None
self.token = None
@@ -275,6 +276,9 @@ def get_container(self, name=None):
return self.client[name]
+ def get_object_name(self, name):
+ return "%s%s" % (self.prefix, name)
+
def new_revision(self, _from, marker):
l = logging.getLogger("new_revision")
if self.retention < 1:
@@ -607,6 +611,7 @@ def delta_force_one(files, directories, remote_objects):
d = set(directories)
r = set(remote_objects.keys())
a = set(files + directories)
+
# FIXME patchup file and directory names for comparison
work = zip(repeat('upload'), f - r) + \
@@ -690,13 +695,7 @@ def upload_directory(app):
args = optparse.OptionParser(
'slbackup -s PATH -o CONTAINER [....]'
"\n\n"
- 'SoftLayer rsync-like object storage backup script',
- epilog="WARNING: this script uses mutliprocessing from python to "
- "reduce high latency HTTP round trip times."
- "It spawns on local file reader per thread (-t) and on "
- "uploader/deleter for every 2 readers."
- "Take this into consideration when specifying the -t option "
- "as the number is essentially doubled.")
+ 'SoftLayer rsync-like object storage backup script')
args.add_option('-s', '--source', nargs=1, type="str",
help='The directory to backup', metavar="/home")
@@ -762,6 +761,12 @@ def upload_directory(app):
type="str", default=None, metavar="FILE",
help="File including a line seperated list of directories.")
+ xargs.add_option("--prefix", "-p", nargs=1,
+ type="str", default='', metavar="some/path/",
+ help="Prefix all objects with speficied string. "
+ "Make sure to include the trailing slash but not the leading one. "
+ "i.e --prefix static/imgs/ or --prefix some:pre:fix:")
+
args.add_option_group(oargs)
args.add_option_group(xargs)
(opts, extra) = args.parse_args()
Please sign in to comment.
Something went wrong with that request. Please try again.