nodes: per-node default credentials seeded from the template

Add default_username/default_password as controller-only node properties
(the netmiko_device_type pattern): they are not sent to the compute,
persist with the project topology and can be updated or cleared per
node. Creating a node from a template seeds them from the template
appliance metadata, and the metadata itself is dropped there so it
never leaks into the node properties.
This commit is contained in:
YueGuobin committed 2026-08-21 21:41:42 +08:00
1 parent 300c53e6fb
commit 92d4e3d378
5 files changed
+125

No files matched your search

+22
View File
@@ -58,6 +58,8 @@ class Node:
"category",
"console_auto_start",
"netmiko_device_type",
"default_username",
"default_password",
]
def __init__(self, project, compute, name, node_id=None, node_type=None, template_id=None, **kwargs):
@@ -114,6 +116,8 @@ class Node:
self._first_port_name = None
self._console_auto_start = False
self._netmiko_device_type = None
self._default_username = None
self._default_password = None
# This properties will be recomputed
ignore_properties = ("width", "height", "hover_symbol")
@@ -222,6 +226,22 @@ class Node:
def netmiko_device_type(self, val):
self._netmiko_device_type = val
@property
def default_username(self):
return self._default_username
@default_username.setter
def default_username(self, val):
self._default_username = val
@property
def default_password(self):
return self._default_password
@default_password.setter
def default_password(self, val):
self._default_password = val
@property
def properties(self):
return self._properties
@@ -844,6 +864,8 @@ class Node:
"console_type": self._console_type,
"console_auto_start": self._console_auto_start,
"netmiko_device_type": self._netmiko_device_type,
"default_username": self._default_username,
"default_password": self._default_password,
"aux": self._aux,
"aux_type": self._aux_type,
"properties": self._properties,