On Mon, Apr 22, 2013 at 06:15:51PM +0100, Mathew Snyder wrote:
> 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)

Reading

        
http://www.ruby-doc.org/stdlib-2.0/libdoc/xmlrpc/rdoc/XMLRPC/Client.html#method-c-new3

makes me believe that the host is the FQDN of the host, not the
"protocol://FQDN". Thus,

        ruby -e 'require "xmlrpc/client"; client = XMLRPC::Client.new3({ "host" 
=> "machine.example.com", "path" => "/rpc/api" }); sys_ver = 
client.call("api.systemVersion"); puts sys_ver;'
5.5.0

works just fine for me. Reading the same page reveals that

        XMLRPC::Client.new_from_uri("http://machine.example.com/rpc/api";);

works as well, should you prefer to work with URIs. And with the
VERIFY_NONE mode, it even works with https.

-- 
Jan Pazdziora
Principal Software Engineer, Satellite Engineering, Red Hat

_______________________________________________
Spacewalk-list mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/spacewalk-list

Reply via email to