mirror of
https://github.com/GNS3/gns3-server.git
synced 2026-11-03 14:01:15 +02:00
fix: use bound-method param count for Dynamips create_nio detection
The inspect check tested unbound function signatures (3 params unbound vs 2 unbound) but node.manager.create_nio is a bound method — inspect excludes 'self'. Dynamips bound = 2 (node + nio_settings), standard bound = 1 (nio_settings). The old '== 3' never matched, so the extra 'node' arg was never passed. Switch to '>= 2' and rewrite the test to exercise the actual bound-method scenario.
This commit is contained in:
2 files changed
+19
-14
No files matched your search
@@ -191,8 +191,12 @@ async def create_batch_nios(
|
||||
nio_settings = jsonable_encoder(entry.nio, exclude_unset=True)
|
||||
# Dynamips.create_nio takes an extra positional `node` argument that
|
||||
# the base signature does not include. Detect it via parameter count.
|
||||
# Dynamips.create_nio(self, node, nio_settings) exposes one extra
|
||||
# positional on the bound method compared to the standard signature
|
||||
# (self, nio_settings). Detect it: standard == 1 bound param,
|
||||
# Dynamips == 2 bound params (node + nio_settings).
|
||||
sig = inspect.signature(node.manager.create_nio)
|
||||
if len(sig.parameters) == 3:
|
||||
if len(sig.parameters) >= 2:
|
||||
nio = node.manager.create_nio(node, nio_settings)
|
||||
else:
|
||||
nio = node.manager.create_nio(nio_settings)
|
||||
|
||||
Reference in new issue
Block a user