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
This commit is contained in:
Dan Prince 2019-01-16 13:07:48 -05:00
parent d747625b82
commit 144b74d3b4

View File

@ -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))