def wait_for_qos_operations(client, qos_id, operation, args=None):
 start_time = int(time.time())
 while True:
  if (operation == 'qos-key-unset'):
   body = client.show_qos(qos_id)['qos_specs']
   if (not any(((key in body['specs']) for key in args))):
    return
  elif (operation == 'disassociate'):
   body = client.show_association_qos(qos_id)['qos_associations']
   if (not any(((args in body[i]['id']) for i in range(0, len(body))))):
    return
  elif (operation == 'disassociate-all'):
   body = client.show_association_qos(qos_id)['qos_associations']
   if (not body):
    return
  else:
   msg = ' operation value is either not defined or incorrect.'
   raise lib_exc.UnprocessableEntity(msg)
  if ((int(time.time()) - start_time) >= client.build_timeout):
   raise lib_exc.TimeoutException
  time.sleep(client.build_interval)

def wait_for_qos_operations ( client , qos_id , operation , args = None ) : start_time = int ( time . time ( ) ) while True : if ( operation == 'qos-key-unset' ) : body = client . show_qos ( qos_id ) [ 'qos_specs' ] if ( not any ( ( ( key in body [ 'specs' ] ) for key in args ) ) ) : return elif ( operation == 'disassociate' ) : body = client . show_association_qos ( qos_id ) [ 'qos_associations' ] if ( not any ( ( ( args in body [ i ] [ 'id' ] ) for i in range ( 0 , len ( body ) ) ) ) ) : return elif ( operation == 'disassociate-all' ) : body = client . show_association_qos ( qos_id ) [ 'qos_associations' ] if ( not body ) : return else : msg = ' operation value is either not defined or incorrect.' raise lib_exc . UnprocessableEntity ( msg ) if ( ( int ( time . time ( ) ) - start_time ) >= client . build_timeout ) : raise lib_exc . TimeoutException time . sleep ( client . build_interval )
waits for a qos operations to be completed .