From 160b4e6e05e2cb9a2fa4ed6de203b4be754e4a83 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20M=C3=A4kel=C3=A4?= Date: Thu, 7 Mar 2019 04:33:54 +0200 Subject: [PATCH 1/2] MXS-2368: Fix reading of non-tty input The password input only worked if stdin was a TTY. This was caused by the fact that the readline-sync library only worked for TTYs. --- maxctrl/lib/common.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/maxctrl/lib/common.js b/maxctrl/lib/common.js index 379508d42..4003ac19c 100644 --- a/maxctrl/lib/common.js +++ b/maxctrl/lib/common.js @@ -50,9 +50,14 @@ module.exports = function() { // No password given, ask it from the command line if (argv.p == '') { - argv.p = readlineSync.question('Enter password: ', { - hideEchoBack: true - }) + if (process.stdin.isTTY) { + argv.p = readlineSync.question('Enter password: ', { + hideEchoBack: true + }) + } else { + var line = fs.readFileSync(0) + argv.p = line.toString().trim() + } } // Split the hostnames, separated by commas From c132125d555aff552f41cb0f609fa61322e7d11b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20M=C3=A4kel=C3=A4?= Date: Sat, 9 Mar 2019 17:16:37 +0200 Subject: [PATCH 2/2] Fix log truncation Syslog wasn't truncated which caused massive disk space usage when the full test set was run. --- maxscale-system-test/mariadb_nodes.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/maxscale-system-test/mariadb_nodes.cpp b/maxscale-system-test/mariadb_nodes.cpp index 464fb4e1d..ffd314f64 100644 --- a/maxscale-system-test/mariadb_nodes.cpp +++ b/maxscale-system-test/mariadb_nodes.cpp @@ -1146,13 +1146,13 @@ int Mariadb_nodes::truncate_mariadb_logs() int local_result = 0; for (int node = 0; node < N; node++) { - char sys[1024]; if (strcmp(IP[node], "127.0.0.1") != 0) { - sprintf(sys, - "ssh -i %s -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -o LogLevel=quiet %s@%s 'sudo truncate /var/lib/mysql/*.err --size 0;sudo rm -f /etc/my.cnf.d/binlog_enc*\' &", - sshkey[node], access_user[node], IP[node]); - local_result += system(sys); + local_result += ssh_node_f(node, true, + "truncate -s 0 /var/lib/mysql/*.err;" + "truncate -s 0 /var/log/syslog;" + "truncate -s 0 /var/log/messages;" + "rm -f /etc/my.cnf.d/binlog_enc*;"); } } return local_result;