24 lines
936 B
Diff
24 lines
936 B
Diff
|
From: Lee Duncan <lduncan@suse.com>
|
||
|
Date: Fri Apr 20 12:07:30 PDT 2018
|
||
|
Subject: [PATCH] targetcli: only save old config if present
|
||
|
|
||
|
There is no reason to copy the current configuration to the
|
||
|
backup directory if there is no current configuration.
|
||
|
|
||
|
Already fixed upstream, but the code is totally different
|
||
|
there.
|
||
|
|
||
|
Signed-off-by: Lee Duncan <lduncan@suse.com>
|
||
|
---
|
||
|
--- a/targetcli/ui_root.py 2018-04-20 11:53:58.987907240 -0700
|
||
|
+++ b/targetcli/ui_root.py 2018-04-20 11:56:35.231375345 -0700
|
||
|
@@ -70,7 +70,7 @@ class UIRoot(UINode):
|
||
|
savefile = os.path.expanduser(savefile)
|
||
|
|
||
|
# Only save backups if saving to default location
|
||
|
- if savefile == default_save_file:
|
||
|
+ if (savefile == default_save_file) and os.path.exists(savefile):
|
||
|
backup_dir = os.path.dirname(savefile) + "/backup"
|
||
|
backup_name = "saveconfig-" + \
|
||
|
datetime.now().strftime("%Y%m%d-%H:%M:%S") + ".json"
|