add repr for hostvars (#15793)

* allows passing full hostvars to a module
This commit is contained in:
Matthew Stoltenberg 2016-05-10 08:23:10 -06:00 committed by Brian Coca
parent 9e88fa21f5
commit ddd9f92255

View file

@ -99,3 +99,9 @@ class HostVars(collections.Mapping):
def __len__(self):
return len(self._inventory.get_hosts(ignore_limits_and_restrictions=True))
def __repr__(self):
out = {}
for host in self._inventory.get_hosts(ignore_limits_and_restrictions=True):
name = host.name
out[name] = self.get(name)
return repr(out)