multi protocol url suffix

Asked by constantin on 2019-09-10


i want to group backups by directory with the multi protocol.

ive got a backup script which for example retrieves a list of databases, exports them and then creates a backup with duplicity.


so the url changes depending on the database.

ive used offsite backups only for now but i want to mirror to a local disk therefore switching to multi

i read the documentation and googled but could not find a way to append a suffix to the url.

is there a way i missed ?

otherwise i would like to create a feature request, the implementation should be really easy.

could be implemented with another http get query like this:

duplicity /database/$dbname "multi:///multiconfig.conf?mode=mirror&onfail=continue&urlsuffix=$dbname"

$dbname will be appended to the url value in the json file

Question information

English Edit question
Duplicity Edit question
No assignee Edit question
Solved by:
Last query:
Last reply:
Revision history for this message
constantin (h4r0) said :

so i implemented the feature myself but i cant test it because i dont know how to build duplicity

"python install" doesnt compile the source changes i verified with log output

 "python" also doesnt create a binary

can someone help me with this, README* didnt help

Revision history for this message
constantin (h4r0) said :

dunno why but i have to delete the dist.packages folder, now its working

rm -rf /usr/local/lib/python2.7/dist-packages/duplicity
rm /usr/local/bin/duplicity
python install

Revision history for this message
constantin (h4r0) said :

tested everything and it works fine.

here is my patch

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

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

+ # 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']
             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")

Revision history for this message
Kenneth Loafman (kenneth-loafman) said :

Thanks for the patch! All help is welcome!