diff --git a/device/wistron/x86_64-wistron_6512_32r-r0/sonic_platform/chassis.py b/device/wistron/x86_64-wistron_6512_32r-r0/sonic_platform/chassis.py index 232ca0ca5fe..2f240abbf1d 100644 --- a/device/wistron/x86_64-wistron_6512_32r-r0/sonic_platform/chassis.py +++ b/device/wistron/x86_64-wistron_6512_32r-r0/sonic_platform/chassis.py @@ -8,7 +8,6 @@ ############################################################################# try: import sys - import os import time import subprocess from sonic_platform_base.chassis_base import ChassisBase @@ -23,9 +22,9 @@ PMON_REBOOT_CAUSE_PATH = "/usr/share/sonic/platform/api_files/reboot-cause/" REBOOT_CAUSE_FILE = "reboot-cause.txt" PREV_REBOOT_CAUSE_FILE = "previous-reboot-cause.txt" -HOST_CHK_CMD = "docker > /dev/null 2>&1" -GET_HWSKU_CMD = "sonic-cfggen -d -v DEVICE_METADATA.localhost.hwsku" -GET_PLATFORM_CMD = "sonic-cfggen -d -v DEVICE_METADATA.localhost.platform" +HOST_CHK_CMD = ["docker"] +GET_HWSKU_CMD = ["sonic-cfggen", "-d", "-v", "DEVICE_METADATA.localhost.hwsku"] +GET_PLATFORM_CMD = ["sonic-cfggen", "-d", "-v", "DEVICE_METADATA.localhost.platform"] class Chassis(ChassisBase): """Platform-specific Chassis class""" @@ -76,7 +75,7 @@ def __initialize_eeprom(self): self._eeprom = Tlv() def __is_host(self): - return os.system(HOST_CHK_CMD) == 0 + return subprocess.call(HOST_CHK_CMD) == 0 def __read_txt_file(self, file_path): try: @@ -141,12 +140,12 @@ def get_reboot_cause(self): return (reboot_cause, description) def _get_sku_name(self): - p = subprocess.Popen(GET_HWSKU_CMD, shell=True, stdout=subprocess.PIPE) + p = subprocess.Popen(GET_HWSKU_CMD, stdout=subprocess.PIPE) out, err = p.communicate() return out.decode().rstrip('\n') def _get_platform_name(self): - p = subprocess.Popen(GET_PLATFORM_CMD, shell=True, stdout=subprocess.PIPE) + p = subprocess.Popen(GET_PLATFORM_CMD, stdout=subprocess.PIPE) out, err = p.communicate() return out.decode().rstrip('\n') @@ -206,7 +205,7 @@ def get_change_event(self, timeout=0): port_dict[port] = '0' self._transceiver_presence = cur_presence - if change_event == True: + if change_event is True: break if not forever: