diff --git a/lisa/sut_orchestrator/azure/tools.py b/lisa/sut_orchestrator/azure/tools.py index c2f9bdcdf4..71456cb3d2 100644 --- a/lisa/sut_orchestrator/azure/tools.py +++ b/lisa/sut_orchestrator/azure/tools.py @@ -63,12 +63,19 @@ def _initialize(self, *args: Any, **kwargs: Any) -> None: def get_version(self) -> str: result = self.run("-version") - if isinstance(self.node.os, CBLMariner): - self._command = "/usr/bin/waagent" - else: - self._command = "/usr/sbin/waagent" + if result.exit_code != 0: + if self.node.tools[Ls].path_exists("/usr/bin/waagent"): + self._command = "/usr/bin/waagent" + elif self.node.tools[Ls].path_exists("/usr/sbin/waagent"): + self._command = "/usr/sbin/waagent" + else: + raise LisaException( + "waagent is not found in system path variable," + " /usr/bin and /usr/sbin." + ) result = self.run("-version") + # When the default command python points to python2, # we need specify python3 clearly. # e.g. bt-americas-inc diamondip-sapphire-v5 v5-9 9.0.53.