Barclamp.import_template: Fixed template_id assignment

The template_id was never updated in the database, as it was only assigned to
the local template_id variable instead for the template_id instance attribute
Add installation-time preparation for barclamp engines
make role unit tests pass until fixed later
Merge pull request #371 from rhafer/pull-req-master-a1ef985d4302e6bafb0affec8df3244c1693c984

Merged by devtool for cloudedge
resolve merge conflict - template.save moved
Merge pull request #373 from waynepallen/pull-req-master-471039747e929e29c1793da0494c666f5f36c8c0

Merged by devtool for cloudedge
resolve merge conflicts