Make safe condition for resource.changes
If state contains warning message
the changes in result are null in json output.
PROD-32436
Change-Id: I366ec6ddd34b3e6ee7aeb2f4eb42b83826feab4c
diff --git a/src/com/mirantis/mk/Salt.groovy b/src/com/mirantis/mk/Salt.groovy
index fa6dd60..0a9c78e 100644
--- a/src/com/mirantis/mk/Salt.groovy
+++ b/src/com/mirantis/mk/Salt.groovy
@@ -1008,7 +1008,7 @@
outputResources.add(String.format("Resource: %s\n\u001B[33m%s\u001B[0m", resKey, common.prettify(resource)))
}
}else{
- if(!printOnlyChanges || resource.changes.size() > 0){
+ if(!printOnlyChanges || (resource.changes && resource.changes.size() > 0)) {
outputResources.add(String.format("Resource: %s\n\u001B[32m%s\u001B[0m", resKey, common.prettify(resource)))
}
}