Skip to content
This repository has been archived by the owner on Jan 4, 2022. It is now read-only.

Commit

Permalink
networkDriverService should be active to process healthcheck
Browse files Browse the repository at this point in the history
  • Loading branch information
kinarashah authored and Alena Prokharchyk committed Feb 13, 2018
1 parent e5ae7e1 commit 83b0ddf
Showing 1 changed file with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,13 @@

import static io.cattle.platform.core.model.tables.ServiceTable.SERVICE;

import java.util.Arrays;
import java.util.List;
import javax.inject.Inject;

public class ServiceEventFilter extends AbstractDefaultResourceManagerFilter {


private static List<String> invalidStates = Arrays.asList(CommonStatesConstants.REMOVED, CommonStatesConstants.REMOVING);
public static final String VERIFY_AGENT = "CantVerifyHealthcheck";

@Inject
Expand Down Expand Up @@ -111,8 +112,15 @@ public Object create(String type, ApiRequest request, ResourceManager next) {
}

private boolean isNetworkUp(long accountId) {
Service networkDriverService = objectManager.findAny(Service.class, SERVICE.ACCOUNT_ID, accountId, SERVICE.REMOVED, null, SERVICE.KIND,
Service networkDriverService = null;
List<Service> networkDriverServices = objectManager.find(Service.class, SERVICE.ACCOUNT_ID, accountId, SERVICE.REMOVED, null, SERVICE.KIND,
ServiceConstants.KIND_NETWORK_DRIVER_SERVICE);
for(Service service : networkDriverServices) {
if(invalidStates.contains(service.getState())) {
continue;
}
networkDriverService = service;
}
if (networkDriverService == null) {
return true;
}
Expand Down

0 comments on commit 83b0ddf

Please sign in to comment.