From dc658eaa1c636c47804bf70eddc55ada5e4078bf Mon Sep 17 00:00:00 2001 From: James Cammarata Date: Mon, 24 Mar 2014 15:59:43 -0500 Subject: [PATCH] Check to make sure the host is in the inventory vars cache before clearing it Fixes #6660 --- lib/ansible/runner/action_plugins/group_by.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/ansible/runner/action_plugins/group_by.py b/lib/ansible/runner/action_plugins/group_by.py index f8b4f318db2..4d6205ca60c 100644 --- a/lib/ansible/runner/action_plugins/group_by.py +++ b/lib/ansible/runner/action_plugins/group_by.py @@ -83,7 +83,8 @@ class ActionModule(object): inv_group = ansible.inventory.Group(name=group) inventory.add_group(inv_group) for host in hosts: - del self.runner.inventory._vars_per_host[host] + if host in self.runner.inventory._vars_per_host: + del self.runner.inventory._vars_per_host[host] inv_host = inventory.get_host(host) if not inv_host: inv_host = ansible.inventory.Host(name=host)