From b7907dc1ae3097293e1bb05d2a0c679b0959dea3 Mon Sep 17 00:00:00 2001 From: Thorsten Weber Date: Wed, 3 Jul 2019 00:35:35 +0200 Subject: [PATCH 1/2] fix mysql test after #63862 introduced non-functional initialScript --- nixos/tests/mysql.nix | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/nixos/tests/mysql.nix b/nixos/tests/mysql.nix index f712357b9ff..abf9606aa36 100644 --- a/nixos/tests/mysql.nix +++ b/nixos/tests/mysql.nix @@ -29,10 +29,10 @@ import ./make-test.nix ({ pkgs, ...} : { users.users.testuser = { }; services.mysql.enable = true; services.mysql.initialScript = pkgs.writeText "mariadb-init.sql" '' - echo "ALTER USER root@localhost IDENTIFIED WITH unix_socket;" - echo "DELETE FROM mysql.user WHERE password = ''' AND plugin = ''';" - echo "DELETE FROM mysql.user WHERE user = ''';" - echo "FLUSH PRIVILEGES;" + ALTER USER root@localhost IDENTIFIED WITH unix_socket; + DELETE FROM mysql.user WHERE password = ''' AND plugin = '''; + DELETE FROM mysql.user WHERE user = '''; + FLUSH PRIVILEGES; ''; services.mysql.ensureDatabases = [ "testdb" ]; services.mysql.ensureUsers = [{ From 46ea3ebc19bfc056760841f073b08c3e259c2190 Mon Sep 17 00:00:00 2001 From: Thorsten Weber Date: Wed, 3 Jul 2019 08:50:21 +0200 Subject: [PATCH 2/2] nixos/mysql: make ExecStartPost script fail on error --- nixos/modules/services/databases/mysql.nix | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/nixos/modules/services/databases/mysql.nix b/nixos/modules/services/databases/mysql.nix index 177e742d65e..df74cfc9a26 100644 --- a/nixos/modules/services/databases/mysql.nix +++ b/nixos/modules/services/databases/mysql.nix @@ -319,7 +319,9 @@ in ExecStart = "${mysql}/bin/mysqld --defaults-file=/etc/my.cnf ${mysqldOptions} $_WSREP_NEW_CLUSTER $_WSREP_START_POSITION"; ExecStartPost = let - setupScript = pkgs.writeShellScript "mysql-setup" '' + setupScript = pkgs.writeScript "mysql-setup" '' + #!${pkgs.runtimeShell} -e + ${optionalString (!hasNotify) '' # Wait until the MySQL server is available for use count=0