diff options
author | Prasanna Kumar Kalever <prasanna.kalever@redhat.com> | 2017-12-19 14:32:41 +0530 |
---|---|---|
committer | Prasanna Kumar Kalever <prasanna.kalever@redhat.com> | 2017-12-19 15:23:15 +0530 |
commit | bd3b2b50d741848a748830d9a1a7ee642e8d40d3 (patch) | |
tree | 5341152f0b60b6373fd8ebaed20115da230c0c7a /targetcli | |
parent | 2f209d7749b12047be0c71469bb9b4f2ae2b6e9a (diff) | |
download | targetcli-bd3b2b50d741848a748830d9a1a7ee642e8d40d3.tar.gz |
config: rename key 'kept_backups' as 'max_backup_files'
$ cat /etc/target/targetcli.conf
max_backup_files = 25
$ targetcli / saveconfig
Last 25 configs saved in /etc/target/backup.
Configuration saved to /etc/target/saveconfig.json
Signed-off-by: Prasanna Kumar Kalever <prasanna.kalever@redhat.com>
Diffstat (limited to 'targetcli')
-rw-r--r-- | targetcli/ui_root.py | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/targetcli/ui_root.py b/targetcli/ui_root.py index f398395..f84d33d 100644 --- a/targetcli/ui_root.py +++ b/targetcli/ui_root.py @@ -101,18 +101,18 @@ class UIRoot(UINode): # Kill excess backups try: with open(universal_prefs_file) as prefs: - backups = [line for line in prefs.read().splitlines() if re.match('^kept_backups\s*=', line)] - kept_backups = int(backups[0].split('=')[1].strip()) + backups = [line for line in prefs.read().splitlines() if re.match('^max_backup_files\s*=', line)] + max_backup_files = int(backups[0].split('=')[1].strip()) except: - kept_backups = default_kept_backups + max_backup_files = default_kept_backups - files_to_unlink = list(reversed(backed_files_list))[kept_backups:] + files_to_unlink = list(reversed(backed_files_list))[max_backup_files:] for f in files_to_unlink: with ignored(IOError): os.unlink(f) self.shell.log.info("Last %d configs saved in %s." % \ - (kept_backups, backup_dir)) + (max_backup_files, backup_dir)) else: self.shell.log.warning("Could not create backup file %s: %s." % \ (backupfile, backup_error)) |