#NEWLINE# def run( self ) : #NEWLINE# #INDENT# manager = OpenStackManager ( ) #NEWLINE# if ( ( not manager . enabled ) or ( not manager . has_openstack ) ) : #NEWLINE# #INDENT# sys . exit ( ) #NEWLINE# #UNINDENT# while True : #NEWLINE# #INDENT# instances = Instance . objects . filter ( ip = None ) #NEWLINE# for instance in instances : #NEWLINE# #INDENT# manager . client . connect ( username = manager . client . keystone . username , password = manager . client . keystone . password , tenant = instance . slice . name ) #NEWLINE# instance . os_manager = manager #NEWLINE# servers = manager . client . nova . servers . findall ( id = instance . instance_id ) #NEWLINE# if ( not servers ) : #NEWLINE# #INDENT# continue #NEWLINE# #UNINDENT# server = servers [ 0 ] #NEWLINE# ips = server . addresses . get ( instance . slice . name , [ ] ) #NEWLINE# if ( not ips ) : #NEWLINE# #INDENT# continue #NEWLINE# #UNINDENT# instance . ip = ips [ 0 ] [ 'addr' ] #NEWLINE# instance . save ( ) #NEWLINE# #UNINDENT# time . sleep ( 7 )