opscode/knife-rackspace — pull request #42 by chrissnell (2013-05-03 02:07:18+00:00)
Title: Wait for RackConnect and/or Service Level automation before bootstrapping

I took kief's PR ( https://github.com/opscode/knife-rackspace/pull/35 ) and made some changes to make it work more reliably with a variety of different Rackspace Cloud environments.

Here's what I fixed:

kief's code only checks Chef::Config[:knife] to see if :rackconnect_wait is set. The CLI option was essentially being ignored. Fixed.

Next, I noticed that kief's code required that both the RackConnect automation and the Service Level automation had to be complete before moving on. For users of RackConnect who use the un-managed service level, this resulted in a hang waiting for rax_service_level_automation == 'Complete', which would never happen. I fixed this by splitting the service level automation wait into it's own CLI option, --rackspace-servicelevel-wait. I don't have a Managed service level account so I can't test this, unfortunately. Can someone with Managed Cloud with and without RackConnect test this?

Finally, I noticed that the code hangs waiting for sshd to open. This is because Fog's server.addresses data structure only contains the pre-RackConnect public IP. Once the RC automation runs, the server can only be accessed via the new "access IP". My fix is to pull this access IP using Fog's server.access_ipv4_address method and use this value if it exists.
Some discussion of this issue can be found here: fog/fog#1507 ... I believe that a more long-term fix in Fog itself is being discussed.

Big ups to Kief for creating the initial PR.