← Back to team overview

duplicity-team team mailing list archive

Re: [Question #683832]: multi protocol url suffix

 

Question #683832 on Duplicity changed:
https://answers.launchpad.net/duplicity/+question/683832

    Status: Open => Solved

constantin confirmed that the question is solved:
tested everything and it works fine.

here is my patch

#sub path patch
cat << 'EOP' | git -C duplicity/backends apply
diff --git a/multibackend.py b/multibackend.py
index 27ffa0a..58d4f51 100644
--- a/multibackend.py
+++ b/multibackend.py
@@ -50,6 +50,7 @@ class MultiBackend(duplicity.backend.Backend):
     __knownQueryParameters = frozenset([
         u'mode',
         u'onfail',
+        u'subpath',
     ])

     # the mode of operation to follow
@@ -70,6 +71,10 @@ class MultiBackend(duplicity.backend.Backend):
         u'continue',
     ])

+    # sub path to dynamically add sub directories to backends
+    # will be appended to the url value
+    __subpath = u''
+
     # when we write in stripe mode, we "stripe" via a simple round-robin across
     # remote stores.  It's hard to get too much more sophisticated
     # since we can't rely on the backend to give us any useful meta
@@ -159,6 +164,9 @@ class MultiBackend(duplicity.backend.Backend):
                     % (u'onfail', self.__onfail_mode), log.ERROR)
             raise BackendException(u"MultiBackend: invalid onfail value")

+        if u'subpath' in queryParams:
+            self.__subpath = queryParams[u'subpath']
+
         try:
             with open(parsed_url.path) as f:
                 configs = json.load(f)
@@ -173,7 +181,7 @@ class MultiBackend(duplicity.backend.Backend):
             raise BackendException(u'Could not load config file')

         for config in configs:
-            url = config[u'url']
+            url = config[u'url'] + self.__subpath
             # Fix advised in bug #1471795
             url = url.encode(u'utf-8')
             log.Log(_(u"MultiBackend: use store %s")
EOP

-- 
You received this question notification because your team duplicity-team
is an answer contact for Duplicity.