Changes between Version 4 and Version 5 of Doc/panc/stdtpl/functions


Ignore:
Timestamp:
Nov 30, 2007, 12:05:02 PM (16 years ago)
Author:
/O=GRID-FR/C=FR/O=CNRS/OU=LAL/CN=Charles Loomis
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Doc/panc/stdtpl/functions

    v4 v5  
    11= pan/functions Template =
    22[[TracNav]]
     3
     4[[TOC(inline)]]
    35
    46Several pan programming patterns or idioms occur frequently in machine configurations.  The functions defined in the "pan/functions" template provide shortcuts to using those idioms.  To access the functions, the template must be included in the machine configuration:
     
    5456
    5557== 'object' Utility Functions ==
     58
     59In 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
     63This 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
     67This 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
     71This 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