duplicity-team team mailing list archive
-
duplicity-team team
-
Mailing list archive
-
Message #05428
[Merge] lp:~thomas-ross/duplicity/b2-hide-files into lp:duplicity
Thomas Ross has proposed merging lp:~thomas-ross/duplicity/b2-hide-files into lp:duplicity.
Commit message:
Add option --b2-hide-files that causes the B2 backend to hide files instead of deleting them
Requested reviews:
duplicity-team (duplicity-team)
Related bugs:
Bug #1875529 in Duplicity: "Support hiding instead of deleting for Backblaze B2 backend"
https://bugs.launchpad.net/duplicity/+bug/1875529
For more details, see:
https://code.launchpad.net/~thomas-ross/duplicity/b2-hide-files/+merge/383164
--
Your team duplicity-team is requested to review the proposed merge of lp:~thomas-ross/duplicity/b2-hide-files into lp:duplicity.
=== modified file 'bin/duplicity.1'
--- bin/duplicity.1 2020-03-19 20:33:09 +0000
+++ bin/duplicity.1 2020-04-29 18:59:27 +0000
@@ -348,6 +348,11 @@
.BR cloudfiles .
.TP
+.BI --b2-hide-files
+Causes Duplicity to hide files in B2 instead of deleting them. Useful in
+combination with B2's lifecycle rules.
+
+.TP
.BI --compare-data
Enable data comparison of regular files on action verify. This conducts a
verify as described above to verify the integrity of the backup archives,
=== modified file 'duplicity/backends/b2backend.py'
--- duplicity/backends/b2backend.py 2020-03-31 21:43:45 +0000
+++ duplicity/backends/b2backend.py 2020-04-29 18:59:27 +0000
@@ -32,6 +32,7 @@
from duplicity import log
from duplicity import progress
from duplicity import util
+from duplicity import config
from duplicity.errors import BackendException, FatalBackendException
import duplicity.backend
@@ -143,9 +144,14 @@
u"""
Delete filename from remote server
"""
- log.Log(u"Delete: %s" % self.path + util.fsdecode(filename), log.INFO)
- file_version_info = self.file_info(quote_plus(self.path + util.fsdecode(filename), u'/'))
- self.bucket.delete_file_version(file_version_info.id_, file_version_info.file_name)
+ full_filename = self.path + util.fsdecode(filename)
+ log.Log(u"Delete: %s" % full_filename, log.INFO)
+
+ if config.b2_hide_files:
+ self.bucket.hide_file(full_filename)
+ else:
+ file_version_info = self.file_info(quote_plus(full_filename, u'/'))
+ self.bucket.delete_file_version(file_version_info.id_, file_version_info.file_name)
def _query(self, filename):
u"""
=== modified file 'duplicity/commandline.py'
--- duplicity/commandline.py 2020-03-21 20:50:35 +0000
+++ duplicity/commandline.py 2020-04-29 18:59:27 +0000
@@ -581,6 +581,9 @@
# allow the user to switch cloudfiles backend
parser.add_option(u"--cf-backend", metavar=_(u"pyrax|cloudfiles"))
+ # Option that causes the B2 backend to hide files instead of deleting them
+ parser.add_option(u"--b2-hide-files", action=u"store_true")
+
# If set, use short (< 30 char) filenames for all the remote files.
parser.add_option(u"--short-filenames", action=u"callback",
dest=u"short_filenames",
=== modified file 'duplicity/config.py'
--- duplicity/config.py 2020-03-21 20:50:35 +0000
+++ duplicity/config.py 2020-04-29 18:59:27 +0000
@@ -291,6 +291,9 @@
# default cf backend is pyrax
cf_backend = u"pyrax"
+# default to fully deleting files in b2
+b2_hide_files = False
+
# HTTPS ssl options (currently only webdav, lftp)
ssl_cacert_file = None
ssl_cacert_path = None
Follow ups