I've had repeated issues with the deployment of hundreds of packages using the Distribution Server. The target distsrv, and the master distsrv forwarding requests would get stuck, and would no longer process requests. So I wrote this. Sleeping for 5 seconds keeps the distsrv from getting overwhelmed.
I have an environment where I can define a regex for device type which is captured in the robot name. Modify for your needs.
master = "/Your/Master/Hub"
hubs = nimbus.request(master, "gethubs")
robotname_regex = ".*hubregex.*/robotnameregex.*"
requestpds = pds.create()
pds.putString(requestpds, "package", "some_package_to_distribute")
for hubindex,hub in pairs(hubs.hublist) do
robots = nimbus.request(hub.addr, "getrobots")
for robotindex,robot in pairs(robots.robotlist) do
if string.match(robot.addr, robotname_regex) ~= nil then
ret, rc = nimbus.request(robot.addr, "inst_request", requestpds)
if (rc == nil or rc ~= 0) then
print ("There was an error with inst_request")
end
sleep(5000)
end
end
end
pds.delete (requestpds)