Skip to content

Commit

Permalink
Merge pull request #25 from andreygubarev/driver-schema
Browse files Browse the repository at this point in the history
add molecule qemu driver schema
  • Loading branch information
andreygubarev authored Aug 23, 2023
2 parents b188c60 + 29edde7 commit 4fe7d70
Show file tree
Hide file tree
Showing 2 changed files with 107 additions and 0 deletions.
104 changes: 104 additions & 0 deletions molecule_qemu/driver.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
{
"$defs": {
"MoleculeDriverModel": {
"properties": {
"name": {
"enum": [
"molecule-qemu"
],
"title": "Name",
"type": "string"
}
},
"title": "MoleculeDriverModel",
"type": "object"
},
"MoleculePlatformModel": {
"additionalProperties": true,
"properties": {
"image_arch": {
"title": "Image Architecture",
"type": "string",
"enum": [
"x86_64",
"aarch64"
]
},
"image_url": {
"title": "Image URL",
"type": "string"
},
"image_checksum": {
"title": "Image Checksum",
"type": "string"
},
"image_format": {
"title": "Image Format",
"type": "string",
"enum": [
"qcow2"
]
},
"network_mode": {
"title": "Network Mode",
"type": "string",
"enum": [
"vmnet-shared",
"user"
]
},
"network_ssh_port": {
"title": "Network SSH Port",
"type": "integer"
},
"network_ssh_user": {
"title": "Network SSH User",
"type": "string"
},
"vm_cpus": {
"title": "VM CPUs",
"type": "integer"
},
"vm_memory": {
"title": "VM Memory",
"type": "integer"
},
"vm_disk": {
"title": "VM Disk",
"type": "string"
},
"name": {
"title": "Name",
"type": "string"
}
},
"required": [
"name",
"image_url",
"image_checksum"
],
"title": "MoleculePlatformModel",
"type": "object"
}
},
"$id": "https://github.com/andreygubarev/molecule-qemu/blob/main/molecule_qemu/driver.json",
"$schema": "http://json-schema.org/draft-07/schema",
"properties": {
"driver": {
"$ref": "#/$defs/MoleculeDriverModel"
},
"platforms": {
"items": {
"$ref": "#/$defs/MoleculePlatformModel"
},
"title": "Platforms",
"type": "array"
}
},
"required": [
"driver",
"platforms"
],
"title": "Molecule QEMU Driver Schema",
"type": "object"
}
3 changes: 3 additions & 0 deletions molecule_qemu/driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,3 +72,6 @@ def _get_instance_config(self, instance_name):
return next(
item for item in instance_config_dict if item["name"] == instance_name
)

def schema_file(self):
return os.path.join(os.path.dirname(__file__), "driver.json")

0 comments on commit 4fe7d70

Please sign in to comment.