Skip to content

Commit

Permalink
Delete AMA extension at start in case its already installed (#3285)
Browse files Browse the repository at this point in the history
* Update AzureMonitorAgentLinux.py

* Update AzureMonitorAgentLinux.py

* Update AzureMonitorAgentLinux.py

* Update AzureMonitorAgentLinux.py

* Update AzureMonitorAgentLinux.py

* fix indent

* fix indent
  • Loading branch information
simathih authored Apr 30, 2024
1 parent 7820764 commit 788bbe6
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions microsoft/testsuites/vm_extensions/AzureMonitorAgentLinux.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from typing import Any

from assertpy import assert_that
from azure.core.exceptions import HttpResponseError

from lisa import (
Logger,
Expand Down Expand Up @@ -52,6 +53,13 @@ def verify_azuremonitoragent_linux(self, log: Logger, node: Node) -> None:
# Run VM Extension
extension = node.features[AzureExtension]

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",
publisher="Microsoft.Azure.Monitor",
Expand Down

0 comments on commit 788bbe6

Please sign in to comment.