From 53032b2289fd39a2aaee9a8ec5b60be774dd93f4 Mon Sep 17 00:00:00 2001 From: Johan Marcusson Date: Mon, 21 Oct 2024 16:26:00 +0200 Subject: [PATCH] open/close before get config --- src/cnaas_nms/devicehandler/sync_devices.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/cnaas_nms/devicehandler/sync_devices.py b/src/cnaas_nms/devicehandler/sync_devices.py index fb4ad704..e3d8e493 100644 --- a/src/cnaas_nms/devicehandler/sync_devices.py +++ b/src/cnaas_nms/devicehandler/sync_devices.py @@ -363,7 +363,9 @@ def populate_device_vars( # if device type in api_settings.DEVICE_TYPES_WITH_INCLUDE_RUNNING_CONFIG for dt_str in api_settings.DEVICE_TYPES_WITH_INCLUDE_RUNNING_CONFIG: if dev.device_type.name.lower() == dt_str.lower(): + task.host.open_connection("napalm", configuration=task.nornir.config) res = task.run(task=napalm_get, getters=["config"]) + task.host.close_connection("napalm") running_config = dict(res.result)["config"]["running"] # Remove the first task result, which is the napalm_get result, since it's not needed anymore