#NEWLINE# def to_dict( self ) : #NEWLINE# #INDENT# 'Host dict contains its underlying machine dict.' #NEWLINE# dict_info = self . machine . to_dict ( ) #NEWLINE# dict_info . update ( super ( Host , self ) . to_dict ( ) ) #NEWLINE# state_dict = self . state_dict ( ) #NEWLINE# ip = None #NEWLINE# for host_network in self . host_networks : #NEWLINE# #INDENT# if host_network . is_mgmt : #NEWLINE# #INDENT# ip = self . ip #NEWLINE# #UNINDENT# #UNINDENT# dict_info . update ( { #NEWLINE# #INDENT# 'machine_id' : self . machine . id , #NEWLINE# 'os_installed' : self . os_installed , #NEWLINE# 'hostname' : self . hostname , #NEWLINE# 'ip' : ip , #NEWLINE# 'networks' : [ host_network . to_dict ( ) for host_network in self . host_networks ] , #NEWLINE# 'os_id' : self . os_id , #NEWLINE# 'clusters' : [ cluster . to_dict ( ) for cluster in self . clusters ] , #NEWLINE# 'state' : state_dict [ 'state' ] , #NEWLINE# #UNINDENT# } ) #NEWLINE# return dict_info