Simple Ruby script to listCompletedActions is failing with Net::ReadTimeout

Latest response

We have hundreds of thousands (probably millions, actually) of completed items in our Satellite 5 database that I want to archive then delete. I'm just taking steps for the moment. My first is to just list out the items. Considering how many we have I doubt this will be a short task. I expect it would take a while to complete. That said, my script appears to be timing out:

/usr/share/ruby/net/protocol.rb:158:in rescue in rbuf_fill': Net::ReadTimeout (Net::ReadTimeout)
from /usr/share/ruby/net/protocol.rb:152:in
rbuf_fill'
from /usr/share/ruby/net/protocol.rb:134:in readuntil'
from /usr/share/ruby/net/protocol.rb:144:in
readline'
from /usr/share/ruby/net/http/response.rb:39:in read_status_line'
from /usr/share/ruby/net/http/response.rb:28:in
read_new'
from /usr/share/ruby/net/http.rb:1412:in block in transport_request'
from /usr/share/ruby/net/http.rb:1409:in
catch'
from /usr/share/ruby/net/http.rb:1409:in transport_request'
from /usr/share/ruby/net/http.rb:1382:in
request'
from /usr/share/ruby/net/http.rb:1327:in request_post'
from /usr/share/ruby/xmlrpc/client.rb:475:in
do_rpc'
from /usr/share/ruby/xmlrpc/client.rb:279:in call2'
from /usr/share/ruby/xmlrpc/client.rb:260:in
call'
from ./sat_archive.rb:16:in `'

This is all I have in the script:
!/usr/bin/env ruby
require "xmlrpc/client"

@SATELLITE_URL = "https://sat.example.com/rpc/api"
@SATELLITE_USER = "username"
@SATELLITE_PASS = "U53rP@55"

@client = XMLRPC::Client.new2(@SATELLITE_URL)

@client.instance_variable_get("@http").verify_mode = OpenSSL::SSL::VERIFY_NONE

@key = @client.call('auth.login', @SATELLITE_USER, @SATELLITE_PASS)

list = @client.call('schedule.listCompletedActions', @key)
for action in list do
p action["type"]
end

@client.call('auth.logout', @key)

How do I increase the timeout so that I can (hopefully) pull all of the items? Also, the Web UI automatically limits the returned list to 10000 items. The API documentation does not provide that option as far as I can tell. Is it built in and automatically done?

Thanks,
-Mathew

Responses