show 'Error ENOENT: New host example (example) failed check: ["Can't communicate with
remote host, possibly because python3 is not installed there"]' instead of traceback
with OSError: cannot send(already closed?) when adding host if python3 is not on host
Signed-off-by: Daniel-Pivonka <dpivonka@redhat.com>
(cherry picked from commit
bb4554a3a67c4fc29b5dad597fbb880ea52394ac)
addr = self.inventory[host].get('addr', host)
try:
- conn, connr = self._get_connection(addr)
+ try:
+ conn, connr = self._get_connection(addr)
+ except IOError as e:
+ if error_ok:
+ self.log.exception('failed to establish ssh connection')
+ return [], [str("Can't communicate with remote host, possibly because python3 is not installed there")], 1
+ raise
assert image or entity
if not image: