Adding domain check to build template


I am needing to make a change to the build template in foreman,

What i need it to do is to check the local name is set as fully qualified domain name as part of the initial build process and to cause exit 1 when the name is not correctly set on the host causing the system to indicate there is a build error.

It would be good if this can also in the build log data could state the reason for being incomplete fully qualified domain name rather than a generic error.

Basically the problem that we are trying to address is that when the endpoint host if not configured with the fully qualified domain name will create an entry in foreman. this then gets set to the fully qualified domain name and then when puppet checks in it seems to create another entry called name.local.

How would i go about doing that?

also is the build template ruby or bash script?