assertions: fix eval error when mailserver.stateVersion
is unset (null)
Eval does not stop on the first assertion failure it encouters. Instead, it tries to evaluate all assertions and returns with a list of those that failed. This means our very top `config.mailserver.stateVersion != null` assertion does not gate against any other assertions trying to compare null against an integer. The error prior to this commit can be reproduced by removing `mailserver.stateVersion = 999;` in tests/lib/config.nix and then trying to evaluate any of the tests: ~~~bash # nix eval --raw .#checks.x86_64-linux.internal-unstable error: … while evaluating the attribute 'outPath' at /nix/store/syvnmj3hhckkbncm94kfkbl76qsdqqj3-source/lib/customisation.nix:421:7: 420| drv.drvPath; 421| outPath = | ^ 422| assert condition; … while calling the 'getAttr' builtin at «internal»:1:500: (stack trace truncated; use '--show-trace' to show the full trace) error: cannot compare null with an integer ~~~
This commit is contained in:
parent
9d8caf5944
commit
6ef1eb9ce1
2 changed files with 3 additions and 3 deletions
|
@ -26,7 +26,7 @@
|
|||
lib.optionals (config.mailserver.ldap.enable && config.mailserver.mailDirectory != "/var/vmail")
|
||||
[
|
||||
{
|
||||
assertion = config.mailserver.stateVersion >= 2;
|
||||
assertion = config.mailserver.stateVersion != null -> config.mailserver.stateVersion >= 2;
|
||||
message = ''
|
||||
Issue: The dovecot homedir for LDAP users was previously not respecting `mailserver.mailDirectory`.
|
||||
Remediation:
|
||||
|
@ -40,7 +40,7 @@
|
|||
]
|
||||
++ [
|
||||
{
|
||||
assertion = config.mailserver.stateVersion >= 3;
|
||||
assertion = config.mailserver.stateVersion != null -> config.mailserver.stateVersion >= 3;
|
||||
message = ''
|
||||
Issue: The dovecot mail location for all users has changed and need to be migrated.
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue