diff options
author | Brian Coca <bcoca@users.noreply.github.com> | 2022-02-07 15:13:40 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-02-07 15:13:40 -0500 |
commit | be19863e44cc6b78706147b25489a73d7c8fbcb5 (patch) | |
tree | cb02b864e38bc51ed6e5edf04483e1a21cdc5ecc /lib/ansible/plugins | |
parent | a5eadaf3fd5496bd1f100ff14badf5c4947185a2 (diff) | |
download | ansible-be19863e44cc6b78706147b25489a73d7c8fbcb5.tar.gz |
ssh connection: use 'correct' host in all cases (#76017)
ssh plugin, use 'correct' information source in all cases
* still fallback to pc
* added inventory to new test
* undef var can still show as parser error on pc
now task_exectuer has a more accurate error handling
Diffstat (limited to 'lib/ansible/plugins')
-rw-r--r-- | lib/ansible/plugins/connection/ssh.py | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/ansible/plugins/connection/ssh.py b/lib/ansible/plugins/connection/ssh.py index 1915e0df0b..f827f5884d 100644 --- a/lib/ansible/plugins/connection/ssh.py +++ b/lib/ansible/plugins/connection/ssh.py @@ -1283,6 +1283,8 @@ class Connection(ConnectionBase): super(Connection, self).exec_command(cmd, in_data=in_data, sudoable=sudoable) + self.host = self.get_option('host') or self._play_context.remote_addr + display.vvv(u"ESTABLISH SSH CONNECTION FOR USER: {0}".format(self.user), host=self.host) if getattr(self._shell, "_IS_WINDOWS", False): @@ -1327,6 +1329,8 @@ class Connection(ConnectionBase): super(Connection, self).put_file(in_path, out_path) + self.host = self.get_option('host') or self._play_context.remote_addr + display.vvv(u"PUT {0} TO {1}".format(in_path, out_path), host=self.host) if not os.path.exists(to_bytes(in_path, errors='surrogate_or_strict')): raise AnsibleFileNotFound("file or module does not exist: {0}".format(to_native(in_path))) @@ -1341,6 +1345,8 @@ class Connection(ConnectionBase): super(Connection, self).fetch_file(in_path, out_path) + self.host = self.get_option('host') or self._play_context.remote_addr + display.vvv(u"FETCH {0} TO {1}".format(in_path, out_path), host=self.host) # need to add / if path is rooted @@ -1352,6 +1358,7 @@ class Connection(ConnectionBase): def reset(self): run_reset = False + self.host = self.get_option('host') or self._play_context.remote_addr # If we have a persistent ssh connection (ControlPersist), we can ask it to stop listening. # only run the reset if the ControlPath already exists or if it isn't configured and ControlPersist is set |