mirror of
https://git.launchpad.net/ubuntu-dev-tools
synced 2025-03-13 08:01:09 +00:00
requestsync: mail_bug: Catch socket.error (LP: #190739)
This commit is contained in:
parent
fd5479e548
commit
3f7c03a0e8
1
debian/changelog
vendored
1
debian/changelog
vendored
@ -14,6 +14,7 @@ ubuntu-dev-tools (0.31) hardy; urgency=low
|
||||
- Do not fallback to submitting by email, if posting to Launchpad failed.
|
||||
This hasn't been requested and therefore should not get done.
|
||||
- post_bug: Catch IOError when setting bug importance (LP: #190061)
|
||||
- mail_bug: Catch socket.error (LP: #190739)
|
||||
|
||||
-- Daniel Hahler <ubuntu@thequod.de> Wed, 16 Apr 2008 01:57:41 +0200
|
||||
|
||||
|
@ -127,6 +127,7 @@ def mail_bug(source_package, subscribe, status, bugtitle, bugtext, keyid = None)
|
||||
Return True if email successfully send, otherwise False.'''
|
||||
|
||||
import smtplib
|
||||
import socket
|
||||
|
||||
to = 'new@bugs.launchpad.net'
|
||||
|
||||
@ -192,7 +193,12 @@ def mail_bug(source_package, subscribe, status, bugtitle, bugtext, keyid = None)
|
||||
mailserver_port = 25
|
||||
|
||||
# connect to the server
|
||||
s = smtplib.SMTP(mailserver, mailserver_port)
|
||||
try:
|
||||
s = smtplib.SMTP(mailserver, mailserver_port)
|
||||
except socket.error, s:
|
||||
print "ERROR: Could not connect to mailserver %s at port %s: %s (%i)" % \
|
||||
(mailserver, mailserver_port, s[1], s[0])
|
||||
return False
|
||||
|
||||
# authenticate to the server
|
||||
mailserver_user = os.getenv('DEBSMTP_USER')
|
||||
|
Loading…
x
Reference in New Issue
Block a user