commit | 3db2bf584efe147ca323f9b4177e6ddfd111e3c2 | [log] [tgz] |
---|---|---|
author | Jian Li <pyguni@gmail.com> | Fri Jan 03 10:29:41 2020 +0900 |
committer | Jian Li <pyguni@gmail.com> | Wed Mar 04 08:47:20 2020 +0000 |
tree | 3db8dbe463500dee7a2738b296a1d40a747ce1fd | |
parent | 0a5288479f254b226907358ac7f787f9ee16d0f9 [diff] |
Fix: harden the post-on-board K8S node state check logic Change-Id: I04bf5c20c92064c75816b864a51ea6ac3b4eac38
diff --git a/apps/k8s-node/app/src/main/java/org/onosproject/k8snode/web/K8sNodeWebResource.java b/apps/k8s-node/app/src/main/java/org/onosproject/k8snode/web/K8sNodeWebResource.java index 042e932..df4f63f 100644 --- a/apps/k8s-node/app/src/main/java/org/onosproject/k8snode/web/K8sNodeWebResource.java +++ b/apps/k8s-node/app/src/main/java/org/onosproject/k8snode/web/K8sNodeWebResource.java
@@ -283,7 +283,12 @@ long numOfReadyNodes = nodeAdminService.nodes().stream() .filter(n -> n.state() == POST_ON_BOARD) .count(); - boolean result = numOfAllNodes == numOfReadyNodes; + boolean result; + if (numOfAllNodes == 0) { + result = false; + } else { + result = numOfAllNodes == numOfReadyNodes; + } return ok(mapper().createObjectNode().put(RESULT, result)).build(); }