Fix exit code of validate-templates script

We didn't propagate the error properly in validate-templates, thus
exiting with 0 even when an error happened. We could also get a None
value when parsing environment files.

Change-Id: I005b1491c82db9d389b6176125563811ab2c83ba
Merge "Fix exit code of validate-templates script"