From 3bb1f7a5612d36a86b23d886c8df2543e338d45f Mon Sep 17 00:00:00 2001 From: nitzmahone Date: Mon, 16 Nov 2015 09:58:23 -0800 Subject: [PATCH] hostvars should return j2 undefined as instance, not type Looks like someone forgot to create an instance of undefined here- we were returning the undefined type object, which broke all the undefined checks. Added an integration test around add_host that will catch this (separate PR to follow) --- lib/ansible/vars/hostvars.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/ansible/vars/hostvars.py b/lib/ansible/vars/hostvars.py index f56f542574..de27984039 100644 --- a/lib/ansible/vars/hostvars.py +++ b/lib/ansible/vars/hostvars.py @@ -77,7 +77,7 @@ class HostVars(collections.Mapping): def __getitem__(self, host_name): if host_name not in self._lookup: - return j2undefined + return j2undefined() host = self._lookup.get(host_name) data = self._variable_manager.get_vars(loader=self._loader, host=host, play=self._play, include_hostvars=False)