Fix iteration on null
Change-Id: I663c8a387b6b888a9a5a37c613ccc318d73dd4de
diff --git a/cicd-lab-pipeline.groovy b/cicd-lab-pipeline.groovy
index 3475298..6898b96 100644
--- a/cicd-lab-pipeline.groovy
+++ b/cicd-lab-pipeline.groovy
@@ -135,11 +135,13 @@
def entry = out['return'].get(a)
for (int i = 0; i < entry.size(); i++) {
def node = entry.get(i)
- if (node.value =~ /Some services are not running/) {
- sleep(10)
- throw new Exception("$node.key: $node.value")
- } else {
- print out
+ if (node) {
+ if (node.value =~ /Some services are not running/) {
+ sleep(10)
+ throw new Exception("$node.key: $node.value")
+ } else {
+ print out
+ }
}
}
}