← Back to team overview

duplicity-team team mailing list archive

[Merge] lp:~mterry/duplicity/report-encrypted-chains into lp:duplicity

 

Michael Terry has proposed merging lp:~mterry/duplicity/report-encrypted-chains into lp:duplicity.

Requested reviews:
  duplicity-team (duplicity-team)

For more details, see:
https://code.launchpad.net/~mterry/duplicity/report-encrypted-chains/+merge/68885

For Deja Dup, I'm trying to support automatically detecting whether a backup is encrypted or not.  This is useful especially when restoring so we can ask one less question of the user.

There are several ways to do this, none of which need work on top of today's duplicity:

1) I could watch for the debug message that prints the list of files we found on the backend and look at the suffixes.  (WORK NEEDED: make that message machine-parsable; DISADVANTAGES: suffix information would need to be kept in Deja Dup)

2) I could have duplicity not return collection-status information for mismatched encryption states (e.g. if --no-encryption is passed, don't return any encrypted sets in the results).  Then Deja Dup would just run collection-status at most twice to see which one returned results.  (WORK NEEDED: make duplicity ignore mismached states, which is a trivial two-liner; DISADVANTAGES: seems less useful than it could be for human users and requires at most two passes for machine users)

3) I could have duplicity report in collection-status output whether a backup set is encrypted (but still return results even in a mismatch).  (WORK NEEDED: make duplicity note and report encryption status for backup sets; DISADVANTAGES: none?)

So this branch implements #3.  But let me know if you prefer the others and I can whip them up.
-- 
https://code.launchpad.net/~mterry/duplicity/report-encrypted-chains/+merge/68885
Your team duplicity-team is requested to review the proposed merge of lp:~mterry/duplicity/report-encrypted-chains into lp:duplicity.
=== modified file 'duplicity/collections.py'
--- duplicity/collections.py	2011-06-17 18:22:28 +0000
+++ duplicity/collections.py	2011-07-22 17:41:23 +0000
@@ -52,6 +52,7 @@
         self.start_time = None                      # will be set if inc
         self.end_time = None                        # will be set if inc
         self.partial = False                        # true if a partial backup
+        self.encrypted = False                      # true if an encrypted backup
 
     def is_complete(self):
         """
@@ -108,6 +109,7 @@
         self.end_time = pr.end_time
         self.time = pr.time
         self.partial = pr.partial
+        self.encrypted = bool(pr.encrypted)
         self.info_set = True
 
     def set_manifest(self, remote_filename):
@@ -366,7 +368,8 @@
             else:
                 type = "inc"
                 time = s.end_time
-            l.append("%s%s %s %d" % (prefix, type, dup_time.timetostring(time), (len(s)),))
+            enc = "enc" if s.encrypted else "noenc"
+            l.append("%s%s %s %d %s" % (prefix, type, dup_time.timetostring(time), (len(s)), enc))
         return l
 
     def __str__(self):


Follow ups