#NEWLINE# def get_index_tags( self , index , results , index_tags , column_tags ) : #NEWLINE# #INDENT# '\n        Gather the tags for this row of the table (index) based on the\n        results (all the results from the query).\n        index_tags and column_tags are the tags to gather.\n         - Those specified in index_tags contain the tag_group name and the\n           index of the value we want to extract from the index tuple.\n           cf. 1 for ipVersion in the IP-MIB::ipSystemStatsTable for example\n         - Those specified in column_tags contain the name of a column, which\n           could be a potential result, to use as a tage\n           cf. ifDescr in the IF-MIB::ifTable for example\n        ' #NEWLINE# tags = [ ] #NEWLINE# for idx_tag in index_tags : #NEWLINE# #INDENT# tag_group = idx_tag [ 0 ] #NEWLINE# try : #NEWLINE# #INDENT# tag_value = index [ ( idx_tag [ 1 ] - 1 ) ] . prettyPrint ( ) #NEWLINE# #UNINDENT# except IndexError : #NEWLINE# #INDENT# self . log . warning ( 'Not enough indexes, skipping this tag' ) #NEWLINE# continue #NEWLINE# #UNINDENT# tags . append ( '{0}:{1}' . format ( tag_group , tag_value ) ) #NEWLINE# #UNINDENT# for col_tag in column_tags : #NEWLINE# #INDENT# tag_group = col_tag [ 0 ] #NEWLINE# try : #NEWLINE# #INDENT# tag_value = results [ col_tag [ 1 ] ] [ index ] #NEWLINE# #UNINDENT# except KeyError : #NEWLINE# #INDENT# self . log . warning ( 'Column %s not present in the table, skipping this tag' , col_tag [ 1 ] ) #NEWLINE# continue #NEWLINE# #UNINDENT# if reply_invalid ( tag_value ) : #NEWLINE# #INDENT# self . log . warning ( "Can't deduct tag from column for tag %s" , tag_group ) #NEWLINE# continue #NEWLINE# #UNINDENT# tag_value = tag_value . prettyPrint ( ) #NEWLINE# tags . append ( '{0}:{1}' . format ( tag_group , tag_value ) ) #NEWLINE# #UNINDENT# return tags