Merge lp:~dobey/ubuntuone-client/better-noconnect into lp:ubuntuone-client

Proposed by dobey
Status: Merged
Approved by: dobey
Approved revision: 1408
Merged at revision: 1405
Proposed branch: lp:~dobey/ubuntuone-client/better-noconnect
Merge into: lp:ubuntuone-client
Diff against target: 139 lines (+51/-53)
2 files modified
ubuntuone/syncdaemon/interaction_interfaces.py (+6/-0)
ubuntuone/syncdaemon/main.py (+45/-53)
To merge this branch: bzr merge lp:~dobey/ubuntuone-client/better-noconnect
Reviewer Review Type Date Requested Status
Facundo Batista (community) Approve
Review via email: mp+220698@code.launchpad.net

Commit message

Move the date check into the connect method.

Description of the change

This reverts the changes to main.py from the previous revision, and moves the date check to the connect() method. The previous change does not actually cause the process to exit and results in any code using the DBus API hanging around waiting for the request to time out, for a very long time. Instead, we just always block connections, and allow the syncdaemon to start normally otherwise, so that ubuntuone-control-panel, u1sdtool, and Nautilus will continue working normally without problems (outside of the intent of never connecting to the server and not synchronizing files).

To post a comment you must log in.
1407. By dobey

Need to import datetime here.

1408. By dobey

Fix the logic in the date check.

Revision history for this message
Facundo Batista (facundo) wrote :

Nice!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'ubuntuone/syncdaemon/interaction_interfaces.py'
2--- ubuntuone/syncdaemon/interaction_interfaces.py 2013-01-22 20:03:12 +0000
3+++ ubuntuone/syncdaemon/interaction_interfaces.py 2014-05-22 19:23:08 +0000
4@@ -38,6 +38,7 @@
5 """
6
7 import collections
8+import datetime
9 import logging
10 import os
11 import uuid
12@@ -1247,6 +1248,11 @@
13 for login/registration, only already existent credentials will be used.
14
15 """
16+ # Avoid connecting after June 1.
17+ end_date = datetime.date(2014, 6, 1)
18+ if datetime.date.today() >= end_date:
19+ return
20+
21 if self.oauth_credentials is not None:
22 logger.debug('connect: oauth credentials were given by parameter.')
23 ckey = csecret = key = secret = None
24
25=== modified file 'ubuntuone/syncdaemon/main.py'
26--- ubuntuone/syncdaemon/main.py 2014-04-10 19:58:12 +0000
27+++ ubuntuone/syncdaemon/main.py 2014-05-22 19:23:08 +0000
28@@ -31,7 +31,6 @@
29 import logging
30 import os
31 import sys
32-import datetime
33
34 from dirspec.utils import user_home
35 from twisted.internet import defer, reactor, task
36@@ -107,58 +106,51 @@
37 if not throttling_enabled:
38 throttling_enabled = user_config.get_throttling()
39
40- end_date = datetime.date(2014, 6, 1)
41- if datetime.date.today() < end_date:
42- self.logger.info("Starting Ubuntu One client version %s",
43- clientdefs.VERSION)
44- self.logger.info("Using %r as root dir", self.root_dir)
45- self.logger.info("Using %r as data dir", self.data_dir)
46- self.logger.info("Using %r as shares root dir", self.shares_dir)
47- self.db = tritcask.Tritcask(tritcask_dir)
48- self.vm = volume_manager.VolumeManager(self)
49- self.fs = filesystem_manager.FileSystemManager(
50- data_dir, partials_dir, self.vm, self.db)
51- self.event_q = event_queue.EventQueue(
52- self.fs, ignore_files, monitor_class=monitor_class)
53- self.fs.register_eq(self.event_q)
54-
55- # subscribe VM to EQ, to be unsubscribed in shutdown
56- self.event_q.subscribe(self.vm)
57- self.vm.init_root()
58-
59- # we don't have the oauth tokens yet, we 'll get them later
60- self.action_q = action_queue.ActionQueue(self.event_q, self,
61- host, port,
62- dns_srv, ssl,
63- disable_ssl_verify,
64- read_limit, write_limit,
65- throttling_enabled)
66- self.hash_q = hash_queue.HashQueue(self.event_q)
67- events_nanny.DownloadFinishedNanny(self.fs, self.event_q,
68- self.hash_q)
69-
70- # call StateManager after having AQ
71- self.state_manager = StateManager(self, handshake_timeout)
72-
73- self.sync = sync.Sync(self)
74- self.lr = local_rescan.LocalRescan(self.vm, self.fs,
75- self.event_q, self.action_q)
76-
77- self.external = SyncdaemonService(main=self,
78- send_events=broadcast_events)
79- self.external.oauth_credentials = oauth_credentials
80- if user_config.get_autoconnect():
81- self.external.connect(autoconnecting=True)
82-
83- self.status_listener = None
84- self.start_status_listener()
85-
86- self.mark = task.LoopingCall(self.log_mark)
87- self.mark.start(mark_interval)
88- else:
89- if reactor.running:
90- reactor.stop()
91- sys.exit(0)
92+ self.logger.info("Starting Ubuntu One client version %s",
93+ clientdefs.VERSION)
94+ self.logger.info("Using %r as root dir", self.root_dir)
95+ self.logger.info("Using %r as data dir", self.data_dir)
96+ self.logger.info("Using %r as shares root dir", self.shares_dir)
97+ self.db = tritcask.Tritcask(tritcask_dir)
98+ self.vm = volume_manager.VolumeManager(self)
99+ self.fs = filesystem_manager.FileSystemManager(
100+ data_dir, partials_dir, self.vm, self.db)
101+ self.event_q = event_queue.EventQueue(self.fs, ignore_files,
102+ monitor_class=monitor_class)
103+ self.fs.register_eq(self.event_q)
104+
105+ # subscribe VM to EQ, to be unsubscribed in shutdown
106+ self.event_q.subscribe(self.vm)
107+ self.vm.init_root()
108+
109+ # we don't have the oauth tokens yet, we 'll get them later
110+ self.action_q = action_queue.ActionQueue(self.event_q, self,
111+ host, port,
112+ dns_srv, ssl,
113+ disable_ssl_verify,
114+ read_limit, write_limit,
115+ throttling_enabled)
116+ self.hash_q = hash_queue.HashQueue(self.event_q)
117+ events_nanny.DownloadFinishedNanny(self.fs, self.event_q, self.hash_q)
118+
119+ # call StateManager after having AQ
120+ self.state_manager = StateManager(self, handshake_timeout)
121+
122+ self.sync = sync.Sync(self)
123+ self.lr = local_rescan.LocalRescan(self.vm, self.fs,
124+ self.event_q, self.action_q)
125+
126+ self.external = SyncdaemonService(main=self,
127+ send_events=broadcast_events)
128+ self.external.oauth_credentials = oauth_credentials
129+ if user_config.get_autoconnect():
130+ self.external.connect(autoconnecting=True)
131+
132+ self.status_listener = None
133+ self.start_status_listener()
134+
135+ self.mark = task.LoopingCall(self.log_mark)
136+ self.mark.start(mark_interval)
137
138 def start_status_listener(self):
139 """Start the status listener if it is configured to start."""

Subscribers

People subscribed via source and target branches