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
This commit is contained in:
Thomas Herve 2014-05-01 12:31:40 +02:00
parent 824239e053
commit 4bc832fb7d
1 changed files with 2 additions and 2 deletions

View File

@ -20,14 +20,14 @@ def main(args):
dirs.remove(excluded)
for name in files:
if name.endswith((".yaml", ".template")):
got_error = validate(root, name)
got_error = validate(root, name) or got_error
sys.exit(int(got_error))
def validate(base, name):
basename, ext = os.path.splitext(name)
if basename.endswith("_env"):
return
return False
args = ["heat", "template-validate", "-f", os.path.join(base, name)]
base_env = "%s_env%s" % (basename, ext)
env = os.path.join(base, base_env)