Skip to content

Commit

Permalink
Add option to save config to startup
Browse files Browse the repository at this point in the history
  • Loading branch information
jbemmel committed Oct 4, 2023
1 parent 32f2d77 commit 1cf3169
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions napalm_srl/srl.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,8 @@ def __init__(self, hostname, username, password, timeout=60, optional_args=None)
self.device = SRLAPI(hostname, username, password, timeout=60, optional_args=optional_args)

self.pending_commit = False
# Whether to save changes to startup config, default False
self.commit_save = optional_args.get("commit_save",False)
self.cand_config_file_path = f"/tmp/{hostname}.json"
self.chkpoint_id = 0

Expand Down Expand Up @@ -2155,10 +2157,10 @@ def _cli_commit(self, message='', revert_in=None):
"""
try:
cmds = [
# "enter candidate private name {}".format(self.private_candidate_name),
"enter candidate private ",
"/",
'commit now comment "{}"'.format(message) if message else "commit now"
f'commit { "save" if self.commit_save else "now" }' +
(f'comment "{message}"' if message else '')
]
output = self.device._jsonrpcRunCli(cmds)
return self._return_result(output)
Expand Down

0 comments on commit 1cf3169

Please sign in to comment.