geofffranks / spruce

A BOSH template merge tool
MIT License
426 stars 77 forks source link

spruce merge with json pipe #332

Closed marcus-sds closed 4 years ago

marcus-sds commented 4 years ago

$ spruce merge aab aaa aaa: unmarshal []byte to yaml failed: yaml: line 31: did not find expected ',' or ']'

$ echo $? 2

and when I use spruce json pipe with spruce 1.16.2 , it's returning with exit 2 $ spruce merge aab aaa|spruce json aaa: unmarshal []byte to yaml failed: yaml: line 31: did not find expected ',' or ']' $ echo $? 2

but if I use 1.25.2 or 1.25.3, it's returning exit 0 $ spruce merge aab aaa|spruce json aaa: unmarshal []byte to yaml failed: yaml: line 31: did not find expected ',' or ']' $ echo $? 0

Would you check this?

geofffranks commented 4 years ago

This is a side effect of 1.25.3 allowing null input to output an empty yaml document. Previously the failure to merge passed empty data into spruce json which then exited 2. Now this failure is passing empty data to spruce json which is allowable, and that exits 0. To catch the merge failure, you will want to set -o pipefail before running the spruce merge | spruce json