#8445 EPN: '[Errno 111] Connection refused' when the SMTP is down
Closed: fixed by rcritten. Opened by fcami.

Issue

ipa-epn command displays 'exception: ConnectionRefusedError: [Errno 111] Connection refused'

Steps to Reproduce:
1. Run ipa-epn on IPA server without smtp service running

Actual results:
[root@master ~]# ipa-epn --dry-run
[]
The IPA-EPN command was successful
[root@master ~]# ipa-epn --mail-test
[Errno 111] Connection refused

2020-08-03T14:58:11Z DEBUG File "/usr/lib/python3.6/site-packages/ipapython/admintool.py", line 179, in execute
return_value = self.run()
File "/usr/lib/python3.6/site-packages/ipaclient/install/ipa_epn.py", line 290, in run
msg_charset=api.env.msg_charset,
File "/usr/lib/python3.6/site-packages/ipaclient/install/ipa_epn.py", line 741, in init
smtp_password=smtp_password,
File "/usr/lib/python3.6/site-packages/ipaclient/install/ipa_epn.py", line 597, in init
self._connect()
File "/usr/lib/python3.6/site-packages/ipaclient/install/ipa_epn.py", line 629, in _connect
timeout=self._smtp_timeout,
File "/usr/lib64/python3.6/smtplib.py", line 251, in init
(code, msg) = self.connect(host, port)
File "/usr/lib64/python3.6/smtplib.py", line 336, in connect
self.sock = self._get_socket(host, port, self.timeout)
File "/usr/lib64/python3.6/smtplib.py", line 307, in _get_socket
self.source_address)
File "/usr/lib64/python3.6/socket.py", line 724, in create_connection
raise err
File "/usr/lib64/python3.6/socket.py", line 713, in create_connection
sock.connect(sa)

2020-08-03T14:58:11Z DEBUG The IPA-EPN command failed, exception: ConnectionRefusedError: [Errno 111] Connection refused
2020-08-03T14:58:11Z ERROR [Errno 111] Connection refused
2020-08-03T14:58:11Z ERROR The IPA-EPN command failed. See /var/log/ipaepn.log for more information

Expected results:
Need to fix the traceback seen.


Metadata Update from @fcami:
- Custom field rhbz adjusted to https://bugzilla.redhat.com/show_bug.cgi?id=1863079

Metadata Update from @fcami:
- Custom field changelog adjusted to EPN now displays a proper message if the configured SMTP server cannot be contacted.
- Custom field on_review adjusted to https://github.com/freeipa/freeipa/pull/5010

master:

  • 6edf648d7bb368b1703bd2796d4cb090db64577a ipatests: test_epn: add test_EPN_connection_refused
  • 22cf65b09a56d94857aa8253ae2b79c34f82b0b8 IPA-EPN: Fix SMTP connection error handling

Metadata Update from @rcritten:
- Custom field rhbz adjusted to https://bugzilla.redhat.com/show_bug.cgi?id=1863079, https://bugzilla.redhat.com/show_bug.cgi?id=1863079 (was: https://bugzilla.redhat.com/show_bug.cgi?id=1863079)

Issue linked to Bugzilla: Bug 1863079

ipa-4-8:

  • 3cf7fb1014ae40fd5a5278f27577a8196a4af051 ipatests: test_epn: add test_EPN_connection_refused
  • 53f330b053740b169d211aa16b3b36fb61157bbd IPA-EPN: Fix SMTP connection error handling

Metadata Update from @rcritten:
- Issue close_status updated to: fixed
- Issue status updated to: Closed (was: Open)

Metadata