Merge pull request #692 from DDS-Derek/main

This commit is contained in:
jxxghp
2023-09-28 20:04:30 +08:00
committed by GitHub

View File

@ -354,6 +354,12 @@ class SystemUtils:
index_second_slash = data.rfind("/", 0, index_resolv_conf) index_second_slash = data.rfind("/", 0, index_resolv_conf)
index_first_slash = data.rfind("/", 0, index_second_slash) + 1 index_first_slash = data.rfind("/", 0, index_second_slash) + 1
container_id = data[index_first_slash:index_second_slash] container_id = data[index_first_slash:index_second_slash]
if len(container_id) < 20:
index_resolv_conf = data.find("/sys/fs/cgroup/devices")
if index_resolv_conf != -1:
index_second_slash = data.rfind(" ", 0, index_resolv_conf)
index_first_slash = data.rfind("/", 0, index_second_slash) + 1
container_id = data[index_first_slash:index_second_slash]
if not container_id: if not container_id:
return False, "获取容器ID失败" return False, "获取容器ID失败"
# 重启当前容器 # 重启当前容器