@Override public boolean deployCertificate(final Host host, final Certificate certificate, final Boolean reconnect, final Map<String, String> sshAccessDetails) throws AgentUnavailableException, OperationTimedoutException { final SetupCertificateCommand cmd = new SetupCertificateCommand(certificate); if (sshAccessDetails != null && !sshAccessDetails.isEmpty()) { cmd.setAccessDetail(sshAccessDetails); } CallContext.current().setEventDetails("deploying certificate for host id: " + host.getId()); final SetupCertificateAnswer answer = (SetupCertificateAnswer)agentManager.send(host.getId(), cmd); if (answer.getResult()) { CallContext.current().setEventDetails("successfully deployed certificate for host id: " + host.getId()); } else { CallContext.current().setEventDetails("failed to deploy certificate for host id: " + host.getId()); } if (answer.getResult()) { getActiveCertificatesMap().put(host.getPrivateIpAddress(), certificate.getClientCertificate()); if (sshAccessDetails == null && reconnect != null && reconnect) { LOG.info(String.format("Successfully setup certificate on host, reconnecting with agent with id=%d, name=%s, address=%s", host.getId(), host.getName(), host.getPublicIpAddress())); try { agentManager.reconnect(host.getId()); } catch (AgentUnavailableException | CloudRuntimeException e) { LOG.debug("Error when reconnecting to host: " + host.getUuid(), e); } } return true; } return false; }