Forum Discussion

Mariusz_B's avatar
Mariusz_B
Icon for Nimbostratus rankNimbostratus
Feb 17, 2015

iRule - wrong variable definition ?

Hi all,

I have the following iRule, which in terms of syntax is fine:

when DNS_REQUEST {
    switch [IP::remote_addr] {   
        "10.10.1.32/27" -
        "10.10.1.64/27" -
        "10.10.1.160/27" -
        "10.10.1.192/27" {
            set status [LB::status vs Client_Monitor_VIP]
        }
    }
    if {$status equals "up"} {
        host 1.1.1.1
    } else {
        host 2.2.2.2
    }   
}

....but it generated the following error message:

TCL error: Rule /Common/iRule_ab.example.ncom  - can't read "status": no such variable     while executing "if {$status equals "up"} {         host 1.1.1.1     } else {         host 2.2.2.2    }"

Any idea what's wrong with the variable definition? I have tested this without the "status" variable, and TCL was able to "read" the Client_Monitor_VIP status, so it seems to be setup correctly.

Regards

Mariusz

17 Replies