replace host check command in e1031 (#18279)

This commit is contained in:
Xichen96 2024-03-08 00:46:28 +08:00 committed by GitHub
parent 5db634beb1
commit c66acd93b4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -24,7 +24,6 @@ class Common:
SET_METHOD_IPMI = 'ipmitool'
NULL_VAL = 'N/A'
HOST_CHK_CMD = ["docker"]
REF_KEY = '$ref:'
def __init__(self, conf=None):
@ -184,12 +183,13 @@ class Common:
return False
return True
def is_host(self):
try:
subprocess.call(self.HOST_CHK_CMD, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
except FileNotFoundError:
return False
return True
def is_host():
"""
Test whether current process is running on the host or an docker
return True for host and False for docker
"""
docker_env_file = '/.dockerenv'
return os.path.exists(docker_env_file) is False
def load_json_file(self, path):
"""