!33 使用PATH环境变量运行uwsgi命令,防止出现uwsgi路径变动,导致patch-tracking服务启动失败的问题

From: @protkhn 
Reviewed-by: @liheavy 
Signed-off-by: @liheavy
This commit is contained in:
openeuler-ci-bot 2024-05-10 02:37:04 +00:00 committed by Gitee
commit fcbc9311b0
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
3 changed files with 34 additions and 12 deletions

View File

@ -0,0 +1,25 @@
From b756c4d49636d935adab3422b3d7967992b4cfdc Mon Sep 17 00:00:00 2001
From: hanjinpeng <hanjinpeng@kylinos.cn>
Date: Tue, 7 May 2024 11:05:48 +0800
Subject: [PATCH] fix uwsgi path not found issue
---
patch_tracking/patch-tracking | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/patch_tracking/patch-tracking b/patch_tracking/patch-tracking
index f5961fc..b0f4fce 100755
--- a/patch_tracking/patch-tracking
+++ b/patch_tracking/patch-tracking
@@ -8,4 +8,7 @@ settings_file='/etc/patch-tracking/settings.conf'
server=`grep 'LISTEN' $settings_file | awk -F'=' '{print $2}' | sed -e 's/^[ ]"//g' | sed -e 's/"$//g'`
-/usr/local/bin/uwsgi --master --https "${server},/etc/patch-tracking/self-signed.crt,/etc/patch-tracking/self-signed.key" --wsgi-file "${app_file}" --callable app --chdir "${chdir_path}" --threads 100 --lazy
+echo $PATH | grep -q -E "/usr/bin" || PATH=$PATH:/usr/bin
+echo $PATH | grep -q -E "/usr/sbin" || PATH=$PATH:/usr/sbin
+
+uwsgi --master --https "${server},/etc/patch-tracking/self-signed.crt,/etc/patch-tracking/self-signed.key" --wsgi-file "${app_file}" --callable app --chdir "${chdir_path}" --threads 100 --lazy
--
2.43.0

View File

@ -1,9 +0,0 @@
diff --color -Nur a/patch_tracking/patch-tracking b/patch_tracking/patch-tracking
--- a/patch_tracking/patch-tracking 2020-09-07 18:26:52.000000000 +0800
+++ b/patch_tracking/patch-tracking 2022-03-07 19:54:18.156108927 +0800
@@ -8,4 +8,4 @@
server=`grep 'LISTEN' $settings_file | awk -F'=' '{print $2}' | sed -e 's/^[ ]"//g' | sed -e 's/"$//g'`
-/usr/local/bin/uwsgi --master --https "${server},/etc/patch-tracking/self-signed.crt,/etc/patch-tracking/self-signed.key" --wsgi-file "${app_file}" --callable app --chdir "${chdir_path}" --threads 100 --lazy
+/usr/bin/uwsgi --master --https "${server},/etc/patch-tracking/self-signed.crt,/etc/patch-tracking/self-signed.key" --wsgi-file "${app_file}" --callable app --chdir "${chdir_path}" --threads 100 --lazy

View File

@ -1,13 +1,13 @@
Summary: This is a tool for automatically tracking upstream repository code patches
Name: patch-tracking
Version: 1.0.1
Release: 4
Release: 6
License: Mulan PSL v2
URL: https://gitee.com/openeuler/openEuler-Advisor
Source0: patch-tracking-%{version}.tar
Patch0000: fix-uwsgi-not-found.patch
BuildArch: noarch
Patch0: 0001-fix-uwsgi-path-not-found-issue.patch
BuildArch: noarch
BuildRequires: python3-setuptools systemd
Requires: python3-uWSGI python3-flask python3-Flask-SQLAlchemy python3-pandas
@ -53,6 +53,12 @@ rm -rf $RPM_BUILD_ROOT
%changelog
* Tue May 7 2024 Han Jinpeng <hanjinpeng@kylinos.cn> - 1.0.1-6
- Fix uwsgi not found issue, Use the path environment variable to run the uwsgi command
* Wed Apr 17 2024 Han Jinpeng <hanjinpeng@kylinos.cn> - 1.0.1-5
- Fix uwsgi path issue to ensure patch-tracking service start up success
* Tue Feb 28 2023 liheavy <lihaiwei8@huawei.com> - 1.0.1-4
- Add ReadMe and add install Requires