Merge pull request #31641 from danbst/patch-13

mysql module: fix flaky check
This commit is contained in:
Franz Pletz 2017-11-16 00:07:55 +01:00 committed by GitHub
commit 903a7e2f94
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 2 deletions

View File

@ -7,6 +7,11 @@ let
cfg = config.services.mysql; cfg = config.services.mysql;
mysql = cfg.package; mysql = cfg.package;
isMariaDB =
let
pName = _p: (builtins.parseDrvName (_p.name)).name;
in pName mysql == pName pkgs.mariadb;
atLeast55 = versionAtLeast mysql.mysqlVersion "5.5"; atLeast55 = versionAtLeast mysql.mysqlVersion "5.5";
@ -59,7 +64,7 @@ in
type = types.package; type = types.package;
example = literalExample "pkgs.mysql"; example = literalExample "pkgs.mysql";
description = " description = "
Which MySQL derivation to use. Which MySQL derivation to use. MariaDB packages are supported too.
"; ";
}; };
@ -360,7 +365,7 @@ in
${concatMapStrings (user: ${concatMapStrings (user:
'' ''
( echo "CREATE USER IF NOT EXISTS '${user.name}'@'localhost' IDENTIFIED WITH ${if mysql == pkgs.mariadb then "unix_socket" else "auth_socket"};" ( echo "CREATE USER IF NOT EXISTS '${user.name}'@'localhost' IDENTIFIED WITH ${if isMariaDB then "unix_socket" else "auth_socket"};"
${concatStringsSep "\n" (mapAttrsToList (database: permission: '' ${concatStringsSep "\n" (mapAttrsToList (database: permission: ''
echo "GRANT ${permission} ON ${database} TO '${user.name}'@'localhost';" echo "GRANT ${permission} ON ${database} TO '${user.name}'@'localhost';"
'') user.ensurePermissions)} '') user.ensurePermissions)}