#NEWLINE# @ classmethod #NEWLINE# def prepare_nodes_for_task( cls , nodes , mclient_remove = True ) : #NEWLINE# #INDENT# 'Format all specified nodes for the deletion task.\n\n        :param nodes:\n        :param mclient_remove:\n        :return: dict\n        ' #NEWLINE# nodes_to_delete = [ ] #NEWLINE# nodes_to_restore = [ ] #NEWLINE# for node in nodes : #NEWLINE# #INDENT# nodes_to_delete . append ( cls . format_node_to_delete ( node , mclient_remove = mclient_remove ) ) #NEWLINE# if ( not node . pending_deletion ) : #NEWLINE# #INDENT# objects . Node . update ( node , { #NEWLINE# #INDENT# 'pending_deletion' : True , #NEWLINE# #UNINDENT# } ) #NEWLINE# db ( ) . flush ( ) #NEWLINE# #UNINDENT# node_to_restore = cls . format_node_to_restore ( mclient_remove ) #NEWLINE# if node_to_restore : #NEWLINE# #INDENT# nodes_to_restore . append ( node_to_restore ) #NEWLINE# #UNINDENT# #UNINDENT# return { #NEWLINE# #INDENT# 'nodes_to_delete' : nodes_to_delete , #NEWLINE# 'nodes_to_restore' : nodes_to_restore , #NEWLINE# #UNINDENT# }