From 15b2b3a020e8d931ec8ce356fa592a2278f82c9d Mon Sep 17 00:00:00 2001 From: Michael DeHaan Date: Sat, 14 Jul 2012 12:39:06 -0400 Subject: [PATCH] Warn if something loaded by vars_files is not a dictionary --- lib/ansible/playbook/play.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/ansible/playbook/play.py b/lib/ansible/playbook/play.py index c14fabd6d4..73bfcc5a00 100644 --- a/lib/ansible/playbook/play.py +++ b/lib/ansible/playbook/play.py @@ -217,5 +217,7 @@ class Play(object): fpath = utils.path_dwim(self.playbook.basedir, filename2) new_vars = utils.parse_yaml_from_file(fpath) if new_vars: + if type(new_vars) != dict: + raise errors.AnsibleError("files specified in vars_files must be a YAML dictionary: %s" % fpath) self.playbook.SETUP_CACHE[host].update(new_vars) - #else: could warn if vars file contains no vars. +