I build an array like this:

            "siteconf[cos][dns_config][nameserver][0]"
                comment => "Primary DNS server" ,
                string => "10.9.72.50";
            "siteconf[cos][dns_config][nameserver][1]"
                comment => "Secondary DNS server" ,
                string => "10.18.30.50";
            "siteconf[cos][dns_config][nameserver][2]"
                comment => "Tertiary DNS server" ,
                string => "10.32.28.30";

and this this bundle to build my resolv.conf:

bundle edit_line resolvconf
{
    vars:
        "dns_idx" slist => 
getindices("mysite.siteconf[$(mysite.site)][dns_config][nameserver]");

    insert_lines:
        "nameserver 
$(mysite.siteconf[$(mysite.site)][dns_config][nameserver][$(dns_idx)])"
            comment => "Add the list of DNS servers for the site.";
}

I expect the name servers to appear in resolv.conf in the same order I specify 
in the array, but this doesn't happen everywhere.

# cat /etc/resolv.conf
nameserver 10.18.30.50
nameserver 10.9.72.50
nameserver 10.32.28.30

In this instance, the indices were inserted in the order 1 , 0 , 2.  A similar 
reports promise iterates over the same slist in the same order.  I don't know, 
or necessarily care, whether it's the order of the slist that is mixed up or if 
the function of iterating over the slist that goes out of order, but is there 
any way to ensure that the order is always 0 , 1 , 2?  Other than removing the 
iteration altogether.

-- 
/* Wes Hardin */
UNIX/Linux Systems Administrator, IT Engineering Support
Maxim Integrated Products: Innovation Delivered
_______________________________________________
Help-cfengine mailing list
[email protected]
https://cfengine.org/mailman/listinfo/help-cfengine

Reply via email to