From 42c1b95b7c4f57527c5bed3e04aa5cdd7c369f22 Mon Sep 17 00:00:00 2001 From: Bruno Windels Date: Tue, 18 Sep 2018 10:17:03 +0200 Subject: [PATCH] spit out logs for creating REST users to figure out what is going on with the CI server --- src/rest/creator.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/rest/creator.js b/src/rest/creator.js index 84b1fbc70a..cc87134108 100644 --- a/src/rest/creator.js +++ b/src/rest/creator.js @@ -35,11 +35,12 @@ module.exports = class RestSessionCreator { async createSession(username, password) { await this._register(username, password); + console.log(` * created REST user ${username} ... done`); const authResult = await this._authenticate(username, password); return new RestSession(authResult); } - _register(username, password) { + async _register(username, password) { const registerArgs = [ '-c homeserver.yaml', `-u ${username}`, @@ -55,11 +56,14 @@ module.exports = class RestSessionCreator { registerCmd ].join(';'); - return exec(allCmds, {cwd: this.cwd, encoding: 'utf-8'}).catch((result) => { + try { + await exec(allCmds, {cwd: this.cwd, encoding: 'utf-8'}); + } catch (result) { const lines = result.stdout.trim().split('\n'); const failureReason = lines[lines.length - 1]; - throw new Error(`creating user ${username} failed: ${failureReason}`); - }); + const logs = (await exec("tail -n 100 synapse/installations/consent/homeserver.log")).stdout; + throw new Error(`creating user ${username} failed: ${failureReason}, synapse logs:\n${logs}`); + } } async _authenticate(username, password) {