Skip to content

Commit

Permalink
replace host check command in e1031 (sonic-net#18279)
Browse files Browse the repository at this point in the history
  • Loading branch information
Xichen96 authored and saksarav-nokia committed Mar 12, 2024
1 parent 83190de commit 3c2784e
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions device/celestica/x86_64-cel_e1031-r0/sonic_platform/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -184,12 +183,13 @@ def write_txt_file(self, file_path, value):
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):
"""
Expand Down

0 comments on commit 3c2784e

Please sign in to comment.