From b6d0e3bdac2d50f53bdc455305d6758da5936255 Mon Sep 17 00:00:00 2001 From: rahkumar651991 Date: Mon, 16 Aug 2021 13:33:08 +0530 Subject: [PATCH 1/3] Adding ignore warning for rollback api --- lib/jnpr/junos/utils/config.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/jnpr/junos/utils/config.py b/lib/jnpr/junos/utils/config.py index d540610f4..74228d0db 100644 --- a/lib/jnpr/junos/utils/config.py +++ b/lib/jnpr/junos/utils/config.py @@ -643,7 +643,7 @@ def unlock(self): # rollback # ------------------------------------------------------------------------- - 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. @@ -659,7 +659,7 @@ 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 From e6f6685c1b11235bb80d0420791c9078d7dcbea0 Mon Sep 17 00:00:00 2001 From: rahkumar651991 Date: Tue, 31 Aug 2021 11:54:45 +0530 Subject: [PATCH 2/3] formatting with the black tool --- lib/jnpr/junos/utils/config.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/jnpr/junos/utils/config.py b/lib/jnpr/junos/utils/config.py index 74228d0db..3a1041ef6 100644 --- a/lib/jnpr/junos/utils/config.py +++ b/lib/jnpr/junos/utils/config.py @@ -659,7 +659,9 @@ def rollback(self, rb_id=0, ignore_warning=False): 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)), ignore_warning=ignore_warning) + self.rpc.load_configuration( + dict(compare="rollback", rollback=str(rb_id)), ignore_warning=ignore_warning + ) return True From 110a09e86a3cf48c6823ca8b15d1df48cff53714 Mon Sep 17 00:00:00 2001 From: rahkumar651991 <58289625+rahkumar651991@users.noreply.github.com> Date: Thu, 16 Sep 2021 16:01:38 +0530 Subject: [PATCH 3/3] update documentation for rollback arguments --- lib/jnpr/junos/utils/config.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/jnpr/junos/utils/config.py b/lib/jnpr/junos/utils/config.py index 3a1041ef6..78a86df3e 100644 --- a/lib/jnpr/junos/utils/config.py +++ b/lib/jnpr/junos/utils/config.py @@ -650,6 +650,13 @@ def rollback(self, rb_id=0, ignore_warning=False): :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