From bef5ee2c3b8f4688d2d6d3d301b82f283e40b64d Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Thu, 12 Dec 2013 09:23:51 +0100 Subject: [PATCH] improve error on invalid vars file (if its a list instead of a dict) --- lib/ansible/playbook/play.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/ansible/playbook/play.py b/lib/ansible/playbook/play.py index 4abd51fbb92..e404e8ab01d 100644 --- a/lib/ansible/playbook/play.py +++ b/lib/ansible/playbook/play.py @@ -188,6 +188,8 @@ class Play(object): if os.path.isfile(vars): vars_data = utils.parse_yaml_from_file(vars) if vars_data: + if not isinstance(vars_data, dict): + raise errors.AnsibleError("vars from '%s' are not a dict" % vars) role_vars = utils.combine_vars(vars_data, role_vars) defaults = self._resolve_main(utils.path_dwim(self.basedir, os.path.join(role_path, 'defaults'))) defaults_data = {}