Only try to generate resource if not in state "Pending" already.
@@ -65,6 +65,7 @@ public class ActivateHandler implements StatusChangeHandlerProvider.StatusChange
return new StatusUpdate(integration.getCurrentStatus(), "No token present");
}
+
String token = integration.getToken().get();
Tokens.setAuthenticationToken(token);
@@ -79,6 +80,8 @@ public class ActivateHandler implements StatusChangeHandlerProvider.StatusChange
// TODO: Verify Token and refresh if expired ....
+ Optional<Integration.Status> currentStatus = integration.getCurrentStatus();
+ if (!currentStatus.isPresent() || currentStatus.get() != Integration.Status.Pending) {
String gitHubUser = getGitHubUser();
log.info("{} : Looked up GitHubUser {}", getLabel(integration), gitHubUser);
@@ -90,6 +93,10 @@ public class ActivateHandler implements StatusChangeHandlerProvider.StatusChange
ensureOpenShiftResources(integration.getName(), gitCloneUrl, secret, extractSecretsFrom(integration));
log.info("{} : Created OpenShift resources", getLabel(integration));
+ } else {
+ log.info("{} : Skipping project generation because integration is in status {}",
+ getLabel(integration), currentStatus.map(Enum::name).orElse("[none]"));
+ }
Integration.Status status = openShiftService.isScaled(deployment) ?
Integration.Status.Activated : Integration.Status.Pending;
