| 58 | |
| 59 | In standard usage, the name of the object template corresponds to the machine name (either with or without the domain). The host and domain names are very frequently needed in the configuration. These values can be hardcoded within variables, but then one risks to have an inconsistency between the name of the object template and those hardcoded values. A better method is to extract the host and domain names from the 'object' variable. The functions here do that for you. |
| 60 | |
| 61 | === hostname_from_object() === |
| 62 | |
| 63 | This function will return the short host name (i.e. without the domain). If the profile has a prefix "profile_", that prefix will be stripped from the returned hostname. The function verifies that the returned name is a valid hostname. |
| 64 | |
| 65 | === domainname_from_object(string) === |
| 66 | |
| 67 | This function will return the domain name from the 'object' variable. If there is no domain in the 'object' variable, then the string argument will be used as the default domain name. The function checks that the value is a valid domain name. |
| 68 | |
| 69 | === full_hostname_from_object(string) === |
| 70 | |
| 71 | This function returns the full hostname of the machine as determined from the 'object' variable. If value in the 'object' variable does not contain a domain, the string argument is used as the default domain. The function checks that the returned value is a valid host name. |
| 72 | |