Fix bug and set default for hieradata_file
Make hieradata_file point to /etc/puppet/hieradata/service_configs.json since this is a tripleo module anyway and we can assume the file is there for most cases.
This commit is contained in:
parent
e1f200c2ba
commit
038278f734
|
@ -1,4 +1,4 @@
|
||||||
schema: {}
|
schema: {}
|
||||||
hieradata: {}
|
hieradata: {}
|
||||||
hieradata_file: ''
|
hieradata_file: '/etc/puppet/hieradata/service_configs.json'
|
||||||
fact_variable: ''
|
fact_variable: ''
|
||||||
|
|
|
@ -85,11 +85,12 @@ def main():
|
||||||
hieradata = module.params['hieradata']
|
hieradata = module.params['hieradata']
|
||||||
hieradata_file = module.params['hieradata_file']
|
hieradata_file = module.params['hieradata_file']
|
||||||
|
|
||||||
if not (hieradata or hieradata_file):
|
if not (hieradata or (hieradata_file and os.path.exists(hieradata_file))):
|
||||||
module.fail_json(msg="Either hieradata or hieradata_file must be set")
|
module.fail_json(msg="Either hieradata or hieradata_file must be set")
|
||||||
|
|
||||||
if os.path.exists(hieradata_file):
|
if os.path.exists(hieradata_file):
|
||||||
hieradata = yaml.safe_load(hieradata_file)
|
# NOTE(flaper87): This will load both, json and yaml, files
|
||||||
|
hieradata = yaml.safe_load(open(hieradata_file))
|
||||||
|
|
||||||
conf_dict = {}
|
conf_dict = {}
|
||||||
for key, mapping in schema.items():
|
for key, mapping in schema.items():
|
||||||
|
|
Loading…
Reference in New Issue