From a941b10d63fc151597aba7eee73b57d7ab22dbb9 Mon Sep 17 00:00:00 2001 From: Patrick Uiterwijk Date: Mon, 3 Feb 2014 19:50:52 +0000 Subject: [PATCH] Add hotfix for python-openid --- files/hotfix/python-openid/fetchers.py | 9 ++++++--- roles/ask/tasks/main.yml | 11 +++++++++++ 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/files/hotfix/python-openid/fetchers.py b/files/hotfix/python-openid/fetchers.py index d628a2ac54..928dadbaae 100644 --- a/files/hotfix/python-openid/fetchers.py +++ b/files/hotfix/python-openid/fetchers.py @@ -93,7 +93,10 @@ def setDefaultFetcher(fetcher, wrap_exceptions=True): def usingCurl(): """Whether the currently set HTTP fetcher is a Curl HTTP fetcher.""" - return isinstance(getDefaultFetcher(), CurlHTTPFetcher) + fetcher = getDefaultFetcher() + if isinstance(fetcher, ExceptionWrappingFetcher): + fetcher = fetcher.fetcher + return isinstance(fetcher, CurlHTTPFetcher) class HTTPResponse(object): """XXX document attributes""" @@ -250,7 +253,7 @@ class CurlHTTPFetcher(HTTPFetcher): # Remove the status line from the beginning of the input unused_http_status_line = header_file.readline().lower () - while unused_http_status_line.startswith('http/1.1 100 '): + while unused_http_status_line.startswith('http/1.1 1'): unused_http_status_line = header_file.readline() unused_http_status_line = header_file.readline() @@ -319,7 +322,7 @@ class CurlHTTPFetcher(HTTPFetcher): return 0 else: return data.write(chunk) - + response_header_data = cStringIO.StringIO() c.setopt(pycurl.WRITEFUNCTION, write_data) c.setopt(pycurl.HEADERFUNCTION, response_header_data.write) diff --git a/roles/ask/tasks/main.yml b/roles/ask/tasks/main.yml index c875688abc..33b9437294 100644 --- a/roles/ask/tasks/main.yml +++ b/roles/ask/tasks/main.yml @@ -20,6 +20,17 @@ tags: - packages +# https://github.com/openid/python-openid/pull/76 +- name: hotfix - copy over python-openid fixed messages + copy: src="{{ files }}/hotfix/python-openid/fetchers.py" dest=/usr/lib/python2.6/site-packages/openid/fetchers.py + owner=root group=root mode=0644 + notify: + - restart apache + tags: + - config + - hotfix + - python-openid + - name: set sebooleans so ask can talk to the db action: seboolean name=httpd_can_network_connect_db state=true