#NEWLINE# @ osbsapi #NEWLINE# def restore_resource( self , resource_type , resources , continue_on_error = False ) : #NEWLINE# #INDENT# nfailed = 0 #NEWLINE# for r in resources [ 'items' ] : #NEWLINE# #INDENT# name = ( utils . graceful_chain_get ( r , 'metadata' , 'name' ) or '(no name)' ) #NEWLINE# logger . debug ( 'restoring %s/%s' , resource_type , name ) #NEWLINE# try : #NEWLINE# #INDENT# self . _prepare_resource ( resource_type , r ) #NEWLINE# self . os . restore_resource ( resource_type , r ) #NEWLINE# #UNINDENT# except Exception : #NEWLINE# #INDENT# if continue_on_error : #NEWLINE# #INDENT# logger . exception ( 'failed to restore %s/%s' , resource_type , name ) #NEWLINE# nfailed += 1 #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# raise #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# if continue_on_error : #NEWLINE# #INDENT# ntotal = len ( resources [ 'items' ] ) #NEWLINE# logger . info ( 'restored %s/%s %s' , ( ntotal - nfailed ) , ntotal , resource_type )