mirror of
https://github.com/GNS3/gns3-registry.git
synced 2025-04-09 04:14:21 +00:00
New file format for allowing install with two disk
This commit is contained in:
parent
b06f83ac19
commit
45431440a8
59
build.py
59
build.py
@ -19,6 +19,7 @@ import os
|
||||
import sys
|
||||
import json
|
||||
import shutil
|
||||
import copy
|
||||
|
||||
from jinja2 import Environment, FileSystemLoader
|
||||
|
||||
@ -52,26 +53,60 @@ def render(template_file, out, **kwargs):
|
||||
template.stream(**kwargs).dump(os.path.join('build', out))
|
||||
|
||||
|
||||
def keep_only_version_with_device(md5sum, device):
|
||||
"""
|
||||
Filter device version in order to keep only the
|
||||
version where the image is present.
|
||||
|
||||
:param md5sum: Md5sum of the image
|
||||
:param device: Device hash
|
||||
:returns: List of version
|
||||
"""
|
||||
|
||||
new_versions = []
|
||||
for version in device["versions"]:
|
||||
found = False
|
||||
for image in version["images"].values():
|
||||
if image["md5sum"] == md5sum:
|
||||
found = True
|
||||
break
|
||||
if found:
|
||||
new_versions.append(version)
|
||||
return new_versions
|
||||
|
||||
|
||||
render('index.html', 'index.html')
|
||||
render('chat.html', 'chat.html')
|
||||
render('downloads.html', 'downloads.html')
|
||||
|
||||
|
||||
devices = []
|
||||
for file in os.listdir('devices'):
|
||||
filename = file[:-5]
|
||||
with open(os.path.join('devices', file)) as f:
|
||||
for device_file in os.listdir('devices'):
|
||||
print("Process " + device_file)
|
||||
out_filename = device_file[:-5]
|
||||
with open(os.path.join('devices', device_file)) as f:
|
||||
device = json.load(f)
|
||||
device['id'] = filename
|
||||
render('device.html', os.path.join('devices', filename + '.html'), device=device)
|
||||
device['id'] = out_filename
|
||||
|
||||
# Resolve version image to the corresponding file
|
||||
for version in device['versions']:
|
||||
for image_type, filename in version['images'].items():
|
||||
for file in device['images']:
|
||||
if file['filename'] == filename:
|
||||
version['images'][image_type] = copy.copy(file)
|
||||
version['images'][image_type]["type"] = image_type
|
||||
|
||||
render('device.html', os.path.join('devices', out_filename + '.html'), device=device)
|
||||
print(device)
|
||||
devices.append(device)
|
||||
|
||||
|
||||
for image_type in device['images']:
|
||||
for image in device['images'][image_type]:
|
||||
# We keep only this image in the page
|
||||
image_device = device
|
||||
image_device['images'][image_type] = [ image ]
|
||||
render('device.html', os.path.join('images', image['md5sum'] + '.html'), device=image_device)
|
||||
# Build a page named with the md5sum of each file of the device
|
||||
# it's allow to get the device informations via HTTP with just an md5sum
|
||||
# it's what powered the import feature
|
||||
for image in device['images']:
|
||||
# We keep only version with this image in the page
|
||||
image_device = copy.copy(device)
|
||||
image_device['versions'] = keep_only_version_with_device(image['md5sum'], device)
|
||||
render('device.html', os.path.join('images', image['md5sum'] + '.html'), device=image_device)
|
||||
|
||||
render('devices.html', os.path.join('devices', 'index.html'), devices=devices)
|
||||
|
@ -20,22 +20,28 @@
|
||||
"processor": "x64"
|
||||
},
|
||||
|
||||
"images": {
|
||||
"hda_disk_image": [
|
||||
{
|
||||
"filename": "Aboot-veos-2.1.0.iso",
|
||||
"version": "2.1.0",
|
||||
"md5sum": "44177f7f9157354f213a1545c65e92ec",
|
||||
"download_url": "https://www.arista.com/en/support/software-download"
|
||||
"images": [
|
||||
{
|
||||
"filename": "Aboot-veos-2.1.0.iso",
|
||||
"version": "2.1.0",
|
||||
"md5sum": "44177f7f9157354f213a1545c65e92ec",
|
||||
"download_url": "https://www.arista.com/en/support/software-download"
|
||||
},
|
||||
{
|
||||
"filename": "vEOS-lab-4.13.8M.vmdk",
|
||||
"version": "4.13.8M",
|
||||
"md5sum": "a47145b9e6e7a24171c0850f8755535e",
|
||||
"download_url": "https://www.arista.com/en/support/software-download"
|
||||
}
|
||||
],
|
||||
|
||||
"versions": [
|
||||
{
|
||||
"name": "4.13.8M",
|
||||
"images": {
|
||||
"hda_disk_image": "Aboot-veos-2.1.0.iso",
|
||||
"hdb_disk_image": "vEOS-lab-4.13.8M.vmdk"
|
||||
}
|
||||
],
|
||||
"hdb_disk_image": [
|
||||
{
|
||||
"filename": "vEOS-lab-4.13.8M.vmdk",
|
||||
"version": "4.13.8M",
|
||||
"md5sum": "a47145b9e6e7a24171c0850f8755535e",
|
||||
"download_url": "https://www.arista.com/en/support/software-download"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@ -24,14 +24,21 @@
|
||||
"install_instructions": "* Wait for boot\n* Run fresh install\n* Say yes to reboot\nClose the window after reboot success"
|
||||
},
|
||||
|
||||
"images": {
|
||||
"cdrom": [
|
||||
{
|
||||
"filename": "VSR1000_HP-CMW710-R0204P01-X64.iso",
|
||||
"version": "7.10.R0204P01",
|
||||
"md5sum": "d0b539f3ba9723ad8c3ed46f6d772627",
|
||||
"download_url": "https://h10145.www1.hp.com/Downloads/DownloadSoftware.aspx?SoftwareReleaseUId=11832&ProductNumber=JG811AAE&lang=en&cc=us&prodSeriesId=5443163&OrderNumber=&PurchaseDate="
|
||||
"images": [
|
||||
{
|
||||
"filename": "VSR1000_HP-CMW710-R0204P01-X64.iso",
|
||||
"version": "7.10.R0204P01",
|
||||
"md5sum": "d0b539f3ba9723ad8c3ed46f6d772627",
|
||||
"download_url": "https://h10145.www1.hp.com/Downloads/DownloadSoftware.aspx?SoftwareReleaseUId=11832&ProductNumber=JG811AAE&lang=en&cc=us&prodSeriesId=5443163&OrderNumber=&PurchaseDate="
|
||||
}
|
||||
],
|
||||
|
||||
"versions": [
|
||||
{
|
||||
"name": "7.10.R0204P01",
|
||||
"images": {
|
||||
"cdrom": "VSR1000_HP-CMW710-R0204P01-X64.iso"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "Micro Core Linux",
|
||||
"category": "guest",
|
||||
"category": "guest",
|
||||
"vendor_name": "Team Tiny Core",
|
||||
"vendor_url": "http://distro.ibiblio.org/tinycorelinux",
|
||||
"documentation_url": "http://wiki.tinycorelinux.net/",
|
||||
@ -19,22 +19,35 @@
|
||||
"graphic": false
|
||||
},
|
||||
|
||||
"images": {
|
||||
"hda_disk_image": [
|
||||
{
|
||||
"filename": "linux-microcore-3.4.1.img",
|
||||
"version": "3.4.1",
|
||||
"md5sum": "fa2ec4b1fffad67d8103c3391bbf9df2",
|
||||
"download_url": "https://sourceforge.net/projects/gns-3/files/Qemu%20Appliances/",
|
||||
"direct_download_url": "http://downloads.sourceforge.net/project/gns-3/Qemu%20Appliances/linux-microcore-3.4.1.img"
|
||||
},
|
||||
{
|
||||
"filename": "linux-microcore-4.0.2-clean.img",
|
||||
"version": "4.0.2",
|
||||
"md5sum": "e13d0d1c0b3999ae2386bba70417930c",
|
||||
"download_url": "https://sourceforge.net/projects/gns-3/files/Qemu%20Appliances/",
|
||||
"direct_download_url": "http://downloads.sourceforge.net/project/gns-3/Qemu%20Appliances/linux-microcore-4.0.2-clean.img"
|
||||
"images": [
|
||||
{
|
||||
"filename": "linux-microcore-3.4.1.img",
|
||||
"version": "3.4.1",
|
||||
"md5sum": "fa2ec4b1fffad67d8103c3391bbf9df2",
|
||||
"download_url": "https://sourceforge.net/projects/gns-3/files/Qemu%20Appliances/",
|
||||
"direct_download_url": "http://downloads.sourceforge.net/project/gns-3/Qemu%20Appliances/linux-microcore-3.4.1.img"
|
||||
},
|
||||
{
|
||||
"filename": "linux-microcore-4.0.2-clean.img",
|
||||
"version": "4.0.2",
|
||||
"md5sum": "e13d0d1c0b3999ae2386bba70417930c",
|
||||
"download_url": "https://sourceforge.net/projects/gns-3/files/Qemu%20Appliances/",
|
||||
"direct_download_url": "http://downloads.sourceforge.net/project/gns-3/Qemu%20Appliances/linux-microcore-4.0.2-clean.img"
|
||||
}
|
||||
],
|
||||
|
||||
"versions": [
|
||||
{
|
||||
"name": "3.4.1",
|
||||
"images": {
|
||||
"hda_disk_image": "linux-microcore-3.4.1.img"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "4.0.2",
|
||||
"images": {
|
||||
"hda_disk_image": "linux-microcore-4.0.2-clean.img"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@ -15,18 +15,21 @@
|
||||
{{ key }}: {{ device["qemu"][key] }}<br />
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
{% for image_type in device["images"] %}
|
||||
<h2>Images for {{image_type}}</h2>
|
||||
{% for image in device["images"][image_type] %}
|
||||
<h3>{{image["filename"]}}</h3>
|
||||
Version: {{image["version"]}}<br />
|
||||
{% for version in device["versions"] | reverse %}
|
||||
<h2>{{ device["name"] }} {{version["name"]}}</h2>
|
||||
<button class="btn btn-primary btn-lg" type="button" onclick='gns3.install("{{device|jsonify|escape_quote}}", "{{version["name"]}}")'>Install</button>
|
||||
<h3>Require files</h3>
|
||||
{% for image in version.images.values() %}
|
||||
<h4>{{image["filename"]}}</h4>
|
||||
Slot: {{image["type"]}}<br />
|
||||
File Version: {{image["version"]}}<br />
|
||||
Checksum: {{image["md5sum"]}}<br />
|
||||
Download url: <a href="{{image["download_url"]}}">{{image["download_url"]}}</a><br />
|
||||
{% if "direct_download_url" in image %}
|
||||
Direct download url: <a href="{{image["direct_download_url"]}}">{{image["direct_download_url"]}}</a><br />
|
||||
<button class="btn btn-primary btn-lg" type="button" onclick='gns3.download("{{device|jsonify|escape_quote}}", "{{image["md5sum"]}}")'>Download</button>
|
||||
{% endif %}
|
||||
<button class="btn btn-primary btn-lg" type="button" onclick='gns3.install("{{device|jsonify|escape_quote}}", "{{image["md5sum"]}}")'>Install</button>
|
||||
<hr />
|
||||
{% endfor %}
|
||||
{% endfor %}
|
||||
{% endblock %}
|
||||
|
Loading…
x
Reference in New Issue
Block a user