mirror of
https://github.com/GNS3/gns3-server.git
synced 2026-11-05 23:01:15 +02:00
templates: persist appliance metadata on install
Appliance fields that describe the appliance (vendor information, default credentials, installation instructions...) were dropped when installing a template. Keep them in a new appliance_metadata JSON column on the templates table, filled by the appliance-to-template conversion for both registry v1-6 and v8 (version level values override the appliance level ones). The nested schema allows extra fields so future registry fields persist without a migration.
This commit is contained in:
7 files changed
+216
No files matched your search
@@ -34,6 +34,34 @@ class Category(str, Enum):
|
||||
firewall = "firewall"
|
||||
|
||||
|
||||
class ApplianceMetadata(BaseModel):
|
||||
"""
|
||||
Metadata kept on a template installed from an appliance: vendor
|
||||
information, default credentials and other fields that describe
|
||||
the appliance but are not node properties.
|
||||
"""
|
||||
|
||||
model_config = ConfigDict(extra="allow")
|
||||
|
||||
appliance_id: Optional[str] = Field(
|
||||
None, description="ID of the appliance the template was installed from"
|
||||
)
|
||||
description: Optional[str] = None
|
||||
vendor_name: Optional[str] = None
|
||||
vendor_url: Optional[str] = None
|
||||
vendor_logo_url: Optional[str] = None
|
||||
documentation_url: Optional[str] = None
|
||||
product_name: Optional[str] = None
|
||||
product_url: Optional[str] = None
|
||||
status: Optional[str] = None
|
||||
availability: Optional[str] = None
|
||||
maintainer: Optional[str] = None
|
||||
maintainer_email: Optional[str] = None
|
||||
installation_instructions: Optional[str] = None
|
||||
default_username: Optional[str] = None
|
||||
default_password: Optional[str] = None
|
||||
|
||||
|
||||
class TemplateBase(BaseModel):
|
||||
"""
|
||||
Common template properties.
|
||||
@@ -57,6 +85,10 @@ class TemplateBase(BaseModel):
|
||||
default_factory=list,
|
||||
description="User-defined metadata tags (e.g. 'vendor:cisco' or 'model:7200')"
|
||||
)
|
||||
appliance_metadata: Optional[ApplianceMetadata] = Field(
|
||||
None,
|
||||
description="Metadata inherited from the appliance the template was installed from"
|
||||
)
|
||||
|
||||
|
||||
class TemplateCreate(TemplateBase):
|
||||
|
||||
Reference in new issue
Block a user