@@ -527,6 +527,7 @@ def get_image(
527
527
replace_inactive : bool = False ,
528
528
ignore_not_active : bool = False ,
529
529
ignore_not_found : bool = False ,
530
+ replace_not_found : bool = False ,
530
531
) -> Image :
531
532
logger .info (f"Get Image { name_or_id } " )
532
533
@@ -535,6 +536,14 @@ def get_image(
535
536
raise ImageNotFoundException (
536
537
message = f"Image { name_or_id } not found!" , name_or_id = name_or_id
537
538
)
539
+ elif not image and replace_not_found :
540
+ for version in ["18.04" , "20.04" , "22.04" , "1804" , "2004" , "2204" ]:
541
+ if version in name_or_id :
542
+ image = self .get_active_image_by_os_version (
543
+ os_version = version , os_distro = "ubuntu"
544
+ )
545
+ break
546
+
538
547
elif image and image .status != "active" and replace_inactive :
539
548
metadata = image .get ("metadata" , None )
540
549
image_os_version = metadata .get ("os_version" , None )
@@ -1214,7 +1223,10 @@ def start_server(
1214
1223
key_name : str = None # type: ignore
1215
1224
try :
1216
1225
image : Image = self .get_image (
1217
- name_or_id = image_name , replace_inactive = True , ignore_not_found = True
1226
+ name_or_id = image_name ,
1227
+ replace_not_found = True ,
1228
+ replace_inactive = True ,
1229
+ ignore_not_found = True ,
1218
1230
)
1219
1231
flavor : Flavor = self .get_flavor (name_or_id = flavor_name )
1220
1232
network : Network = self .get_network ()
0 commit comments