Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
openEuler-Advisor
提交
11e894a3
O
openEuler-Advisor
项目概览
openeuler
/
openEuler-Advisor
通知
34
Star
4
Fork
4
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
O
openEuler-Advisor
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
11e894a3
编写于
6月 28, 2020
作者:
J
jiang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Clear status code information and perfect exception capture in the interface
上级
2829cc0f
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
19 addition
and
18 deletion
+19
-18
packageship/packageship/application/apps/package/function/constants.py
...ackageship/application/apps/package/function/constants.py
+8
-8
packageship/packageship/application/apps/package/view.py
packageship/packageship/application/apps/package/view.py
+10
-10
packageship/packageship/application/initsystem/data_import.py
...ageship/packageship/application/initsystem/data_import.py
+1
-0
未找到文件。
packageship/packageship/application/apps/package/function/constants.py
浏览文件 @
11e894a3
...
...
@@ -29,21 +29,21 @@ class ResponseCode():
Description: response code to web
changeLog:
"""
# Four digits are common status codes
SUCCESS
=
"2001"
PARAM_ERROR
=
"4001"
DB_NAME_ERROR
=
"4002"
PACK_NAME_NOT_FOUND
=
"4003"
CONNECT_DB_ERROR
=
"4004"
FILE_NOT_FOUND
=
"40041"
INPUT_NONE
=
"4005"
# Delete database module error status code
FILE_NOT_FOUND
=
"40041"
DELETE_DB_ERROR
=
"40051"
# Database initialization module error status code
CONFIGFILE_PATH_EMPTY
=
"50001"
FAILED_CREATE_DATABASE_TABLE
=
"50002"
TYPEERROR
=
"50003"
DATA
MERGE
ERROR
=
"50004"
TYPE
_
ERROR
=
"50003"
DATA
_MERGE_
ERROR
=
"50004"
FILE_NOT_FIND_ERROR
=
"50005"
DIS_CONNECTION_DB
=
"50006"
...
...
@@ -58,8 +58,8 @@ class ResponseCode():
DELETE_DB_ERROR
:
"Failed to delete database"
,
CONFIGFILE_PATH_EMPTY
:
"Initialization profile does not exist or cannot be found"
,
FAILED_CREATE_DATABASE_TABLE
:
"Failed to create database or table"
,
TYPEERROR
:
"The source code and binary path types in the initialization file are abnormal"
,
DATA
MERGE
ERROR
:
"abnormal multi-file database integration"
,
TYPE
_
ERROR
:
"The source code and binary path types in the initialization file are abnormal"
,
DATA
_MERGE_
ERROR
:
"abnormal multi-file database integration"
,
FILE_NOT_FIND_ERROR
:
"system initialization configuration file does not exist"
,
DIS_CONNECTION_DB
:
"Unable to connect to the database, check the database configuration"
}
...
...
packageship/packageship/application/apps/package/view.py
浏览文件 @
11e894a3
...
...
@@ -3,9 +3,9 @@ view: Request logic processing Return json format
"""
import
yaml
from
flask
import
request
from
flask_restful
import
Resource
from
flask
import
jsonify
from
flask
import
current_app
from
flask_restful
import
Resource
from
sqlalchemy.exc
import
DisconnectionError
from
packageship.application.apps.package.function.constants
import
ResponseCode
...
...
@@ -144,7 +144,7 @@ class SinglePack(Resource):
current_app
.
logger
.
error
(
dis_connection_error
)
abnormal
=
ResponseCode
.
DIS_CONNECTION_DB
except
(
AttributeError
,
Error
)
as
attribute_error
:
except
(
AttributeError
,
TypeError
,
Error
)
as
attribute_error
:
current_app
.
logger
.
error
(
attribute_error
)
abnormal
=
ResponseCode
.
PACK_NAME_NOT_FOUND
if
abnormal
is
not
None
:
...
...
@@ -198,7 +198,7 @@ class SinglePack(Resource):
return
jsonify
(
ResponseCode
.
response_json
(
ResponseCode
.
DIS_CONNECTION_DB
))
except
(
AttributeError
,
Error
)
as
attri_error
:
except
(
AttributeError
,
TypeError
,
Error
)
as
attri_error
:
current_app
.
logger
.
error
(
attri_error
)
return
jsonify
(
ResponseCode
.
response_json
(
ResponseCode
.
PACK_NAME_NOT_FOUND
)
...
...
@@ -367,13 +367,13 @@ class Repodatas(Resource):
ResponseCode
.
response_json
(
ResponseCode
.
SUCCESS
,
data
=
init_database_date
))
except
(
FileNotFoundError
,
Error
)
as
file_not_found
:
except
(
FileNotFoundError
,
TypeError
,
Error
)
as
file_not_found
:
current_app
.
logger
.
error
(
file_not_found
)
return
jsonify
(
ResponseCode
.
response_json
(
ResponseCode
.
FILE_NOT_FOUND
)
)
def
delete
(
self
,
*
args
,
**
kwargs
):
def
delete
(
self
):
'''
description: get all database
input: database name
...
...
@@ -401,7 +401,7 @@ class Repodatas(Resource):
return
jsonify
(
ResponseCode
.
response_json
(
ResponseCode
.
SUCCESS
)
)
except
Error
as
error
:
except
(
FileNotFoundError
,
TypeError
,
Error
)
as
error
:
current_app
.
logger
.
error
(
error
)
return
jsonify
(
ResponseCode
.
response_json
(
ResponseCode
.
DELETE_DB_ERROR
)
...
...
@@ -411,7 +411,7 @@ class Repodatas(Resource):
class
InitSystem
(
Resource
):
'''InitSystem'''
def
post
(
self
,
*
args
,
**
kwargs
):
def
post
(
self
):
"""
description: InitSystem
input:
...
...
@@ -443,14 +443,14 @@ class InitSystem(Resource):
abnormal
=
ResponseCode
.
DIS_CONNECTION_DB
except
TypeError
as
type_error
:
LOGGER
.
logger
.
error
(
type_error
)
abnormal
=
ResponseCode
.
TYPEERROR
abnormal
=
ResponseCode
.
TYPE
_
ERROR
except
DataMergeException
as
data_merge_error
:
LOGGER
.
logger
.
error
(
data_merge_error
)
abnormal
=
ResponseCode
.
DATA
MERGE
ERROR
abnormal
=
ResponseCode
.
DATA
_MERGE_
ERROR
except
FileNotFoundError
as
file_not_found_error
:
LOGGER
.
logger
.
error
(
file_not_found_error
)
abnormal
=
ResponseCode
.
FILE_NOT_FIND_ERROR
except
Error
as
error
:
except
(
Error
,
Exception
)
as
error
:
LOGGER
.
logger
.
error
(
error
)
abnormal
=
ResponseCode
.
FAILED_CREATE_DATABASE_TABLE
if
abnormal
is
not
None
:
...
...
packageship/packageship/application/initsystem/data_import.py
浏览文件 @
11e894a3
...
...
@@ -139,6 +139,7 @@ class InitDataBase():
database:database configuration information
'''
try
:
db_file
=
None
# 1. create a database and related tables in the database
db_name
=
self
.
_create_database
(
database
)
# 2. get the data of binary packages and source packages
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录