Drop is_eventlet_bug105() from manila/utils.py
The function is not used anywhere. Change-Id: I9dd7aedec35c6295e764301e7f5a81a126de85df
This commit is contained in:
parent
d144bf7593
commit
2a27a433d3
manila
@ -15,9 +15,7 @@
|
|||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
import datetime
|
import datetime
|
||||||
import errno
|
|
||||||
import json
|
import json
|
||||||
import socket
|
|
||||||
import time
|
import time
|
||||||
|
|
||||||
import ddt
|
import ddt
|
||||||
@ -75,24 +73,6 @@ class GenericUtilsTestCase(test.TestCase):
|
|||||||
self.assertFalse(result)
|
self.assertFalse(result)
|
||||||
timeutils.utcnow.assert_called_once_with()
|
timeutils.utcnow.assert_called_once_with()
|
||||||
|
|
||||||
def test_is_eventlet_bug105(self):
|
|
||||||
fake_dns = mock.Mock()
|
|
||||||
fake_dns.getaddrinfo.side_effect = socket.gaierror(errno.EBADF)
|
|
||||||
with mock.patch.dict('sys.modules', {
|
|
||||||
'eventlet.support.greendns': fake_dns}):
|
|
||||||
self.assertTrue(utils.is_eventlet_bug105())
|
|
||||||
self.assertTrue(fake_dns.getaddrinfo.called)
|
|
||||||
|
|
||||||
def test_is_eventlet_bug105_neg(self):
|
|
||||||
fake_dns = mock.Mock()
|
|
||||||
fake_dns.getaddrinfo.return_value = [
|
|
||||||
(socket.AF_INET6, socket.SOCK_STREAM, 0, '', (u'127.0.0.1', 80)),
|
|
||||||
]
|
|
||||||
with mock.patch.dict('sys.modules', {
|
|
||||||
'eventlet.support.greendns': fake_dns}):
|
|
||||||
self.assertFalse(utils.is_eventlet_bug105())
|
|
||||||
fake_dns.getaddrinfo.assert_called_once_with('::1', 80)
|
|
||||||
|
|
||||||
@ddt.data(['ssh', '-D', 'my_name@name_of_remote_computer'],
|
@ddt.data(['ssh', '-D', 'my_name@name_of_remote_computer'],
|
||||||
['echo', '"quoted arg with space"'],
|
['echo', '"quoted arg with space"'],
|
||||||
['echo', "'quoted arg with space'"])
|
['echo', "'quoted arg with space'"])
|
||||||
|
@ -25,7 +25,6 @@ import pyclbr
|
|||||||
import random
|
import random
|
||||||
import re
|
import re
|
||||||
import shutil
|
import shutil
|
||||||
import socket
|
|
||||||
import sys
|
import sys
|
||||||
import tempfile
|
import tempfile
|
||||||
import time
|
import time
|
||||||
@ -262,27 +261,6 @@ class LazyPluggable(object):
|
|||||||
return getattr(backend, key)
|
return getattr(backend, key)
|
||||||
|
|
||||||
|
|
||||||
def is_eventlet_bug105():
|
|
||||||
"""Check if eventlet support IPv6 addresses.
|
|
||||||
|
|
||||||
See https://bitbucket.org/eventlet/eventlet/issue/105
|
|
||||||
|
|
||||||
:rtype: bool
|
|
||||||
"""
|
|
||||||
try:
|
|
||||||
mod = sys.modules['eventlet.support.greendns']
|
|
||||||
except KeyError:
|
|
||||||
return False
|
|
||||||
|
|
||||||
try:
|
|
||||||
connect_data = mod.getaddrinfo('::1', 80)
|
|
||||||
except socket.gaierror:
|
|
||||||
return True
|
|
||||||
|
|
||||||
fail = [x for x in connect_data if x[0] != socket.AF_INET6]
|
|
||||||
return bool(fail)
|
|
||||||
|
|
||||||
|
|
||||||
def monkey_patch():
|
def monkey_patch():
|
||||||
"""Patch decorator.
|
"""Patch decorator.
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user