git.iko.soy/typeable/nixpkgs
on master help sign in
nixos: fix services.foundationdb.traceFormat for older server versions

This was a testing oversight that came from #61009 -- I forgot to test the new traceFormat option with older server versions while I was working on FDB 6.1. Since trace_format is only available in 6.1+, emitting it unconditionally caused older versions of the database fail to start, reporting an error. We simply gate it behind a version check instead, and assert the format is always XML on older versions. This avoids the case where the user has an old version, changes traceFormat willingly, and then is confused by why it didn't work. As reported by @TimothyKlim in the comments on commit c55b9236f0f208a8689e400ddbea52858c923372. See https://github.com/NixOS/nixpkgs/commit/c55b9236f0f208a8689e400ddbea52858c923372#r33566132 Signed-off-by: Austin Seipp <aseipp@pobox.com>

commite2bbc6fb469a43384b593f3018920a0f2a090a5e authorAustin Seipp <aseipp@pobox.com> dateThu 16 May 2019, 15:05 (8 years ago) parent9aa6837
1 file changed+12
nixos/modules/services/databases/foundationdb.nix+12
nixos/modules/services/databases/foundationdb.nix+12
@@ -35,7 +35,10 @@ let
3535 ${optionalString (cfg.class != null) "class = ${cfg.class}"}
3636 memory = ${cfg.memory}
3737 storage_memory = ${cfg.storageMemory}
38+
39+ ${optionalString (lib.versionAtLeast cfg.package.version "6.1") ''
3840 trace_format = ${cfg.traceFormat}
41+ ''}
3942
4043 ${optionalString (cfg.tls != null) ''
4144 tls_plugin = ${pkg}/libexec/plugins/FDBLibTLS.so
@@ -327,6 +330,15 @@ in
327330 };
328331
329332 config = mkIf cfg.enable {
333+ assertions = [
334+ { assertion = lib.versionOlder cfg.package.version "6.1" -> cfg.traceFormat == "xml";
335+ message = ''
336+ Versions of FoundationDB before 6.1 do not support configurable trace formats (only XML is supported).
337+ This option has no effect for version '' + cfg.package.version + '', and enabling it is an error.
338+ '';
339+ }
340+ ];
341+
330342 environment.systemPackages = [ pkg ];
331343
332344 users.users = optionalAttrs (cfg.user == "foundationdb") (singleton