mirror of
https://github.com/GNS3/gns3-registry.git
synced 2024-12-18 20:37:57 +00:00
"appliance_id" is now required and check for duplicate appliance UUID
This commit is contained in:
parent
aeed55a079
commit
b34eb83ffc
9
check.py
9
check.py
@ -24,7 +24,7 @@ import subprocess
|
||||
import jsonschema
|
||||
from picture import get_size
|
||||
|
||||
|
||||
APPLIANCE_IDS = []
|
||||
SCHEMA_VERSIONS = [3, 4, 5, 6]
|
||||
|
||||
warnings = 0
|
||||
@ -82,8 +82,15 @@ def check_appliance(appliance):
|
||||
|
||||
with open(os.path.join('appliances', appliance)) as f:
|
||||
appliance_json = json.load(f)
|
||||
|
||||
validate_schema(appliance_json, appliance, schemas)
|
||||
|
||||
appliance_id = appliance_json.get("appliance_id")
|
||||
if appliance_id in APPLIANCE_IDS:
|
||||
print('Duplicate appliance UUID detected ' + appliance_id)
|
||||
sys.exit(1)
|
||||
APPLIANCE_IDS.append(appliance_id)
|
||||
|
||||
if 'images' in appliance_json:
|
||||
for image in appliance_json['images']:
|
||||
if image['filename'] in images:
|
||||
|
@ -23,6 +23,7 @@ Create a new appliance from the terminal
|
||||
import json
|
||||
import os
|
||||
import sys
|
||||
import uuid
|
||||
|
||||
|
||||
def ask_multiple(question, options, optional=False):
|
||||
@ -71,7 +72,12 @@ def ask(question, type='string', optional=False):
|
||||
|
||||
def ask_from_schema(schema):
|
||||
data = {}
|
||||
for key,val in schema['properties'].items():
|
||||
for key, val in schema['properties'].items():
|
||||
|
||||
if key == "appliance_id":
|
||||
# generate an unique ID for the appliance
|
||||
result = str(uuid.uuid4())
|
||||
else:
|
||||
optional = not key in schema['required']
|
||||
result = None
|
||||
|
||||
@ -89,7 +95,7 @@ with open(os.path.join('schemas', 'appliance_v5.json')) as f:
|
||||
schema = json.load(f)
|
||||
|
||||
|
||||
appliance_name = ask('Appliance id (example: cisco-asav)')
|
||||
appliance_name = ask('Appliance filename (example: cisco-asav)')
|
||||
|
||||
# TODO check if file exists
|
||||
with open(os.path.join('appliances', appliance_name + '.gns3a'), 'w+') as f:
|
||||
|
@ -1,67 +0,0 @@
|
||||
{
|
||||
"name": "SteelHead",
|
||||
"category": "guest",
|
||||
"description": "SteelHead is the Riverbed Accelerator",
|
||||
"vendor_name": "Riverbed Technology",
|
||||
"vendor_url": "http://www.riverbed.com",
|
||||
"documentation_url": "https://github.com/riverbed/Riverbed-Community-Toolkit/tree/master/SteelHead/GNS3",
|
||||
"product_name": "SteelHead",
|
||||
"product_url": "https://support.riverbed.com/content/support/software/steelhead/cx-appliance.html",
|
||||
"registry_version": 6,
|
||||
"status": "stable",
|
||||
"maintainer": "Riverbed Community",
|
||||
"maintainer_email": "community@riverbed.com",
|
||||
"usage": "Download the KVM image Next Generation Virtual SteelHead VCX Software Image (KVM) from https://support.riverbed.com/content/support/software/steelhead/cx-appliance.html\n Uncompress the .tgz archive using this command: tar xzSf <image_file>\nDefault credentials: admin / password",
|
||||
"symbol": "steelhead-vcx.png",
|
||||
"first_port_name": "PRI",
|
||||
"qemu": {
|
||||
"arch": "x86_64",
|
||||
"adapter_type": "virtio-net-pci",
|
||||
"adapters": 4,
|
||||
"custom_adapters": [
|
||||
{
|
||||
"adapter_number": 1,
|
||||
"port_name": "AUX"
|
||||
},
|
||||
{
|
||||
"adapter_number": 2,
|
||||
"port_name": "LAN0_0"
|
||||
},
|
||||
{
|
||||
"adapter_number": 3,
|
||||
"port_name": "WAN0_0"
|
||||
}
|
||||
],
|
||||
"ram": 2048,
|
||||
"hda_disk_interface": "virtio",
|
||||
"hdb_disk_interface": "virtio",
|
||||
"console_type": "telnet",
|
||||
"kvm": "require"
|
||||
},
|
||||
"images": [
|
||||
{
|
||||
"filename": "mgmt.qcow2",
|
||||
"version": "9.12.0",
|
||||
"md5sum": "0f45d7cfb75b5e7e915dd37136411580",
|
||||
"filesize": 2381840384,
|
||||
"download_url": "https://support.riverbed.com/content/support/software/steelhead/cx-appliance.html#software-alert"
|
||||
},
|
||||
{
|
||||
"filename": "empty100G.qcow2",
|
||||
"version": "1.0",
|
||||
"md5sum": "5d9fec18a980f13002028491259f158d",
|
||||
"filesize": 198656,
|
||||
"download_url": "https://github.com/riverbed/Riverbed-Community-Toolkit/raw/master/SteelHead/GNS3",
|
||||
"direct_download_url": "https://github.com/riverbed/Riverbed-Community-Toolkit/raw/master/SteelHead/GNS3/empty100G.qcow2"
|
||||
}
|
||||
],
|
||||
"versions": [
|
||||
{
|
||||
"name": "9.12.0",
|
||||
"images": {
|
||||
"hda_disk_image": "mgmt.qcow2",
|
||||
"hdb_disk_image": "empty100G.qcow2"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
@ -15,6 +15,7 @@
|
||||
|
||||
"properties": {
|
||||
"appliance_id": {
|
||||
"title": "Appliance ID",
|
||||
"type": "string",
|
||||
"minLength": 36,
|
||||
"maxLength": 36,
|
||||
@ -438,6 +439,7 @@
|
||||
},
|
||||
"additionalProperties": false,
|
||||
"required": [
|
||||
"appliance_id",
|
||||
"name",
|
||||
"category",
|
||||
"description",
|
||||
|
@ -15,6 +15,7 @@
|
||||
|
||||
"properties": {
|
||||
"appliance_id": {
|
||||
"title": "Appliance ID",
|
||||
"type": "string",
|
||||
"minLength": 36,
|
||||
"maxLength": 36,
|
||||
@ -440,6 +441,7 @@
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"appliance_id",
|
||||
"name",
|
||||
"category",
|
||||
"description",
|
||||
|
@ -15,6 +15,7 @@
|
||||
|
||||
"properties": {
|
||||
"appliance_id": {
|
||||
"title": "Appliance ID",
|
||||
"type": "string",
|
||||
"minLength": 36,
|
||||
"maxLength": 36,
|
||||
@ -440,6 +441,7 @@
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"appliance_id",
|
||||
"name",
|
||||
"category",
|
||||
"description",
|
||||
|
@ -15,6 +15,7 @@
|
||||
|
||||
"properties": {
|
||||
"appliance_id": {
|
||||
"title": "Appliance ID",
|
||||
"type": "string",
|
||||
"minLength": 36,
|
||||
"maxLength": 36,
|
||||
@ -491,6 +492,7 @@
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"appliance_id",
|
||||
"name",
|
||||
"category",
|
||||
"description",
|
||||
|
@ -1,45 +0,0 @@
|
||||
{
|
||||
"name": "Ubuntu Server",
|
||||
"category": "guest",
|
||||
"description": "This is a custom Ubuntu server which comes with Canonical security updates, Xorg and Telnetd",
|
||||
"vendor_name": "Canonical Inc.",
|
||||
"vendor_url": "https://www.ubuntu.com",
|
||||
"documentation_url": "https://help.ubuntu.com",
|
||||
"product_name": "Ubuntu",
|
||||
"product_url": "https://ubuntu.com/server",
|
||||
"registry_version": 3,
|
||||
"status": "stable",
|
||||
"maintainer": "Mohamad Siblini",
|
||||
"maintainer_email": "https://www.ictkin.com/contact",
|
||||
"usage": "Username: gns3\nPassword: gns3 | MD5: 435f15a54f7f673e302ad26f05226e0e",
|
||||
"port_name_format": "ens{0}",
|
||||
"qemu": {
|
||||
"adapter_type": "virtio-net-pci",
|
||||
"adapters": 1,
|
||||
"ram": 2048,
|
||||
"hda_disk_interface": "virtio",
|
||||
"arch": "x86_64",
|
||||
"console_type": "vnc",
|
||||
"boot_priority": "c",
|
||||
"kvm": "require",
|
||||
"options": "-vga virtio"
|
||||
},
|
||||
"images": [
|
||||
{
|
||||
"filename": "Ubuntu Server 18.04.3 LTS (64bit).vmdk",
|
||||
"version": "18.04.3",
|
||||
"md5sum": "435f15a54f7f673e302ad26f05226e0e",
|
||||
"filesize": 2707814912,
|
||||
"download_url": "https://www.ictkin.com/gns3-appliance/"
|
||||
}
|
||||
],
|
||||
"versions": [
|
||||
{
|
||||
"name": "18.04.3 LTS Server",
|
||||
"images": {
|
||||
"hda_disk_image": "Ubuntu Server 18.04.3 LTS (64bit).vmdk"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user