replace host check command in e1031 (#18279)
This commit is contained in:
parent
25b24485e9
commit
e00d060834
@ -24,7 +24,6 @@ class Common:
|
|||||||
|
|
||||||
SET_METHOD_IPMI = 'ipmitool'
|
SET_METHOD_IPMI = 'ipmitool'
|
||||||
NULL_VAL = 'N/A'
|
NULL_VAL = 'N/A'
|
||||||
HOST_CHK_CMD = ["docker"]
|
|
||||||
REF_KEY = '$ref:'
|
REF_KEY = '$ref:'
|
||||||
|
|
||||||
def __init__(self, conf=None):
|
def __init__(self, conf=None):
|
||||||
@ -184,12 +183,13 @@ class Common:
|
|||||||
return False
|
return False
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def is_host(self):
|
def is_host():
|
||||||
try:
|
"""
|
||||||
subprocess.call(self.HOST_CHK_CMD, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
|
Test whether current process is running on the host or an docker
|
||||||
except FileNotFoundError:
|
return True for host and False for docker
|
||||||
return False
|
"""
|
||||||
return True
|
docker_env_file = '/.dockerenv'
|
||||||
|
return os.path.exists(docker_env_file) is False
|
||||||
|
|
||||||
def load_json_file(self, path):
|
def load_json_file(self, path):
|
||||||
"""
|
"""
|
||||||
|
Reference in New Issue
Block a user