Adding support for environments when running under chef-solo.

This commit refactors and rebases Kyle Goodwin's original work for
CHEF-3356, as per Bryan McLellan's 12/17 comments.
Raising an exception for chef-solo environment constraints.
fix merge conflict