stages(groups): port to v2 and allow devices/mounts
This will allow us to generate `bootc install to-filesystem` compatible devices/mount setups for the groups stage.
This commit is contained in:
parent
2a0027557f
commit
7c04e1c596
2 changed files with 30 additions and 14 deletions
|
|
@ -6,25 +6,34 @@
|
|||
"If no `gid` is given, `groupadd` will choose one.",
|
||||
"If the specified group name or GID is already in use, this stage will fail."
|
||||
],
|
||||
"schema": {
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"groups": {
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"description": "Keys are group names, values are objects with group info",
|
||||
"patternProperties": {
|
||||
"^[A-Za-z0-9_][A-Za-z0-9_-]{0,31}$": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"gid": {
|
||||
"type": "number",
|
||||
"description": "GID for this group"
|
||||
"schema_2": {
|
||||
"options": {
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"groups": {
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"description": "Keys are group names, values are objects with group info",
|
||||
"patternProperties": {
|
||||
"^[A-Za-z0-9_][A-Za-z0-9_-]{0,31}$": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"gid": {
|
||||
"type": "number",
|
||||
"description": "GID for this group"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"devices": {
|
||||
"type": "object",
|
||||
"additionalProperties": true
|
||||
},
|
||||
"mounts": {
|
||||
"type": "array"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -29,3 +29,10 @@ def test_schema_validation(stage_schema, test_data, expected_err):
|
|||
else:
|
||||
assert res.valid is False
|
||||
assert_jsonschema_error_contains(res, expected_err, expected_num_errs=1)
|
||||
|
||||
|
||||
def test_schema_supports_bootc_style_mounts(stage_schema, bootc_devices_mounts_dict):
|
||||
test_input = bootc_devices_mounts_dict
|
||||
test_input["type"] = STAGE_NAME
|
||||
res = stage_schema.validate(test_input)
|
||||
assert res.valid is True, f"err: {[e.as_dict() for e in res.errors]}"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue