[Spacewalk-list] Getting errors when connecting to the API

Mathew Snyder mathew.snyder at gmail.com
Mon Apr 22 17:15:51 UTC 2013


I'm trying to connect to the API for our Satellite server. According to
everything I've read it should be at https://satellite.example.com/rpc/api.
I've tried this using both Ruby and Perl and have received one of two
errors repeatedly. The first is 404 Not Found and the other is Connection
refused.

I'm not entirely sure how I'm supposed to connect with the xmlrpc/client
gem in Ruby. This is my code:

#!/usr/bin/ruby

require "xmlrpc/client"

host = "https://10.153.156.10"
hostpath = "https://10.153.156.10/rpc/api"
path = "rpc/api"
username = "ecapsupport"
pass = "r310ADed"

params = {
  "host" => "https://REDACTED",
  "path" => "rpc/api",
  "port" => "443",
  "proxy_host" => "",
  "proxy_port" => "",
  "user" => "REDACTED",
  "password" => "REDACTED",
  "use_ssl" => "true",
  "timeout" => "300",
}

client = XMLRPC::Client.new3(params)
client.instance_variable_get(:@http).instance_variable_set(:@verify_mode,
OpenSSL::SSL::VERIFY_NONE)

session = client.call('auth.login', username, pass)

sys_ver = session.call('api.systemVersion')
users = session.call("user.listUsers", session)

puts sys_ver
users.each { |user| puts user }

This results in
/usr/lib/ruby/1.9.1/net/http.rb:762:in `initialize': Connection refused -
connect(2) (Errno::ECONNREFUSED)
from /usr/lib/ruby/1.9.1/net/http.rb:762:in `open'
 from /usr/lib/ruby/1.9.1/net/http.rb:762:in `block in connect'
from /usr/lib/ruby/1.9.1/timeout.rb:68:in `timeout'
 from /usr/lib/ruby/1.9.1/timeout.rb:99:in `timeout'
from /usr/lib/ruby/1.9.1/net/http.rb:762:in `connect'
 from /usr/lib/ruby/1.9.1/net/http.rb:755:in `do_start'
from /usr/lib/ruby/1.9.1/net/http.rb:750:in `start'
 from /usr/lib/ruby/1.9.1/xmlrpc/client.rb:535:in `do_rpc'
from /usr/lib/ruby/1.9.1/xmlrpc/client.rb:420:in `call2'
 from /usr/lib/ruby/1.9.1/xmlrpc/client.rb:410:in `call'
from sat_test.rb:29:in `<main>'

I've ensured that the server is accessible both from the workstation I'm on
as well as from servers on the same subnet (got the same error from those).

I copied the example Perl script in the API documentation tweaking. That
one gave me the 404.

I've found that if I point my browser to https://REDACTED/rpc/api it also
shows up as 404 Error - File Not Found

Is there something I'm missing? Was I supposed to install something
additional?

-Mathew

"When you do things right, people won't be sure you've done anything at
all." - God; Futurama

"We'll get along much better once you accept that you're wrong and neither
am I." - Me
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/spacewalk-list/attachments/20130422/91cccb0a/attachment.htm>


More information about the Spacewalk-list mailing list