Title issue with mirrorprobe mail handler
Priority bug Status resolved
Superseder Nosy List dfarning, poeml
Assigned To poeml Keywords

Created on 2009-10-07.23:17:12 by dfarning, last changed by poeml.

msg21 (view) Author: dfarning Date: 2009-10-07.23:17:12
Peter here is a issues report on the mail handler.

mirrorbrain@Y650:/home/dfarning$ mirrorprobe
Traceback (most recent call last):
  File "/usr/bin/mirrorprobe", line 334, in <module>
  File "/usr/bin/mirrorprobe", line 216, in main
    'root@' + socket.gethostbyaddr(socket.gethostname())[0], 
socket.gaierror: [Errno -2] Name or service not known

I just commented out lines 214-222 in /usr/bin/mirrorprobe .

msg29 (view) Author: poeml Date: 2009-10-08.11:33:52
Hi David, I remember the email where you already mentioned this. I didn't read closely enough though. 
I thought the error came from some mirror hostname. In fact, it is the machine name itself (of the 
MirrorBrain host) that the script tries to resolve.

The lookup is done to have a hostname/domain to append to mailed logs; the feature of mailing logs 
isn't actually used anymore, but the code is still there.

On my test host, the hostname "ubuntu" resolves to

# python -c "import socket; h = socket.gethostname(); print h; print socket.gethostbyaddr(h)"
('ubuntu', [], [''])

The code is obviously naively running on assumptions that can't be met everywhere.

Development plans for the mirrorprobe are:
* integrate it into the "mb" tool, so there isn't the need to have a second script, and it can use 
shared functionality from the "mb" Python module
* clean up its error reporting in general - it is a big neglected because it relied on the mail 
functionality in the past, and was run with &>/dev/null, which didn't turn out to be a good idea (rare 
errors could easily get lost)

Therefore, I'd think the code should be removed, and make place for a better notification mechanism. A 
future notification system should be integrated with a web frontend, and allow for mail notification 
at the same time, for important things.

I'll commit a fix in SVN, but as it will take a while until that ends up in the Ubuntu packages, I'd 
recommend a workaround for now. Maybe you can adjust /etc/hostname and /etc/hosts in a way that it 
avoids the crash - or comment out the code as you did.

This works here:

root@ubuntu:~# cat /etc/hostname
root@ubuntu:~# grep ubuntu /etc/hosts	ubuntu
root@ubuntu:~# python -c "import socket; socket.gethostbyaddr(socket.gethostname())[0]"

(Returns empty value, but doesn't crash at least)
msg30 (view) Author: poeml Date: 2009-10-08.11:46:56
Fix committed with r7838. Will be included in the next release (post-2.10.1).
Date User Action Args
2009-10-08 11:46:56poemlsetstatus: chatting -> resolved
messages: + msg30
2009-10-08 11:33:53poemlsetstatus: unread -> chatting
assignedto: poeml
messages: + msg29
title: issue with mail handler on ubuntu 9.04 -> issue with mirrorprobe mail handler
2009-10-08 07:08:24poemlsetnosy: + poeml
2009-10-07 23:17:12dfarningcreate