Compare commits

..

10 Commits

Author SHA1 Message Date
openeuler-ci-bot
26046d15de
!77 [sync] PR-76: [bug fix]Update the exception catching type of the function
From: @openeuler-sync-bot 
Reviewed-by: @zhu-yuncheng 
Signed-off-by: @zhu-yuncheng
2024-02-01 11:59:26 +00:00
rabbitali
4b08652307 Update the exception catching type of the function
(cherry picked from commit 0a5ac9e286812581b0e616b2a0bc1f9407bb0a87)
2023-12-29 15:59:32 +08:00
openeuler-ci-bot
f3a5418911
!72 [sync] PR-71: 增加连接prometheus的异常捕获,修复主机详情界面报内部错误的问题
From: @openeuler-sync-bot 
Reviewed-by: @zhu-yuncheng 
Signed-off-by: @zhu-yuncheng
2023-12-25 03:11:24 +00:00
zhu-yuncheng
66b0128112 add connection error catch when connecting prometheus
(cherry picked from commit e45aa8ab578a32ed65966ce1cab4e1850a844ecc)
2023-12-25 09:39:18 +08:00
openeuler-ci-bot
b28ea577a5
!67 [sync] PR-66: Add IPV4 validation method
From: @openeuler-sync-bot 
Reviewed-by: @zhu-yuncheng 
Signed-off-by: @zhu-yuncheng
2023-12-23 10:07:01 +00:00
rabbitali
f67aeec9ad Add IPV4 validation method
(cherry picked from commit a777772f13e61be6e181aead4a842b9d9c8dd654)
2023-12-22 14:21:15 +08:00
openeuler-ci-bot
b020836c9e
!62 [sync] PR-61: Optimize paging statistics and software dependency versions
From: @openeuler-sync-bot 
Reviewed-by: @zhu-yuncheng 
Signed-off-by: @zhu-yuncheng
2023-12-22 03:58:12 +00:00
gongzt
3cdc9a5537 Optimize paging statistics and software dependency versions
(cherry picked from commit 451e60f42466347526cad470c38276fb3ee282bb)
2023-12-18 19:04:55 +08:00
openeuler-ci-bot
eb5a21e9d6
!56 补充缺失安装依赖以及修复脚本文件错误
From: @rabbitali 
Reviewed-by: @zhu-yuncheng 
Signed-off-by: @zhu-yuncheng
2023-11-21 13:02:33 +00:00
rabbitali
fd920500e7 update spec file and some scripts 2023-11-16 10:45:32 +08:00
8 changed files with 146 additions and 107 deletions

View File

