Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
LiliDeng committed Sep 18, 2024
1 parent 6143ae2 commit efa032a
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 10 deletions.
7 changes: 7 additions & 0 deletions lisa/sut_orchestrator/azure/features.py
Original file line number Diff line number Diff line change
Expand Up @@ -2850,6 +2850,13 @@ def create_or_update(
continue
break

try:
# Delete VM Extension if already present
self.delete("Microsoft.Azure.Monitor.AzureMonitorLinuxAgent")
except HttpResponseError as identifier:
if any(s in str(identifier) for s in ["was not found"]):
self._log.debug("AzureMonitorLinuxAgent is not already installed")

extension_parameters = VirtualMachineExtension(
tags=tags,
name=name,
Expand Down
16 changes: 6 additions & 10 deletions microsoft/testsuites/vm_extensions/AzureMonitorAgentLinux.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,16 +53,12 @@ def verify_azuremonitoragent_linux(self, log: Logger, node: Node) -> None:
# Run VM Extension
extension = node.features[AzureExtension]

for extension_name in [
"Microsoft.Azure.Monitor.AzureMonitorLinuxAgent",
"AzureMonitorLinuxAgent",
]:
try:
# Delete VM Extension if already present
extension.delete(extension_name)
except HttpResponseError as identifier:
if any(s in str(identifier) for s in ["was not found"]):
log.info(f"{extension_name} is not already installed")
try:
# Delete VM Extension if already present
extension.delete("AzureMonitorLinuxAgent")
except HttpResponseError as identifier:
if any(s in str(identifier) for s in ["was not found"]):
log.info("AzureMonitorLinuxAgent is not already installed")

extension_result = extension.create_or_update(
name="AzureMonitorLinuxAgent",
Expand Down

0 comments on commit efa032a

Please sign in to comment.