From 48ff044260d2c40c021719fef89352387761adb9 Mon Sep 17 00:00:00 2001 From: Serg Melikyan Date: Mon, 24 Feb 2014 16:58:00 +0400 Subject: [PATCH] Fixed work in envs patched by eventlet Change-Id: I3aa11e2f462d6534cc87b549f13b5140f87a7d14 Closes-bug: #1284031 --- metadataclient/common/utils.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/metadataclient/common/utils.py b/metadataclient/common/utils.py index 57528b2..0602974 100644 --- a/metadataclient/common/utils.py +++ b/metadataclient/common/utils.py @@ -117,3 +117,16 @@ def exit(msg=''): if msg: print >> sys.stderr, msg sys.exit(1) + + +def getsockopt(self, *args, **kwargs): + """ + A function which allows us to monkey patch eventlet's + GreenSocket, adding a required 'getsockopt' method. + TODO: (mclaren) we can remove this once the eventlet fix + (https://bitbucket.org/eventlet/eventlet/commits/609f230) + lands in mainstream packages. + NOTE: Already in 0.13, but we can't be sure that all clients + that use python client also use newest eventlet + """ + return self.fd.getsockopt(*args, **kwargs)