mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-27 23:21:22 -07:00
Reverting HostVars change from a mapping back to a dictionary
This commit is contained in:
parent
f1eb5b45d9
commit
6e9fa5019f
1 changed files with 2 additions and 14 deletions
|
@ -81,7 +81,7 @@ def _executor_hook(job_queue, result_queue, new_stdin):
|
||||||
except:
|
except:
|
||||||
traceback.print_exc()
|
traceback.print_exc()
|
||||||
|
|
||||||
class HostVars(collections.MutableMapping):
|
class HostVars(dict):
|
||||||
''' A special view of setup_cache that adds values from the inventory when needed. '''
|
''' A special view of setup_cache that adds values from the inventory when needed. '''
|
||||||
|
|
||||||
def __init__(self, setup_cache, inventory):
|
def __init__(self, setup_cache, inventory):
|
||||||
|
@ -90,25 +90,13 @@ class HostVars(collections.MutableMapping):
|
||||||
self.lookup = dict()
|
self.lookup = dict()
|
||||||
self.update(setup_cache)
|
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):
|
def __getitem__(self, host):
|
||||||
if not host in self.lookup:
|
if host not in self.lookup:
|
||||||
result = self.inventory.get_variables(host)
|
result = self.inventory.get_variables(host)
|
||||||
result.update(self.setup_cache.get(host, {}))
|
result.update(self.setup_cache.get(host, {}))
|
||||||
self.lookup[host] = result
|
self.lookup[host] = result
|
||||||
return self.lookup[host]
|
return self.lookup[host]
|
||||||
|
|
||||||
def __iter__(self):
|
|
||||||
return iter(self.lookup)
|
|
||||||
|
|
||||||
def __len__(self):
|
|
||||||
return len(self.lookup)
|
|
||||||
|
|
||||||
|
|
||||||
class Runner(object):
|
class Runner(object):
|
||||||
''' core API interface to ansible '''
|
''' core API interface to ansible '''
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue