ambari-bootstrap icon indicating copy to clipboard operation
ambari-bootstrap copied to clipboard

Validate configuration-custom.json syntax before deployment starts

Open wcbdata opened this issue 6 years ago • 0 comments

When configuration-custom.json is modified, there is a chance it will be invalid. If the JSON is within a script or generated at runtime, the json usually isn't validated before being passed to deploy-recommended-cluster.bash. Failure due to malformed json is a bit opaque from the error messages, and can be labor-intensive to recover from after other parts of ambari-bootstrap have already run.

Using something like the example below at the earliest point that makes sense could make the script more restartable in the event of a malformed json file:

`#Check validity of configuration-custom.json

if jq '.' configuration-custom.json; then echo "JSON file is valid ..." else echo "Custom config JSON file is invalid! Please fix the source script ..." 1>&2 exit 1 fi`

wcbdata avatar Jun 13 '18 15:06 wcbdata