Fix connection plugin physical host set

I75f9d0f55ecd875caa1bf608a77c92f950b679a1 introduced a problem when
ansible_host is not defined on a host.

Related-Bug: 1695944
Change-Id: I9863757eef363cb05f581ab1449eb2f4aa3a0dda
This commit is contained in:
Logan V 2017-06-09 11:41:48 -05:00
parent 1e7d489673
commit d91d203361

View File

@ -61,7 +61,9 @@ class Connection(SSH.Connection):
def set_host_overrides(self, host, hostvars=None): def set_host_overrides(self, host, hostvars=None):
if self._container_check() or self._chroot_check(): if self._container_check() or self._chroot_check():
self.host = self._play_context.remote_addr = hostvars.get('physical_host_addr') physical_host_addr = hostvars.get('physical_host_addr')
if physical_host_addr:
self.host = self._play_context.remote_addr = physical_host_addr
def exec_command(self, cmd, in_data=None, sudoable=True): def exec_command(self, cmd, in_data=None, sudoable=True):
"""run a command on the remote host.""" """run a command on the remote host."""