From 144b74d3b4900635fff7b05d12bfc4930b97c1fe Mon Sep 17 00:00:00 2001 From: Dan Prince Date: Wed, 16 Jan 2019 13:07:48 -0500 Subject: [PATCH] Look for used parameters in conditionals This patch searches for parameter use in conditions as well and should eliminate a lot of false positive warnings with our validations. Change-Id: I33eba9d46d8c83b7a34c39fdfcd35b62f52c8752 --- tools/yaml-validate.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tools/yaml-validate.py b/tools/yaml-validate.py index 8a6d8e9cc4..e107d626d8 100755 --- a/tools/yaml-validate.py +++ b/tools/yaml-validate.py @@ -1151,7 +1151,9 @@ def validate(filename, param_map): 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 and args.quiet < 2: + in_conditions = str_p in str(tpl.get('conditions', {})) + if (not in_resources and not in_outputs and not in_conditions + and args.quiet < 2): print('Warning: parameter %s in template %s ' 'appears to be unused' % (p, filename))