mitchellh/packer — pull request #737 by sneal (2013-12-20 17:53:15+00:00)
Title: Start_wait for provisioners

The problem I'm trying to solve is avoiding starting a provisioner in the middle of a reboot. Currently, at least on Windows guests, if a provisioner runs while the machine is shutting down that provisioner hangs indefinitely. Packer never receives a signal that the provisioner finished, so the [sleep trick mentioned in the docs](http://www.packer.io/docs/provisioners/shell.html) doesn't work.

The usage of this looks like:

```
{
"type": "chef-solo",
"start_wait": "90s",
"cookbook_paths": ["../../cookbooks"],
"execute_command": "powershell.exe -InputFormat none -File c:/windows/temp/chef/cheftask.ps1",
"staging_directory": "c:/windows/temp/chef",
"prevent_sudo": true,
"skip_install": true,
"run_list": ["windows"],
}
```

This would keep the chef-solo provisioner waiting 90 seconds before it attempts to run. This has allowed me to move forward and make progress with Packer standing up fully provisioned machines. I understand this might not be an ideal solution and this PR is not fully baked, but I wanted to get some feedback before continuing down this path.

In vagrant-windows before starting a provisioner we run a command to check the state of the guest. If the guest has a pending reboot or is currently shutting down we don't start the provisioner. The problem with this is that its very OS specific.

Another option might to add a "sleep provisioner" that could be placed between real provisioners. This would at least keep the waiting logic out of all the other provisioners and reduce duplication.

Thoughts?