1515 simple_requirement ,
1616)
1717from lisa .base_tools .service import Service
18- from lisa .operating_system import BSD , SLES , CBLMariner , Debian , Ubuntu
18+ from lisa .operating_system import BSD , SLES , CBLMariner , Debian
1919from lisa .sut_orchestrator import AZURE
2020from lisa .sut_orchestrator .azure .common import (
2121 get_compute_client ,
@@ -96,6 +96,7 @@ def _verify_vm_agent_running(node: Node, log: Logger) -> None:
9696def _assert_status_file_result (
9797 node : Node , status_file : Any , error_code : str , api_type : Optional [str ] = None
9898) -> None :
99+ file_status_is_error = status_file ["status" ].lower () == "error"
99100 expected_succeeded_status_msg = "Expected the status file status to be Succeeded"
100101 expected_warning_status_msg = (
101102 "Expected the status file status to be CompletedWithWarnings"
@@ -117,47 +118,34 @@ def _assert_status_file_result(
117118 else False
118119 )
119120
120- if truncated_package_code :
121+ if truncated_package_code and not file_status_is_error :
121122 assert_that (status_file ["status" ]).described_as (
122123 expected_warning_status_msg
123- ).is_equal_to ("CompletedWithWarnings" )
124- elif (
125- _is_supported_linux_distro (node )
126- and node .os .information .version .major == 18
127- and ua_esm_required_code
128- ):
129- # Ubuntu 1804 OS image has UA patches that needs upgrade OS to Pro version
130- # Set error code to 1 notify customers to upgrade OS to Pro to install patches
131- assert_that (status_file ["status" ]).described_as (
132- expected_succeeded_status_msg
133- ).is_equal_to ("Succeeded" )
124+ ).is_in ("CompletedWithWarnings" , "Succeeded" )
134125 assert_that (error_code ).described_as (
135126 "Expected 1 error in status file patches operation"
136127 ).is_equal_to ("1" )
137- elif (
138- api_type is not None
139- and _is_supported_linux_distro (node )
140- and node .os .information .version .major == 16
141- and ua_esm_required_code
142- ):
143- # This only applies on installation api call
144- # Ubuntu 1604 OS image has UA patches that needs upgrade OS to Pro version
145- # Set error code to 1 notify customers to upgrade OS to Pro to install patches
128+
129+ elif ua_esm_required_code and not file_status_is_error :
146130 assert_that (status_file ["status" ]).described_as (
147- expected_warning_status_msg
148- ).is_equal_to ("CompletedWithWarnings" )
131+ expected_succeeded_status_msg
132+ ).is_in ("CompletedWithWarnings" , "Succeeded " )
149133 assert_that (error_code ).described_as (
150134 "Expected 1 error in status file patches operation"
151135 ).is_equal_to ("1" )
136+
152137 elif package_manager_failure_code :
153138 assert_that (status_file ["status" ]).described_as (
154139 expected_succeeded_status_msg
155140 ).is_equal_to ("Succeeded" )
141+ assert_that (error_code ).described_as (
142+ "Expected 1 error in status file patches operation"
143+ ).is_equal_to ("1" )
144+
156145 else :
157146 assert_that (status_file ["status" ]).described_as (
158147 expected_succeeded_status_msg
159148 ).is_equal_to ("Succeeded" )
160-
161149 assert_that (error_code ).described_as (
162150 "Expected no error in status file patches operation"
163151 ).is_equal_to ("0" )
@@ -171,24 +159,6 @@ def _verify_details_code(status_file: Any, code: str) -> bool:
171159 )
172160
173161
174- def _is_supported_linux_distro (node : Node ) -> bool :
175- supported_major_versions = {
176- Ubuntu : [18 , 16 ],
177- }
178-
179- for distro in supported_major_versions :
180- if isinstance (node .os , distro ):
181- version_list = supported_major_versions .get (distro )
182- if (
183- version_list is not None
184- and node .os .information .version .major in version_list
185- ):
186- return True
187- else :
188- return False
189- return False
190-
191-
192162def _unsupported_image_exception_msg (node : Node ) -> None :
193163 raise SkippedException (
194164 UnsupportedDistroException (
@@ -211,7 +181,11 @@ def _assert_assessment_patch(
211181
212182 except HttpResponseError as identifier :
213183 if any (
214- s in str (identifier ) for s in ["The selected VM image is not supported" ]
184+ s in str (identifier )
185+ for s in [
186+ "The selected VM image is not supported" ,
187+ "CPU Architecture 'arm64' was not found in the extension repository" ,
188+ ]
215189 ):
216190 _unsupported_image_exception_msg (node )
217191 else :
@@ -247,7 +221,11 @@ def _assert_installation_patch(
247221
248222 except HttpResponseError as identifier :
249223 if any (
250- s in str (identifier ) for s in ["The selected VM image is not supported" ]
224+ s in str (identifier )
225+ for s in [
226+ "The selected VM image is not supported" ,
227+ "CPU Architecture 'arm64' was not found in the extension repository" ,
228+ ]
251229 ):
252230 _unsupported_image_exception_msg (node )
253231 else :
0 commit comments