I'm trying to write a script that will get a system ID from Red Hat Satellite/Spacewalk, which uses XMLRPC. I'm trying to get the ID which is the first value when using the XMLRPC client using the system name.
I'm referencing the documentation from Red Hat for the method used below:
#!/usr/bin/env ruby
require "xmlrpc/client"
@SATELLITE_URL = "satellite.rdu.salab.redhat.com"
@SATELLITE_API = "/rpc/api"
@SATELLITE_LOGIN = "********"
@SATELLITE_PASSWORD = "*******"
@client = XMLRPC::Client.new(@SATELLITE_URL, @SATELLITE_API)
@key = @client.call("auth.login", @SATELLITE_LOGIN, @SATELLITE_PASSWORD)
@getsystemid = @client.call("system.getId", @key, 'cfme038')
print "#{@getsystemid}"
@systemid = @getsystemid ['id']
The output of getsystemid looks like this:
[{"id"=>1000010466, "name"=>"cfme038", "last_checkin"=>#<XMLRPC::DateTime:0x007f9581042428 @year=2013, @month=12, @day=26, @hour=14, @min=31, @sec=28>}]
But when I try to just get just id
I get this error:
no implicit conversion of String into Integer (TypeError)
Any help is appreciated