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
f02fc195
Commit
f02fc195
authored
Apr 08, 2020
by
金凯强
🎨
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
数据库连接测试报错信息修改
parent
05f33d4f
Pipeline
#22243
failed with stage
in 11 seconds
Changes
1
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
1 deletion
+4
-1
common_tools.py
app/utils/common_tools.py
+4
-1
No files found.
app/utils/common_tools.py
View file @
f02fc195
...
@@ -22,7 +22,7 @@ class CommonTools:
...
@@ -22,7 +22,7 @@ class CommonTools:
raise
HSException
(
f
"{key}不能为空"
)
raise
HSException
(
f
"{key}不能为空"
)
# 超过四秒,基本上没救了,告辞~~~~
# 超过四秒,基本上没救了,告辞~~~~
@
timeout_decorator
.
timeout
(
4
)
@
timeout_decorator
.
timeout
(
2
)
def
test_db_connection
(
cls
,
ip
:
int
,
port
:
int
,
user_name
:
str
,
password
:
str
,
db_name
:
str
):
def
test_db_connection
(
cls
,
ip
:
int
,
port
:
int
,
user_name
:
str
,
password
:
str
,
db_name
:
str
):
'''
'''
测试数据库连接
测试数据库连接
...
@@ -56,6 +56,9 @@ class CommonTools:
...
@@ -56,6 +56,9 @@ class CommonTools:
return
False
return
False
except
Exception
as
e
:
except
Exception
as
e
:
if
isinstance
(
e
,
TimeoutError
):
logger
.
error
(
"数据库连接失败,失败原因:{}"
.
format
(
e
))
return
False
orig
=
getattr
(
e
,
'orig'
)
orig
=
getattr
(
e
,
'orig'
)
args
=
getattr
(
orig
,
'args'
,
((),))[
0
]
args
=
getattr
(
orig
,
'args'
,
((),))[
0
]
error_message
=
''
error_message
=
''
...
...
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