X-Git-Url: https://gerrit.opnfv.org/gerrit/gitweb?a=blobdiff_plain;f=tools%2Fyaml-validate.py;h=2da873d059c4c6abad37609c4eba5b04dae36b67;hb=d2710b871b9f0141f0e7150590f896ab1fd71ba7;hp=fe690d8c82e2b911999e8a39cf899adf67f7b24c;hpb=4af63c0b17c89799c57efb45bcf575110d54d9e3;p=apex-tripleo-heat-templates.git diff --git a/tools/yaml-validate.py b/tools/yaml-validate.py index fe690d8c..2da873d0 100755 --- a/tools/yaml-validate.py +++ b/tools/yaml-validate.py @@ -24,10 +24,19 @@ def exit_usage(): def validate(filename): print('Validating %s' % filename) try: - yaml.load(open(filename).read()) + tpl = yaml.load(open(filename).read()) except Exception: print(traceback.format_exc()) return 1 + # yaml is OK, now walk the parameters and output a warning for unused ones + for p in tpl.get('parameters', {}): + str_p = '\'%s\'' % p + in_resources = str_p in str(tpl.get('resources', {})) + in_outputs = str_p in str(tpl.get('outputs', {})) + if not in_resources and not in_outputs: + print('Warning: parameter %s in template %s appears to be unused' + % (p, filename)) + return 0 if len(sys.argv) < 2: