Commit a416a803 authored by Anael Beutot's avatar Anael Beutot
Browse files

Fix plugin loading at startup

parent 42406f11
Loading
Loading
Loading
Loading
+7 −2
Original line number Diff line number Diff line
@@ -233,7 +233,7 @@ class Handler(BasePlugin):
                def plugins_install():
                    for p in to_load:
                        try:
                            self.plugin_install(self.main.rpc.rpc_con, None, p)
                            self.plugin_install(self.main.rpc_con.rpc, None, p)
                        except Exception:
                            logger.exception('Error while loading plugin %s', p)
                        else:
@@ -416,6 +416,11 @@ class Handler(BasePlugin):

    @pass_connection
    def plugin_install(self, conn, sha1, name):
        """
        :param conn: RPC connection
        :param sha1: sha1 string or None (get the latest)
        :param name: plugin name
        """
        # check if plugin is not already loaded and upgrade it if the sha1 hash
        # has changed:
        if name in self.plugins:
@@ -427,7 +432,7 @@ class Handler(BasePlugin):

        # get plugin from server:
        sha1_get, content = conn.call('plugin_get', name)
        if sha1 != sha1_get:
        if sha1 is not None and sha1 != sha1_get:
            raise RuntimeError('Requested sha1 is not available on the server')

        # load the plugin: