Fix appliance schema v8, adapt check.py for schema v8

This commit is contained in:
Bernhard Ehlers 2024-07-07 16:40:32 +02:00
parent 8cf5ed4c04
commit d990ad1b80
No known key found for this signature in database
2 changed files with 169 additions and 168 deletions

View File

@ -96,8 +96,9 @@ def check_appliance(appliance):
if image['filename'] in images: if image['filename'] in images:
print('Duplicate image filename ' + image['filename']) print('Duplicate image filename ' + image['filename'])
warnings += 1 warnings += 1
if image['md5sum'] in md5sums: md5sum = image.get('checksum') or image.get('md5sum')
print('Duplicate image md5sum ' + image['md5sum']) if md5sum in md5sums:
print('Duplicate image md5sum ' + md5sum)
sys.exit(1) sys.exit(1)
versions_found = False versions_found = False
for version in appliance_json['versions']: for version in appliance_json['versions']:
@ -107,7 +108,7 @@ def check_appliance(appliance):
print('Unused image ' + image['filename'] + ' in ' + appliance) print('Unused image ' + image['filename'] + ' in ' + appliance)
warnings += 1 warnings += 1
images[image['filename']] = image['version'] images[image['filename']] = image['version']
md5sums.add(image['md5sum']) md5sums.add(md5sum)
for version in appliance_json['versions']: for version in appliance_json['versions']:
version_match = False version_match = False

View File

@ -720,174 +720,174 @@
"template_properties" "template_properties"
] ]
} }
} },
}, "images": {
"images": { "type": "array",
"type": "array", "title": "Images for this appliance",
"title": "Images for this appliance", "items": {
"items": { "type": "object",
"type": "object", "title": "An image file",
"title": "An image file", "properties": {
"properties": { "filename": {
"filename": { "type": "string",
"type": "string", "title": "Filename"
"title": "Filename" },
"version": {
"type": "string",
"title": "Version of the image file"
},
"md5sum": {
"type": "string",
"title": "MD5 cheksum of the image file",
"pattern": "^[a-f0-9]{32}$"
},
"checksum": {
"type": "string",
"title": "checksum of the image file"
},
"checksum_type": {
"title": "checksum type of the image file",
"enum": [
"md5"
]
},
"filesize": {
"type": "integer",
"title": "File size in bytes of the image file"
},
"download_url": {
"type": "string",
"format": "uri",
"title": "Download URL where you can download the image file from a browser"
},
"direct_download_url": {
"type": "string",
"format": "uri",
"title": "Optional. Non authenticated URL to the image file where you can download the image directly"
},
"compression": {
"enum": [
"bzip2",
"gzip",
"lzma",
"xz",
"rar",
"zip",
"7z"
],
"title": "Optional, compression type of direct download URL image."
},
"compression_target": {
"type": "string",
"title": "Optional, file name of the image file inside the compressed file."
}
}, },
"version": { "anyOf": [
"type": "string", {
"title": "Version of the image file" "required": [
}, "filename",
"md5sum": { "version",
"type": "string", "md5sum",
"title": "MD5 cheksum of the image file", "filesize"
"pattern": "^[a-f0-9]{32}$" ]
}, },
"checksum": { {
"type": "string", "required": [
"title": "checksum of the image file" "filename",
}, "version",
"checksum_type": { "checksum",
"title": "checksum type of the image file", "filesize"
"enum": [ ]
"md5" }
] ]
}, }
"filesize": { },
"type": "integer", "versions": {
"title": "File size in bytes of the image file" "type": "array",
}, "title": "Versions of the appliance",
"download_url": { "items": {
"type": "string", "type": "object",
"format": "uri", "title": "A version of the appliance",
"title": "Download URL where you can download the image file from a browser" "properties": {
}, "name": {
"direct_download_url": { "type": "string",
"type": "string", "title": "Name of the version"
"format": "uri", },
"title": "Optional. Non authenticated URL to the image file where you can download the image directly" "settings": {
}, "type": "string",
"compression": { "title": "Template settings to use to run the version"
"enum": [ },
"bzip2", "category": {
"gzip", "$ref": "#/definitions/categories",
"lzma", "title": "Category of the version"
"xz", },
"rar", "installation_instructions": {
"zip", "type": "string",
"7z" "title": "Optional installation instructions for the version"
], },
"title": "Optional, compression type of direct download URL image." "usage": {
}, "type": "string",
"compression_target": { "title": "Optional instructions about using the version"
"type": "string", },
"title": "Optional, file name of the image file inside the compressed file." "default_username": {
} "type": "string",
}, "title": "Default username for the version"
"anyOf": [ },
{ "default_password": {
"required": [ "type": "string",
"filename", "title": "Default password for the version"
"version", },
"md5sum", "symbol": {
"filesize" "type": "string",
] "title": "An optional symbol for the version"
}, },
{ "images": {
"required": [ "type": "object",
"filename", "title": "Images used for this version",
"version", "properties": {
"checksum", "kernel_image": {
"filesize" "type": "string",
] "title": "Kernel image (Qemu only)"
} },
] "initrd": {
} "type": "string",
}, "title": "Initrd disk image (Qemu only)"
"versions": { },
"type": "array", "image": {
"title": "Versions of the appliance", "type": "string",
"items": { "title": "OS image (IOU and Dynamips only)"
"type": "object", },
"title": "A version of the appliance", "bios_image": {
"properties": { "type": "string",
"name": { "title": "Bios image (Qemu only)"
"type": "string", },
"title": "Name of the version" "hda_disk_image": {
}, "type": "string",
"settings": { "title": "Hda disk image (Qemu only)"
"type": "string", },
"title": "Template settings to use to run the version" "hdb_disk_image": {
}, "type": "string",
"category": { "title": "Hdc disk image (Qemu only)"
"$ref": "#/definitions/categories", },
"title": "Category of the version" "hdc_disk_image": {
}, "type": "string",
"installation_instructions": { "title": "Hdd disk image (Qemu only)"
"type": "string", },
"title": "Optional installation instructions for the version" "hdd_disk_image": {
}, "type": "string",
"usage": { "title": "Hdd disk image (Qemu only)"
"type": "string", },
"title": "Optional instructions about using the version" "cdrom_image": {
}, "type": "string",
"default_username": { "title": "cdrom image (Qemu only)"
"type": "string", }
"title": "Default username for the version"
},
"default_password": {
"type": "string",
"title": "Default password for the version"
},
"symbol": {
"type": "string",
"title": "An optional symbol for the version"
},
"images": {
"type": "object",
"title": "Images used for this version",
"properties": {
"kernel_image": {
"type": "string",
"title": "Kernel image (Qemu only)"
},
"initrd": {
"type": "string",
"title": "Initrd disk image (Qemu only)"
},
"image": {
"type": "string",
"title": "OS image (IOU and Dynamips only)"
},
"bios_image": {
"type": "string",
"title": "Bios image (Qemu only)"
},
"hda_disk_image": {
"type": "string",
"title": "Hda disk image (Qemu only)"
},
"hdb_disk_image": {
"type": "string",
"title": "Hdc disk image (Qemu only)"
},
"hdc_disk_image": {
"type": "string",
"title": "Hdd disk image (Qemu only)"
},
"hdd_disk_image": {
"type": "string",
"title": "Hdd disk image (Qemu only)"
},
"cdrom_image": {
"type": "string",
"title": "cdrom image (Qemu only)"
} }
} }
} },
}, "required": [
"required": [ "name"
"name" ]
] }
} }
}, },
"required": [ "required": [