@@ -493,6 +493,7 @@ def main():
493493 save = module .params ["save" ]
494494 filter = module .params ["get_filter" ]
495495 format = module .params ["format" ]
496+ commit = module .params ["commit" ]
496497
497498 try :
498499 filter_data , filter_type = validate_and_normalize_data (filter )
@@ -598,7 +599,7 @@ def main():
598599 conn .validate (target )
599600 if source :
600601 if not module .check_mode :
601- conn .copy_config (source , target )
602+ conn .copy (source , target )
602603 result ["changed" ] = True
603604 elif delete :
604605 if not module .check_mode :
@@ -689,6 +690,18 @@ def main():
689690 "before" : sanitized_before ,
690691 "after" : sanitized_after ,
691692 }
693+ elif not config and commit :
694+ if not module .check_mode :
695+ confirm_timeout = confirm if confirm > 0 else None
696+ commit_rpc = f"""
697+ <commit xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
698+ <confirmed/>
699+ <confirm-timeout>{ confirm_timeout } </confirm-timeout>
700+ </commit>
701+ """
702+ response = conn .dispatch (commit_rpc .strip ())
703+ else :
704+ conn .discard_changes ()
692705
693706 except ConnectionError as e :
694707 module .fail_json (msg = to_text (e , errors = "surrogate_then_replace" ).strip ())
0 commit comments