~ubuntuone-control-tower/desktopcouch/trunk

« back to all changes in this revision

Viewing changes to desktopcouch/application/service.py

When running plugin code in initializing the desktopcouch service, do not call any functions that require that the service be running and answering DBus method calls. In particular, we already know the port couchdb is listening on, so do not ask for that via DBus client call, but explicity pass it into the plugin function calls. (LP: #706939)

Show diffs side-by-side

added added

removed removed

Lines of Context:
111
111
            if replication_runtime:
112
112
                replication.tear_down(*replication_runtime)
113
113
 
114
 
    def _start_server_main(self):
 
114
    def _start_server_main(self, couchdb_port):
115
115
        """Start server."""
116
116
        self._advertiser_factory(self._mainloop.stop, self._ctx)
117
117
        logging.debug("starting dbus main loop")
118
118
        try:
119
 
            load_plugins()
 
119
            load_plugins(couchdb_port)
120
120
            self._mainloop.run()
121
121
        finally:
122
122
            logging.debug("ending dbus main loop")
149
149
            if child_pid == 0:
150
150
                # Let's be the migration tool!
151
151
                self._logging("migration")
152
 
                time.sleep(60)  # wait a minute to let user finish
 
152
                self._sleep(60)  # wait a minute to let user finish
153
153
                try:
154
154
                    logging.info("Attempting update of design docs")
155
155
                    migration.update_design_documents(ctx=self._ctx)
166
166
                try:
167
167
                    set_up_logging("dbus")
168
168
                    # offer the dbus service
169
 
                    self._start_server_main()
 
169
                    self._start_server_main(couchdb_port)
170
170
                except:
171
171
                    logging.exception(      # pylint: disable=W0702
172
172
                        "uncaught exception makes us shut down.")