Skip to content

Commit

Permalink
waagent: specify the waagent command when previous command has errors
Browse files Browse the repository at this point in the history
  • Loading branch information
LiliDeng committed Mar 20, 2024
1 parent 468fb21 commit 54026cf
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions lisa/sut_orchestrator/azure/tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 54026cf

Please sign in to comment.