From 5b61dd8915896e24547d7375bbe8ad238f25cb9a Mon Sep 17 00:00:00 2001 From: CentOS Sources Date: Tue, 28 Apr 2020 05:33:55 -0400 Subject: [PATCH] import redfish-finder-0.3-4.el8 --- SOURCES/hostname-null-check.patch | 70 +++++++++++++++++++++++++++++++ SPECS/redfish-finder.spec | 6 ++- 2 files changed, 75 insertions(+), 1 deletion(-) create mode 100644 SOURCES/hostname-null-check.patch diff --git a/SOURCES/hostname-null-check.patch b/SOURCES/hostname-null-check.patch new file mode 100644 index 0000000..9320f38 --- /dev/null +++ b/SOURCES/hostname-null-check.patch @@ -0,0 +1,70 @@ +commit 74c305647c892b9035332aaf179d11544104caba +Author: Adrian Huang +Date: Thu Jul 11 15:50:40 2019 +0800 + + Fix the exception if hostname is empty + + Redfish Host Interface Specification [1] defines the field "Redfish + Service Hostname" as "Varies", which means it can be empty. Moreover, + this field is not mandatory for well-defined configuration (a valid + string). + + The original design assumes that this field is the non-empty string + shown as follows: + + ------------------------------------------------------------------- + self.hostname = cursor.split()[0] + ------------------------------------------------------------------- + + This leads to the exception, and the "self.hostname" is not configured. + Here is the error output: + + ------------------------------------------------------------------- + redfish-finder: Getting dmidecode info + redfish-finder: Unexpected error parsing ServiceConfig + redfish-finder: Building NetworkManager connection info + redfish-finder: Obtaining OS config info + redfish-finder: Converting SMBIOS Host Config to NetworkManager Connection info + redfish-finder: Applying NetworkManager connection configuration changes + Error: 'enp6s0f3u2u3c2' is not an active connection. + Error: no active connection provided. + Connection successfully activated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/5) + redfish-finder: Adding redfish host info to OS config + Traceback (most recent call last): + File "./redfish-finder", line 526, in + main() + File "./redfish-finder", line 520, in main + svc.update_redfish_info() + File "./redfish-finder", line 349, in update_redfish_info + if h.find(self.sconf.hostname) != -1: + AttributeError: ServiceConfig instance has no attribute 'hostname' + ------------------------------------------------------------------- + + This patch fixes the above-mentioned issue accordingly. + + [1] https://www.dmtf.org/sites/default/files/standards/documents/DSP0270_1.1.0.pdf + + Signed-off-by: Adrian Huang + +diff --git a/redfish-finder b/redfish-finder +index 429cc42..c2cba75 100755 +--- a/redfish-finder ++++ b/redfish-finder +@@ -235,7 +235,16 @@ class ServiceConfig(): + cursor = cursor_consume_next(cursor, "Redfish Service Vlan: ") + self.vlan = int(cursor.split()[0]) + cursor = cursor_consume_next(cursor, "Redfish Service Hostname: ") +- self.hostname = cursor.split()[0] ++ ++ # ++ # Sanity check: If it contains the consecutive spaces ++ # only, reference to the index '0' will throw an ++ # exception. ++ # ++ if len(cursor.split()) != 0: ++ self.hostname = cursor.split()[0] ++ else: ++ self.hostname = "" + except: + print("redfish-finder: Unexpected error parsing ServiceConfig") + diff --git a/SPECS/redfish-finder.spec b/SPECS/redfish-finder.spec index 922357b..f243ee6 100644 --- a/SPECS/redfish-finder.spec +++ b/SPECS/redfish-finder.spec @@ -1,6 +1,6 @@ Name: redfish-finder Version: 0.3 -Release: 3%{?dist} +Release: 4%{?dist} Summary: Utility for parsing SMBIOS information and configuring canonical BMC access BuildArch: noarch @@ -9,6 +9,7 @@ URL: https://github.com/nhorman/redfish-finder Source0: %url/archive/V%{version}/%{name}-%{version}.tar.gz Patch0: redfish-finder-multi-block.patch +Patch1: hostname-null-check.patch %{?systemd_requires} BuildRequires: systemd @@ -50,6 +51,9 @@ install -D -p -m 0644 ./redfish-finder.service %{buildroot}/%{_unitdir}/redfish- %{_unitdir}/redfish-finder.service %changelog +* Thu Oct 17 2019 Neil Horman - 0.3-4 +- Fix null hostname check (bz1729343) + * Mon Jul 01 2019 Neil Horman - 0.3-3 - Enhance to support multiple type 42 blocks (bz1715914)