Search in sources :

Example 1 with AgentUpdateValidator

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;
}
Also used : AgentInstance(com.thoughtworks.go.domain.AgentInstance) NullAgentInstance(com.thoughtworks.go.domain.NullAgentInstance) AgentInstance.createFromAgent(com.thoughtworks.go.domain.AgentInstance.createFromAgent) AgentUpdateValidator(com.thoughtworks.go.config.update.AgentUpdateValidator)

Aggregations

AgentUpdateValidator (com.thoughtworks.go.config.update.AgentUpdateValidator)1 AgentInstance (com.thoughtworks.go.domain.AgentInstance)1 AgentInstance.createFromAgent (com.thoughtworks.go.domain.AgentInstance.createFromAgent)1 NullAgentInstance (com.thoughtworks.go.domain.NullAgentInstance)1