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
|
from osbuild import mounts
|
||||||
|
|
||||||
|
|
||||||
SCHEMA = """
|
SCHEMA_2 = """
|
||||||
"additionalProperties": False
|
"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
|
from osbuild import mounts
|
||||||
|
|
||||||
|
|
||||||
SCHEMA = """
|
SCHEMA_2 = """
|
||||||
"additionalProperties": false
|
"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
|
from osbuild import mounts
|
||||||
|
|
||||||
|
|
||||||
SCHEMA = """
|
SCHEMA_2 = """
|
||||||
"additionalProperties": false
|
"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
|
from osbuild import mounts
|
||||||
|
|
||||||
|
|
||||||
SCHEMA = """
|
SCHEMA_2 = """
|
||||||
"additionalProperties": false
|
"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
|
from osbuild import mounts
|
||||||
|
|
||||||
|
|
||||||
SCHEMA = """
|
SCHEMA_2 = """
|
||||||
"additionalProperties": false
|
"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,
|
**opts,
|
||||||
}
|
}
|
||||||
schema["required"] = [type_id]
|
schema["required"] = [type_id]
|
||||||
elif self.type in ("Device", "Mount"):
|
elif self.type in ("Device"):
|
||||||
schema["additionalProperties"] = True
|
schema["additionalProperties"] = True
|
||||||
opts = self._load_opts(version, "1")
|
opts = self._load_opts(version, "1")
|
||||||
schema["properties"] = {
|
schema["properties"] = {
|
||||||
"type": {"enum": [self.name]},
|
"type": {"enum": [self.name]},
|
||||||
"options": opts
|
"options": opts
|
||||||
}
|
}
|
||||||
|
elif self.type in ("Mount"):
|
||||||
|
opts = self._load_opts("2")
|
||||||
|
schema.update(opts)
|
||||||
|
schema["properties"]["type"] = {
|
||||||
|
"enum": [self.name],
|
||||||
|
}
|
||||||
else:
|
else:
|
||||||
opts = self._load_opts(version, "1")
|
opts = self._load_opts(version, "1")
|
||||||
schema.update(opts)
|
schema.update(opts)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue