use of com.thoughtworks.go.config.update.AgentUpdateValidator in project gocd by gocd.
the class AgentService method updateAgentAttributes.
public AgentInstance updateAgentAttributes(String uuid, String hostname, String resources, String environments, TriState state) {
AgentInstance agentInstance = agentInstances.findAgent(uuid);
validateThatAgentExists(agentInstance);
Agent agent = getPendingAgentOrFromDB(agentInstance);
if (validateAnyOperationPerformedOnAgent(hostname, environments, resources, state)) {
new AgentUpdateValidator(agentInstance, state).validate();
setAgentAttributes(hostname, resources, environments, state, agent);
saveOrUpdate(agent);
return createFromAgent(agent, systemEnvironment, agentStatusChangeNotifier);
}
return null;
}
Aggregations