Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
openEuler-Advisor
提交
2dab59cf
O
openEuler-Advisor
项目概览
openeuler
/
openEuler-Advisor
通知
30
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,体验更适合开发者的 AI 搜索 >>
提交
2dab59cf
编写于
9月 03, 2020
作者:
G
gongzt
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
数据库初始化配置文件格式或内容错误时,命令行中的提示信息内容变更
上级
518cc0e2
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
37 addition
and
13 deletion
+37
-13
packageship/packageship/application/apps/package/function/constants.py
...ackageship/application/apps/package/function/constants.py
+7
-3
packageship/packageship/application/apps/package/view.py
packageship/packageship/application/apps/package/view.py
+5
-0
packageship/packageship/application/initsystem/data_import.py
...ageship/packageship/application/initsystem/data_import.py
+10
-9
packageship/packageship/libs/exception/__init__.py
packageship/packageship/libs/exception/__init__.py
+6
-1
packageship/packageship/libs/exception/ext.py
packageship/packageship/libs/exception/ext.py
+9
-0
未找到文件。
packageship/packageship/application/apps/package/function/constants.py
浏览文件 @
2dab59cf
...
...
@@ -85,16 +85,20 @@ class ResponseCode():
TABLE_NAME_NOT_EXIST_IN_DATABASE
:
"the table name dose not match the existed database"
,
YAML_FILE_ERROR
:
"Data error in yaml file"
,
EMPTY_FOLDER
:
"This is an empty folder, no yaml file"
}
}
@
classmethod
def
response_json
(
cls
,
code
,
data
=
None
):
def
response_json
(
cls
,
code
,
data
=
None
,
msg
=
None
):
"""
Description: classmethod
"""
try
:
_msg
=
cls
.
CODE_MSG_MAP
[
code
]
except
KeyError
:
_msg
=
msg
return
{
"code"
:
code
,
"msg"
:
cls
.
CODE_MSG_MAP
[
code
]
,
"msg"
:
_msg
,
"data"
:
data
}
...
...
packageship/packageship/application/apps/package/view.py
浏览文件 @
2dab59cf
...
...
@@ -17,6 +17,7 @@ from packageship.libs.configutils.readconfig import ReadConfig
from
packageship.libs.exception
import
Error
from
packageship.libs.exception
import
ContentNoneException
from
packageship.libs.exception
import
DataMergeException
from
packageship.libs.exception
import
ConfigurationException
from
packageship.libs.log
import
Log
from
packageship.system_config
import
DATABASE_FILE_INFO
from
.function.constants
import
ResponseCode
...
...
@@ -581,6 +582,10 @@ class InitSystem(Resource):
except
TypeError
as
type_error
:
LOGGER
.
logger
.
error
(
type_error
)
abnormal
=
ResponseCode
.
TYPE_ERROR
except
ConfigurationException
as
error
:
LOGGER
.
logger
.
error
(
error
)
abnormal
=
error
return
jsonify
(
ResponseCode
.
response_json
(
'5000'
,
msg
=
abnormal
.
message
))
except
DataMergeException
as
data_merge_error
:
LOGGER
.
logger
.
error
(
data_merge_error
)
abnormal
=
ResponseCode
.
DATA_MERGE_ERROR
...
...
packageship/packageship/application/initsystem/data_import.py
浏览文件 @
2dab59cf
...
...
@@ -12,6 +12,7 @@ from packageship.libs.dbutils.sqlalchemy_helper import DBHelper
from
packageship.libs.exception
import
ContentNoneException
from
packageship.libs.exception
import
DatabaseRepeatException
from
packageship.libs.exception
import
Error
from
packageship.libs.exception
import
ConfigurationException
from
packageship.libs.configutils.readconfig
import
ReadConfig
from
packageship.libs.log
import
Log
from
packageship.application.models.package
import
SrcPack
...
...
@@ -90,21 +91,21 @@ class InitDataBase():
init_database_config
=
yaml
.
load
(
file_context
.
read
(),
Loader
=
yaml
.
FullLoader
)
except
yaml
.
YAMLError
as
yaml_error
:
raise
Error
(
'The format of the yaml configuration file is wrong, please check and try agai
n
\
:%s'
%
yaml_error
)
raise
ConfigurationException
(
' '
.
join
(
"The format of the yaml configuratio
n
\
file is wrong please check and try again:{0}"
.
format
(
yaml_error
).
split
())
)
if
init_database_config
is
None
:
raise
Con
tentNone
Exception
(
raise
Con
figuration
Exception
(
'The content of the database initialization configuration file cannot be empty'
)
if
not
isinstance
(
init_database_config
,
list
):
raise
TypeError
(
'
The format of the initial database configuration file is incorrect:%s'
%
self
.
config_file_path
)
raise
ConfigurationException
(
'
'
.
join
(
'The format of the initial database configuration
\
file is incorrect:{}'
.
format
(
self
.
config_file_path
).
split
())
)
for
config_item
in
init_database_config
:
if
not
isinstance
(
config_item
,
dict
):
raise
TypeError
(
'The format of the initial database configuration file is
\
incorrect:%s'
%
self
.
config_file_path
)
raise
ConfigurationException
(
' '
.
join
(
'The format of the initial database
\
configuration file is incorrect:{}'
.
format
(
self
.
config_file_path
).
split
())
)
return
init_database_config
def
init_data
(
self
):
...
...
packageship/packageship/libs/exception/__init__.py
浏览文件 @
2dab59cf
...
...
@@ -7,6 +7,11 @@ from packageship.libs.exception.ext import DatabaseRepeatException
from
packageship.libs.exception.ext
import
DataMergeException
from
packageship.libs.exception.ext
import
Error
from
packageship.libs.exception.ext
import
DbnameNoneException
from
.ext
import
ConfigurationException
__all__
=
[
'ContentNoneException'
,
'DatabaseRepeatException'
,
'DataMergeException'
,
'Error'
,
'DbnameNoneException'
]
'DatabaseRepeatException'
,
'DataMergeException'
,
'Error'
,
'DbnameNoneException'
,
'ConfigurationException'
]
packageship/packageship/libs/exception/ext.py
浏览文件 @
2dab59cf
...
...
@@ -62,3 +62,12 @@ class DataMergeException(Error):
def
__init__
(
self
,
message
):
Error
.
__init__
(
self
,
'DataMerge exception: %r'
%
(
message
,))
class
ConfigurationException
(
Error
):
"""
Description: Configuration file exception information
"""
def
__init__
(
self
,
message
):
Error
.
__init__
(
self
,
'Configuration exception : %r'
%
(
message
,))
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录