Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
openEuler-Advisor
提交
33a3322a
O
openEuler-Advisor
项目概览
openeuler
/
openEuler-Advisor
通知
40
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看板
提交
33a3322a
编写于
9月 04, 2020
作者:
O
openeuler-ci-bot
提交者:
Gitee
9月 04, 2020
浏览文件
操作
浏览文件
下载
差异文件
!117 针对数据库初始化配置文件格式或内容错误时,命令行中提示信息的修改
Merge pull request !117 from gongzhengtang/master
上级
3e63523d
09995a2b
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
43 addition
and
15 deletion
+43
-15
packageship/packageship/application/apps/lifecycle/view.py
packageship/packageship/application/apps/lifecycle/view.py
+2
-2
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
+14
-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/lifecycle/view.py
浏览文件 @
33a3322a
...
...
@@ -188,12 +188,12 @@ class TableColView(Resource):
(
'version'
,
'Version'
,
True
),
(
'release'
,
'Release'
,
True
),
(
'url'
,
'Url'
,
True
),
(
'
lin
ense'
,
'License'
,
False
),
(
'
rpm_lic
ense'
,
'License'
,
False
),
(
'feature'
,
'Feature'
,
False
),
(
'maintainer'
,
'Maintainer'
,
True
),
(
'maintainlevel'
,
'Maintenance Level'
,
True
),
(
'release_time'
,
'Release Time'
,
False
),
(
'
end_of_lifecycle'
,
'End of Life Cycl
e'
,
True
),
(
'
used_time'
,
'Used Tim
e'
,
True
),
(
'maintainer_status'
,
'Maintain Status'
,
True
),
(
'latest_version'
,
'Latest Version'
,
False
),
(
'latest_version_time'
,
'Latest Version Release Time'
,
False
),
...
...
packageship/packageship/application/apps/package/function/constants.py
浏览文件 @
33a3322a
...
...
@@ -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
浏览文件 @
33a3322a
...
...
@@ -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
...
...
@@ -601,6 +602,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
浏览文件 @
33a3322a
...
...
@@ -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,25 @@ 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.When multiple databases need to be initialized,
\
it needs to be configured in the form of multiple
\
nodes:{}'
.
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, and the value in a single node should
\
be presented in the form of key - val pairs:
\
{}'
.
format
(
self
.
config_file_path
).
split
()))
return
init_database_config
def
init_data
(
self
):
...
...
packageship/packageship/libs/exception/__init__.py
浏览文件 @
33a3322a
...
...
@@ -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
packageship.libs.exception.ext
import
ConfigurationException
__all__
=
[
'ContentNoneException'
,
'DatabaseRepeatException'
,
'DataMergeException'
,
'Error'
,
'DbnameNoneException'
]
'DatabaseRepeatException'
,
'DataMergeException'
,
'Error'
,
'DbnameNoneException'
,
'ConfigurationException'
]
packageship/packageship/libs/exception/ext.py
浏览文件 @
33a3322a
...
...
@@ -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.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录