Search in sources :

Example 1 with RevokeCertsResponse

use of com.sequenceiq.freeipa.flow.freeipa.cleanup.event.cert.RevokeCertsResponse in project cloudbreak by hortonworks.

the class FreeIpaDownscaleActions method removeDnsEntriesAction.

@Bean(name = "DOWNSCALE_REMOVE_DNS_ENTRIES_STATE")
public Action<?, ?> removeDnsEntriesAction() {
    return new AbstractDownscaleAction<>(RevokeCertsResponse.class) {

        @Override
        protected void doExecute(StackContext context, RevokeCertsResponse payload, Map<Object, Object> variables) {
            stackUpdater.updateStackStatus(context.getStack().getId(), getInProgressStatus(variables), "Remove DNS entries");
            CleanupEvent cleanupEvent = buildCleanupEvent(context, getDownscaleHosts(variables));
            RemoveDnsRequest request = new RemoveDnsRequest(cleanupEvent);
            sendEvent(context, request);
        }
    };
}
Also used : StackContext(com.sequenceiq.freeipa.flow.stack.StackContext) RemoveDnsRequest(com.sequenceiq.freeipa.flow.freeipa.cleanup.event.dns.RemoveDnsRequest) RevokeCertsResponse(com.sequenceiq.freeipa.flow.freeipa.cleanup.event.cert.RevokeCertsResponse) CleanupEvent(com.sequenceiq.freeipa.flow.freeipa.cleanup.CleanupEvent) Map(java.util.Map) Bean(org.springframework.context.annotation.Bean)

Example 2 with RevokeCertsResponse

use of com.sequenceiq.freeipa.flow.freeipa.cleanup.event.cert.RevokeCertsResponse in project cloudbreak by hortonworks.

the class RevokeCertsResponseToDownscaleFailureEventConverter method convert.

@Override
public DownscaleFailureEvent convert(Object payload) {
    RevokeCertsResponse revokeCertsResponse = (RevokeCertsResponse) payload;
    DownscaleFailureEvent event = new DownscaleFailureEvent(revokeCertsResponse.getResourceId(), "Cert revocation", revokeCertsResponse.getCertCleanupSuccess(), revokeCertsResponse.getCertCleanupFailed(), new Exception("Payload failed: " + payload));
    return event;
}
Also used : RevokeCertsResponse(com.sequenceiq.freeipa.flow.freeipa.cleanup.event.cert.RevokeCertsResponse) DownscaleFailureEvent(com.sequenceiq.freeipa.flow.freeipa.downscale.event.DownscaleFailureEvent)

Example 3 with RevokeCertsResponse

use of com.sequenceiq.freeipa.flow.freeipa.cleanup.event.cert.RevokeCertsResponse in project cloudbreak by hortonworks.

the class FreeIpaCleanupActions method removeHostsAction.

@Bean(name = "REMOVE_HOSTS_STATE")
public Action<?, ?> removeHostsAction() {
    return new AbstractFreeIpaCleanupAction<>(RevokeCertsResponse.class) {

        @Override
        protected void doExecute(FreeIpaContext context, RevokeCertsResponse payload, Map<Object, Object> variables) {
            if (shouldSkipState(payload, variables) || payload.getHosts() == null || payload.getHosts().isEmpty()) {
                LOGGER.info("Host is empty, skipping removing hosts");
                RemoveHostsResponse response = new RemoveHostsResponse(payload, Collections.emptySet(), Collections.emptyMap());
                sendEvent(context, response);
            } else {
                RemoveHostsRequest request = new RemoveHostsRequest(payload, context.getStack());
                sendEvent(context, request);
            }
        }
    };
}
Also used : RemoveHostsRequest(com.sequenceiq.freeipa.flow.freeipa.cleanup.event.host.RemoveHostsRequest) RemoveHostsResponse(com.sequenceiq.freeipa.flow.freeipa.cleanup.event.host.RemoveHostsResponse) RevokeCertsResponse(com.sequenceiq.freeipa.flow.freeipa.cleanup.event.cert.RevokeCertsResponse) Map(java.util.Map) Bean(org.springframework.context.annotation.Bean)

Example 4 with RevokeCertsResponse

use of com.sequenceiq.freeipa.flow.freeipa.cleanup.event.cert.RevokeCertsResponse in project cloudbreak by hortonworks.

the class RevokeCertsResponseToCleanupFailureEventConverter method convert.

@Override
public CleanupFailureEvent convert(Object payload) {
    RevokeCertsResponse revokeCertsResponse = (RevokeCertsResponse) payload;
    CleanupFailureEvent event = new CleanupFailureEvent(revokeCertsResponse, "Cert revocation", revokeCertsResponse.getCertCleanupFailed(), revokeCertsResponse.getCertCleanupSuccess());
    return event;
}
Also used : RevokeCertsResponse(com.sequenceiq.freeipa.flow.freeipa.cleanup.event.cert.RevokeCertsResponse)

Example 5 with RevokeCertsResponse

use of com.sequenceiq.freeipa.flow.freeipa.cleanup.event.cert.RevokeCertsResponse in project cloudbreak by hortonworks.

the class FreeIpaCleanupActions method revokeCertsAction.

@Bean(name = "REVOKE_CERTS_STATE")
public Action<?, ?> revokeCertsAction() {
    return new AbstractFreeIpaCleanupAction<>(CleanupEvent.class) {

        @Override
        protected void doExecute(FreeIpaContext context, CleanupEvent payload, Map<Object, Object> variables) {
            if (shouldSkipState(payload, variables) || payload.getHosts() == null || payload.getHosts().isEmpty()) {
                LOGGER.info("Host is empty, skipping revoking certificates");
                RevokeCertsResponse response = new RevokeCertsResponse(payload, Collections.emptySet(), Collections.emptyMap());
                sendEvent(context, response);
            } else {
                RevokeCertsRequest request = new RevokeCertsRequest(payload, context.getStack());
                sendEvent(context, request);
            }
        }
    };
}
Also used : RevokeCertsRequest(com.sequenceiq.freeipa.flow.freeipa.cleanup.event.cert.RevokeCertsRequest) RevokeCertsResponse(com.sequenceiq.freeipa.flow.freeipa.cleanup.event.cert.RevokeCertsResponse) Map(java.util.Map) Bean(org.springframework.context.annotation.Bean)

Aggregations

RevokeCertsResponse (com.sequenceiq.freeipa.flow.freeipa.cleanup.event.cert.RevokeCertsResponse)6 Map (java.util.Map)4 Bean (org.springframework.context.annotation.Bean)3 RevokeCertsRequest (com.sequenceiq.freeipa.flow.freeipa.cleanup.event.cert.RevokeCertsRequest)2 CleanupEvent (com.sequenceiq.freeipa.flow.freeipa.cleanup.CleanupEvent)1 RemoveDnsRequest (com.sequenceiq.freeipa.flow.freeipa.cleanup.event.dns.RemoveDnsRequest)1 RemoveHostsRequest (com.sequenceiq.freeipa.flow.freeipa.cleanup.event.host.RemoveHostsRequest)1 RemoveHostsResponse (com.sequenceiq.freeipa.flow.freeipa.cleanup.event.host.RemoveHostsResponse)1 DownscaleFailureEvent (com.sequenceiq.freeipa.flow.freeipa.downscale.event.DownscaleFailureEvent)1 StackContext (com.sequenceiq.freeipa.flow.stack.StackContext)1 Set (java.util.Set)1 Event (reactor.bus.Event)1