Skip warning for required parameters
Skips the unused parameter warning for required parameters. Change-Id: I71ad4ab9f6e6c63e3f01b8cc9c72262f1958331e
This commit is contained in:
parent
3f5a6b1a82
commit
dd05114944
|
@ -17,6 +17,8 @@ import traceback
|
||||||
import yaml
|
import yaml
|
||||||
|
|
||||||
|
|
||||||
|
required_params = ['EndpointMap', 'ServiceNetMap', 'DefaultPasswords']
|
||||||
|
|
||||||
def exit_usage():
|
def exit_usage():
|
||||||
print('Usage %s <yaml file or directory>' % sys.argv[0])
|
print('Usage %s <yaml file or directory>' % sys.argv[0])
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
@ -40,7 +42,6 @@ def validate_service(filename, tpl):
|
||||||
% filename)
|
% filename)
|
||||||
return 1
|
return 1
|
||||||
if 'parameters' in tpl:
|
if 'parameters' in tpl:
|
||||||
required_params = ['EndpointMap', 'ServiceNetMap', 'DefaultPasswords']
|
|
||||||
for param in required_params:
|
for param in required_params:
|
||||||
if param not in tpl['parameters']:
|
if param not in tpl['parameters']:
|
||||||
print('ERROR: parameter %s is required for %s.'
|
print('ERROR: parameter %s is required for %s.'
|
||||||
|
@ -64,6 +65,8 @@ def validate(filename):
|
||||||
return 1
|
return 1
|
||||||
# yaml is OK, now walk the parameters and output a warning for unused ones
|
# yaml is OK, now walk the parameters and output a warning for unused ones
|
||||||
for p in tpl.get('parameters', {}):
|
for p in tpl.get('parameters', {}):
|
||||||
|
if p in required_params:
|
||||||
|
continue
|
||||||
str_p = '\'%s\'' % p
|
str_p = '\'%s\'' % p
|
||||||
in_resources = str_p in str(tpl.get('resources', {}))
|
in_resources = str_p in str(tpl.get('resources', {}))
|
||||||
in_outputs = str_p in str(tpl.get('outputs', {}))
|
in_outputs = str_p in str(tpl.get('outputs', {}))
|
||||||
|
|
Loading…
Reference in New Issue