Search in sources :

Example 6 with FingerprintsResponse

use of com.sequenceiq.cloudbreak.orchestrator.salt.domain.FingerprintsResponse in project cloudbreak by hortonworks.

the class MinionAcceptor method proceedWithAcceptingMinions.

private void proceedWithAcceptingMinions(SaltConnector sc, List<String> unacceptedMinions) throws CloudbreakOrchestratorFailedException {
    LOGGER.info("There are unaccepted minions on master: {}", unacceptedMinions);
    Map<String, String> fingerprintsFromMaster = fetchFingerprintsFromMaster(sc, unacceptedMinions);
    List<Minion> minionsToAccept = minions.stream().filter(minion -> unacceptedMinions.contains(minion.getId())).collect(Collectors.toList());
    LOGGER.info("Processing the following minions so they are accepted on the master: {}", minionsToAccept.stream().map(Minion::getId).collect(Collectors.toList()));
    if (!minionsToAccept.isEmpty()) {
        FingerprintsResponse fingerprintsResponse = fingerprintCollector.collectFingerprintFromMinions(sc, minionsToAccept);
        acceptMatchingFingerprints(sc, fingerprintsFromMaster, fingerprintsResponse, minionsToAccept);
    }
}
Also used : Logger(org.slf4j.Logger) Fingerprint(com.sequenceiq.cloudbreak.orchestrator.salt.domain.Fingerprint) Collection(java.util.Collection) LoggerFactory(org.slf4j.LoggerFactory) Set(java.util.Set) Collectors(java.util.stream.Collectors) ArrayList(java.util.ArrayList) List(java.util.List) MinionKeysOnMasterResponse(com.sequenceiq.cloudbreak.orchestrator.salt.domain.MinionKeysOnMasterResponse) Minion(com.sequenceiq.cloudbreak.orchestrator.salt.domain.Minion) CloudbreakOrchestratorFailedException(com.sequenceiq.cloudbreak.orchestrator.exception.CloudbreakOrchestratorFailedException) FingerprintsResponse(com.sequenceiq.cloudbreak.orchestrator.salt.domain.FingerprintsResponse) Map(java.util.Map) MinionFingersOnMasterResponse(com.sequenceiq.cloudbreak.orchestrator.salt.domain.MinionFingersOnMasterResponse) Predicate.not(java.util.function.Predicate.not) SaltConnector(com.sequenceiq.cloudbreak.orchestrator.salt.client.SaltConnector) FingerprintsResponse(com.sequenceiq.cloudbreak.orchestrator.salt.domain.FingerprintsResponse) Minion(com.sequenceiq.cloudbreak.orchestrator.salt.domain.Minion)

Aggregations

FingerprintsResponse (com.sequenceiq.cloudbreak.orchestrator.salt.domain.FingerprintsResponse)6 Fingerprint (com.sequenceiq.cloudbreak.orchestrator.salt.domain.Fingerprint)4 FingerprintRequest (com.sequenceiq.cloudbreak.orchestrator.salt.domain.FingerprintRequest)4 Minion (com.sequenceiq.cloudbreak.orchestrator.salt.domain.Minion)4 Test (org.junit.jupiter.api.Test)4 CloudbreakOrchestratorFailedException (com.sequenceiq.cloudbreak.orchestrator.exception.CloudbreakOrchestratorFailedException)3 SaltConnector (com.sequenceiq.cloudbreak.orchestrator.salt.client.SaltConnector)2 MinionFingersOnMasterResponse (com.sequenceiq.cloudbreak.orchestrator.salt.domain.MinionFingersOnMasterResponse)2 MinionKeysOnMasterResponse (com.sequenceiq.cloudbreak.orchestrator.salt.domain.MinionKeysOnMasterResponse)2 List (java.util.List)2 Map (java.util.Map)2 ArrayList (java.util.ArrayList)1 Collection (java.util.Collection)1 Set (java.util.Set)1 Predicate.not (java.util.function.Predicate.not)1 Collectors (java.util.stream.Collectors)1 Assertions.assertEquals (org.junit.jupiter.api.Assertions.assertEquals)1 Assertions.assertThrows (org.junit.jupiter.api.Assertions.assertThrows)1 ArgumentMatchers.any (org.mockito.ArgumentMatchers.any)1 ArgumentMatchers.anyCollection (org.mockito.ArgumentMatchers.anyCollection)1