Skip to content

Commit

Permalink
open/close before get config
Browse files Browse the repository at this point in the history
  • Loading branch information
indy-independence committed Oct 21, 2024
1 parent 68e8813 commit 53032b2
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/cnaas_nms/devicehandler/sync_devices.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 53032b2

Please sign in to comment.