Skip to content

Instantly share code, notes, and snippets.

@krames
Created June 25, 2013 13:36
Show Gist options
  • Select an option

  • Save krames/5858487 to your computer and use it in GitHub Desktop.

Select an option

Save krames/5858487 to your computer and use it in GitHub Desktop.
I am attempting to delete a cloud network that is attached to a server. I am expecting to see an error come back in json, but it is coming back in HTML. I am using our Ruby SDK (fog). A dump of the output is given below.
1.9.3p392 :003 > service.delete_network net.id
excon.request {:chunk_size=>1048576, :connect_timeout=>60, :debug_request=>false, :debug_response=>true, :headers=>{"User-Agent"=>"fog/1.12.1", "Content-Type"=>"application/json", "Accept"=>"application/json", "X-Auth-Token"=>"6ff9abe98db0415f99a12317e59e0cc0", "Host"=>"dfw.servers.api.rackspacecloud.com:443"}, :idempotent=>false, :instrumentor_name=>"excon", :middlewares=>[Excon::Middleware::Expects, Excon::Middleware::Idempotent, Excon::Middleware::Instrumentor, Excon::Middleware::Mock], :mock=>false, :nonblock=>true, :omit_default_port=>false, :read_timeout=>60, :retry_limit=>4, :ssl_ca_file=>"/Users/kyle.rames/.rvm/gems/ruby-1.9.3-p392@fog_dev/gems/excon-0.24.0/data/cacert.pem", :ssl_verify_peer=>true, :tcp_nodelay=>false, :uri_parser=>URI, :write_timeout=>60, :host=>"dfw.servers.api.rackspacecloud.com", :path=>"/v2/772045/os-networksv2/ef03eac3-e07e-4001-b151-d0af2231e6de.json", :port=>"443", :query=>nil, :scheme=>"https", :user=>nil, :password=>"REDACTED", :instrumentor=>Excon::StandardInstrumentor, :family=>0, :method=>"DELETE", :format=>"json", :expects=>202, :retries_remaining=>4, :connection=>#<Excon::Connection:7ffa21ba35b0 @data={:chunk_size=>1048576, :connect_timeout=>60, :debug_request=>false, :debug_response=>true, :headers=>{"User-Agent"=>"fog/1.12.1"}, :idempotent=>false, :instrumentor_name=>"excon", :middlewares=>[Excon::Middleware::Expects, Excon::Middleware::Idempotent, Excon::Middleware::Instrumentor, Excon::Middleware::Mock], :mock=>false, :nonblock=>true, :omit_default_port=>false, :read_timeout=>60, :retry_limit=>4, :ssl_ca_file=>"/Users/kyle.rames/.rvm/gems/ruby-1.9.3-p392@fog_dev/gems/excon-0.24.0/data/cacert.pem", :ssl_verify_peer=>true, :tcp_nodelay=>false, :uri_parser=>URI, :write_timeout=>60, :host=>"dfw.servers.api.rackspacecloud.com", :path=>"/v2/772045", :port=>"443", :query=>nil, :scheme=>"https", :user=>nil, :password=>nil, :instrumentor=>Excon::StandardInstrumentor, :family=>0} @socket_key="https://dfw.servers.api.rackspacecloud.com:443">, :stack=>#<Excon::Middleware::Expects:0x007ffa22c34cd0 @stack=#<Excon::Middleware::Idempotent:0x007ffa22c34cf8 @stack=#<Excon::Middleware::Instrumentor:0x007ffa22c34d20 @stack=#<Excon::Middleware::Mock:0x007ffa22c34d48 @stack=#<Excon::Connection:7ffa21ba35b0 @data={:chunk_size=>1048576, :connect_timeout=>60, :debug_request=>false, :debug_response=>true, :headers=>{"User-Agent"=>"fog/1.12.1"}, :idempotent=>false, :instrumentor_name=>"excon", :middlewares=>[Excon::Middleware::Expects, Excon::Middleware::Idempotent, Excon::Middleware::Instrumentor, Excon::Middleware::Mock], :mock=>false, :nonblock=>true, :omit_default_port=>false, :read_timeout=>60, :retry_limit=>4, :ssl_ca_file=>"/Users/kyle.rames/.rvm/gems/ruby-1.9.3-p392@fog_dev/gems/excon-0.24.0/data/cacert.pem", :ssl_verify_peer=>true, :tcp_nodelay=>false, :uri_parser=>URI, :write_timeout=>60, :host=>"dfw.servers.api.rackspacecloud.com", :path=>"/v2/772045", :port=>"443", :query=>nil, :scheme=>"https", :user=>nil, :password=>nil, :instrumentor=>Excon::StandardInstrumentor, :family=>0} @socket_key="https://dfw.servers.api.rackspacecloud.com:443">>>>>}
excon.error {:error=>#<Excon::Errors::Forbidden: Expected(202) <=> Actual(403 Forbidden)
response => #<Excon::Response:0x007ffa25297c60 @data={:body=>"403 Forbidden\n\nAccess was denied to this resource.\n\n Network has active ports ", :headers=>{"Date"=>"Tue, 25 Jun 2013 13:32:40 GMT", "Content-Length"=>"79", "Content-Type"=>"text/plain;charset=UTF-8", "Server"=>"Jetty(8.0.y.z-SNAPSHOT)"}, :status=>403, :remote_ip=>"72.32.168.196"}, @body="403 Forbidden\n\nAccess was denied to this resource.\n\n Network has active ports ", @headers={"Date"=>"Tue, 25 Jun 2013 13:32:40 GMT", "Content-Length"=>"79", "Content-Type"=>"text/plain;charset=UTF-8", "Server"=>"Jetty(8.0.y.z-SNAPSHOT)"}, @status=403, @remote_ip="72.32.168.196">>}
[WARNING] Received exception 'lexical error: invalid char in json text.
403 Forbidden Access was denied to
(right here) ------^
' while decoding>> 403 Forbidden
Access was denied to this resource.
Network has active ports
Fog::Compute::RackspaceV2::ServiceError: [HTTP 403] 403 Forbidden
Access was denied to this resource.
Network has active ports
from /Users/kyle.rames/.rvm/gems/ruby-1.9.3-p392@fog_dev/gems/excon-0.24.0/lib/excon/middlewares/expects.rb:10:in `response_call'
from /Users/kyle.rames/.rvm/gems/ruby-1.9.3-p392@fog_dev/gems/excon-0.24.0/lib/excon/connection.rb:353:in `response'
from /Users/kyle.rames/.rvm/gems/ruby-1.9.3-p392@fog_dev/gems/excon-0.24.0/lib/excon/connection.rb:247:in `request'
from /Users/kyle.rames/Projects/fog/lib/fog/core/connection.rb:25:in `request'
from /Users/kyle.rames/Projects/fog/lib/fog/rackspace/service.rb:36:in `request'
from /Users/kyle.rames/Projects/fog/lib/fog/rackspace/compute_v2.rb:143:in `request'
from /Users/kyle.rames/Projects/fog/lib/fog/rackspace/requests/compute_v2/delete_network.rb:6:in `delete_network'
from (irb):3
from /Users/kyle.rames/.rvm/gems/ruby-1.9.3-p392@global/gems/bundler-1.3.5/lib/bundler/cli.rb:619:in `console'
from /Users/kyle.rames/.rvm/gems/ruby-1.9.3-p392@global/gems/bundler-1.3.5/lib/bundler/vendor/thor/task.rb:27:in `run'
from /Users/kyle.rames/.rvm/gems/ruby-1.9.3-p392@global/gems/bundler-1.3.5/lib/bundler/vendor/thor/invocation.rb:120:in `invoke_task'
from /Users/kyle.rames/.rvm/gems/ruby-1.9.3-p392@global/gems/bundler-1.3.5/lib/bundler/vendor/thor.rb:344:in `dispatch'
from /Users/kyle.rames/.rvm/gems/ruby-1.9.3-p392@global/gems/bundler-1.3.5/lib/bundler/vendor/thor/base.rb:434:in `start'
from /Users/kyle.rames/.rvm/gems/ruby-1.9.3-p392@global/gems/bundler-1.3.5/bin/bundle:20:in `block in <top (required)>'
from /Users/kyle.rames/.rvm/gems/ruby-1.9.3-p392@global/gems/bundler-1.3.5/lib/bundler/friendly_errors.rb:3:in `with_friendly_errors'
from /Users/kyle.rames/.rvm/gems/ruby-1.9.3-p392@global/gems/bundler-1.3.5/bin/bundle:20:in `<top (required)>'
from /Users/kyle.rames/.rvm/gems/ruby-1.9.3-p392@global/bin/bundle:19:in `load'
from /Users/kyle.rames/.rvm/gems/ruby-1.9.3-p392@global/bin/bundle:19:in `<main>'
from /Users/kyle.rames/.rvm/gems/ruby-1.9.3-p392@fog_dev/bin/ruby_noexec_wrapper:14:in `eval'
from /Users/kyle.rames/.rvm/gems/ruby-1.9.3-p392@fog_dev/bin/ruby_noexec_wrapper:14:in `<main>'1.9.3p392 :004 >
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment