|
|
@ -117,6 +117,7 @@ def update_cine(request): |
|
|
|
|
|
|
|
|
|
|
|
# 增加状态 |
|
|
|
# 增加状态 |
|
|
|
update_status = { |
|
|
|
update_status = { |
|
|
|
|
|
|
|
'result': '', |
|
|
|
'git': {'result': '', 'msg': ''}, |
|
|
|
'git': {'result': '', 'msg': ''}, |
|
|
|
'setup': {'result': '', 'msg': ''}, |
|
|
|
'setup': {'result': '', 'msg': ''}, |
|
|
|
'sql': {'result': '', 'msg': ''}, |
|
|
|
'sql': {'result': '', 'msg': ''}, |
|
|
@ -133,9 +134,13 @@ def update_cine(request): |
|
|
|
|
|
|
|
|
|
|
|
if redis_conn.exists(redis_key): |
|
|
|
if redis_conn.exists(redis_key): |
|
|
|
# update_status = copy.deepcopy(json.loads(redis_conn.get(redis_key))) |
|
|
|
# update_status = copy.deepcopy(json.loads(redis_conn.get(redis_key))) |
|
|
|
|
|
|
|
val = json.loads(redis_conn.get(redis_key)) |
|
|
|
|
|
|
|
print(val) |
|
|
|
|
|
|
|
if val['result'] == 'running': |
|
|
|
print('redis存在key', redis_key) |
|
|
|
print('redis存在key', redis_key) |
|
|
|
return JsonResponse({'result': 'fail', 'ip': cinema_ip, 'msg': '该影院正在升级中,请稍后再试!'}) |
|
|
|
return JsonResponse({'result': 'fail', 'ip': cinema_ip, 'msg': '该影院正在升级中,请稍后再试!'}) |
|
|
|
else: |
|
|
|
# 如果存在对应的键值,且结果为running,则提示升级中 |
|
|
|
|
|
|
|
|
|
|
|
redis_conn.set(redis_key, json.dumps(update_status), 5 * 60) |
|
|
|
redis_conn.set(redis_key, json.dumps(update_status), 5 * 60) |
|
|
|
|
|
|
|
|
|
|
|
print('update_status', update_status) |
|
|
|
print('update_status', update_status) |
|
|
@ -151,6 +156,9 @@ def update_cine(request): |
|
|
|
# short_release = '2.0.33.0338_Release' |
|
|
|
# short_release = '2.0.33.0338_Release' |
|
|
|
# cmd_list = [10, 11, 12, 13, 14, 15, 16, 17, 19, 20] |
|
|
|
# cmd_list = [10, 11, 12, 13, 14, 15, 16, 17, 19, 20] |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
update_status['result'] = 'running' |
|
|
|
|
|
|
|
redis_conn.set(redis_key, json.dumps(update_status), 5 * 60) |
|
|
|
|
|
|
|
|
|
|
|
# 获取并写入cine.sql |
|
|
|
# 获取并写入cine.sql |
|
|
|
print('获取并写入cine.sql') |
|
|
|
print('获取并写入cine.sql') |
|
|
|
try: |
|
|
|
try: |
|
|
@ -163,8 +171,10 @@ def update_cine(request): |
|
|
|
redis_conn.set(redis_key, json.dumps(update_status), 5 * 60) |
|
|
|
redis_conn.set(redis_key, json.dumps(update_status), 5 * 60) |
|
|
|
except Exception as e: |
|
|
|
except Exception as e: |
|
|
|
print('git', e) |
|
|
|
print('git', e) |
|
|
|
|
|
|
|
update_status['result'] = 'fail' |
|
|
|
update_status['git']['result'] = 'fail' |
|
|
|
update_status['git']['result'] = 'fail' |
|
|
|
update_status['git']['msg'] = str(e) |
|
|
|
update_status['git']['msg'] = str(e) |
|
|
|
|
|
|
|
redis_conn.set(redis_key, json.dumps(update_status), 5 * 60) |
|
|
|
# redis_conn.delete(redis_key) |
|
|
|
# redis_conn.delete(redis_key) |
|
|
|
return JsonResponse({'result': 'fail', 'ip': cinema_ip, 'msg': str(e)}) |
|
|
|
return JsonResponse({'result': 'fail', 'ip': cinema_ip, 'msg': str(e)}) |
|
|
|
|
|
|
|
|
|
|
@ -177,14 +187,17 @@ def update_cine(request): |
|
|
|
update_cmd = UpdateCommandUtil() |
|
|
|
update_cmd = UpdateCommandUtil() |
|
|
|
result, setup_output = update_cmd.exec_cmd_by_type(cinema_ip, 'setup', setup_list, short_release) |
|
|
|
result, setup_output = update_cmd.exec_cmd_by_type(cinema_ip, 'setup', setup_list, short_release) |
|
|
|
if result is False: |
|
|
|
if result is False: |
|
|
|
|
|
|
|
print('执行setup特殊处理') |
|
|
|
raise Exception(setup_output) |
|
|
|
raise Exception(setup_output) |
|
|
|
update_status['setup']['result'] = 'success' |
|
|
|
update_status['setup']['result'] = 'success' |
|
|
|
update_status['setup']['msg'] = setup_output |
|
|
|
update_status['setup']['msg'] = setup_output |
|
|
|
redis_conn.set(redis_key, json.dumps(update_status), 5 * 60) |
|
|
|
redis_conn.set(redis_key, json.dumps(update_status), 5 * 60) |
|
|
|
except Exception as e: |
|
|
|
except Exception as e: |
|
|
|
print('setup', e) |
|
|
|
print('setup', e) |
|
|
|
|
|
|
|
update_status['result'] = 'fail' |
|
|
|
update_status['setup']['result'] = 'fail' |
|
|
|
update_status['setup']['result'] = 'fail' |
|
|
|
update_status['setup']['msg'] = str(e) |
|
|
|
update_status['setup']['msg'] = str(e) |
|
|
|
|
|
|
|
redis_conn.set(redis_key, json.dumps(update_status), 5 * 60) |
|
|
|
# redis_conn.delete(redis_key) |
|
|
|
# redis_conn.delete(redis_key) |
|
|
|
return JsonResponse({'result': 'fail', 'ip': cinema_ip, 'msg': str(e)}) |
|
|
|
return JsonResponse({'result': 'fail', 'ip': cinema_ip, 'msg': str(e)}) |
|
|
|
|
|
|
|
|
|
|
@ -202,8 +215,10 @@ def update_cine(request): |
|
|
|
redis_conn.set(redis_key, json.dumps(update_status), 5 * 60) |
|
|
|
redis_conn.set(redis_key, json.dumps(update_status), 5 * 60) |
|
|
|
except Exception as e: |
|
|
|
except Exception as e: |
|
|
|
print('sql', e) |
|
|
|
print('sql', e) |
|
|
|
|
|
|
|
update_status['result'] = 'fail' |
|
|
|
update_status['sql']['result'] = 'fail' |
|
|
|
update_status['sql']['result'] = 'fail' |
|
|
|
update_status['sql']['msg'] = str(e) |
|
|
|
update_status['sql']['msg'] = str(e) |
|
|
|
|
|
|
|
redis_conn.set(redis_key, json.dumps(update_status), 5 * 60) |
|
|
|
# redis_conn.delete(redis_key) |
|
|
|
# redis_conn.delete(redis_key) |
|
|
|
return JsonResponse({'result': 'fail', 'ip': cinema_ip, 'msg': str(e)}) |
|
|
|
return JsonResponse({'result': 'fail', 'ip': cinema_ip, 'msg': str(e)}) |
|
|
|
|
|
|
|
|
|
|
@ -220,8 +235,10 @@ def update_cine(request): |
|
|
|
redis_conn.set(redis_key, json.dumps(update_status), 5 * 60) |
|
|
|
redis_conn.set(redis_key, json.dumps(update_status), 5 * 60) |
|
|
|
except Exception as e: |
|
|
|
except Exception as e: |
|
|
|
print('config', e) |
|
|
|
print('config', e) |
|
|
|
|
|
|
|
update_status['result'] = 'fail' |
|
|
|
update_status['config']['result'] = 'fail' |
|
|
|
update_status['config']['result'] = 'fail' |
|
|
|
update_status['config']['msg'] = str(e) |
|
|
|
update_status['config']['msg'] = str(e) |
|
|
|
|
|
|
|
redis_conn.set(redis_key, json.dumps(update_status), 5 * 60) |
|
|
|
# redis_conn.delete(redis_key) |
|
|
|
# redis_conn.delete(redis_key) |
|
|
|
return JsonResponse({'result': 'fail', 'ip': cinema_ip, 'msg': str(e)}) |
|
|
|
return JsonResponse({'result': 'fail', 'ip': cinema_ip, 'msg': str(e)}) |
|
|
|
|
|
|
|
|
|
|
@ -241,8 +258,10 @@ def update_cine(request): |
|
|
|
redis_conn.set(redis_key, json.dumps(update_status), 5 * 60) |
|
|
|
redis_conn.set(redis_key, json.dumps(update_status), 5 * 60) |
|
|
|
except Exception as e: |
|
|
|
except Exception as e: |
|
|
|
print('teardown', e) |
|
|
|
print('teardown', e) |
|
|
|
|
|
|
|
update_status['result'] = 'fail' |
|
|
|
update_status['teardown']['result'] = 'fail' |
|
|
|
update_status['teardown']['result'] = 'fail' |
|
|
|
update_status['teardown']['msg'] = str(e) |
|
|
|
update_status['teardown']['msg'] = str(e) |
|
|
|
|
|
|
|
redis_conn.set(redis_key, json.dumps(update_status), 5 * 60) |
|
|
|
# redis_conn.delete(redis_key) |
|
|
|
# redis_conn.delete(redis_key) |
|
|
|
return JsonResponse({'result': 'fail', 'ip': cinema_ip, 'msg': str(e)}) |
|
|
|
return JsonResponse({'result': 'fail', 'ip': cinema_ip, 'msg': str(e)}) |
|
|
|
|
|
|
|
|
|
|
@ -259,8 +278,10 @@ def update_cine(request): |
|
|
|
redis_conn.set(redis_key, json.dumps(update_status), 5 * 60) |
|
|
|
redis_conn.set(redis_key, json.dumps(update_status), 5 * 60) |
|
|
|
except Exception as e: |
|
|
|
except Exception as e: |
|
|
|
print('config', e) |
|
|
|
print('config', e) |
|
|
|
|
|
|
|
update_status['result'] = 'fail' |
|
|
|
update_status['config']['result'] = 'fail' |
|
|
|
update_status['config']['result'] = 'fail' |
|
|
|
update_status['config']['msg'] = config_before_output + '<br/>' + str(e) |
|
|
|
update_status['config']['msg'] = config_before_output + '<br/>' + str(e) |
|
|
|
|
|
|
|
redis_conn.set(redis_key, json.dumps(update_status), 5 * 60) |
|
|
|
# redis_conn.delete(redis_key) |
|
|
|
# redis_conn.delete(redis_key) |
|
|
|
return JsonResponse({'result': 'fail', 'ip': cinema_ip, 'msg': str(e)}) |
|
|
|
return JsonResponse({'result': 'fail', 'ip': cinema_ip, 'msg': str(e)}) |
|
|
|
|
|
|
|
|
|
|
@ -272,17 +293,23 @@ def update_cine(request): |
|
|
|
update_status['client']['result'] = 'running' |
|
|
|
update_status['client']['result'] = 'running' |
|
|
|
redis_conn.set(redis_key, json.dumps(update_status), 5 * 60) |
|
|
|
redis_conn.set(redis_key, json.dumps(update_status), 5 * 60) |
|
|
|
client_release = ClientUtil() |
|
|
|
client_release = ClientUtil() |
|
|
|
|
|
|
|
print('client_release.client_process') |
|
|
|
client_release.client_process(cinema_ip, short_release) |
|
|
|
client_release.client_process(cinema_ip, short_release) |
|
|
|
update_status['client']['result'] = 'success' |
|
|
|
update_status['client']['result'] = 'success' |
|
|
|
update_status['client']['msg'] = '客户端上传成功' |
|
|
|
update_status['client']['msg'] = '客户端上传成功' |
|
|
|
redis_conn.set(redis_key, json.dumps(update_status), 5 * 60) |
|
|
|
redis_conn.set(redis_key, json.dumps(update_status), 5 * 60) |
|
|
|
except Exception as e: |
|
|
|
except Exception as e: |
|
|
|
print('client', e) |
|
|
|
print('client', e) |
|
|
|
|
|
|
|
update_status['result'] = 'fail' |
|
|
|
update_status['client']['result'] = 'fail' |
|
|
|
update_status['client']['result'] = 'fail' |
|
|
|
update_status['client']['msg'] = str(e) |
|
|
|
update_status['client']['msg'] = str(e) |
|
|
|
|
|
|
|
redis_conn.set(redis_key, json.dumps(update_status), 5 * 60) |
|
|
|
# redis_conn.delete(redis_key) |
|
|
|
# redis_conn.delete(redis_key) |
|
|
|
return JsonResponse({'result': 'fail', 'ip': cinema_ip, 'msg': str(e)}) |
|
|
|
return JsonResponse({'result': 'fail', 'ip': cinema_ip, 'msg': str(e)}) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
update_status['result'] = 'success' |
|
|
|
|
|
|
|
redis_conn.set(redis_key, json.dumps(update_status), 5 * 60) |
|
|
|
|
|
|
|
|
|
|
|
print('update_status', update_status) |
|
|
|
print('update_status', update_status) |
|
|
|
print('redis_get', redis_conn.get(redis_key)) |
|
|
|
print('redis_get', redis_conn.get(redis_key)) |
|
|
|
return JsonResponse({'result': 'success', 'ip': cinema_ip, 'msg': ''}) |
|
|
|
return JsonResponse({'result': 'success', 'ip': cinema_ip, 'msg': ''}) |
|
|
|