Merge lp:~mterry/duplicity/gio-questions into lp:duplicity/0.6

Proposed by Michael Terry
Status: Merged
Merged at revision: 852
Proposed branch: lp:~mterry/duplicity/gio-questions
Merge into: lp:duplicity/0.6
Diff against target: 29 lines (+13/-2)
1 file modified
duplicity/backends/giobackend.py (+13/-2)
To merge this branch: bzr merge lp:~mterry/duplicity/gio-questions
Reviewer Review Type Date Requested Status
duplicity-team Pending
Review via email: mp+98262@code.launchpad.net

Description of the change

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.

To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'duplicity/backends/giobackend.py'
2--- duplicity/backends/giobackend.py 2011-08-29 00:07:48 +0000
3+++ duplicity/backends/giobackend.py 2012-03-19 19:08:20 +0000
4@@ -55,12 +55,23 @@
5 def __init__(self, backend):
6 gio.MountOperation.__init__(self)
7 self.backend = backend
8- self.connect('ask-password', self.ask_password)
9+ self.connect('ask-password', self.ask_password_cb)
10+ self.connect('ask-question', self.ask_question_cb)
11
12- def ask_password(self, *args, **kwargs):
13+ def ask_password_cb(self, *args, **kwargs):
14 self.set_password(self.backend.get_password())
15 self.reply(gio.MOUNT_OPERATION_HANDLED)
16
17+ def ask_question_cb(self, *args, **kwargs):
18+ # Obviously just always answering with the first choice is a naive
19+ # approach. But there's no easy way to allow for answering questions
20+ # in duplicity's typical run-from-cron mode with environment variables.
21+ # And only a couple gvfs backends ask questions: 'sftp' does about
22+ # new hosts and 'afc' does if the device is locked. 0 should be a
23+ # safe choice.
24+ self.set_choice(0)
25+ self.reply(gio.MOUNT_OPERATION_HANDLED)
26+
27 class GIOBackend(duplicity.backend.Backend):
28 """Use this backend when saving to a GIO URL.
29 This is a bit of a meta-backend, in that it can handle multiple schemas.

Subscribers

People subscribed via source and target branches

to all changes: