mirror of
https://github.com/midoks/mdserver-web.git
synced 2026-10-10 04:19:26 +08:00
Update index.py
This commit is contained in:
+18
-17
@@ -145,24 +145,25 @@ class App():
|
||||
|
||||
def get_server_list(self):
|
||||
host_list = []
|
||||
for name in os.listdir(self.__host_dir):
|
||||
info_file = self.__host_dir + '/' + name + '/info.json'
|
||||
if not os.path.exists(info_file):
|
||||
continue
|
||||
try:
|
||||
info_tmp = self.getSshInfo(info_file)
|
||||
host_info = {}
|
||||
host_info['host'] = name
|
||||
host_info['port'] = info_tmp['port']
|
||||
host_info['ps'] = info_tmp['ps']
|
||||
# host_info['sort'] = int(info_tmp['sort'])
|
||||
except Exception as e:
|
||||
print(e)
|
||||
# if os.path.exists(info_file):
|
||||
# os.remove(info_file)
|
||||
# continue
|
||||
if os.path.exists(self.__host_dir):
|
||||
for name in os.listdir(self.__host_dir):
|
||||
info_file = self.__host_dir + '/' + name + '/info.json'
|
||||
if not os.path.exists(info_file):
|
||||
continue
|
||||
try:
|
||||
info_tmp = self.getSshInfo(info_file)
|
||||
host_info = {}
|
||||
host_info['host'] = name
|
||||
host_info['port'] = info_tmp['port']
|
||||
host_info['ps'] = info_tmp['ps']
|
||||
# host_info['sort'] = int(info_tmp['sort'])
|
||||
except Exception as e:
|
||||
print(e)
|
||||
# if os.path.exists(info_file):
|
||||
# os.remove(info_file)
|
||||
# continue
|
||||
|
||||
host_list.append(host_info)
|
||||
host_list.append(host_info)
|
||||
|
||||
host_list = sorted(host_list, key=lambda x: x['host'], reverse=False)
|
||||
return mw.returnJson(True, 'ok!', host_list)
|
||||
|
||||
Reference in New Issue
Block a user