Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
openEuler-Advisor
提交
518cc0e2
O
openEuler-Advisor
项目概览
openeuler
/
openEuler-Advisor
通知
43
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看板
提交
518cc0e2
编写于
9月 02, 2020
作者:
G
gongzt
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
初始化配置文件中lifecycle参数配置无效的问题
上级
14786a42
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
8 addition
and
18 deletion
+8
-18
packageship/packageship/application/initsystem/data_import.py
...ageship/packageship/application/initsystem/data_import.py
+8
-18
未找到文件。
packageship/packageship/application/initsystem/data_import.py
浏览文件 @
518cc0e2
...
...
@@ -200,12 +200,8 @@ class InitDataBase():
raise
FileNotFoundError
(
"sqlite file {src} or {bin} does not exist, please
\
check and try again"
.
format
(
src
=
src_db_file
,
bin
=
bin_db_file
))
# 3. Obtain temporary source package files and binary package files
_lifecycle_status_val
=
database_config
.
get
(
'lifecycle'
)
if
self
.
__save_data
(
src_db_file
,
bin_db_file
,
self
.
database_name
,
_db_name
,
_lifecycle_status_val
):
if
self
.
__save_data
(
database_config
,
self
.
database_name
):
# Update the configuration file of the database
database_content
=
{
'database_name'
:
_db_name
,
...
...
@@ -266,7 +262,7 @@ class InitDataBase():
LOGGER
.
logger
.
error
(
sql_error
)
return
None
def
__save_data
(
self
,
src_db_file
,
bin_db_file
,
db_name
,
table_name
,
lifecycle_status_val
):
def
__save_data
(
self
,
database_config
,
db_name
):
"""
integration of multiple data files
...
...
@@ -278,6 +274,10 @@ class InitDataBase():
Raises:
"""
src_db_file
=
database_config
.
get
(
'src_db_file'
)
bin_db_file
=
database_config
.
get
(
'bin_db_file'
)
table_name
=
database_config
.
get
(
'dbname'
)
lifecycle_status_val
=
database_config
.
get
(
'lifecycle'
)
try
:
with
DBHelper
(
db_name
=
src_db_file
,
db_type
=
'sqlite:///'
,
complete_route_db
=
True
)
\
as
database
:
...
...
@@ -324,15 +324,6 @@ class InitDataBase():
if
lifecycle_status_val
==
'enable'
:
InitDataBase
.
_storage_packages
(
table_name
,
packages_datas
)
@
staticmethod
def
__meta_model
(
table_name
):
"""
The mapping relationship of the orm model
"""
model
=
type
(
"packages"
,
(
Packages
,
DBHelper
.
BASE
),
{
'__tablename__'
:
table_name
})
return
model
@
staticmethod
def
_storage_packages
(
table_name
,
package_data
):
"""
...
...
@@ -744,8 +735,7 @@ class SqliteDatabaseOperations():
if
not
self
.
storage
and
os
.
path
.
exists
(
_db_file
+
'.db'
):
os
.
remove
(
_db_file
+
'.db'
)
# create a sqlite database
# if (self.is_datum and not os.path.exists(_db_file + '.db')) or not self.is_datum:
# create a sqlite database
with
DBHelper
(
db_name
=
_db_file
)
as
database
:
try
:
if
self
.
tables
:
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录