Skip to content

Commit

Permalink
fix(provider/kubernetes): reads correct fields from cache refresh
Browse files Browse the repository at this point in the history
  • Loading branch information
Lars Wander committed Oct 13, 2017
1 parent 9182347 commit 5b62bac
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,6 @@ private OnDemandAgent.OnDemandResult addEntry(ProviderCache providerCache, Strin
.put(CACHE_TIME_KEY, System.currentTimeMillis())
.put(CACHE_RESULTS_KEY, jsonResult)
.put(PROCESSED_COUNT_KEY, 0)
.put(PROCESSED_TIME_KEY, null)
.put(MONIKER_KEY, namer.deriveMoniker(manifest))
.build();

Expand All @@ -230,7 +229,7 @@ private OnDemandAgent.OnDemandResult addEntry(ProviderCache providerCache, Strin

@Override
public OnDemandAgent.OnDemandResult handle(ProviderCache providerCache, Map<String, ?> data) {
String account = (String) data.get("accountName");
String account = (String) data.get("account");
String namespace = (String) data.get("location");
String fullName = (String) data.get("name");
String name;
Expand All @@ -247,14 +246,16 @@ public OnDemandAgent.OnDemandResult handle(ProviderCache providerCache, Map<Stri
// This is OK - the cache controller tries (w/o much info) to get every cache agent to handle each request
return null;
}

reloadNamespaces();
if (StringUtils.isEmpty(account)
|| StringUtils.isEmpty(name)
|| StringUtils.isEmpty(namespace)
|| !namespaces.contains(namespace)) {
return null;
}

reloadNamespaces();
log.info("Accepted on demand refresh of '{}'", data);
OnDemandAgent.OnDemandResult result;
T resource = loadPrimaryResource(namespace, name);
String resourceKey = Keys.infrastructure(primaryApiVersion(), primaryKind(), account, namespace, name);
Expand Down

0 comments on commit 5b62bac

Please sign in to comment.