From 10648fa7ce12f1e01c97d91429c11f0b6fae907b Mon Sep 17 00:00:00 2001 From: lixin Date: Mon, 13 Nov 2023 11:00:36 +0800 Subject: [PATCH] =?UTF-8?q?=E8=8E=B7=E5=8F=96=E8=BD=AF=E4=BB=B6=E4=BB=93?= =?UTF-8?q?=E5=BA=93=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- index.py | 1 + views/server.py | 30 ++++++++++++++++++++++++++++++ 2 files changed, 31 insertions(+) diff --git a/index.py b/index.py index 8629ae3..d9a564b 100644 --- a/index.py +++ b/index.py @@ -34,6 +34,7 @@ mods = { 'get_repo_data': server.get_repo_data, 'check_environment':migration.check_environment, 'get_environment_data': server.get_environment_data, + 'get_repo_arch_info': server.get_repo_arch_info, } diff --git a/views/server.py b/views/server.py index c959c2a..0a8eeed 100644 --- a/views/server.py +++ b/views/server.py @@ -291,5 +291,35 @@ def get_environment_data(data): res['info'] = info_list res['num'] = len(finall_progress) + json_res = json.dumps(res) + return json_res + + +def get_repo_arch_info(data): + """ + 获取软件仓库架构和系统信息 + :param data: + :return: + """ + sql = "select agent_os,agent_arch from agent_info where agent_online_status='0' and agent_storage>='10' " \ + "and agent_migration_os is null;" + get_info = DBHelper().execute(sql).fetchall() + get_info_list = [] + for i in get_info: + get_info_list.append(list(i)) + + for i in get_info_list : + if i[0] == 'redhat7': + i[0] = 'centos7' + if i[0] == 'redhat8': + i[0] = 'centos8' + + info_list = [] + info_dict_keys_list = ['agent_os', 'agent_arch'] + for i in get_info_list: + info_list.append(dict(zip(info_dict_keys_list, i))) + + res = {} + res['info'] = info_list json_res = json.dumps(res) return json_res \ No newline at end of file -- 2.20.1