This seems like an awful lot of work to get the long/short hostname.  What 
about:

classes:
    "xxx" expression => regextract("([\w-]+)\..*", "$(sys.fqhost)", 
"short_host");

After this, you have the short hostname in $(short_host[1]), and the long one 
has always been available as $(sys.fqhost)

-Dan

On Dec 1, 2010, at 4:17 PM, no-re...@cfengine.com wrote:

> Forum: Cfengine Help
> Subject: Re: Class case sensitivity
> Author: babudro
> Link to topic: https://cfengine.com/forum/read.php?3,19548,19559#msg-19559
> 
> Hi Neil.
> 
> I'm the one who posted that question regarding the hostnames about a month or 
> so ago.  My "feature request" is on the Bug Tracker (issue #358).
> 
> The short-term solution I came up with was to define global variables for the 
> classes I wanted to be case-insensitive, like this:
> 
> 
> 
>    linux::
>      "short_hostname" string => execresult("/bin/hostname -s | /usr/bin/tr 
> '[:upper:]' '[:lower:]'"
>    linux.domain_missing::
>      "long_hostname"  string => "$(short_hostname).$(default_domain)";
>    linux.!domain_missing::
>      "long_hostname"  string => execresult("/bin/hostname -f | /usr/bin/tr 
> '[:upper:]' '[:lower:]'"
> 
>  classes:
>    "domain_missing" expression => strcmp("$(sys.domain)", "undefined_domain");
> 
> 
> -- Angelo
> 
> _______________________________________________
> Help-cfengine mailing list
> Help-cfengine@cfengine.org
> https://cfengine.org/mailman/listinfo/help-cfengine

_______________________________________________
Help-cfengine mailing list
Help-cfengine@cfengine.org
https://cfengine.org/mailman/listinfo/help-cfengine

Reply via email to