From 6e9fa5019f3d43500d6ad65bccf4291ffc550320 Mon Sep 17 00:00:00 2001 From: James Cammarata Date: Fri, 6 Sep 2013 20:18:41 -0500 Subject: [PATCH] Reverting HostVars change from a mapping back to a dictionary --- lib/ansible/runner/__init__.py | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/lib/ansible/runner/__init__.py b/lib/ansible/runner/__init__.py index 465a560e7ff..e676d8fa506 100644 --- a/lib/ansible/runner/__init__.py +++ b/lib/ansible/runner/__init__.py @@ -81,7 +81,7 @@ def _executor_hook(job_queue, result_queue, new_stdin): except: traceback.print_exc() -class HostVars(collections.MutableMapping): +class HostVars(dict): ''' A special view of setup_cache that adds values from the inventory when needed. ''' def __init__(self, setup_cache, inventory): @@ -90,25 +90,13 @@ class HostVars(collections.MutableMapping): self.lookup = dict() self.update(setup_cache) - def __setitem__(self, host, value): - self.lookup[host] = value - - def __delitem__(self, host): - del self.lookup[host] - def __getitem__(self, host): - if not host in self.lookup: + if host not in self.lookup: result = self.inventory.get_variables(host) result.update(self.setup_cache.get(host, {})) self.lookup[host] = result return self.lookup[host] - def __iter__(self): - return iter(self.lookup) - - def __len__(self): - return len(self.lookup) - class Runner(object): ''' core API interface to ansible '''