@@ -92,6 +92,12 @@ def download_template_if_needed(template, url, filename, checksum):
9292 print (f"Downloading { template } System VM template from { url } to { dest_path } ..." )
9393 try :
9494 download_file (url , dest_path )
95+ #After download, verify checksum if provided
96+ if checksum :
97+ if verify_sha512_checksum (dest_path , checksum ):
98+ print (f"{ template } System VM template downloaded and verified successfully." )
99+ else :
100+ print (f"ERROR: Checksum verification failed for { template } System VM template after download." )
95101 except Exception as e :
96102 print (f"ERROR: Failed to download { template } System VM template: { e } " )
97103
@@ -164,9 +170,21 @@ if __name__ == '__main__':
164170 if templates_arg :
165171 templates_list = [t .strip ().lower () for t in templates_arg .split ("," )]
166172 if "all" in templates_list :
173+ if len (templates_list ) > 1 :
174+ print ("WARNING: 'all' specified for System VM templates, ignoring other specified templates." )
167175 selected_templates = available_templates
168176 else :
169- selected_templates = [t for t in templates_list if t in available_templates ]
177+ invalid_templates = []
178+ for t in templates_list :
179+ if t in available_templates :
180+ if t not in selected_templates :
181+ selected_templates .append (t )
182+ else :
183+ if t not in invalid_templates :
184+ invalid_templates .append (t )
185+ if invalid_templates :
186+ print (f"ERROR: Invalid System VM template names provided: { ', ' .join (invalid_templates )} " )
187+ sys .exit (1 )
170188 print (f"Selected systemvm templates to download: { ', ' .join (selected_templates ) if selected_templates else 'None' } " )
171189
172190 template_metadata_list = []
0 commit comments