Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
I
install.api
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Script
install.api
Commits
ea1aca99
Commit
ea1aca99
authored
Apr 08, 2020
by
金凯强
🎨
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
去除classmethod
parent
759a1d10
Pipeline
#22206
failed with stage
in 11 seconds
Changes
2
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
2 additions
and
3 deletions
+2
-3
conncetion_service.py
app/conncetion/conncetion_service.py
+2
-2
common_tools.py
app/utils/common_tools.py
+0
-1
No files found.
app/conncetion/conncetion_service.py
View file @
ea1aca99
...
...
@@ -43,7 +43,7 @@ class ConnectionService():
CommonTools
.
validate_dict_value_all_not_none
(
json_data
)
# 验证数据库连接是否正确
if
not
CommonTools
.
test_db_connection
(
db_ip
,
db_port
,
db_user
,
db_password
,
mes_db_name
):
if
not
CommonTools
()
.
test_db_connection
(
db_ip
,
db_port
,
db_user
,
db_password
,
mes_db_name
):
raise
HSException
(
'数据库连接失败,请检查'
)
with
db_driver
as
session
:
...
...
@@ -136,7 +136,7 @@ values
db_password
=
json_data
[
'db_password'
]
test_db_name
=
json_data
[
'mes_db_name'
]
if
CommonTools
.
test_db_connection
(
db_ip
,
db_port
,
db_user
,
db_password
,
test_db_name
):
if
CommonTools
()
.
test_db_connection
(
db_ip
,
db_port
,
db_user
,
db_password
,
test_db_name
):
return
{
'message'
:
'连接成功'
}
else
:
return
{
'message'
:
'连接失败'
}
...
...
app/utils/common_tools.py
View file @
ea1aca99
...
...
@@ -23,7 +23,6 @@ class CommonTools:
# 超过四秒,基本上没救了,告辞~~~~
@
timeout_decorator
.
timeout
(
4
)
@
classmethod
def
test_db_connection
(
cls
,
ip
:
int
,
port
:
int
,
user_name
:
str
,
password
:
str
,
db_name
:
str
):
'''
测试数据库连接
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment