nix: warn on the ignored swarm-ui switches instead of failing eval
deploy.swarm-ui.enable and swarm.ui.enable are declared again as nullOr bool, default null, and do nothing. Setting either adds an eval warning that swarm-ui now runs wherever swarm-controller runs.
This commit is contained in:
parent
f9954b91b4
commit
44346d8c6c
3 changed files with 36 additions and 33 deletions
|
|
@ -75,8 +75,8 @@ let
|
|||
# saying "it is not there" would hold just as well if it were never there.
|
||||
# Package stubbed per this file's header: the vhost roots at it.
|
||||
#
|
||||
# Also sets both removed UI switches to `false`: the vhost must render
|
||||
# regardless, and each must fail evaluation through its assertion. Neither
|
||||
# Also sets both ignored UI switches to `false`: the vhost must render
|
||||
# regardless, and each must evaluate and warn. Neither
|
||||
# is read anywhere else, so they change nothing the other arms see.
|
||||
swarmUiHere = hive {
|
||||
deploy.swarm-controller.enable = true;
|
||||
|
|
@ -245,24 +245,23 @@ let
|
|||
ok = swarmUiHere.services.nginx.virtualHosts ? "t.local";
|
||||
}
|
||||
{
|
||||
# Control: `swarmServicesHere` sets neither removed switch.
|
||||
name = "a definition of a removed swarm UI switch fails evaluation, naming the option and the controller";
|
||||
# Control: `swarmServicesHere` sets neither ignored switch.
|
||||
name = "a definition of an ignored swarm UI switch evaluates and warns, naming the option and the controller";
|
||||
ok =
|
||||
let
|
||||
refused =
|
||||
warned =
|
||||
m: path:
|
||||
lib.any (
|
||||
a:
|
||||
!a.assertion
|
||||
&& lib.hasInfix "services.hyperhive.${path}" a.message
|
||||
&& lib.hasInfix "swarm-ui now runs wherever swarm-controller runs" a.message
|
||||
) m.assertions;
|
||||
w:
|
||||
lib.hasInfix "services.hyperhive.${path} no longer has any effect" w
|
||||
&& lib.hasInfix "swarm-ui now runs wherever swarm-controller runs" w
|
||||
) m.warnings;
|
||||
paths = [
|
||||
"deploy.swarm-ui.enable"
|
||||
"swarm.ui.enable"
|
||||
];
|
||||
in
|
||||
lib.all (refused swarmUiHere) paths && !(lib.any (refused swarmServicesHere) paths);
|
||||
lib.all (warned swarmUiHere) paths && !(lib.any (warned swarmServicesHere) paths);
|
||||
}
|
||||
{
|
||||
# The swarm-services toggle enables them explicitly, from its own
|
||||
|
|
|
|||
Loading…
Reference in a new issue