From 90d04a1e6c1ec63ea523314de77bc8529c6832c5 Mon Sep 17 00:00:00 2001 From: Kirk Byers Date: Wed, 15 Sep 2021 10:59:26 -0700 Subject: [PATCH] Exit config mode at the end of commit --- nornir_netmiko/tasks/netmiko_commit.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/nornir_netmiko/tasks/netmiko_commit.py b/nornir_netmiko/tasks/netmiko_commit.py index 7f6555d..e5e071a 100644 --- a/nornir_netmiko/tasks/netmiko_commit.py +++ b/nornir_netmiko/tasks/netmiko_commit.py @@ -16,4 +16,7 @@ def netmiko_commit(task: Task, **kwargs: Any) -> Result: """ conn = task.host.get_connection(CONNECTION_NAME, task.nornir.config) result = conn.commit(**kwargs) + + if conn.check_config_mode(): + conn.exit_config_mode() return Result(host=task.host, result=result, changed=True)