← Back to team overview

duplicity-team team mailing list archive

[Merge] lp:~mterry/duplicity/gio-questions into lp:duplicity

 

Michael Terry has proposed merging lp:~mterry/duplicity/gio-questions into lp:duplicity.

Requested reviews:
  duplicity-team (duplicity-team)
Related bugs:
  Bug #588541 in Duplicity: "Connection failed, please check your password: Login dialog cancelled"
  https://bugs.launchpad.net/duplicity/+bug/588541

For more details, see:
https://code.launchpad.net/~mterry/duplicity/gio-questions/+merge/98262

If the gio backend wants to ask a question during its mount phase, it previously just aborted.  This branch allows it to continue, though not to make an intelligent answer.

Only two gvfs daemons ask questions: 'sftp' does for new hosts, and 'afc' does for locked device.  In both cases, the 0 choice is the 'just keep going' choice.
-- 
https://code.launchpad.net/~mterry/duplicity/gio-questions/+merge/98262
Your team duplicity-team is requested to review the proposed merge of lp:~mterry/duplicity/gio-questions into lp:duplicity.
=== modified file 'duplicity/backends/giobackend.py'
--- duplicity/backends/giobackend.py	2011-08-29 00:07:48 +0000
+++ duplicity/backends/giobackend.py	2012-03-19 19:08:20 +0000
@@ -55,12 +55,23 @@
     def __init__(self, backend):
         gio.MountOperation.__init__(self)
         self.backend = backend
-        self.connect('ask-password', self.ask_password)
+        self.connect('ask-password', self.ask_password_cb)
+        self.connect('ask-question', self.ask_question_cb)
 
-    def ask_password(self, *args, **kwargs):
+    def ask_password_cb(self, *args, **kwargs):
         self.set_password(self.backend.get_password())
         self.reply(gio.MOUNT_OPERATION_HANDLED)
 
+    def ask_question_cb(self, *args, **kwargs):
+        # Obviously just always answering with the first choice is a naive
+        # approach.  But there's no easy way to allow for answering questions
+        # in duplicity's typical run-from-cron mode with environment variables.
+        # And only a couple gvfs backends ask questions: 'sftp' does about
+        # new hosts and 'afc' does if the device is locked.  0 should be a
+        # safe choice.
+        self.set_choice(0)
+        self.reply(gio.MOUNT_OPERATION_HANDLED)
+
 class GIOBackend(duplicity.backend.Backend):
     """Use this backend when saving to a GIO URL.
        This is a bit of a meta-backend, in that it can handle multiple schemas.


Follow ups