#NEWLINE# def availability_zones( request ) : #NEWLINE# #INDENT# zone_list = [ ] #NEWLINE# if cinder_az_supported ( request ) : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# zones = api . cinder . availability_zone_list ( request ) #NEWLINE# zone_list = [ ( zone . zoneName , zone . zoneName ) for zone in zones if zone . zoneState [ 'available' ] ] #NEWLINE# zone_list . sort ( ) #NEWLINE# #UNINDENT# except Exception : #NEWLINE# #INDENT# exceptions . handle ( request , _ ( 'Unable to retrieve availability zones.' ) ) #NEWLINE# #UNINDENT# #UNINDENT# if ( not zone_list ) : #NEWLINE# #INDENT# zone_list . insert ( 0 , ( '' , _ ( 'No availability zones found' ) ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( len ( zone_list ) > 1 ) : #NEWLINE# #INDENT# zone_list . insert ( 0 , ( '' , _ ( 'Any Availability Zone' ) ) ) #NEWLINE# #UNINDENT# #UNINDENT# return zone_list