#NEWLINE# @ shared_task #NEWLINE# def backup_delete( backup_uuid ) : #NEWLINE# #INDENT# backup = Backup . objects . get ( uuid = backup_uuid ) #NEWLINE# logger . debug ( 'About to delete backup for instance: %s' , backup . instance ) #NEWLINE# event_logger . openstack_backup . info ( 'Backup deletion for {resource_name} has been scheduled.' , event_type = 'resource_backup_deletion_scheduled' , event_context = { #NEWLINE# #INDENT# 'resource' : backup . instance , #NEWLINE# #UNINDENT# } ) #NEWLINE# try : #NEWLINE# #INDENT# backend = backup . get_backend ( ) #NEWLINE# backend . delete ( ) #NEWLINE# #UNINDENT# except BackupError : #NEWLINE# #INDENT# logger . exception ( 'Failed to delete backup for instance: %s' , backup . instance ) #NEWLINE# event_logger . openstack_backup . error ( 'Backup deletion for {resource_name} has failed.' , event_type = 'resource_backup_deletion_failed' , event_context = { #NEWLINE# #INDENT# 'resource' : backend . instance , #NEWLINE# #UNINDENT# } ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# logger . info ( 'Successfully deleted backup for instance: %s' , backup . instance ) #NEWLINE# event_logger . openstack_backup . info ( 'Backup for {resource_name} has been deleted.' , event_type = 'resource_backup_deletion_succeeded' , event_context = { #NEWLINE# #INDENT# 'resource' : backup . instance , #NEWLINE# #UNINDENT# } )