Skip to content

Commit

Permalink
make nodeEntry processing better isolated and do not dump node JSON o…
Browse files Browse the repository at this point in the history
…n error
  • Loading branch information
Karl DeBisschop committed Dec 30, 2019
1 parent 1b275a0 commit b178c52
Showing 1 changed file with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,6 @@ public class RancherResourceModelSource implements ResourceModelSource {
// The set of nodes that will be returned by getNodes().
private NodeSetImpl iNodeEntries;

// Labels read from the node.
private JsonNode labels;

// Track how many times each stack_service has been seen.
Map<String, Integer> seen;

Expand Down Expand Up @@ -217,6 +214,9 @@ private class RancherNode {
// Tag set for the node being built.
private HashSet<String> tagset;

// Labels read from the node.
private JsonNode labels;

public RancherNode(String environmentName, JsonNode node) {
nodeEntry = new NodeEntryImpl();
if (tags == null) {
Expand Down Expand Up @@ -252,7 +252,10 @@ public RancherNode(String environmentName, JsonNode node) {
nodeEntry.setAttribute("services", node.get("links").get("services").asText());
nodeEntry.setAttribute("self", node.get("links").get("self").asText());

this.processLabels(node);
if (node.hasNonNull("labels")) {
labels = node.get("labels");
this.processLabels(node);
}
}

public NodeEntryImpl getNodeEntry() {
Expand Down

0 comments on commit b178c52

Please sign in to comment.