From 147e906c9420abb252023071276b9d541309cc1c Mon Sep 17 00:00:00 2001 From: zhangsong234 Date: Mon, 1 Mar 2021 14:58:36 +0800 Subject: [PATCH] authz: print error instead of panic when start server failed (cherry picked from commit 6e9947d22a970e3b9c33eabe55318029c1436fda) --- ...r-instead-of-panic-when-start-server.patch | 26 +++++++++++++++++++ authz.spec | 11 +++++++- 2 files changed, 36 insertions(+), 1 deletion(-) create mode 100644 0001-authz-print-error-instead-of-panic-when-start-server.patch diff --git a/0001-authz-print-error-instead-of-panic-when-start-server.patch b/0001-authz-print-error-instead-of-panic-when-start-server.patch new file mode 100644 index 0000000..bf7e42f --- /dev/null +++ b/0001-authz-print-error-instead-of-panic-when-start-server.patch @@ -0,0 +1,26 @@ +From d6f2fd94f8693c0b5031b9a3235f1888b22864d8 Mon Sep 17 00:00:00 2001 +From: zhangsong234 +Date: Mon, 1 Mar 2021 15:18:48 +0800 +Subject: [PATCH] authz: print error instead of panic when start server failed + +Signed-off-by: zhangsong234 +--- + main.go | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/main.go b/main.go +index 8f8578b..06ac4c2 100644 +--- a/main.go ++++ b/main.go +@@ -77,7 +77,7 @@ func main() { + go func() { + err = srv.Start() + if err != nil { +- panic(err) ++ logrus.Errorf("failed to start server: %s", err) + } + }() + ch := make(chan os.Signal, 1) +-- +2.27.0 + diff --git a/authz.spec b/authz.spec index ab027b3..5fc3d15 100644 --- a/authz.spec +++ b/authz.spec @@ -2,13 +2,15 @@ Name: authz Version: 0.1 -Release: 1 +Release: 3 Summary: a isula auth plugin for RBAC License: Mulan PSL v2 URL: https://gitee.com/openeuler/authz Source0: authz-%{version}.tar.gz BuildRoot: %{_tmppath}/authz-root +Patch0001: 0001-authz-print-error-instead-of-panic-when-start-server.patch + #Dependency BuildRequires: golang >= 1.8 BuildRequires: glibc-static @@ -19,6 +21,7 @@ Work with isulad daemon that enables TLS. It brings the support of RBAC. #Build sections %prep %setup -n %{name} -q +%patch1 -p1 %build make @@ -64,6 +67,12 @@ chmod 0640 /var/lib/authz-broker/policy.json rm -rfv %{buildroot} %changelog +* Mon Mar 01 2021 zhangsong234 - 0.1-3 +- pirnt error instead of panic when start server + +* Mon Sep 07 2020 wangkang101 <873229877@qq.com> - 0.1-2 +- modify url of source0 + * Fri Jul 03 2020 zhangsong234 - 0.1-1 - release version 0.1 -- Gitee