@@ -311,43 +311,54 @@ def __del__(self):
311
311
self .remove_config ()
312
312
313
313
314
+ _known_downburst_distros = {
315
+ 'rhel_minimal' : ['6.4' , '6.5' ],
316
+ 'centos' : ['9.stream' , '10.stream' ],
317
+ 'centos_minimal' : ['6.4' , '6.5' ],
318
+ 'debian' : ['6.0' , '7.0' , '7.9' , '8.0' ],
319
+ 'fedora' : ['41' , '42' ],
320
+ 'opensuse' : ['1.0(tumbleweed)' ,
321
+ '15.5(leap)' , '15.6(leap)' ,
322
+ '16.0(leap)' ,
323
+ ],
324
+ 'sles' : ['12-sp3' , '15-sp1' , '15-sp2' ],
325
+ 'alma' : ['10.0' , '8.10' , '9.6' ],
326
+ 'rocky' : ['10.0' , '8.10' , '9.6' ],
327
+ 'ubuntu' : ['20.04(focal)' , '20.10(groovy)' ,
328
+ '21.04(hirsute)' , '21.10(impish)' ,
329
+ '22.04(jammy)' , '22.10(kinetic)' ,
330
+ '23.04(lunar)' , '23.10(mantic)' ,
331
+ '24.04(noble)' , '24.10(oracular)' ,
332
+ '25.04(plucky)' ,
333
+ ],
334
+ }
335
+
314
336
def get_distro_from_downburst ():
315
337
"""
316
338
Return a table of valid distros.
317
339
318
340
If downburst is in path use it. If either downburst is unavailable,
319
341
or if downburst is unable to produce a json list, then use a default
320
- table.
342
+ table or a table from previous successful call .
321
343
"""
322
- default_table = {'rhel_minimal' : ['6.4' , '6.5' ],
323
- 'fedora' : ['17' , '18' , '19' , '20' , '22' ],
324
- 'centos' : ['6.3' , '6.4' , '6.5' , '7.0' ,
325
- '7.2' , '7.4' , '8.2' ],
326
- 'centos_minimal' : ['6.4' , '6.5' ],
327
- 'ubuntu' : ['8.04(hardy)' , '9.10(karmic)' ,
328
- '10.04(lucid)' , '10.10(maverick)' ,
329
- '11.04(natty)' , '11.10(oneiric)' ,
330
- '12.04(precise)' , '12.10(quantal)' ,
331
- '13.04(raring)' , '13.10(saucy)' ,
332
- '14.04(trusty)' , 'utopic(utopic)' ,
333
- '16.04(xenial)' , '18.04(bionic)' ,
334
- '20.04(focal)' ],
335
- 'sles' : ['12-sp3' , '15-sp1' , '15-sp2' ],
336
- 'opensuse' : ['12.3' , '15.1' , '15.2' ],
337
- 'debian' : ['6.0' , '7.0' , '8.0' ]}
344
+ # because sometimes downburst fails to complete list-json
345
+ # due to temporary issues with vendor site accessibility
346
+ # we cache known downburst distros from previous call
347
+ # to be reused in such cases of outage
348
+ global _known_downburst_distros
338
349
executable_cmd = downburst_executable ()
339
350
environment_dict = downburst_environment ()
340
351
if not executable_cmd :
341
352
log .warning ("Downburst not found!" )
342
353
log .info ('Using default values for supported os_type/os_version' )
343
- return default_table
354
+ return _known_downburst_distros
344
355
try :
345
356
log .debug (executable_cmd )
346
357
output = subprocess .check_output ([executable_cmd , 'list-json' ],
347
358
env = environment_dict )
348
- downburst_data = json .loads (output )
349
- return downburst_data
359
+ _known_downburst_distros = json .loads (output )
360
+ return _known_downburst_distros
350
361
except (subprocess .CalledProcessError , OSError ):
351
362
log .exception ("Error calling downburst!" )
352
- log .info ('Using default values for supported os_type/os_version' )
353
- return default_table
363
+ log .info ('Using default values for supported os_type/os_version or values from previous call... ' )
364
+ return _known_downburst_distros
0 commit comments