Skip to content

Commit

Permalink
address pkg mgm failure is not longer set status to failed
Browse files Browse the repository at this point in the history
  • Loading branch information
feng-j678 authored and LiliDeng committed Sep 9, 2024
1 parent 4df06f0 commit a1358de
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions microsoft/testsuites/vm_extensions/linux_patch_extension.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,12 +106,16 @@ def _assert_status_file_result(
if error_details_not_empty
else False
)

ua_esm_required_code = (
_verify_details_code(status_file, "UA_ESM_REQUIRED")
if error_details_not_empty
else False
)
package_manager_failure_code = (
_verify_details_code(status_file, "PACKAGE_MANAGER_FAILURE")
if error_details_not_empty
else False
)

if truncated_package_code:
assert_that(status_file["status"]).described_as(
Expand Down Expand Up @@ -145,7 +149,10 @@ def _assert_status_file_result(
assert_that(error_code).described_as(
"Expected 1 error in status file patches operation"
).is_equal_to("1")

elif package_manager_failure_code:
assert_that(status_file["status"]).described_as(
expected_succeeded_status_msg
).is_equal_to("Succeeded")
else:
assert_that(status_file["status"]).described_as(
expected_succeeded_status_msg
Expand All @@ -158,7 +165,7 @@ def _assert_status_file_result(

def _verify_details_code(status_file: Any, code: str) -> bool:
return any(
code in detail_code["code"]
code.upper() in detail_code["code"].upper()
for detail_code in status_file["error"]["details"]
if "code" in detail_code
)
Expand Down

0 comments on commit a1358de

Please sign in to comment.