Make sure the context is set right while generating a template.

Fix the regression that is reported [here](http://learn.getchef.com/rhel/make-your-recipe-more-manageable/#comment-1569999861).

/cc: @danielsdeleo