Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import os
import struct
import subprocess
from mmap import *
from sonic_py_common import device_info
from sonic_py_common.general import getstatusoutput_noshell

HOST_CHK_CMD = ["docker"]
EMPTY_STRING = ""
Expand All @@ -14,7 +14,11 @@ def __init__(self):
(self.platform, self.hwsku) = device_info.get_platform_and_hwsku()

def is_host(self):
return subprocess.call(HOST_CHK_CMD) == 0
try:
status, output = getstatusoutput_noshell(HOST_CHK_CMD)
return status == 0
except Exception:
return False

def pci_get_value(self, resource, offset):
status = True
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import os
import struct
import subprocess
from mmap import *
from sonic_py_common import device_info
from sonic_py_common.general import getstatusoutput_noshell

HOST_CHK_CMD = ["docker"]
EMPTY_STRING = ""
Expand All @@ -14,7 +14,11 @@ def __init__(self):
(self.platform, self.hwsku) = device_info.get_platform_and_hwsku()

def is_host(self):
return subprocess.call(HOST_CHK_CMD) == 0
try:
status, output = getstatusoutput_noshell(HOST_CHK_CMD)
return status == 0
except Exception:
return False

def pci_get_value(self, resource, offset):
status = True
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import os
import struct
import subprocess
from mmap import *
from sonic_py_common import device_info
from sonic_py_common.general import getstatusoutput_noshell

HOST_CHK_CMD = ["docker"]
EMPTY_STRING = ""
Expand All @@ -14,7 +14,11 @@ def __init__(self):
(self.platform, self.hwsku) = device_info.get_platform_and_hwsku()

def is_host(self):
return subprocess.call(HOST_CHK_CMD) == 0
try:
status, output = getstatusoutput_noshell(HOST_CHK_CMD)
return status == 0
except Exception:
return False

def pci_get_value(self, resource, offset):
status = True
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import os
import struct
import subprocess
from mmap import *
from sonic_py_common import device_info
from sonic_py_common.general import getstatusoutput_noshell

HOST_CHK_CMD = ["docker"]
EMPTY_STRING = ""
Expand All @@ -14,7 +14,11 @@ def __init__(self):
(self.platform, self.hwsku) = device_info.get_platform_and_hwsku()

def is_host(self):
return subprocess.call(HOST_CHK_CMD) == 0
try:
status, output = getstatusoutput_noshell(HOST_CHK_CMD)
return status == 0
except Exception:
return False

def pci_get_value(self, resource, offset):
status = True
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import os
import struct
import subprocess
from mmap import *
from sonic_py_common import device_info
from sonic_py_common.general import getstatusoutput_noshell

HOST_CHK_CMD = ["docker"]
EMPTY_STRING = ""
Expand All @@ -14,7 +14,11 @@ def __init__(self):
(self.platform, self.hwsku) = device_info.get_platform_and_hwsku()

def is_host(self):
return subprocess.call(HOST_CHK_CMD) == 0
try:
status, output = getstatusoutput_noshell(HOST_CHK_CMD)
return status == 0
except Exception:
return False

def pci_get_value(self, resource, offset):
status = True
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import os
import struct
import subprocess
from mmap import *
from sonic_py_common import device_info
from sonic_py_common.general import getstatusoutput_noshell

HOST_CHK_CMD = ["docker"]
EMPTY_STRING = ""
Expand All @@ -14,7 +14,11 @@ def __init__(self):
(self.platform, self.hwsku) = device_info.get_platform_and_hwsku()

def is_host(self):
return subprocess.call(HOST_CHK_CMD) == 0
try:
status, output = getstatusoutput_noshell(HOST_CHK_CMD)
return status == 0
except Exception:
return False

def pci_get_value(self, resource, offset):
status = True
Expand Down