Skip to content

Instantly share code, notes, and snippets.

@josacar
Last active October 2, 2015 15:09
Show Gist options
  • Save josacar/49effb09571d118f5bb9 to your computer and use it in GitHub Desktop.
Save josacar/49effb09571d118f5bb9 to your computer and use it in GitHub Desktop.
berkshelf error
rsions/0.10.0/download","dependencies":{"runit":">= 0.0.0","build-essential":">= 0.0.0"}},"0.12.1":{"location_type":"opscode","location_path":"https://supermarket.chef.io:443/api/v1","download_url":"https://supermarket.chef.io:443/api/v1/cookbooks/nginx/versions/0.12.1/download","dependencies":{"runit":">= 0.0.0","build-essential":">= 0.0.0"}},"0.14.0":{"location_type":"opscode","location_path":"https://supermarket.chef.io:443/api/v1","download_url":"https://supermarket.chef.io:443/api/v1/cookbooks/nginx/versions/0.14.0/download","dependencies":{"runit":">= 0.0.0","build-essential":">= 0.0.0"}},"0.14.1":{"location_type":"opscode","location_path":"https://supermarket.chef.io:443/api/v1","download_url":"https://supermarket.chef.io:443/api/v1/cookbooks/nginx/versions/0.1' (JSON::ParserError)
from vendor/bundle/ruby/2.2.0/gems/json-1.8.3/lib/json/common.rb:155:in `parse'
from vendor/bundle/ruby/2.2.0/gems/ridley-4.2.0/lib/ridley/middleware/parse_json.rb:30:in `parse'
from vendor/bundle/ruby/2.2.0/gems/ridley-4.2.0/lib/ridley/middleware/parse_json.rb:100:in `on_complete'
from vendor/bundle/ruby/2.2.0/gems/faraday-0.9.1/lib/faraday/response.rb:9:in `block in call'
from vendor/bundle/ruby/2.2.0/gems/faraday-0.9.1/lib/faraday/response.rb:57:in `on_complete'
from vendor/bundle/ruby/2.2.0/gems/faraday-0.9.1/lib/faraday/response.rb:8:in `call'
from vendor/bundle/ruby/2.2.0/gems/faraday-0.9.1/lib/faraday/rack_builder.rb:139:in `build_response'
from vendor/bundle/ruby/2.2.0/gems/faraday-0.9.1/lib/faraday/connection.rb:377:in `run_request'
from vendor/bundle/ruby/2.2.0/gems/faraday-0.9.1/lib/faraday/connection.rb:140:in `get'
from vendor/bundle/ruby/2.2.0/gems/berkshelf-api-client-1.3.0/lib/berkshelf/api_client/connection.rb:62:in `universe'
from vendor/bundle/ruby/2.2.0/bundler/gems/berkshelf-7a06112afd20/lib/berkshelf/source.rb:22:in `build_universe'
from vendor/bundle/ruby/2.2.0/bundler/gems/berkshelf-7a06112afd20/lib/berkshelf/installer.rb:21:in `block (2 levels) in build_universe
I, [2015-10-02T13:02:04.780481 #4363] INFO -- : get https://supermarket.chef.io/universe
D, [2015-10-02T13:02:04.781259 #4363] DEBUG -- request: User-Agent: "Faraday v0.9.1"
I, [2015-10-02T13:02:07.158832 #4363] INFO -- Status: 200
D, [2015-10-02T13:02:07.159693 #4363] DEBUG -- response: Cache-Control: "max-age=0, private, must-revalidate"
Content-Type: "application/json; charset=utf-8"
Date: "Fri, 02 Oct 2015 13:02:05 GMT"
ETag: "\"7960d3311c353718fd0b09c684b00f60\""
Server: "nginx/1.8.0"
Status: "200 OK"
X-Content-Type-Options: "nosniff"
X-Frame-Options: "SAMEORIGIN"
X-Request-Id: "f2f22652-3523-4e6d-8dca-a6f30d7da8eb"
X-Runtime: "0.250346"
X-XSS-Protection: "1; mode=block"
transfer-encoding: "chunked"
Connection: "keep-alive"
64:
65: require 'pry'
=> 66: binding.pry
67: case response.status
68: when 200
69: [].tap do |cookbooks|
70: response.body.each do |name, versions|
71: versions.each { |version, attributes| cookbooks << RemoteCookbook.new(name, version, attributes) }
72: end
73: end
74: when 404
75: raise ServiceNotFound, "service not found at: #{url}"
76: when 500..504
77: raise ServiceUnavaiable, "service unavailable at: #{url}"
78: else
79: raise BadResponse, "bad response #{response.inspect}"
80: end
81: rescue Faraday::Error::TimeoutError, Errno::ETIMEDOUT
82: raise TimeoutError, "Unable to connect to: #{url}"
83: rescue Faraday::Error::ConnectionFailed => ex
84: raise ServiceUnavaiable, ex
85: end
[1] pry(#<Berkshelf::APIClient::Connection>)> response.body.length
=> 85898
vagrant:~$ curl -o /dev/null https://supermarket.chef.io/universe
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 114k 0 114k 0 0 58204 0 --:--:-- 0:00:02 --:--:-- 66247
curl: (18) transfer closed with outstanding read data remaining
vagrant:~$ curl -o /dev/null https://supermarket.chef.io/universe
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 3034k 0 3034k 0 0 341k 0 --:--:-- 0:00:08 --:--:-- 351k
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment