15
15
simple_requirement ,
16
16
)
17
17
from 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
19
19
from lisa .sut_orchestrator import AZURE
20
20
from lisa .sut_orchestrator .azure .common import (
21
21
get_compute_client ,
@@ -96,6 +96,7 @@ def _verify_vm_agent_running(node: Node, log: Logger) -> None:
96
96
def _assert_status_file_result (
97
97
node : Node , status_file : Any , error_code : str , api_type : Optional [str ] = None
98
98
) -> None :
99
+ file_status_is_error = status_file ["status" ].lower () == "error"
99
100
expected_succeeded_status_msg = "Expected the status file status to be Succeeded"
100
101
expected_warning_status_msg = (
101
102
"Expected the status file status to be CompletedWithWarnings"
@@ -117,47 +118,34 @@ def _assert_status_file_result(
117
118
else False
118
119
)
119
120
120
- if truncated_package_code :
121
+ if truncated_package_code and not file_status_is_error :
121
122
assert_that (status_file ["status" ]).described_as (
122
123
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" )
134
125
assert_that (error_code ).described_as (
135
126
"Expected 1 error in status file patches operation"
136
127
).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 :
146
130
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 " )
149
133
assert_that (error_code ).described_as (
150
134
"Expected 1 error in status file patches operation"
151
135
).is_equal_to ("1" )
136
+
152
137
elif package_manager_failure_code :
153
138
assert_that (status_file ["status" ]).described_as (
154
139
expected_succeeded_status_msg
155
140
).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
+
156
145
else :
157
146
assert_that (status_file ["status" ]).described_as (
158
147
expected_succeeded_status_msg
159
148
).is_equal_to ("Succeeded" )
160
-
161
149
assert_that (error_code ).described_as (
162
150
"Expected no error in status file patches operation"
163
151
).is_equal_to ("0" )
@@ -171,24 +159,6 @@ def _verify_details_code(status_file: Any, code: str) -> bool:
171
159
)
172
160
173
161
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
-
192
162
def _unsupported_image_exception_msg (node : Node ) -> None :
193
163
raise SkippedException (
194
164
UnsupportedDistroException (
@@ -211,7 +181,11 @@ def _assert_assessment_patch(
211
181
212
182
except HttpResponseError as identifier :
213
183
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
+ ]
215
189
):
216
190
_unsupported_image_exception_msg (node )
217
191
else :
@@ -247,7 +221,11 @@ def _assert_installation_patch(
247
221
248
222
except HttpResponseError as identifier :
249
223
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
+ ]
251
229
):
252
230
_unsupported_image_exception_msg (node )
253
231
else :
0 commit comments