Merge lp:~diegosarmentero/ubuntuone-client/syncdaemon-q into lp:ubuntuone-client
| Status: | Merged |
|---|---|
| Approved by: | Natalia Bidart on 2012-04-18 |
| Approved revision: | 1228 |
| Merged at revision: | 1225 |
| Proposed branch: | lp:~diegosarmentero/ubuntuone-client/syncdaemon-q |
| Merge into: | lp:ubuntuone-client |
| Diff against target: |
96 lines (+35/-1) 4 files modified
tests/platform/windows/test_tools.py (+27/-0) tests/syncdaemon/test_action_queue.py (+1/-0) ubuntuone/platform/tools/windows.py (+3/-1) ubuntuone/platform/windows/ipc_client.py (+4/-0) |
| To merge this branch: | bzr merge lp:~diegosarmentero/ubuntuone-client/syncdaemon-q |
| Related bugs: |
| Reviewer | Review Type | Date Requested | Status |
|---|---|---|---|
| Natalia Bidart | 2012-04-05 | Abstain on 2012-04-18 | |
| Alejandro J. Cura (community) | Approve on 2012-04-18 | ||
| Manuel de la Peña (community) | Approve on 2012-04-16 | ||
| dobey (community) | Approve on 2012-04-05 | ||
|
Review via email:
|
|||
Commit Message
- Avoid creating SyncDaemonTool if is not already running and the user wants to close it. (LP: #907479).
| Diego Sarmentero (diegosarmentero) wrote : | # |
We can't change the if to: "if running and options.quit:" because you will be leaving out a lot of options.
I can avoid printing the message and just exit if you think it's best, but i added the message to show some kind of feedback, so the user actually knows that something was executed.
| dobey (dobey) wrote : | # |
Approving, but we should probably fix that code to be more modular, so that all the options actually get handled separately in parsing. Right now, the logic is hard to separate when reading the diff/code.
| Natalia Bidart (nataliabidart) wrote : | # |
The creation of the sync_daemon_tool instance should not start the service, only the call to .start() should do it.
The changes applied to this branch are not incorrect, but I'm not comfortable with landing this, since we will be masquerading the real issue which is that the simple fact of creating an instance of SyncDaemonTool starts the service in windows (and it shouldn't).
| Diego Sarmentero (diegosarmentero) wrote : | # |
> The creation of the sync_daemon_tool instance should not start the service,
> only the call to .start() should do it.
>
> The changes applied to this branch are not incorrect, but I'm not comfortable
> with landing this, since we will be masquerading the real issue which is that
> the simple fact of creating an instance of SyncDaemonTool starts the service
> in windows (and it shouldn't).
The problem seems to be that in ubuntu_sso tcpactivation to get the active port, if sd is not running self._spawn_
def _spawn_
"""Start running the server process."""
# Without using close_fds=True, strange things happen
# with logging on windows. More information at
# http://
with open(r"
@defer.
def _do_get_
"""Get the port for the running instance, starting it if needed."""
is_running = yield self.is_
if not is_running:
yield self._wait_
I assume that this code (starting sd just to ask the port if running) is here for another reason, because it doesn't make sense with this issue, we wouldn't need to start sd to ask for the port, if we want to close it.
So, i'm not sure if the proper fix is the one already proposed, or we should close sd after asking for the port (which it doesn't have much sense to me).
| Diego Sarmentero (diegosarmentero) wrote : | # |
http://
These are the series of call that end up openning syncdaemon in the "_spawn_server" method.
-------
(u1sdtool)
@defer.
def main(options, args, stdout):
"""Entry point."""
sync_
-------
(ubuntuone-
class SyncDaemonTool(
"""Various utility methods to test/play with the SyncDaemon."""
def __init__(self, bus=None):
self.bus = bus
self.log = logger
self.proxy = source.
-------
(ubuntuone-
class SyncDaemonToolP
...
def __init__(self, bus=None):
self.client = UbuntuOneClient()
-------
(ubuntuone-
class UbuntuOneClient
"""Root object that provides access to all the remote objects."""
def __init__(self):
"""Create a new instance."""
...
@defer.
def connect(self):
"""Connect to the syncdaemon service."""
# pylint: disable=W0702
try:
# connect to the remote objects
...
-------
(ubuntuone-
@defer.
def ipc_client_
"""Connect the IPC client factory."""
ac = ActivationClien
port = yield ac.get_
-------
(ubuntu-
class ActivationClien
"""A client for tcp activation."""
# a classwide lock, so the server is started only once
lock = defer.DeferredL
@defer.
def _wait_server_
"""Wait till the server is active."""
for _ in xrange(
if is_running:
yield async_sleep(
raise ActivationTimeo
def _spawn_
"""Start running the server process."""
# Without using close_fds=True, strange things happen
# with logging on windows. More information at
# http://
@defer.
def _do_get_
"""Get the port for the running instance, starting it if needed."""
is_running = yield self.is_
if not is_running:
yield self._wait_
de...
| Diego Sarmentero (diegosarmentero) wrote : | # |
> The creation of the sync_daemon_tool instance should not start the service,
> only the call to .start() should do it.
>
> The changes applied to this branch are not incorrect, but I'm not comfortable
> with landing this, since we will be masquerading the real issue which is that
> the simple fact of creating an instance of SyncDaemonTool starts the service
> in windows (and it shouldn't).
Done!
| Alejandro J. Cura (alecu) wrote : | # |
self.wait_
| Diego Sarmentero (diegosarmentero) wrote : | # |
> self.wait_
> connection is done, so this branch won't work as expected.
Fixed.
The call to wait_connection(), was wrong, and unnecessary, because inside of the proper function call "call_after_
| Alejandro J. Cura (alecu) wrote : | # |
After some chat on IRC with nessita, it became clear that these areas of the branch need improvement:
<nessita> alecu: so, I'm not that happy with the definition of record_calls, since it also dismissed the arguments passed to the patched functions
<alecu> nessita, the point about record_calls is very valid: we should also be checking the arguments for those calls.
<nessita> alecu: also, I would advice using functools.partial for the pacth, and not defining a new record_calls
| Ubuntu One Auto Pilot (otto-pilot) wrote : | # |
Voting does not meet specified criteria. Required: Approve >= 1, Disapprove == 0, Needs Fixing == 0, Needs Information == 0, Resubmit == 0, Pending == 0. Got: 2 Approve, 2 Needs Fixing.


Do we really need to print the "not running" message here? I think just exiting cleanly would be fine, and it would change this block of code to just be "if running and options.quit:" which I think is better.