[Anthill-pro] Select a list of agents from an environment
Peter Steele
psteele at maxiscale.com
Tue May 27 12:03:19 CDT 2008
As I have pointed out in my thread "Is this a feature, a bug, or user
error?", the problem with this approach (as we have recently discovered)
is even if one agent is the environment is down, the secondary workflow
will not run. It doesn't matter if the user doesn't include this agent
in his list; if the filter specifies -1 as the agent count for the
filter, Anthill seems to require all agents to be up in the selected
environment before the workflow will run. This is a big issue for us;
not sure what to do for a workaround...
From: anthill-pro-bounces at lists.urbancode.com
[mailto:anthill-pro-bounces at lists.urbancode.com] On Behalf Of Steve
Boone
Sent: Tuesday, May 27, 2008 9:07 AM
To: AnthillPro user and support list.
Subject: Re: [Anthill-pro] Select a list of agents from an environment
To make it truly dynamic, the way you have it set up is the best
solution.
It is a bit tedious to have to type the names of the agents in, but this
does have some benefits. It will ensure that only those agents are
used, and that an agent that should not get a job delegated to it,
won't.
On Fri, May 9, 2008 at 7:38 PM, Peter Steele <psteele at maxiscale.com>
wrote:
I am writing a deploy job that will be run as a non-originating
workflow. We have set of machines that a build can potentially be
deployed to, and I have these machines grouped in their own environment.
On a given run of the deploy workflow I want to be able to filter the
list of agents that will be selected from this environment, for example
as a comma separated list that the user fills in when the secondary
process is run:
Workflow: deploy server artifacts
Environment: qa test servers
Servers to Populate: qa-dataserv1,qa-dataserv2,qa-dataserv3
...
and so on. The "Servers to Populate" field is a simple text field which
the user fills in with the list of servers (agents) that he wants to
deploy the build to. So, although the "qa test servers" environment
might have 50 servers in it, on a given run the use can select the
specific systems he's interested in.
I created the agent filter below to accomplish this, and it seems to
work well. My only issue is that requiring the user to enter the agent
names is a bit tedious, especially if they have to enter more than three
or four. Is there a better way I could accomplish what I'm trying to do
here? Being able to present the user with a full list of agents that
they could select multiple entries from would be better for example. As
for the script itself, are there any improvements I could make?
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");
List agentList = new ArrayList();
for (String agentName : (agentNames +",").split(","))
{
for (int i = 0; i < agents.length; i++)
{
if (agents[i].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);
_______________________________________________
Anthill-pro mailing list
Anthill-pro at lists.urbancode.com
http://lists.urbancode.com/mailman/listinfo/anthill-pro
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.urbancode.com/pipermail/anthill-pro/attachments/20080527/3690e2dd/attachment.htm
More information about the Anthill-pro
mailing list