summaryrefslogtreecommitdiff
path: root/python/vyos/config_mgmt.py
diff options
context:
space:
mode:
authorJohn Estabrook <jestabro@vyos.io>2023-12-11 09:02:38 -0600
committerJohn Estabrook <jestabro@vyos.io>2023-12-11 09:05:01 -0600
commitccbf03f1a87ac37eef78aeb29420ceea9a730a90 (patch)
treef4f7f860411d636a91393dcbf85c00f16f9b8eb2 /python/vyos/config_mgmt.py
parente7cf5af4e558412d5cf1b8b6eca1ded1a264c6a8 (diff)
downloadvyos-1x-ccbf03f1a87ac37eef78aeb29420ceea9a730a90.tar.gz
vyos-1x-ccbf03f1a87ac37eef78aeb29420ceea9a730a90.zip
T5812: report actual number of revisions instead of max
Diffstat (limited to 'python/vyos/config_mgmt.py')
-rw-r--r--python/vyos/config_mgmt.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/python/vyos/config_mgmt.py b/python/vyos/config_mgmt.py
index 950f14d4f..fd0fa7a75 100644
--- a/python/vyos/config_mgmt.py
+++ b/python/vyos/config_mgmt.py
@@ -125,6 +125,7 @@ class ConfigMgmt:
get_first_key=True)
self.max_revisions = int(d.get('commit_revisions', 0))
+ self.num_revisions = 0
self.locations = d.get('commit_archive', {}).get('location', [])
self.source_address = d.get('commit_archive',
{}).get('source_address', '')
@@ -233,7 +234,7 @@ Proceed ?'''
msg = ''
if not self._check_revision_number(rev):
- msg = f'Invalid revision number {rev}: must be 0 < rev < {self.max_revisions}'
+ msg = f'Invalid revision number {rev}: must be 0 < rev < {self.num_revisions}'
return msg, 1
prompt_str = 'Proceed with reboot ?'
@@ -560,8 +561,8 @@ Proceed ?'''
return len(l)
def _check_revision_number(self, rev: int) -> bool:
- maxrev = self._get_number_of_revisions()
- if not 0 <= rev < maxrev:
+ self.num_revisions = self._get_number_of_revisions()
+ if not 0 <= rev < self.num_revisions:
return False
return True