Graham Paasch commited on
Commit
e3cc8b5
·
1 Parent(s): 44ffd72

Fix hybrid seeding to use template engine and add generate_config alias

Browse files
agent/config_templates.py CHANGED
@@ -455,6 +455,10 @@ class ConfigTemplateEngine:
455
  device_name = device.get('name') if isinstance(device, dict) else device.name
456
  logger.info(f"Generated config for {device_name} using template {template_name}")
457
  return config
 
 
 
 
458
 
459
  def _select_template(self, device: Any) -> str:
460
  """
 
455
  device_name = device.get('name') if isinstance(device, dict) else device.name
456
  logger.info(f"Generated config for {device_name} using template {template_name}")
457
  return config
458
+
459
+ # Backward-compatible alias used by some callers
460
+ def generate_config(self, device: Any, network_context: Optional[Dict[str, Any]] = None) -> str:
461
+ return self.generate_device_config(device, network_context)
462
 
463
  def _select_template(self, device: Any) -> str:
464
  """
agent/pipeline_engine.py CHANGED
@@ -1311,13 +1311,15 @@ Be specific and practical. Use RFC1918 addressing. Consider scalability and secu
1311
  seeded = False
1312
  if deploy_mode in ("hybrid", "gns3") and project_for_seed:
1313
  from agent.network_ops import seed_gns3_node_config
 
 
 
 
 
1314
  seed_resp = seed_gns3_node_config(
1315
  project_name=project_for_seed["name"],
1316
  device_name=device.name,
1317
- config=deployment_engine.template_engine.generate_config(
1318
- device=device,
1319
- network_context=network_context
1320
- )
1321
  )
1322
  seed_results.append({
1323
  "device": device.name,
 
1311
  seeded = False
1312
  if deploy_mode in ("hybrid", "gns3") and project_for_seed:
1313
  from agent.network_ops import seed_gns3_node_config
1314
+ # Generate config for seeding via GNS3
1315
+ cfg_text = deployment_engine.template_engine.generate_device_config(
1316
+ device=device,
1317
+ network_context=network_context
1318
+ )
1319
  seed_resp = seed_gns3_node_config(
1320
  project_name=project_for_seed["name"],
1321
  device_name=device.name,
1322
+ config=cfg_text
 
 
 
1323
  )
1324
  seed_results.append({
1325
  "device": device.name,