Skip to content

Commit

Permalink
Junos: close configuration in case configure_private is set to avoid …
Browse files Browse the repository at this point in the history
…configure session to stay forever. (#1199)

This is done in commit_config  and discard_config functions.

Co-authored-by: Mircea Ulinic <mirceaulinic@users.noreply.github.com>
  • Loading branch information
spinoshi and mirceaulinic authored May 9, 2020
1 parent 928807f commit b29c554
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions napalm/junos/junos.py
Original file line number Diff line number Diff line change
Expand Up @@ -283,12 +283,16 @@ def commit_config(self, message=""):
self.device.cu.commit(ignore_warning=self.ignore_warning, **commit_args)
if not self.lock_disable and not self.session_config_lock:
self._unlock()
if self.config_private:
self.device.rpc.close_configuration()

def discard_config(self):
"""Discard changes (rollback 0)."""
self.device.cu.rollback(rb_id=0)
if not self.lock_disable and not self.session_config_lock:
self._unlock()
if self.config_private:
self.device.rpc.close_configuration()

def rollback(self):
"""Rollback to previous commit."""
Expand Down

0 comments on commit b29c554

Please sign in to comment.