From 08c5fe875bcd8abe03331e58a9150475073e9797 Mon Sep 17 00:00:00 2001 From: Michael DeHaan Date: Wed, 1 Aug 2012 19:46:33 -0400 Subject: [PATCH] yell if input data for host or group vars are not hashes --- lib/ansible/playbook/play.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/ansible/playbook/play.py b/lib/ansible/playbook/play.py index d063b2a19d..f1e9fed1f6 100644 --- a/lib/ansible/playbook/play.py +++ b/lib/ansible/playbook/play.py @@ -224,10 +224,14 @@ class Play(object): path = os.path.join(basedir, "group_vars/%s" % x) if os.path.exists(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) path = os.path.join(basedir, "host_vars/%s" % hostrec.name) if os.path.exists(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) for filename in self.vars_files: