automated removal from hub on robot removal

Discussion created by andrew.tranquada on Mar 22, 2010
Latest reply on Apr 6, 2010 by jesse.gonzalez
I am wondering the best way to do the following:
uninstalling a robot removes it from the hub automatically.

What I am doing:
I have an rpm that basically runs a perl script that installs the robot and all probes needed via request.cfg. That part works great. On an uninstall, in the rpm under %postun, I have it calling my script with an argument to call the removerobot callback on the hub it is installed on, after the call the script stops Nimbus on the robot then removes the directory it is installed in. So the order is:
1) %postun calls my script with the remove_robot call.
2) The script figures out what hub the robot is on, then calls
/opt/Nimbus/bin/pu blah blah blah /hub removerobot $hostname
3)The rpm then runs a service nimbus stop.
rpm removes directory.

After the call to 1, I refresh and see the robot is gone from the hub list.
I refresh a few seconds later, and even though the robot is in the middle of shutting down, I see it return to the list of robots in a "yellow" state. The robot then completely shuts down and is now red in the list of robots.

Am I doing something wrong? Does anyone have a better way? I cannot call the callback with pu after I shut the robot down, is there another way?

I hope this made sense, thanks!