hw-cookbooks/postgresql — pull request #202 by kisoku (2014-10-25 21:21:03+00:00)
Title: give postgres a fighting chance to recover from incorrect configuration

suppose you typo a setting in node['postgresql']['config'] or node['postgresql']['pg_hba']

the cookbook will converge the postgresql service before rendering the broken templates, then tries to restart postgres, which fails. After fixing the issue with your config attributes you wind up in a chicken and egg situation, where the cookbook attempts to start the (now) stopped postgresql service but cannot because the broken config files have not been replaced yet, as all the configuration templates live further down the resource collection than service['postgresql'].

This patch simply moves the definition of the templates to just before the definition of the service.