opscode/chef — pull request #2368 by sersut (2014-11-06 20:00:45+00:00)
Title: Knife cloud plugins bootstrap problem with Chef 12 when using custom templates.

In Chef 12, we've deprecated `distro` and `template-file` options in `knife bootstrap` and added `bootstrap-template` option which covers both options in order to simplify the options. We've also slightly changed the way we pick up the defaults. Check out the current code in 12.0.0.rc.0 [here](https://github.com/opscode/chef/blob/12.0.0.rc.0/lib/chef/knife/bootstrap.rb#L203).

This works well for bootstrap. However if you're using any of the knife cloud plugins this is currently broken. The reason is that pretty much all the knife cloud plugins set a default for `config[:distro]` (see [here](https://github.com/opscode/knife-ec2/blob/master/lib/chef/knife/ec2_server_create.rb#L163) for an example). Due to this if you specify `--template-file` option in the command line (pretty common scenario if you're using your custom bootstrap template as @schisamo does in opscode-ci), we never pick it up because `config[:distro]` is always set to something. This code is copy pasted in all cloud plugins so pretty much every one of them has this problem.

This PR fixes a few things:

1. It makes sure that the merge configs is done correctly and any option favoring the specific file names are preferred over the `distro` option.
2. It introduces the `default_bootstrap_template` method by which cloud plugins can override the default template if they choose to. This is required for `knife-windows`.

/cc: @opscode/client-engineers