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
This commit is contained in:
Lee Duncan 2018-04-20 20:39:29 +00:00 committed by Git OBS Bridge
parent f8c3097b3b
commit abfb49c9bf
3 changed files with 32 additions and 0 deletions

View File

@ -1,3 +1,10 @@
-------------------------------------------------------------------
Fri Apr 20 19:13:39 UTC 2018 - lduncan@suse.com
- Only save current config to backup if current
config exists (bsc#1090424), adding patch:
* targetcli-only-save-old-config-if-present.patch
-------------------------------------------------------------------
Wed Apr 11 00:00:54 UTC 2018 - ddiss@suse.com

View File

@ -58,6 +58,7 @@ Patch1: Auto-detect-readonly-state-for-iblock-devices.patch
Patch2: Use-signed-char-instead-of-char.patch
Patch3: Split-out-blockdev-readonly-state-detection-helper.patch
Patch4: rbd-support.patch
Patch5: targetcli-only-save-old-config-if-present.patch
%python_subpackages
@ -89,6 +90,7 @@ python2-targetcli-fb and python3-targetcli-fb.
# RBD support is dependent on LIO changes present in the SLE/Leap kernel
%patch4 -p1
%endif
%patch5 -p1
%build
%python_build

View File

@ -0,0 +1,23 @@
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"