From 951ce83cc31bc1fa893743dc797ebaac290fcb7b Mon Sep 17 00:00:00 2001 From: Shamee Mahmud Date: Fri, 28 Aug 2026 08:09:12 +0000 Subject: [PATCH] Add ESXi to OSFamily enum and add ESXi detection, as well as disable sudo for ESXi --- nodescraper/base/inbandcollectortask.py | 3 +++ nodescraper/connection/inband/inbandmanager.py | 2 ++ nodescraper/enums/osfamily.py | 1 + 3 files changed, 6 insertions(+) diff --git a/nodescraper/base/inbandcollectortask.py b/nodescraper/base/inbandcollectortask.py index 25a3c55b..b3e30c98 100644 --- a/nodescraper/base/inbandcollectortask.py +++ b/nodescraper/base/inbandcollectortask.py @@ -97,6 +97,9 @@ def _run_sut_cmd( Returns: CommandArtifact: The result of the command execution, which includes stdout, stderr, and exit code. """ + if self.system_info.os_family == OSFamily.ESXI: + # ESXi runs as root and has no sudo binary; prefixing sudo would fail. + sudo = False command_res = self.connection.run_command( command=command, sudo=sudo, timeout=timeout, strip=strip ) diff --git a/nodescraper/connection/inband/inbandmanager.py b/nodescraper/connection/inband/inbandmanager.py index c1c6bea5..a934f5b3 100644 --- a/nodescraper/connection/inband/inbandmanager.py +++ b/nodescraper/connection/inband/inbandmanager.py @@ -94,6 +94,8 @@ def _check_os_family(self): res = self.connection.run_command("uname -s") if "not recognized as an internal or external command" in res.stdout + res.stderr: self.system_info.os_family = OSFamily.WINDOWS + elif res.exit_code == 0 and "VMkernel" in res.stdout: + self.system_info.os_family = OSFamily.ESXI elif res.exit_code == 0: self.system_info.os_family = OSFamily.LINUX else: diff --git a/nodescraper/enums/osfamily.py b/nodescraper/enums/osfamily.py index bce34550..81024631 100644 --- a/nodescraper/enums/osfamily.py +++ b/nodescraper/enums/osfamily.py @@ -32,5 +32,6 @@ class OSFamily(enum.Enum): WINDOWS = enum.auto() UNKNOWN = enum.auto() LINUX = enum.auto() + ESXI = enum.auto() EOS = enum.auto() SONIC = enum.auto()