Merge pull request 'Feat(inventory): simplify instance module spec, by applying a default' (#4054) from hsjobeki/module-default into main
Reviewed-on: https://git.clan.lol/clan/clan-core/pulls/4054
This commit is contained in:
@@ -373,7 +373,11 @@ in
|
|||||||
instances = lib.mkOption {
|
instances = lib.mkOption {
|
||||||
description = "Multi host service module instances";
|
description = "Multi host service module instances";
|
||||||
type = types.attrsOf (
|
type = types.attrsOf (
|
||||||
types.submodule {
|
types.submoduleWith {
|
||||||
|
modules = [
|
||||||
|
(
|
||||||
|
{ name, ... }:
|
||||||
|
{
|
||||||
options = {
|
options = {
|
||||||
# ModuleSpec
|
# ModuleSpec
|
||||||
module = lib.mkOption {
|
module = lib.mkOption {
|
||||||
@@ -388,8 +392,10 @@ in
|
|||||||
};
|
};
|
||||||
options.name = lib.mkOption {
|
options.name = lib.mkOption {
|
||||||
type = types.str;
|
type = types.str;
|
||||||
|
default = name;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
default = { };
|
||||||
};
|
};
|
||||||
roles = lib.mkOption {
|
roles = lib.mkOption {
|
||||||
default = { };
|
default = { };
|
||||||
@@ -465,6 +471,9 @@ in
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
)
|
||||||
|
];
|
||||||
|
}
|
||||||
);
|
);
|
||||||
default = { };
|
default = { };
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -15,12 +15,12 @@ class Unknown:
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
InventoryInstanceModuleNameType = str
|
|
||||||
InventoryInstanceModuleInputType = str
|
InventoryInstanceModuleInputType = str
|
||||||
|
InventoryInstanceModuleNameType = str
|
||||||
|
|
||||||
class InventoryInstanceModule(TypedDict):
|
class InventoryInstanceModule(TypedDict):
|
||||||
name: str
|
|
||||||
input: NotRequired[InventoryInstanceModuleInputType]
|
input: NotRequired[InventoryInstanceModuleInputType]
|
||||||
|
name: NotRequired[InventoryInstanceModuleNameType]
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user