LGTM
On Friday, April 15, 2016 at 2:33:02 PM UTC+1, Brian Foley wrote: > > The "fix" in 750467a was incorrect. The original code was correct, but > the unit test mocks were missing the necessary information. > > While here, tweak whitespace to make the linter happy. > > Signed-off-by: Brian Foley <[email protected]> > --- > lib/http/client.py | 12 ++++++------ > test/py/ganeti.http_unittest.py | 12 ++++++++++-- > 2 files changed, 16 insertions(+), 8 deletions(-) > > diff --git a/lib/http/client.py b/lib/http/client.py > index 11c8049..4da5aec 100644 > --- a/lib/http/client.py > +++ b/lib/http/client.py > @@ -226,13 +226,13 @@ class _PendingRequest(object): > assert req.success is None, "Request has already been finalized" > > try: > - # LOCAL_* options added in pycurl 7.21.5 > - from_str = "from %s:%s " % ( > - req.getinfo(pycurl.LOCAL_IP), > - req.getinfo(pycurl.LOCAL_PORT) > - ) > + # LOCAL_* options added in pycurl 7.21.5 > + from_str = "from %s:%s " % ( > + curl.getinfo(pycurl.LOCAL_IP), > + curl.getinfo(pycurl.LOCAL_PORT) > + ) > except AttributeError: > - from_str = "" > + from_str = "" > logging.debug("Request %s%s finished, errmsg=%s", from_str, req, > errmsg) > > req.success = not bool(errmsg) > diff --git a/test/py/ganeti.http_unittest.py b/test/py/ > ganeti.http_unittest.py > index 518f817..5b4c1e1 100755 > --- a/test/py/ganeti.http_unittest.py > +++ b/test/py/ganeti.http_unittest.py > @@ -478,7 +478,11 @@ class TestClientStartRequest(unittest.TestCase): > > curl.info = { > pycurl.RESPONSE_CODE: response_code, > - } > + } > + if hasattr(pycurl, 'LOCAL_IP'): > + curl.info[pycurl.LOCAL_IP] = '127.0.0.1' > + if hasattr(pycurl, 'LOCAL_PORT'): > + curl.info[pycurl.LOCAL_PORT] = port > > # Finalize request > pending.Done(errmsg) > @@ -710,7 +714,11 @@ class TestProcessRequests(unittest.TestCase): > > curl.info = { > pycurl.RESPONSE_CODE: response_code, > - } > + } > + if hasattr(pycurl, 'LOCAL_IP'): > + curl.info[pycurl.LOCAL_IP] = '127.0.0.1' > + if hasattr(pycurl, 'LOCAL_PORT'): > + curl.info[pycurl.LOCAL_PORT] = port > > # Prepare for reset > self.assertFalse(curl.opts.pop(pycurl.POSTFIELDS)) > -- > 2.8.0.rc3.226.g39d4020 > >
