use of com.thoughtworks.go.security.Registration in project gocd by gocd.
the class SslInfrastructureService method register.
private void register(AgentAutoRegistrationProperties agentAutoRegistrationProperties) throws Exception {
String hostName = SystemUtil.getLocalhostNameOrRandomNameIfNotFound();
Registration keyEntry = Registration.createNullPrivateKeyEntry();
while (!keyEntry.isValid()) {
try {
getTokenIfNecessary();
keyEntry = remoteRegistrationRequester.requestRegistration(hostName, agentAutoRegistrationProperties);
} catch (Exception e) {
LOGGER.error("[Agent Registration] There was a problem registering with the go server.", e);
throw e;
}
if ((!keyEntry.isValid())) {
try {
LOGGER.debug("[Agent Registration] Retrieved agent key from Go server is not valid.");
Thread.sleep(REGISTER_RETRY_INTERVAL);
} catch (InterruptedException e) {
// Ok
}
}
}
LOGGER.info("[Agent Registration] Retrieved registration from Go server.");
storeChainIntoAgentStore(keyEntry);
agentAutoRegistrationProperties.scrubRegistrationProperties();
}
Aggregations