

def filter_agents(agents, stack_outputs, override=None):
    deployed_agents = {
        
    }
    for agent in agents.values():
        stack_values = _get_stack_values(deployed_agents, agent['id'], ['ip'])
        if override:
            stack_values.update(override(agent))
        if (not stack_values.get('ip')):
            LOG.info('Ignore non-deployed agent: %s', agent)
            continue
        agent.update(stack_values)
        if ((agent.get('mode') == 'slave') and (not agent.get('ip'))):
            LOG.info('IP address is missing in agent: %s', agent)
            continue
        deployed_agents[agent['id']] = agent
    result = {
        
    }
    for agent in deployed_agents.values():
        if ((agent.get('mode') == 'alone') or ((agent.get('mode') == 'master') and (agent.get('slave_id') in deployed_agents)) or ((agent.get('mode') == 'slave') and (agent.get('master_id') in deployed_agents))):
            result[agent['id']] = agent
    return result

dataset/ETHPy150Open openstack/shaker/shaker/engine/deploy.py filter_agents/VarMisuse@38/50 `stack_outputs`->`deployed_agents`