|
|
@ -18,7 +18,7 @@ from django.core.cache import cache |
|
|
|
from update.utils.get_version import GetVersion |
|
|
|
from update.utils.get_version import GetVersion |
|
|
|
from rest_framework.decorators import action |
|
|
|
from rest_framework.decorators import action |
|
|
|
from update.utils.git_util import GitUtil, GitDbUtil |
|
|
|
from update.utils.git_util import GitUtil, GitDbUtil |
|
|
|
from update.utils.cmd_extcute import UpdateCommandUtil |
|
|
|
from update.utils.cmd_extcute import UpdateCommandUtil, UpdateConfigUtil |
|
|
|
from update.utils.db_compare import DbCompare |
|
|
|
from update.utils.db_compare import DbCompare |
|
|
|
from update.utils.client_util import ClientUtil |
|
|
|
from update.utils.client_util import ClientUtil |
|
|
|
|
|
|
|
|
|
|
@ -93,7 +93,15 @@ def get_git_version(request): |
|
|
|
def update_cine(request): |
|
|
|
def update_cine(request): |
|
|
|
req = request.GET.dict() |
|
|
|
req = request.GET.dict() |
|
|
|
cinema_ip = req.get('ip') |
|
|
|
cinema_ip = req.get('ip') |
|
|
|
|
|
|
|
# 处理命令格式 |
|
|
|
|
|
|
|
cmd_dict = {} |
|
|
|
|
|
|
|
cmd_obj = UpdateCommand.objects.filter(is_sys=0).values('id', 'process') |
|
|
|
|
|
|
|
for cmd in cmd_obj: |
|
|
|
|
|
|
|
if cmd['process'] in cmd_dict.keys(): |
|
|
|
|
|
|
|
cmd_dict[cmd['process']].append(cmd['id']) |
|
|
|
|
|
|
|
else: |
|
|
|
|
|
|
|
cmd_dict[cmd['process']] = [cmd['id']] |
|
|
|
|
|
|
|
print(cmd_dict) |
|
|
|
update_status = { |
|
|
|
update_status = { |
|
|
|
'git': {'result': 'success', 'msg': ''}, |
|
|
|
'git': {'result': 'success', 'msg': ''}, |
|
|
|
'setup': {'result': 'success', 'msg': ''}, |
|
|
|
'setup': {'result': 'success', 'msg': ''}, |
|
|
@ -115,24 +123,39 @@ def update_cine(request): |
|
|
|
print('获取并写入cine.sql') |
|
|
|
print('获取并写入cine.sql') |
|
|
|
git_util = GitUtil(short_release) |
|
|
|
git_util = GitUtil(short_release) |
|
|
|
git_result = git_util.handle_create_cine() |
|
|
|
git_result = git_util.handle_create_cine() |
|
|
|
|
|
|
|
|
|
|
|
# 执行setup |
|
|
|
# 执行setup |
|
|
|
print('执行setup') |
|
|
|
print('执行setup') |
|
|
|
|
|
|
|
setup_list = list(set(cmd_list) & set(cmd_dict['setup'])) |
|
|
|
update_cmd = UpdateCommandUtil() |
|
|
|
update_cmd = UpdateCommandUtil() |
|
|
|
update_cmd.exec_cmd_by_type(cinema_ip, 'setup', cmd_list, short_release) |
|
|
|
update_cmd.exec_cmd_by_type(cinema_ip, 'setup', setup_list, short_release) |
|
|
|
|
|
|
|
|
|
|
|
# 数据库对比 |
|
|
|
# 数据库对比 |
|
|
|
if 19 in cmd_list: |
|
|
|
sql_list = list(set(cmd_list) & set(cmd_dict['sql'])) |
|
|
|
|
|
|
|
if len(sql_list) > 0: |
|
|
|
print('数据库对比') |
|
|
|
print('数据库对比') |
|
|
|
db_compare = DbCompare(cinema_ip, short_release) |
|
|
|
db_compare = DbCompare(cinema_ip, short_release) |
|
|
|
db_compare.exec_diff_sql() |
|
|
|
db_compare.exec_diff_sql() |
|
|
|
|
|
|
|
|
|
|
|
# 执行teardown |
|
|
|
# 执行teardown |
|
|
|
if 17 in cmd_list: |
|
|
|
teardown_list = list(set(cmd_list) & set(cmd_dict['teardown'])) |
|
|
|
|
|
|
|
if len(teardown_list) > 0: |
|
|
|
print('执行teardown') |
|
|
|
print('执行teardown') |
|
|
|
update_cmd.exec_cmd_by_type(cinema_ip, 'teardown', cmd_list, short_release) |
|
|
|
update_cmd.exec_cmd_by_type(cinema_ip, 'teardown', teardown_list, short_release) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# 修改设置 |
|
|
|
|
|
|
|
print('执行config_list') |
|
|
|
|
|
|
|
config_list = list(set(cmd_list) & set(cmd_dict['config'])) |
|
|
|
|
|
|
|
update_config = UpdateConfigUtil(cinema_ip, config_list) |
|
|
|
|
|
|
|
update_config.exec_config() |
|
|
|
|
|
|
|
|
|
|
|
# 传输客户端 |
|
|
|
# 传输客户端 |
|
|
|
if 20 in cmd_list: |
|
|
|
client_list = list(set(cmd_list) & set(cmd_dict['client'])) |
|
|
|
|
|
|
|
if len(client_list) > 0: |
|
|
|
print('传输客户端') |
|
|
|
print('传输客户端') |
|
|
|
client_release = ClientUtil() |
|
|
|
client_release = ClientUtil() |
|
|
|
client_release.client_process(cinema_ip, short_release) |
|
|
|
client_release.client_process(cinema_ip, short_release) |
|
|
|
|
|
|
|
|
|
|
|
return JsonResponse({'result': 'success', 'ip': cinema_ip}) |
|
|
|
return JsonResponse({'result': 'success', 'ip': cinema_ip}) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|