Merge pull request 'inventory: remove role.settings' (#5579) from inventory-fixes-2 into main

Reviewed-on: https://git.clan.lol/clan/clan-core/pulls/5579
This commit is contained in:
hsjobeki
2025-10-19 16:54:31 +00:00
3 changed files with 16 additions and 26 deletions

View File

@@ -97,11 +97,6 @@ let
inherit (v) settings;
}).config;
}) role.machines;
settings =
(evalMachineSettings {
inherit roleName instanceName;
inherit (role) settings;
}).config;
}) instance.roles;
in
{
@@ -446,15 +441,12 @@ in
};
# ...
};
settings = {
timeout = 30;
};
};
# ...
};
```
- `settings`: The settings of the role, as defined in `instances`
- `settings`: The settings of the current machine, as defined in `instances`
```nix
{
timeout = 30;

View File

@@ -123,9 +123,6 @@ in
};
expected = {
instanceName = "instance_foo";
settings = {
timeout = "foo-peer-jon";
};
machine = {
name = "jon";
roles = [
@@ -137,12 +134,9 @@ in
controller = {
machines = {
jon = {
settings = {
};
settings = { };
};
};
settings = {
};
};
peer = {
machines = {
@@ -152,11 +146,11 @@ in
};
};
};
settings = {
timeout = "foo-peer";
};
};
};
settings = {
timeout = "foo-peer-jon";
};
};
};

View File

@@ -70,8 +70,6 @@ let
roles.peer.tags.all = { };
};
};
filterInternals = lib.filterAttrs (n: _v: !lib.hasPrefix "_" n);
in
{
@@ -89,7 +87,8 @@ in
# instance = instance_foo
# roles = peer
# machines = jon
specificMachineSettings = filterInternals res.importedModulesEvaluated.self-A.result.allMachines.jon.passthru.instances.instance_foo.roles.peer.machines.jon.settings;
specificMachineSettings =
res.importedModulesEvaluated.self-A.result.allMachines.jon.passthru.instances.instance_foo.roles.peer.machines.jon.settings;
hasRoleSettings =
res.importedModulesEvaluated.self-A.result.allMachines.jon.passthru.instances.instance_foo.roles.peer
@@ -100,16 +99,21 @@ in
# instance = instance_foo
# roles = peer
# machines = *
specificRoleSettings = filterInternals res.importedModulesEvaluated.self-A.result.allMachines.jon.passthru.instances.instance_foo.roles.peer.settings;
specificRoleSettings =
res.importedModulesEvaluated.self-A.result.allMachines.jon.passthru.instances.instance_foo.roles.peer;
};
expected = {
expected = rec {
hasMachineSettings = true;
hasRoleSettings = false;
specificMachineSettings = {
timeout = "foo-peer-jon";
};
hasRoleSettings = true;
specificRoleSettings = {
timeout = "foo-peer";
machines = {
jon = {
settings = specificMachineSettings;
};
};
};
};
};