#NEWLINE# def update_tenant_name_on_project_update( sender , instance = None , created = False , **kwargs ) : #NEWLINE# #INDENT# project = instance #NEWLINE# if created : #NEWLINE# #INDENT# return #NEWLINE# #UNINDENT# for spl in OpenStackServiceProjectLink . objects . filter ( project = project ) : #NEWLINE# #INDENT# tenant = spl . tenant #NEWLINE# if ( ( tenant is None ) or ( tenant . state != tenant . States . OK ) ) : #NEWLINE# #INDENT# continue #NEWLINE# #UNINDENT# tenant . name = spl . get_tenant_name ( ) #NEWLINE# tenant . save ( ) #NEWLINE# executors . TenantUpdateExecutor ( ) . execute ( tenant , updated_fields = [ 'name' ] )