From d91d2033615276e39243234640a073d2956ccc18 Mon Sep 17 00:00:00 2001 From: Logan V Date: Fri, 9 Jun 2017 11:41:48 -0500 Subject: [PATCH] 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 --- connection/ssh.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/connection/ssh.py b/connection/ssh.py index 1931e600..547d4317 100644 --- a/connection/ssh.py +++ b/connection/ssh.py @@ -61,7 +61,9 @@ class Connection(SSH.Connection): def set_host_overrides(self, host, hostvars=None): 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): """run a command on the remote host."""