Fixes #4538: Use cache for promise templates

This is the conterpart of https://github.com/Normation/cf-clerk/pull/33 that reads all templates first, and then pass them to individual node promise generation method.

Most of the changes are due to indent modification, the actual changes are better view with ?w=1