From 365c5b23ce8dad5fcbaadcb9b86b5f7da4874437 Mon Sep 17 00:00:00 2001 From: James Cammarata Date: Wed, 20 Jan 2016 18:23:30 -0500 Subject: [PATCH] Re-add cache clearing call to Inventory init This prevents a bug where the existing cache outside of the class is not cleared when creating a new Inventory object. This only really affects people using the API directly right now, but wanted to fix it to prevent weird errors from popping up. --- lib/ansible/inventory/__init__.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/ansible/inventory/__init__.py b/lib/ansible/inventory/__init__.py index eb8d190550..3d9ad3516d 100644 --- a/lib/ansible/inventory/__init__.py +++ b/lib/ansible/inventory/__init__.py @@ -78,6 +78,10 @@ class Inventory(object): self._restriction = None self._subset = None + # clear the cache here, which is only useful if more than + # one Inventory objects are created when using the API directly + self.clear_pattern_cache() + self.parse_inventory(host_list) def serialize(self):