restoreconfig: Do not return success if the file doesn't exist

Resolves: RHEL-135093

Signed-off-by: Maurizio Lombardi <mlombard@redhat.com>
This commit is contained in:
Maurizio Lombardi 2025-12-11 09:57:31 +01:00
parent 57c2c4d635
commit 4194bd078f
2 changed files with 20 additions and 1 deletions

View File

@ -0,0 +1,14 @@
diff --git a/targetcli/ui_root.py b/targetcli/ui_root.py
index 79ee985..2dd6614 100644
--- a/targetcli/ui_root.py
+++ b/targetcli/ui_root.py
@@ -207,8 +207,7 @@ class UIRoot(UINode):
savefile = os.path.expanduser(savefile)
if not os.path.isfile(savefile):
- self.shell.log.info("Restore file %s not found" % savefile)
- return
+ raise ExecutionError(f"Restore file {savefile} not found")
target = self.ui_eval_param(target, 'string', None)
storage_object = self.ui_eval_param(storage_object, 'string', None)

View File

@ -4,7 +4,7 @@ Name: targetcli
License: ASL 2.0
Summary: An administration shell for storage targets
Version: 2.1.58
Release: 4%{?dist}
Release: 5%{?dist}
URL: https://github.com/open-iscsi/%{oname}
Source: %{url}/archive/v%{version}/%{oname}-%{version}.tar.gz
# Proposed upstream
@ -14,6 +14,7 @@ BuildRequires: python3-devel, python3-setuptools, systemd-rpm-macros
Requires: python3-rtslib, target-restore, python3-configshell, python3-six, python3-dbus
Requires: python3-gobject-base
Patch0: regex.patch
Patch1: 0002-restoreconfig-do-not-return-success.patch
%description
An administration shell for configuring iSCSI, FCoE, and other
@ -24,6 +25,7 @@ users will also need to install and use fcoe-utils.
%prep
%setup -q -n %{oname}-%{version}
%patch0 -p1
%patch1 -p1
%build
%py3_build
@ -48,6 +50,9 @@ install -m 644 systemd/* %{buildroot}%{_unitdir}/
%dir %{_sysconfdir}/target/backup
%changelog
* Thu Dec 11 2025 Maurizio Lombardi <mlombard@redhat.com> - 2.1.58-5
- restoreconfig: do not return success if the file doesn't exist
* Thu Oct 23 2025 Maurizio Lombardi <mlombard@redhat.com> - 2.1.58-4
- Fix syntax warning RHEL-78512