tk_messageBox -title "Editor only" \
-message "Running in editor only mode. Cannot execute commands. Please report this problem." \
-type ok
- exit 5
+ ;#exit 5
+ return ""
}
if { $remote_exec } {
- if { ! $exec_sockets_opened } { open_exec_sockets }
+ if { ! $exec_sockets_opened } {
+ open_exec_sockets
+ if { ! [info exists exec_sock] } {
+ tk_messageBox -title "Editor only" \
+ -message "Cannot open sockets.\nMode changed to \"editor only\"." \
+ -type ok
+ set editor_only true
+ return ""
+ }
+ }
set exec_results ""
puts $exec_sock "$args"
vwait exec_results_ready
proc open_exec_sockets {} {
global exec_hosts remote_exec exec_sockets_opened
global exec_host exec_port monitor_port exec_sock monitor_sock
+ global editor_only
if { ! $remote_exec } { return }
}
if { ! $remote_exec } { return }
- set exec_sock [socket -async $exec_host $exec_port]
- set monitor_sock [socket -async $exec_host $monitor_port]
set fail true
while {$fail} {
- for { set i 1 } { $i <= 4 } { incr i } {
- if {[lindex [fconfigure $exec_sock -sockname] 0] != "0.0.0.0" &&
- [lindex [fconfigure $monitor_sock -sockname] 0] != "0.0.0.0" } {
- set fail false
- break
- } else {
- after 250 ;# Max 2 sec for socket creation
- }
+ if { ! [info exists exec_sock] || ! [info exists monitor_sock] } {
+ catch {set exec_sock [socket -async $exec_host $exec_port]}
+ catch {set monitor_sock [socket -async $exec_host $monitor_port]}
+ }
+
+ if { [info exists exec_sock] && [info exists monitor_sock] } {
+ for { set i 1 } { $i <= 4 } { incr i } {
+ if {[lindex [fconfigure $exec_sock -sockname] 0] != "0.0.0.0" &&
+ [lindex [fconfigure $monitor_sock -sockname] 0] != "0.0.0.0" } {
+ set fail false
+ break
+ } else {
+ after 250 ;# Max 2 sec for socket creation
+ }
+ }
}
if { $fail } {
"Cannot open sockets {$exec_host,$exec_port|$monitor_port}" \
"" 0 "Retry" "Configure remote hosts" "Editor only mode" ]
switch $sel {
+ 0 { ;# retry
+ }
1 { configRemoteHosts
set at_least_one_up false
set n [llength $exec_hosts]
set editor_only true
.menubat.experiment entryconfigure \
"Execute" -state disabled
- } else {
- set exec_sock
- [socket -async $exec_host $exec_port]
- set monitor_sock
- [socket -async $exec_host $monitor_port]
}
}
global nmbufs nmbclusters
global editor_only
+ if { $mode == "exec" } { ;# let's try something, sockets should be opened
+ nexec id -u
+ if { $editor_only } { ;# if set in nexec or open_exec_sockets
+ .menubar.experiment entryconfigure "Execute" -state disabled
+ return
+ }
+ }
+
# Verify that links to external interfaces are properly configured
if { $mode == "exec" } {
set extifcs [nexec ifconfig -l]