jenkinsci/vsphere-cloud-plugin — pull request #13 by hrabbouh (2014-06-11 14:31:47+00:00)
Title: New fix for afterDisconnect running twice, and builds attempting to start on a disconnecting slave.

Hi,

First of all, I'd like to apologize for the bug my previous PR caused.

This PR has been running successfully in our production setup for a week now, and addresses two issues:
- Post-disconnect actions running twice. This time I simply extracted the logic out into a public method. I realize this lowers cohesion, but having the actions run twice is a bit of drag, and relying on disconnect() is not ideal for the reason below.

- Builds attempting to start on a disconnecting slave, and then failing. Calling disconnect() is not enough when the slave uses a service/daemon, which periodically connects to the master. The slave is now marked as offline (and the thread is locked until then) before completing the post-disconnect options, and then back online.

Thanks,
Hossam