acs::Cluster method execute (protected)

 <instance of acs::Cluster[i]> execute messageDict

Defined in packages/acs-tcl/tcl/cluster-procs.tcl

:log execute $messageDict

Parameters:
messageDict (required)

Testcases:
No testcase defined.
Source code:
dict with messageDict {
    if {$peer ni [nsv_get cluster cluster_peer_nodes]} {
        ns_log notice ":execute: {$peer ni [nsv_get cluster cluster_peer_nodes]} // cmd $cmd"
        set ok [dict exists ${:allowed_host} $peeraddr]
        if {!$ok} {
            set authorizedIP [parameter::get  -package_id $::acs::kernel_id  -parameter ClusterAuthorizedIP]
            set ok [expr {$peer in $authorizedIP}]
            if {!$ok} {
                foreach ip $authorizedIP {
                    #
                    # Check every single element, if it is
                    # in CIDR notation or it contains a
                    # wild card.
                    #
                    if {([string first / $ip] != -1 && [ns_ip match $ip $peer])
                        || ([string first * $ip] != -1 && [string match $ip $peer])
                    } {
                        set ok 1
                        break
                    }
                }
            }
        }
    } else {
        set ok 1
    }
    if {!$ok} {
        ns_log notice "could refuse to execute commands from $peeraddr (command: '$cmd') allowed [dict keys ${:allowed_host}]"
    }
    if {[:allowed_command $cmd]} {
        ns_log notice "--cluster executes command '$cmd' from peeraddr $peeraddr port [ns_conn peerport]"
        return [{*}$cmd]
    }
    error "command '$cmd' from peeraddr $peeraddr not allowed"
}
XQL Not present:
Generic, PostgreSQL, Oracle
[ hide source ] | [ make this the default ]
Show another procedure: