mirror of
https://github.com/GNS3/gns3-server.git
synced 2026-08-27 12:30:13 +03:00
Fix: Use _computes instead of _project_created_on_compute for deletion check
The initial fix used _project_created_on_compute to check for disconnected computes before deletion, but this set gets reset during project.open(), causing the check to fail. Now uses self._computes which is loaded from the topology file and persists through the open() call. Related: #2703 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
4444da9ffa
commit
9c868911e1
@ -1031,10 +1031,19 @@ class Project:
|
||||
log.warning(f"Conflict while deleting project: {e}")
|
||||
|
||||
# Check if all computes used by this project are connected before deletion
|
||||
# We need to check from the topology file because _project_created_on_compute
|
||||
# gets reset during open()
|
||||
disconnected_computes = []
|
||||
for compute in self._project_created_on_compute:
|
||||
if not compute.connected:
|
||||
disconnected_computes.append(compute)
|
||||
for compute_id in self._computes:
|
||||
try:
|
||||
compute = self._controller.get_compute(compute_id)
|
||||
if not compute.connected:
|
||||
disconnected_computes.append(compute)
|
||||
except ControllerError:
|
||||
# Compute doesn't exist anymore, consider it disconnected
|
||||
log.warning(f"Compute '{compute_id}' not found in controller")
|
||||
# We can't add it to disconnected_computes without the compute object
|
||||
pass
|
||||
|
||||
if disconnected_computes:
|
||||
compute_names = ", ".join([f"'{c.name}'" for c in disconnected_computes])
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user