Fix hostname template validation for all services.

Change-Id: I3e506d0fc55d55e6bfd16ebdc6104f8bd0401a63
Closes-bug: #1240107
Merge "Fix hostname template validation for all services."