summaryrefslogtreecommitdiff
path: root/lib/ansible/vars/hostvars.py
diff options
context:
space:
mode:
Diffstat (limited to 'lib/ansible/vars/hostvars.py')
-rw-r--r--lib/ansible/vars/hostvars.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/ansible/vars/hostvars.py b/lib/ansible/vars/hostvars.py
index 17325e219b..9f83342be3 100644
--- a/lib/ansible/vars/hostvars.py
+++ b/lib/ansible/vars/hostvars.py
@@ -78,10 +78,11 @@ class HostVars(collections.Mapping):
return False
def __iter__(self):
- raise NotImplementedError('HostVars does not support iteration as hosts are discovered on an as needed basis.')
+ for host in self._lookup:
+ yield host
def __len__(self):
- raise NotImplementedError('HostVars does not support len. hosts entries are discovered dynamically as needed')
+ return len(self._lookup)
def __getstate__(self):
return dict(loader=self._loader, lookup=self._lookup, play=self._play, var_manager=self._variable_manager)