Fix IgnoreSignals on socket.error
authorGuido Trotter <ultrotter@google.com>
Mon, 31 May 2010 09:36:14 +0000 (11:36 +0200)
committerGuido Trotter <ultrotter@google.com>
Tue, 1 Jun 2010 08:39:06 +0000 (09:39 +0100)
commit14aeab220199befd335d9e23affb116fa6850e32
tree5f5aa67e44d5cd44acb48cef59983b9efc5ef584
parent2652b3631eecd8d41b3abce9292a98850f6f0517
Fix IgnoreSignals on socket.error

Some confusion arose handling EINTR on this function: in python 2.6
socket.error is an IOError, and thus:
  - It's an EnvironmentError
  - It has an .errno member

In 2.4 and 2.5 it's not, and so its errno variable must be extracted
from the args tuple. This patch fixes both the function, and the
unittests.

This is a cherry-pick of master commit
965d0e5ba37f3e88aa38230177ad1c66814bf927 with the portions not relevant
to 2.1 removed (changes to the RetryOnSignals function).

Signed-off-by: Guido Trotter <ultrotter@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>
lib/utils.py
test/ganeti.utils_unittest.py