!24 [sync] PR-23: 修复旧的token依然有效,uwsgi中增加gevent的配置项

From: @openeuler-sync-bot 
Reviewed-by: @zhu-yuncheng 
Signed-off-by: @zhu-yuncheng
This commit is contained in:
openeuler-ci-bot 2023-05-08 06:19:14 +00:00 committed by Gitee
commit c6acfdb240
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
3 changed files with 75 additions and 1 deletions

View File

@ -0,0 +1,29 @@
From: gongzt <gong_zhengtang@163.com>
Date: Sat, 6 May 2023 10:12:42 +0800
Subject:[PATCH] fix old token can still be used normally
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
vulcanus/restful/response.py | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/vulcanus/restful/response.py b/vulcanus/restful/response.py
index 0cb8c4b..f21e6ca 100644
--- a/vulcanus/restful/response.py
+++ b/vulcanus/restful/response.py
@@ -139,9 +139,8 @@ class BaseResponse(Resource):
except ValueError:
return state.TOKEN_ERROR
- cache_token = RedisProxy.redis_connect.get(
- "token_" + verify_info["key"])
- if not cache_token:
+ cache_token = RedisProxy.redis_connect.get("token_" + verify_info["key"])
+ if not cache_token or cache_token != token:
return state.TOKEN_ERROR
args['username'] = verify_info["key"]
--
Gitee

View File

@ -0,0 +1,40 @@
From: rabbitali <shusheng.wen@outlook.com>
Date: Mon, 8 May 2023 10:34:39 +0800
Subject: [PATCH] add gevent conf item when create uwsgi conf file
---
aops-vulcanus | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/aops-vulcanus b/aops-vulcanus
index 368c57f..d7e4cb9 100644
--- a/aops-vulcanus
+++ b/aops-vulcanus
@@ -42,6 +42,7 @@ function create_config_file() {
harakiri=$(get_config "${config_file}" "uwsgi" "harakiri")
processes=$(get_config "${config_file}" "uwsgi" "processes")
threads=$(get_config "${config_file}" "uwsgi" "threads")
+ gevent=$(get_config "${config_file}" "uwsgi" "gevent")
check_file $daemonize
echo "[INFO] run ${service_name} under path: ${wsgi_file}"
@@ -65,10 +66,16 @@ pidfile=${OUT_PATH}/${service_name}.pid
callable=app
http-timeout=${http_timeout}
harakiri=${harakiri}
-threads=${threads}
processes=${processes}
lazy-apps=true
daemonize=${daemonize}" >"${OUT_PATH}"/"${service_name}".ini
+ if [ ${gevent} ]
+ then
+ echo "gevent=${gevent}
+gevent-monkey-patch=true" >>"${OUT_PATH}"/"${service_name}".ini
+ else
+ echo "threads=${threads}" >>"${OUT_PATH}"/"${service_name}".ini
+ fi
chown root: ${OUT_PATH}/"${service_name}".ini
chmod 750 ${OUT_PATH}/"${service_name}".ini
echo "[INFO] create ${service_name} uwsgi file ok,path is ${OUT_PATH}/${service_name}.ini"
--

View File

@ -1,12 +1,14 @@
Name: aops-vulcanus Name: aops-vulcanus
Version: v1.2.0 Version: v1.2.0
Release: 2 Release: 3
Summary: A basic tool libraries of aops, including logging, configure and response, etc. Summary: A basic tool libraries of aops, including logging, configure and response, etc.
License: MulanPSL2 License: MulanPSL2
URL: https://gitee.com/openeuler/%{name} URL: https://gitee.com/openeuler/%{name}
Source0: %{name}-%{version}.tar.gz Source0: %{name}-%{version}.tar.gz
Patch0001: 0001-fix-script-docker-install-error.patch Patch0001: 0001-fix-script-docker-install-error.patch
Patch0002: 0002-add-custom-validation-rules.patch Patch0002: 0002-add-custom-validation-rules.patch
Patch0003: 0003-old-token-is-invalid.patch
Patch0004: 0004-add-gevent-config-item-for-uwsgi.patch
BuildRequires: python3-setuptools BuildRequires: python3-setuptools
Requires: python3-concurrent-log-handler python3-xmltodict python3-pyyaml python3-marshmallow >= 3.13.0 Requires: python3-concurrent-log-handler python3-xmltodict python3-pyyaml python3-marshmallow >= 3.13.0
@ -61,6 +63,9 @@ cp -r scripts %{buildroot}/opt/aops/
%changelog %changelog
* Mon May 8 2023 gongzhengtang<gong_zhengtang@163.com> - v1.2.0-3
- add gevent config item for uwsgi; fix old token is invalid
* Thu Apr 27 2023 wenixn<shusheng.wen@outlook.com> - v1.2.0-2 * Thu Apr 27 2023 wenixn<shusheng.wen@outlook.com> - v1.2.0-2
- add custom validation rules;fix script docker install error - add custom validation rules;fix script docker install error