@ -1,43 +0,0 @@
From 2820dc579dad400c8b0f4dfe4220c3d78e218645 Mon Sep 17 00:00:00 2001
From: gongzt <gong_zhengtang@163.com>
Date: Wed, 30 Aug 2023 15:41:06 +0800
Subject: [PATCH] = Optimize start service check logic
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
aops-vulcanus | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/aops-vulcanus b/aops-vulcanus
index abb02b1..ba854f9 100644
--- a/aops-vulcanus
+++ b/aops-vulcanus
@@ -100,8 +100,13 @@ function is_started() {
function start_service() {
module_name=$1
echo "[INFO] 1. Before starting the service, ensure that the data table is initialized"
- echo "[INFO] 2. Execute aops-basedatabase zeus or apollo to complete the data table initialization, For example '/opt/aops/script/aops-basedatabase init zues'"
+ echo "[INFO] 2. Execute aops-basedatabase zeus or apollo to complete the data table initialization, For example '/opt/aops/script/aops-basedatabase init zeus'"
uwsgi -d --ini ${OUT_PATH}/"${module_name}".ini --enable-threads
+ pid=`ps auxww | grep $module_name.ini | grep -v grep | awk '{print $2}'`
+ if [ "${pid}" = "" ]; then
+ echo "[ERROR] start uwsgi service: ${module_name} failed"
+ exit 1
+ fi
echo "[INFO] start uwsgi service: ${module_name} success"
exit 0
}
@@ -167,7 +172,7 @@ function check_mysql_installed() {
aops_database=$(get_config "$CONFIG_FILE" "mysql" "database_name")
connect_check_cmd="import pymysql
try:
- connect = pymysql.connect(host='$mysql_ip', port=$port, password='123456', database='$aops_database')
+ connect = pymysql.connect(host='$mysql_ip', port=$port, database='$aops_database')
connect.close()
except pymysql.err.OperationalError:
print(False)
--
Gitee

View File

@ -0,0 +1,45 @@
From 77f2c6a864baac31d7e6b4bee924dad82214092c Mon Sep 17 00:00:00 2001
From: rabbitali <wenxin32@foxmail.com>
Date: Wed, 20 Dec 2023 15:37:29 +0800
Subject: [PATCH] update ValidateRules
---
vulcanus/restful/serialize/validate.py | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)
diff --git a/vulcanus/restful/serialize/validate.py b/vulcanus/restful/serialize/validate.py
index d6eacbe..3050693 100644
--- a/vulcanus/restful/serialize/validate.py
+++ b/vulcanus/restful/serialize/validate.py
@@ -64,7 +64,7 @@ class ValidateRules:
"""
validation rules for username, which only contains string or number
"""
- if not re.findall("[a-zA-Z0-9]{5,20}", string):
+ if not re.findall("^[a-zA-Z0-9]{5,20}$", string):
raise ValidationError("username should only contains string or number, between 5 and 20 characters!")
@staticmethod
@@ -72,8 +72,18 @@ class ValidateRules:
"""
validation rules for password, which only contains string or number
"""
- if not re.findall("[a-zA-Z0-9]{6,20}", string):
+ if not re.findall("^[a-zA-Z0-9]{6,20}$", string):
raise ValidationError("password should only contains string or number, between 6 and 20 characters!!")
+
+ @staticmethod
+ def ipv4_address_check(string: str):
+ """
+ validation rules for IPV4 address
+ """
+ ipv4_address_pattern = r"^((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$"
+ if not re.findall(ipv4_address_pattern, string):
+ raise ValidationError("Not a valid IPV4 address.")
+
class PaginationSchema(Schema):
--
2.33.0

View File

@ -0,0 +1,41 @@
From dfd2f38fd34d300448ed9231377fcf4a0be7d367 Mon Sep 17 00:00:00 2001
From: zhu-yuncheng <zhuyuncheng@huawei.com>
Date: Sat, 23 Dec 2023 17:43:18 +0800
Subject: [PATCH] add httpconnection error catch when connect prometheus
---
vulcanus/database/proxy.py | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/vulcanus/database/proxy.py b/vulcanus/database/proxy.py
index 94e9883..5753066 100644
--- a/vulcanus/database/proxy.py
+++ b/vulcanus/database/proxy.py
@@ -16,9 +16,9 @@ Author:
Description: Database proxy
"""
from functools import wraps
-import math
from datetime import datetime
from urllib3.exceptions import LocationValueError
+from requests.exceptions import ConnectionError
import sqlalchemy
from sqlalchemy.exc import SQLAlchemyError, DisconnectionError
@@ -543,8 +543,12 @@ class PromDbProxy(DataBaseProxy):
Returns:
bool: connect succeed or fail
"""
-
- return self._prom.check_prometheus_connection()
+ connected = False
+ try:
+ connected = self._prom.check_prometheus_connection()
+ except ConnectionError as error:
+ LOGGER.error(error)
+ return connected
def query(self, host, time_range, metric, label_config=None):
"""
--
Gitee

View File

@ -1,58 +0,0 @@
From 97d9a39ac7a196af73f491f3d447023797fbe469 Mon Sep 17 00:00:00 2001
From: gongzt <gong_zhengtang@163.com>
Date: Mon, 18 Sep 2023 11:39:40 +0800
Subject: [PATCH 1/1] fix systemctl startup service error
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
aops-vulcanus | 5 ++++-
scripts/deploy/aops-basedatabase.sh | 6 +++---
2 files changed, 7 insertions(+), 4 deletions(-)
diff --git a/aops-vulcanus b/aops-vulcanus
index ba854f9..f00b4a0 100644
--- a/aops-vulcanus
+++ b/aops-vulcanus
@@ -101,9 +101,11 @@ function start_service() {
module_name=$1
echo "[INFO] 1. Before starting the service, ensure that the data table is initialized"
echo "[INFO] 2. Execute aops-basedatabase zeus or apollo to complete the data table initialization, For example '/opt/aops/script/aops-basedatabase init zeus'"
+ rm -rf ${OUT_PATH}/"${module_name}".pid
uwsgi -d --ini ${OUT_PATH}/"${module_name}".ini --enable-threads
pid=`ps auxww | grep $module_name.ini | grep -v grep | awk '{print $2}'`
- if [ "${pid}" = "" ]; then
+ local_pid=`cat ${OUT_PATH}/"${module_name}".pid`
+ if [ "${pid}" = "" ] && [ "${local_pid}" = "" ]; then
echo "[ERROR] start uwsgi service: ${module_name} failed"
exit 1
fi
@@ -115,6 +117,7 @@ function stop_service() {
module_name=$1
echo "[INFO] stop uwsgi service: ${module_name}"
uwsgi --stop ${OUT_PATH}/"${module_name}".pid
+ rm -rf ${OUT_PATH}/"${module_name}".pid
echo "[INFO] stop ${AOPS_CONSTANT} service success"
exit 0
}
diff --git a/scripts/deploy/aops-basedatabase.sh b/scripts/deploy/aops-basedatabase.sh
index 054bea9..49a80f4 100755
--- a/scripts/deploy/aops-basedatabase.sh
+++ b/scripts/deploy/aops-basedatabase.sh
@@ -133,9 +133,9 @@ function main(){
service=$2
case $operation in
"init")
- if [ "${service}" != "zeus" ] && [ "${service}" != "apollo" ]; then
- echo "[ERROR] Table initialization service can only be zeus or apollo"
- echo "[INFO] e.g 'aops-basedatabase init zeus' or 'aops-basedatabase init apollo'"
+ if [ "${service}" != "zeus" ] && [ "${service}" != "apollo" ] && [ "${service}" != "diana" ]; then
+ echo "[ERROR] Table initialization service can only be zeus apollo or diana"
+ echo "[INFO] e.g 'aops-basedatabase init zeus' 'aops-basedatabase init apollo' or 'aops-basedatabase init diana'"
exit 1
fi
config_file="/etc/aops/$service.ini"
--
2.33.1.windows.1

View File

@ -0,0 +1,25 @@
From b0dbdbf4c4992308f738d6ea74a9e3e21fc65129 Mon Sep 17 00:00:00 2001
From: rabbitali <wenxin32@foxmail.com>
Date: Wed, 27 Dec 2023 10:39:30 +0800
Subject: [PATCH] Update the exception catching type of the function
---
vulcanus/database/proxy.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/vulcanus/database/proxy.py b/vulcanus/database/proxy.py
index 94e9883..4e62527 100644
--- a/vulcanus/database/proxy.py
+++ b/vulcanus/database/proxy.py
@@ -108,7 +108,7 @@ class MysqlProxy(DataBaseProxy):
"""
try:
self._create_session()
- except sqlalchemy.exc.SQLAlchemyError as error:
+ except DatabaseConnectionFailed as error:
LOGGER.error(error)
return False
--
2.33.0

Binary file not shown.

BIN
aops-vulcanus-v1.3.1.tar.gz Normal file

Binary file not shown.

View File

@ -1,20 +1,21 @@
Name: aops-vulcanus Name: aops-vulcanus
Version: v1.3.0 Version: v1.3.1
Release: 3 Release: 4
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-optimize-service-start-check-logic.patch Patch0001: 0001-update-ValidateRules.patch
Patch0002: 0002-fix-systemctl-startup-service-error.patch Patch0002: 0002-add-error-catch-when-connect-pro.patch
Patch0003: 0003-update-the-exception-catching-type-of-the-function.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
Requires: python3-requests python3-xlrd python3-prettytable python3-pygments python3-sqlalchemy Requires: python3-requests python3-xlrd python3-prettytable python3-pygments python3-sqlalchemy
Requires: python3-elasticsearch >= 7 python3-prometheus-api-client python3-urllib3 python3-werkzeug Requires: python3-elasticsearch >= 7 python3-elasticsearch < 8 python3-prometheus-api-client python3-urllib3 python3-werkzeug
Requires: python3-flask python3-flask-restful python3-PyMySQL python3-kafka-python Requires: python3-flask python3-flask-restful python3-PyMySQL python3-kafka-python
Requires: python-jwt python-redis Requires: python-jwt python3-redis python3-Flask-APScheduler >= 1.11.0
Provides: aops-vulcanus Provides: aops-vulcanus
Conflicts: aops-utils Conflicts: aops-utils
@ -62,6 +63,34 @@ cp -r scripts %{buildroot}/opt/aops/
%changelog %changelog
* Wed Dec 27 2023 wenxin<wenxin32@foxmail.com> - v1.3.1-4
- update the exception catching type of the function
* Sat Dec 23 2023 zhuyuncheng<zhuyuncheng@huawei.com> - v1.3.1-3
- add Http connection error catch when connecting to prometheus
* Thu Dec 21 2023 wenxin<wenxin32@foxmail.com> - v1.3.1-2
- add IPV4 validation method to ValidateRules
* Mon Dec 18 2023 gongzhengtang<gong_zhengtang@163.com> - v1.3.1-1
- Optimize paging statistics and software dependency versions
* Tue Nov 14 2023 wenxin<wenxin32@foxmail.com> - v1.3.0-8
- update spec file
* Wed Oct 25 2023 wenxin<wenxin32@foxmail.com> - v1.3.0-7
- update timed task args check
* Wed Oct 25 2023 wenxin<wenxin32@foxmail.com> - v1.3.0-6
- since there is no arm-arch package in new repo source, remove changes of the es repo source url
* Tue Oct 24 2023 wenxin<wenxin32@foxmail.com> - v1.3.0-5
- update timed task args check and timeout
- update elasticsearch repo source url
* Wed Oct 18 2023 gongzhengtang<gong_zhengtang@163.com> - v1.3.0-4
- it is suitable for version 20.03-LTS-sp3
* Tue Sep 19 2023 wenxin<shusheng.wen@outlook.com> - v1.3.0-3 * Tue Sep 19 2023 wenxin<shusheng.wen@outlook.com> - v1.3.0-3
- fix systemctl startup service problem - fix systemctl startup service problem