mounts: change schema meta information
Define the mount schema in the actual mounts at a higher level. This is in preparation to give the modules more control over the `source` and `target` properties.
This commit is contained in:
parent
5694743ca6
commit
02404ced94
6 changed files with 92 additions and 11 deletions
|
|
@ -13,8 +13,23 @@ from typing import Dict
|
|||
from osbuild import mounts
|
||||
|
||||
|
||||
SCHEMA = """
|
||||
"additionalProperties": False
|
||||
SCHEMA_2 = """
|
||||
"additionalProperties": false,
|
||||
"required": ["name", "type", "source", "target"],
|
||||
"properties": {
|
||||
"name": { "type": "string" },
|
||||
"type": { "type": "string" },
|
||||
"source": {
|
||||
"type": "string"
|
||||
},
|
||||
"target": {
|
||||
"type": "string"
|
||||
},
|
||||
"options": {
|
||||
"type": "object",
|
||||
"additionalProperties": true
|
||||
}
|
||||
}
|
||||
"""
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -13,8 +13,23 @@ from typing import Dict
|
|||
from osbuild import mounts
|
||||
|
||||
|
||||
SCHEMA = """
|
||||
"additionalProperties": false
|
||||
SCHEMA_2 = """
|
||||
"additionalProperties": false,
|
||||
"required": ["name", "type", "source", "target"],
|
||||
"properties": {
|
||||
"name": { "type": "string" },
|
||||
"type": { "type": "string" },
|
||||
"source": {
|
||||
"type": "string"
|
||||
},
|
||||
"target": {
|
||||
"type": "string"
|
||||
},
|
||||
"options": {
|
||||
"type": "object",
|
||||
"additionalProperties": true
|
||||
}
|
||||
}
|
||||
"""
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -13,8 +13,23 @@ from typing import Dict
|
|||
from osbuild import mounts
|
||||
|
||||
|
||||
SCHEMA = """
|
||||
"additionalProperties": false
|
||||
SCHEMA_2 = """
|
||||
"additionalProperties": false,
|
||||
"required": ["name", "type", "source", "target"],
|
||||
"properties": {
|
||||
"name": { "type": "string" },
|
||||
"type": { "type": "string" },
|
||||
"source": {
|
||||
"type": "string"
|
||||
},
|
||||
"target": {
|
||||
"type": "string"
|
||||
},
|
||||
"options": {
|
||||
"type": "object",
|
||||
"additionalProperties": true
|
||||
}
|
||||
}
|
||||
"""
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -15,8 +15,23 @@ from typing import Dict
|
|||
from osbuild import mounts
|
||||
|
||||
|
||||
SCHEMA = """
|
||||
"additionalProperties": false
|
||||
SCHEMA_2 = """
|
||||
"additionalProperties": false,
|
||||
"required": ["name", "type", "source", "target"],
|
||||
"properties": {
|
||||
"name": { "type": "string" },
|
||||
"type": { "type": "string" },
|
||||
"source": {
|
||||
"type": "string"
|
||||
},
|
||||
"target": {
|
||||
"type": "string"
|
||||
},
|
||||
"options": {
|
||||
"type": "object",
|
||||
"additionalProperties": true
|
||||
}
|
||||
}
|
||||
"""
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -13,8 +13,23 @@ from typing import Dict
|
|||
from osbuild import mounts
|
||||
|
||||
|
||||
SCHEMA = """
|
||||
"additionalProperties": false
|
||||
SCHEMA_2 = """
|
||||
"additionalProperties": false,
|
||||
"required": ["name", "type", "source", "target"],
|
||||
"properties": {
|
||||
"name": { "type": "string" },
|
||||
"type": { "type": "string" },
|
||||
"source": {
|
||||
"type": "string"
|
||||
},
|
||||
"target": {
|
||||
"type": "string"
|
||||
},
|
||||
"options": {
|
||||
"type": "object",
|
||||
"additionalProperties": true
|
||||
}
|
||||
}
|
||||
"""
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -332,13 +332,19 @@ class ModuleInfo:
|
|||
**opts,
|
||||
}
|
||||
schema["required"] = [type_id]
|
||||
elif self.type in ("Device", "Mount"):
|
||||
elif self.type in ("Device"):
|
||||
schema["additionalProperties"] = True
|
||||
opts = self._load_opts(version, "1")
|
||||
schema["properties"] = {
|
||||
"type": {"enum": [self.name]},
|
||||
"options": opts
|
||||
}
|
||||
elif self.type in ("Mount"):
|
||||
opts = self._load_opts("2")
|
||||
schema.update(opts)
|
||||
schema["properties"]["type"] = {
|
||||
"enum": [self.name],
|
||||
}
|
||||
else:
|
||||
opts = self._load_opts(version, "1")
|
||||
schema.update(opts)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue