Sync appliance files and remove old ones after sync with online repo. Fixes #1876

pull/1910/head
grossmj 3 years ago
parent e614ed79f4
commit 685963b85d

@ -1,50 +0,0 @@
{
"name": "Raspian",
"category": "guest",
"description": "Raspberry Pi Desktop comes pre-installed with plenty of software for education, programming and general use; including Python, Scratch, Sonic Pi, Java, and more. Appliance created to demonstrate new_appliance.py - read more at https://nextpertise.net.",
"vendor_name": "Raspberry Pi Foundation",
"vendor_url": "https://www.raspberrypi.org",
"product_name": "Raspberry Pi Desktop",
"product_url": "https://www.raspberrypi.org/downloads/raspberry-pi-desktop/",
"registry_version": 3,
"status": "stable",
"availability": "free",
"maintainer": "Brent Stewart",
"maintainer_email": "brent@stewart.tc",
"usage": "Default password is raspberry",
"symbol": "rpi.png",
"qemu": {
"adapter_type": "virtio",
"adapters": 1,
"ram": 1024,
"hda_disk_interface": "sata",
"arch": "x86_64",
"console_type": "vnc",
"kvm": "disable"
},
"images": [
{
"filename": "2020-02-12-rpd-x86-buster.iso",
"version": "2020-02-12",
"md5sum": "98f34fb53086752b4c9c452094f30740",
"filesize": 3128147968,
"download_url": "https://www.raspberrypi.org/downloads/raspberry-pi-desktop/"
},
{
"filename": "empty8G.qcow2",
"version": "1",
"md5sum": "f1d2c25b6990f99bd05b433ab603bdb4",
"filesize": 197120,
"download_url": "https://sourceforge.net/projects/gns-3/files/Empty%20Qemu%20disk/empty8G.qcow2/download"
}
],
"versions": [
{
"name": "2020-02-12",
"images": {
"hda_disk_image": "empty8G.qcow2",
"cdrom_image": "2020-02-12-rpd-x86-buster.iso"
}
}
]
}

