Forum: Cfengine Help
Subject: Re: is it possible to combine arrays and lists?
Author: Seva Gluschenko
Link to topic: https://cfengine.com/forum/read.php?3,16807,16850#msg-16850

I've become sick of continuous poisoning of my logs with those warnings

!! insert_lines promise uses the same select_line_matching anchor as another 
promise. This will lead to non-convergent behaviour.

so I've tried to rewrite the promise another way:


insert_lines:

"! Configuration File for keepalived, generated by Cfengine
global_defs {
   router_id $(my)
}

vrrp_instance $(my) {
    state MASTER
    interface $(c.external_eth)
    virtual_router_id $(id[$(my)])
    priority 100
    advert_int 1
    authentication {
        auth_type PASS
        auth_pass $(pass)
    }
    virtual_ipaddress {"
        comment => "iteration follows";

        "        $(net).$(ip1) label $(c.external_eth):$(ip1)"
                comment => "continuing";

"    }
    notify_backup \"$(scrpt) BACKUP $(my)\"
    notify_master \"$(scrpt) MASTER $(my)\"
    notify_fault  \"$(scrpt) FAULT $(my)\"
}

vrrp_instance $(his) {
    state BACKUP
    interface $(c.external_eth)
    virtual_router_id $(id[$(his)])
    priority 97
    advert_int 1
    authentication {
        auth_type PASS
        auth_pass $(pass)
    }
    virtual_ipaddress {"
        comment => "iteration follows";

        "        $(net).$(ip2) label $(c.external_eth):$(ip2)"
                comment => "final block follows";

"    }
    notify_backup \"$(scrpt) BACKUP $(his)\"
    notify_master \"$(scrpt) MASTER $(his)\"
    notify_fault  \"$(scrpt) FAULT $(his)\"
}
"
        comment => "Standard keepalived configuration";
}


Here follows what I've got as a result:

! Configuration File for keepalived, generated by Cfengine
global_defs {
   router_id RF1
}

vrrp_instance ID1 {
    state MASTER
    interface eth1
    virtual_router_id 20
    priority 100
    advert_int 1
    authentication {
        auth_type PASS
        auth_pass some_pass
    }
    virtual_ipaddress {
        172.16.90.38 label eth1:38
        172.16.90.138 label eth1:138
        172.16.90.178 label eth1:178
    notify_backup "/usr/local/bin/vrrp.sh BACKUP ID1"
    notify_master "/usr/local/bin/vrrp.sh MASTER ID1"
    notify_fault  "/usr/local/bin/vrrp.sh FAULT ID1"
vrrp_instance ID2 {
    state BACKUP
    virtual_router_id 21
    priority 97
        172.16.90.39 label eth1:39
        172.16.90.139 label eth1:139
        172.16.90.179 label eth1:179
    notify_backup "/usr/local/bin/vrrp.sh BACKUP ID2"
    notify_master "/usr/local/bin/vrrp.sh MASTER ID2"
    notify_fault  "/usr/local/bin/vrrp.sh FAULT ID2"


At this point I'm stuck. Is it a bug, or did I miss something? Why did cf-agent 
cut several lines from multi-line inserts?

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

Reply via email to