Merge lp:~andrea.corbellini/ubuntuone-client/fix-1068006 into lp:ubuntuone-client

Proposed by Andrea Corbellini
Status: Rejected
Rejected by: dobey
Proposed branch: lp:~andrea.corbellini/ubuntuone-client/fix-1068006
Merge into: lp:ubuntuone-client
Diff against target: 63 lines (+14/-11)
2 files modified
bin/ubuntuone-launch (+6/-11)
ubuntuone/syncdaemon/config.py (+8/-0)
To merge this branch: bzr merge lp:~andrea.corbellini/ubuntuone-client/fix-1068006
Reviewer Review Type Date Requested Status
dobey (community) Needs Fixing
Review via email: mp+139928@code.launchpad.net

Description of the change

This is an attempt to fix bug #1068006.

My solution is to use ubuntuone.syncdaemon.config inside ubuntuone-launch. An alternative solution would be to construct an ad-hoc config parser for ubuntuone-launch that just looks for the value of root_dir, without parsing the whole file. This would be a bit faster, but way too complex to maintain, in my opinion.

To post a comment you must log in.
Revision history for this message
dobey (dobey) wrote :

This will need tests for the added methods in ubuntuone.syncdaemon.config. They'll go in tests/syncdaemon/test_config.py where the tests for the other methods in that module are.

Also, please use bzr commit --fixes=lp:1068006 to link the bug into the branch history. The linking of bugs/branches in the LP web interface is not functionally the same. Thanks.

review: Needs Fixing
Revision history for this message
dobey (dobey) wrote :

Andrea, can you please add the necessary tests, and use bzr commit --fixes to link the bug? Thanks.

Revision history for this message
dobey (dobey) wrote :

Rejecting, due to no response.

Revision history for this message
Andrea Corbellini (andrea.corbellini) wrote :

Sorry, I've been busy. I will resubmit as soon as I write the tests. Thanks for your patience!

Unmerged revisions

1365. By Andrea Corbellini

ubuntuone-launch now checks the value of root_dir instead of guessing

1364. By Andrea Corbellini

Add get/set methods for root_dir in the _Config class

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'bin/ubuntuone-launch'
2--- bin/ubuntuone-launch 2012-10-15 20:12:29 +0000
3+++ bin/ubuntuone-launch 2012-12-14 15:31:21 +0000
4@@ -52,14 +52,15 @@
5 """
6 import sys
7 import os
8-
9-U1ROOT = os.path.expanduser('~/Ubuntu One/')
10+from ubuntuone.syncdaemon.config import get_user_config
11
12 if __name__ == '__main__':
13 # this check is done early to speed up startup on people who are not
14- # (yet) using the service (this way avoids all the imports).
15- if not os.path.isdir(U1ROOT):
16- # no directory, just quit
17+ # (yet) using the service (this way avoids most of the imports).
18+ config = get_user_config()
19+ if (not config.get_files_sync_enabled() or
20+ not os.path.isdir(config.get_root_dir())):
21+ # SD disabled by user or no directory, just quit
22 sys.exit(1)
23
24 import dbus
25@@ -68,7 +69,6 @@
26 from gi.repository import GLib
27 from twisted.internet import defer
28
29-from ubuntuone.syncdaemon.config import get_user_config
30 from ubuntuone.platform.tools import SyncDaemonTool, is_already_running
31
32
33@@ -77,11 +77,6 @@
34 """Start syncdaemon and ask it to connect, if possible."""
35 GLib.set_application_name("ubuntuone-launch")
36
37- files_sync_enabled = get_user_config().get_files_sync_enabled()
38- if not files_sync_enabled:
39- # SD will not start (has been disabled by user)
40- raise RuntimeError("File sync is disabled")
41-
42 loop = DBusGMainLoop(set_as_default=True)
43 bus = dbus.SessionBus(mainloop=loop)
44 sync_daemon_tool = SyncDaemonTool(bus)
45
46=== modified file 'ubuntuone/syncdaemon/config.py'
47--- ubuntuone/syncdaemon/config.py 2012-10-17 06:14:38 +0000
48+++ ubuntuone/syncdaemon/config.py 2012-12-14 15:31:21 +0000
49@@ -413,6 +413,14 @@
50 self.set(MAIN, 'use_trash', str(enabled))
51
52 @requires_section(MAIN)
53+ def get_root_dir(self):
54+ return self.get_parsed(MAIN, 'root_dir')
55+
56+ @requires_section(MAIN)
57+ def set_root_dir(self, value):
58+ self.set(MAIN, 'root_dir', str(value))
59+
60+ @requires_section(MAIN)
61 def get_simult_transfers(self):
62 """Get the simultaneous transfers value."""
63 return self.get_parsed(MAIN, 'simult_transfers')

Subscribers

People subscribed via source and target branches