#NEWLINE# def _xfsdump_output( data ) : #NEWLINE# #INDENT# '\n    Parse CLI output of the xfsdump utility.\n    ' #NEWLINE# out = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# summary = [ ] #NEWLINE# summary_block = False #NEWLINE# for line in [ l . strip ( ) for l in data . split ( '\n' ) if l . strip ( ) ] : #NEWLINE# #INDENT# line = re . sub ( '^xfsdump: ' , '' , line ) #NEWLINE# if line . startswith ( 'session id:' ) : #NEWLINE# #INDENT# out [ 'Session ID' ] = line . split ( ' ' ) [ ( - 1 ) ] #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if line . startswith ( 'session label:' ) : #NEWLINE# #INDENT# out [ 'Session label' ] = re . sub ( '^session label: ' , '' , line ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if line . startswith ( 'media file size' ) : #NEWLINE# #INDENT# out [ 'Media size' ] = re . sub ( '^media file size\\s+' , '' , line ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if line . startswith ( 'dump complete:' ) : #NEWLINE# #INDENT# out [ 'Dump complete' ] = re . sub ( '^dump complete:\\s+' , '' , line ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if line . startswith ( 'Dump Status:' ) : #NEWLINE# #INDENT# out [ 'Status' ] = re . sub ( '^Dump Status:\\s+' , '' , line ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if line . startswith ( 'Dump Summary:' ) : #NEWLINE# #INDENT# summary_block = True #NEWLINE# continue #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# if ( line . startswith ( ' ' ) and summary_block ) : #NEWLINE# #INDENT# summary . append ( line . strip ( ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( ( not line . startswith ( ' ' ) ) and summary_block ) : #NEWLINE# #INDENT# summary_block = False #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# if summary : #NEWLINE# #INDENT# out [ 'Summary' ] = ' ' . join ( summary ) #NEWLINE# #UNINDENT# return out