[Anthill-pro] Is this a feature, a bug, or user error?

Peter Steele psteele at maxiscale.com
Tue May 20 18:17:29 CDT 2008


We've just come across a situation that may cause us problems down the
road. We've installed agents on a large number test servers, with the
intent that our daily builds will be deployed to these systems by
various engineers for testing purposes. These agents are grouped into
various environments based on who will be using the systems. For
example, we have an environment called "Rack 5" consisting of 20 agents
that are used by SQA engineers. A given SQA engineer signs out some
subset of the Rack 5 servers for doing whatever testing is planned. I've
written a secondary deploy workflow that the users run against a build
to install the software on the set of target servers assigned to each
user. To do this I wrote an agent filter called "All Agents From List"
that takes as input the list of agents that the user wants to select
from the indicated environment. This all works fine except for one
problem: if even one agent is offline when the workflow is run, Anthill
reports the error "Not all agents in server group Rack 5 were online."
This is a reasonable error of course if one of the agents the user has
selected is offline. However, the error occurs even if one of the agents
not selected by the user is offline. For example, the user might select
systems 1-5 from environment Rack 5 to deploy the build on. If system 15
is currently offline though the secondary workflow does not run.

 

So, is there a solution to this? I've included the agent filter I wrote
below to select the agents to install the build on. The input agent
array is the full list of servers in the environment, and the output is
the filtered list of agents that the user has entered via a field in the
GUI (property agentNames). How can we make Anthill consider only the
status of these selected systems instead of the whole environment?

 

import com.urbancode.anthill3.domain.agent.Agent;
import com.urbancode.anthill3.runtime.scripting.helpers.*;

Where anyWhere = new Where()
{
    public Agent[] filter(Agent[] agents)
    {
        String agentNames =
BuildRequestLookup.getCurrent().getProperty("agentNames");
        if (agentNames.equals("all")) return agents;

        List agentList = new ArrayList();
        for (String agentName : (agentNames+",").split(","))
        {
            for (int i = 0; i < agents.length; i++)
            {
                if (agents[i].name.equals(agentName))
                {
                    agentList.add(agents[i]);
                    break;
                }
            }
        }
        Agent[] selectedAgents = new Agent[agentList.size()];
        for (int i = 0; i < selectedAgents.length; i++)
        {
            selectedAgents[i] = (Agent)agentList.get(i);
        }
        
        return selectedAgents;
    }
};

return Where.is(anyWhere);

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.urbancode.com/pipermail/anthill-pro/attachments/20080520/32e5ae4f/attachment.htm


More information about the Anthill-pro mailing list