@ -30,6 +30,13 @@
"filesize": 1048576,
"download_url": "https://sourceforge.net/projects/gns-3/files",
"direct_download_url": "https://sourceforge.net/projects/gns-3/files/Qemu%20Appliances/IOSv_startup_config.img/download"
},
{
"filename": "vios-adventerprisek9-m.spa.159-3.m2.qcow2",
"version": "15.9(3)M2",
"md5sum": "a19e998bc3086825c751d125af722329",
"filesize": 57308672,
"download_url": "https://learningnetworkstore.cisco.com/myaccount"
},
{
"filename": "vios-adventerprisek9-m.spa.158-3.m2.qcow2",
@ -68,6 +75,13 @@
}
],
"versions": [
{
"name": "15.9(3)M2",
"images": {
"hda_disk_image": "vios-adventerprisek9-m.spa.159-3.m2.qcow2",
"hdb_disk_image": "IOSv_startup_config.img"
}
},
{
"name": "15.8(3)M2",
"images": {

@ -23,6 +23,13 @@
"kvm": "require"
},
"images": [
{
"filename": "vios_l2-adventerprisek9-m.ssa.high_iron_20190423.qcow2",
"version": "15.2(6.0.81)E",
"md5sum": "71cacb678f98a106f99e889b97b34686",
"filesize": 44950016,
"download_url": "https://learningnetworkstore.cisco.com/myaccount"
},
{
"filename": "vios_l2-adventerprisek9-m.SSA.high_iron_20180619.qcow2",
"version": "15.2.1",
@ -46,6 +53,12 @@
}
],
"versions": [
{
"name": "15.2(6.0.81)E",
"images": {
"hda_disk_image": "vios_l2-adventerprisek9-m.ssa.high_iron_20190423.qcow2"
}
},
{
"name": "15.2.1",
"images": {

@ -11,19 +11,27 @@
"status": "stable",
"maintainer": "GNS3 Team",
"maintainer_email": "developers@gns3.net",
"usage": "Default username is cumulus and password is CumulusLinux!",
"usage": "Default username is cumulus and password is CumulusLinux! in version 4.1 and earlier, and cumulus in version 4.2 and later.",
"first_port_name": "eth0",
"port_name_format": "swp{port1}",
"qemu": {
"adapter_type": "virtio-net-pci",
"adapters": 7,
"ram": 512,
"ram": 768,
"hda_disk_interface": "ide",
"arch": "x86_64",
"console_type": "telnet",
"kvm": "require"
},
"images": [
{
"filename": "cumulus-linux-4.3.0-vx-amd64-qemu.qcow2",
"version": "4.3.0",
"md5sum": "aba2f0bb462b26a208afb6202bc97d51",
"filesize": 2819325952,
"download_url": "https://cumulusnetworks.com/cumulus-vx/download/",
"direct_download_url": "https://d2cd9e7ca6hntp.cloudfront.net/public/CumulusLinux-4.3.0/cumulus-linux-4.3.0-vx-amd64-qemu.qcow2"
},
{
"filename": "cumulus-linux-4.2.0-vx-amd64-qemu.qcow2",
"version": "4.2.0",
@ -222,6 +230,12 @@
}
],
"versions": [
{
"name": "4.3.0",
"images": {
"hda_disk_image": "cumulus-linux-4.3.0-vx-amd64-qemu.qcow2"
}
},
{
"name": "4.2.0",
"images": {

@ -17,7 +17,7 @@
"qemu": {
"adapter_type": "e1000",
"adapters": 4,
"ram": 1024,
"ram": 4096,
"hda_disk_interface": "virtio",
"hdb_disk_interface": "virtio",
"arch": "x86_64",
@ -26,6 +26,13 @@
"kvm": "allow"
},
"images": [
{
"filename": "FAZ_VM64_KVM-v6-build2288-FORTINET.out.kvm.qcow2",
"version": "6.4.5",
"md5sum": "e220b48c6e86f8ddc660d578295051a9",
"filesize": 152698880,
"download_url": "https://support.fortinet.com/Download/FirmwareImages.aspx"
},
{
"filename": "FAZ_VM64_KVM-v6-build1183-FORTINET.out.kvm.qcow2",
"version": "6.2.2",
@ -169,6 +176,13 @@
}
],
"versions": [
{
"name": "6.4.5",
"images": {
"hda_disk_image": "FAZ_VM64_KVM-v6-build2288-FORTINET.out.kvm.qcow2",
"hdb_disk_image": "empty30G.qcow2"
}
},
{
"name": "6.2.2",
"images": {

@ -26,6 +26,13 @@
"kvm": "allow"
},
"images": [
{
"filename": "FGT_VM64_KVM-v6-build1828-FORTINET.out.kvm.qcow2",
"version": "6.4.5",
"md5sum": "dc064e16fa65461183544d8ddb5d19d9",
"filesize": 36175872,
"download_url": "https://support.fortinet.com/Download/FirmwareImages.aspx"
},
{
"filename": "FGT_VM64_KVM-v6-build1010-FORTINET.out.kvm.qcow2",
"version": "6.2.2",
@ -246,6 +253,13 @@
}
],
"versions": [
{
"name": "6.4.5",
"images": {
"hda_disk_image": "FGT_VM64_KVM-v6-build1828-FORTINET.out.kvm.qcow2",
"hdb_disk_image": "empty30G.qcow2"
}
},
{
"name": "6.2.2",
"images": {

@ -17,7 +17,7 @@
"qemu": {
"adapter_type": "virtio-net-pci",
"adapters": 4,
"ram": 1024,
"ram": 2048,
"hda_disk_interface": "virtio",
"hdb_disk_interface": "virtio",
"arch": "x86_64",
@ -26,6 +26,20 @@
"kvm": "allow"
},
"images": [
{
"filename": "FMG_VM64_KVM-v6-build2288-FORTINET.out.kvm.qcow2",
"version": "6.4.5",
"md5sum": "bd2791984b03f55a6825297e83c6576a",
"filesize": 117014528,
"download_url": "https://support.fortinet.com/Download/FirmwareImages.aspx"
},
{
"filename": "FMG_VM64_KVM-v6-build2253-FORTINET.out.kvm.qcow2",
"version": "6.4.4",
"md5sum": "3554a47fde2dc91d17eec16fd0dc10a3",
"filesize": 116621312,
"download_url": "https://support.fortinet.com/Download/FirmwareImages.aspx"
},
{
"filename": "FMG_VM64_KVM-v6-build1183-FORTINET.out.kvm.qcow2",
"version": "6.2.2",
@ -162,6 +176,20 @@
}
],
"versions": [
{
"name": "6.4.5",
"images": {
"hda_disk_image": "FMG_VM64_KVM-v6-build2288-FORTINET.out.kvm.qcow2",
"hdb_disk_image": "empty30G.qcow2"
}
},
{
"name": "6.4.4",
"images": {
"hda_disk_image": "FMG_VM64_KVM-v6-build2253-FORTINET.out.kvm.qcow2",
"hdb_disk_image": "empty30G.qcow2"
}
},
{
"name": "6.2.2",
"images": {

@ -34,11 +34,11 @@
"direct_download_url": "https://s3.amazonaws.com/s3-us.vyos.io/snapshot/vyos-1.3-rolling-202101/qemu/vyos-1.3-rolling-202101-qemu.qcow2"
},
{
"filename": "vyos-1.2.6-S1-amd64.iso",
"version": "1.2.6-S1",
"md5sum": "449873ae455d5f3f509db7a614e86984",
"filename": "vyos-1.2.7-amd64.iso",
"version": "1.2.7",
"md5sum": "1a06255edfac63fa3ea89353317130bf",
"filesize": 428867584,
"download_url": "https://support.vyos.io/en/downloads/files/vyos-1-2-6-s1-generic-iso-image"
"download_url": "https://support.vyos.io/en/downloads/files/vyos-1-2-7-generic-iso-image"
},
{
"filename": "vyos-1.1.8-amd64.iso",
@ -65,10 +65,10 @@
}
},
{
"name": "1.2.6-S1",
"name": "1.2.7",
"images": {
"hda_disk_image": "empty8G.qcow2",
"cdrom_image": "vyos-1.2.6-S1-amd64.iso"
"cdrom_image": "vyos-1.2.7-amd64.iso"
}
},
{

@ -16,6 +16,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import os
import shutil
import json
import uuid
import asyncio
@ -181,6 +182,7 @@ class ApplianceManager:
Controller.instance().save()
json_data = await response.json()
appliances_dir = get_resource('appliances')
downloaded_appliance_files = []
for appliance in json_data:
if appliance["type"] == "file":
appliance_name = appliance["name"]
@ -201,6 +203,21 @@ class ApplianceManager:
f.write(appliance_data)
except OSError as e:
raise aiohttp.web.HTTPConflict(text="Could not write appliance file '{}': {}".format(path, e))
downloaded_appliance_files.append(appliance_name)
# delete old appliance files
for filename in os.listdir(appliances_dir):
file_path = os.path.join(appliances_dir, filename)
if filename in downloaded_appliance_files:
continue
try:
if os.path.isfile(file_path) or os.path.islink(file_path):
log.info("Deleting old appliance file {}".format(file_path))
os.unlink(file_path)
except OSError as e:
log.warning("Could not delete old appliance file '{}': {}".format(file_path, e))
continue
except ValueError as e:
raise aiohttp.web.HTTPConflict(text="Could not read appliances information from GitHub: {}".format(e))

Loading…
Cancel
Save