diff options
author | Brian Coca <bcoca@users.noreply.github.com> | 2016-08-02 10:39:00 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-08-02 10:39:00 -0400 |
commit | f7570f1dc4c75795f48c0fe0fff1edb467f8df2f (patch) | |
tree | b566d1b952ba6da799aa354d9122ca28ac2e04df /lib/ansible/vars | |
parent | 17e4629d523534790c95e68ec7d97e3277c0370c (diff) | |
download | ansible-f7570f1dc4c75795f48c0fe0fff1edb467f8df2f.tar.gz |
Implicit localhost ondemand (#16900)
* Revert "There can be only one localhost"
This reverts commit 5f1bbb4fcdea21b106367a5a426dc6f2b4851b9c.
this broke several usages of localhost, see #16882, #16898 and #16886
* ensure there is only 1 localhost
fixes #16886, #16882 and #16898
- make sure localhost exists before returning it
- optimzed host caching
- ensure we always return a host object
Diffstat (limited to 'lib/ansible/vars')
-rw-r--r-- | lib/ansible/vars/hostvars.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/ansible/vars/hostvars.py b/lib/ansible/vars/hostvars.py index faf471fd78..1e2ac7e292 100644 --- a/lib/ansible/vars/hostvars.py +++ b/lib/ansible/vars/hostvars.py @@ -62,7 +62,7 @@ class HostVars(collections.Mapping): self._inventory = inventory def _find_host(self, host_name): - if host_name in C.LOCALHOST: + if host_name in C.LOCALHOST and self._inventory.localhost: host = self._inventory.localhost else: host = self._inventory.get_host(host_name) |