#NEWLINE# def _get_node( self , master_base_url , label ) : #NEWLINE# #INDENT# ( node , created ) = get_or_create ( Node , { #NEWLINE# #INDENT# 'label' : label , #NEWLINE# #UNINDENT# } ) #NEWLINE# if ( not created ) : #NEWLINE# #INDENT# return node #NEWLINE# #UNINDENT# try : #NEWLINE# #INDENT# response = self . _get_text_response ( master_base_url = master_base_url , path = '/computer/{}/config.xml' . format ( label ) ) #NEWLINE# #UNINDENT# except NotFound : #NEWLINE# #INDENT# return node #NEWLINE# #UNINDENT# response = response . encode ( 'utf-8' ) #NEWLINE# xml = objectify . fromstring ( response ) #NEWLINE# cluster_names = xml . label . text . split ( ' ' ) #NEWLINE# for cluster_name in cluster_names : #NEWLINE# #INDENT# if ( xml == 'swarm' ) : #NEWLINE# #INDENT# continue #NEWLINE# #UNINDENT# ( cluster , _ ) = get_or_create ( Cluster , { #NEWLINE# #INDENT# 'label' : cluster_name , #NEWLINE# #UNINDENT# } ) #NEWLINE# get_or_create ( ClusterNode , { #NEWLINE# #INDENT# 'node' : node , #NEWLINE# 'cluster' : cluster , #NEWLINE# #UNINDENT# } ) #NEWLINE# #UNINDENT# return node