targetcli-fb/targetcli-only-save-old-config-if-present.patch
Lee Duncan abfb49c9bf Accepting request 599502 from home:lee_duncan:branches:Base:System
- Only save current config to backup if current
  config exists (bsc#1090424), adding patch:
  * targetcli-only-save-old-config-if-present.patch

OBS-URL: https://build.opensuse.org/request/show/599502
OBS-URL: https://build.opensuse.org/package/show/Base:System/targetcli-fb?expand=0&rev=20
2018-04-20 20:39:29 +00:00

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"