From 545b98645d04b2d26eb95354d8edf4d8e9d4e2a2 Mon Sep 17 00:00:00 2001 From: Matt Williams Date: Mon, 25 Mar 2019 13:18:33 +0000 Subject: [PATCH] Return dict directly to avoid failing key lookup --- lib/ansible/plugins/inventory/foreman.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/ansible/plugins/inventory/foreman.py b/lib/ansible/plugins/inventory/foreman.py index 5fba3976524..996f7d88359 100644 --- a/lib/ansible/plugins/inventory/foreman.py +++ b/lib/ansible/plugins/inventory/foreman.py @@ -175,7 +175,7 @@ class InventoryModule(BaseInventoryPlugin, Cacheable): url = "%s/api/v2/hosts/%s" % (self.foreman_url, hid) ret = self._get_json(url, [404]) if not ret or not isinstance(ret, MutableMapping) or not ret.get('all_parameters', False): - ret = {} + return {} return ret.get('all_parameters') def _get_facts_by_id(self, hid):