#338 smtplib requires connect() call
Closed by aparsons. Opened by aparsons.
aparsons/koji koji-gc-smtp-connect  into  master

Download 338.patch

behavior seen in koji-utils-1.11.0-1.el7.noarch

Traceback (most recent call last):
File "/sbin/koji-gc", line 921, in
rv = main(args)
File "/sbin/koji-gc", line 430, in main
globals()'handle_' + x
File "/sbin/koji-gc", line 538, in handle_trash
send_warning_notice(owner_name, [x[1] for x in builds])
File "/sbin/koji-gc", line 423, in send_warning_notice
s.sendmail(msg['From'], msg['To'], msg.as_string())
File "/usr/lib64/python2.7/smtplib.py", line 722, in sendmail
self.ehlo_or_helo_if_needed()
File "/usr/lib64/python2.7/smtplib.py", line 541, in ehlo_or_helo_if_needed
if not (200 <= self.ehlo()[0] <= 299):
File "/usr/lib64/python2.7/smtplib.py", line 412, in ehlo
self.putcmd(self.ehlo_msg, name or self.local_hostname)
File "/usr/lib64/python2.7/smtplib.py", line 340, in putcmd
self.send(str)
File "/usr/lib64/python2.7/smtplib.py", line 332, in send
raise SMTPServerDisconnected('please run connect() first')
smtplib.SMTPServerDisconnected: please run connect() first

You said you were using koji-utils-1.11.0-1.el7.noarch. Is it safe to assume you are seeing this on rhel7?

We initialize our SMTP object with the configured host. According to the module docs, this is supposed to trigger a connect during initialization. Are you sure you have smtp_host configured?

That is the behavior I see in the module docs too.

I'll need to go check my various environments where I have koji-gc running via cron. I've never had smtp_host set as I just relay through localhost:25. Perhaps I've mistaken the emails over the years as coming natively from koji-gc when really they were just the stdout, but that doesn't explain why it never blew up with an unhandled exception. In any case, I'll have my puppet module set smtp_host in koji-gc.conf from now on.

This PR can be marked invalid.

Pull-Request has been closed by aparsons

Metadata