Skip to content

Commit

Permalink
Merge pull request #1131 from rahkumar651991/ignore_warning_rollback
Browse files Browse the repository at this point in the history
Adding ignore warning for rollback api
  • Loading branch information
Nitin Kr authored Sep 16, 2021
2 parents 5583ff7 + 110a09e commit b3bf657
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions lib/jnpr/junos/utils/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -653,13 +653,20 @@ def unlock(self):
# rollback <number|0*>
# -------------------------------------------------------------------------

def rollback(self, rb_id=0):
def rollback(self, rb_id=0, ignore_warning=False):
"""
Rollback the candidate config to either the last active or
a specific rollback number.
:param int rb_id: The rollback id value [0-49], defaults to ``0``.
:param ignore_warning: A boolean, string or list of string.
If the value is True, it will ignore all warnings regardless of the
warning message. If the value is a string, it will ignore
warning(s) if the message of each warning matches the string. If
the value is a list of strings, ignore warning(s) if the message of
each warning matches at least one of the strings in the list.
:returns:
``True`` always when successful
Expand All @@ -669,7 +676,9 @@ def rollback(self, rb_id=0):
if rb_id < 0 or rb_id > 49:
raise ValueError("Invalid rollback #" + str(rb_id))

self.rpc.load_configuration(dict(compare="rollback", rollback=str(rb_id)))
self.rpc.load_configuration(
dict(compare="rollback", rollback=str(rb_id)), ignore_warning=ignore_warning
)

return True

Expand Down

0 comments on commit b3bf657

Please sign in to comment.