1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

yell if input data for host or group vars are not hashes

This commit is contained in:
Michael DeHaan 2012-08-01 19:46:33 -04:00
parent ed14312ad6
commit 08c5fe875b

View file

@ -224,10 +224,14 @@ class Play(object):
path = os.path.join(basedir, "group_vars/%s" % x) path = os.path.join(basedir, "group_vars/%s" % x)
if os.path.exists(path): if os.path.exists(path):
data = utils.parse_yaml_from_file(path) data = utils.parse_yaml_from_file(path)
if type(data) != dict:
raise errors.AnsibleError("%s must be stored as a dictionary/hash" % path)
self.playbook.SETUP_CACHE[host].update(data) self.playbook.SETUP_CACHE[host].update(data)
path = os.path.join(basedir, "host_vars/%s" % hostrec.name) path = os.path.join(basedir, "host_vars/%s" % hostrec.name)
if os.path.exists(path): if os.path.exists(path):
data = utils.parse_yaml_from_file(path) data = utils.parse_yaml_from_file(path)
if type(data) != dict:
raise errors.AnsibleError("%s must be stored as a dictionary/hash" % path)
self.playbook.SETUP_CACHE[host].update(data) self.playbook.SETUP_CACHE[host].update(data)
for filename in self.vars_files: for filename in self.vars_files: