Skip to content

Instantly share code, notes, and snippets.

@barn
Created April 17, 2018 20:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save barn/ab4aabe10c773dcdc243726600c9c9cf to your computer and use it in GitHub Desktop.
Save barn/ab4aabe10c773dcdc243726600c9c9cf to your computer and use it in GitHub Desktop.
Diff to fix puppet 3.x.x talking to Pypi after they changed their infrastructure (to do the right thing) on 2018-04-17
diff --git i/lib/puppet/provider/package/pip.rb w/lib/puppet/provider/package/pip.rb
index 8e889a0b1..0204b17d0 100644
--- i/lib/puppet/provider/package/pip.rb
+++ w/lib/puppet/provider/package/pip.rb
@@ -68,6 +68,9 @@ Puppet::Type.type(:package).provide :pip,
client = XMLRPC::Client.new2("http://pypi.python.org/pypi", proxy)
client.http_header_extra = {"Content-Type" => "text/xml"}
+ # also add an accept header, as the pypi infra changed and now they
+ # will gzip the response, which xmlrpc client will not handle.
+ client.http_header_extra = {"Accept-Encoding" => "text/xml"}
client.timeout = 10
result = client.call("package_releases", @resource[:name])
result.first
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment