Изменен вызов функции RunCommand.

This commit is contained in:
Sergey Kalinin 2018-06-25 08:09:07 +03:00
parent 72cae7dc26
commit c8151f3b16

View File

@ -64,7 +64,7 @@ proc InsertItemsWorkList {lst} {
incr work_list_row_count incr work_list_row_count
} }
proc RunCommand {root par} { proc RunCommand {par} {
global dir rac_cmd cluster work_list_row_count \ global dir rac_cmd cluster work_list_row_count \
agent_user agent_pwd cluster_user cluster_pwd agent_user agent_pwd cluster_user cluster_pwd
@ -230,7 +230,7 @@ proc GetInfobases {cluster host} {
} else { } else {
set auth "" set auth ""
} }
set lst [RunCommand "" "infobase summary --cluster=$cluster $auth list $host"] set lst [RunCommand "infobase summary --cluster=$cluster $auth list $host"]
set return_list "" set return_list ""
foreach info_bases_list $lst { foreach info_bases_list $lst {
foreach i $info_bases_list { foreach i $info_bases_list {
@ -281,7 +281,7 @@ namespace eval Run {} {}
# Получение данных по кластерам # Получение данных по кластерам
proc Run::server {tree host values} { proc Run::server {tree host values} {
set lst [RunCommand server::$host "cluster list $host"] set lst [RunCommand "cluster list $host"]
if {$lst eq ""} {return} if {$lst eq ""} {return}
set l [lindex $lst 0] set l [lindex $lst 0]
#puts $lst #puts $lst
@ -316,7 +316,7 @@ proc Run::server {tree host values} {
proc Run::cluster {tree host values} { proc Run::cluster {tree host values} {
global active_cluster global active_cluster
set active_cluster $values set active_cluster $values
RunCommand cluster::$values "cluster info --cluster=$values $host" RunCommand "cluster info --cluster=$values $host"
} }
proc Run::cluster_managers {tree host values} { proc Run::cluster_managers {tree host values} {
@ -336,7 +336,7 @@ proc Run::infobases {tree host values} {
} else { } else {
set auth "" set auth ""
} }
set lst [RunCommand infobase::$values "infobase summary --cluster=$active_cluster $auth list $host"] set lst [RunCommand "infobase summary --cluster=$active_cluster $auth list $host"]
puts $lst puts $lst
foreach info_bases_list $lst { foreach info_bases_list $lst {
foreach i $info_bases_list { foreach i $info_bases_list {
@ -369,7 +369,7 @@ proc Run::infobase {tree host values} {
set auth "" set auth ""
} }
.frm_work.tree_work delete [ .frm_work.tree_work children {}] .frm_work.tree_work delete [ .frm_work.tree_work children {}]
set lst [RunCommand infobase::$values "infobase info --cluster=$active_cluster $auth --infobase=$values $host"] set lst [RunCommand "infobase info --cluster=$active_cluster $auth --infobase=$values $host"]
foreach l $lst { foreach l $lst {
InsertItemsWorkList $l InsertItemsWorkList $l
@ -385,7 +385,7 @@ proc Run::List:Base {tree host values par} {
} }
.frm_work.tree_work delete [ .frm_work.tree_work children {}] .frm_work.tree_work delete [ .frm_work.tree_work children {}]
set lst [RunCommand infobase::$values "$par list --cluster=$active_cluster $auth --infobase=$values $host"] set lst [RunCommand "$par list --cluster=$active_cluster $auth --infobase=$values $host"]
foreach l $lst { foreach l $lst {
InsertItemsWorkList $l InsertItemsWorkList $l
@ -400,7 +400,7 @@ proc Run::List {tree host values par} {
} }
.frm_work.tree_work delete [ .frm_work.tree_work children {}] .frm_work.tree_work delete [ .frm_work.tree_work children {}]
set lst [RunCommand infobase::$values "$par list --cluster=$active_cluster $auth $host"] set lst [RunCommand "$par list --cluster=$active_cluster $auth $host"]
foreach l $lst { foreach l $lst {
InsertItemsWorkList $l InsertItemsWorkList $l
} }
@ -425,7 +425,7 @@ proc Run::servers {tree host values} {
set auth "" set auth ""
} }
set lst [RunCommand infobase::$values "server list --cluster=$active_cluster $auth $host"] set lst [RunCommand "server list --cluster=$active_cluster $auth $host"]
if {$lst eq ""} {return} if {$lst eq ""} {return}
foreach l $lst { foreach l $lst {
@ -462,7 +462,7 @@ proc Run::work_server {tree host values} {
set auth "" set auth ""
} }
.frm_work.tree_work delete [ .frm_work.tree_work children {}] .frm_work.tree_work delete [ .frm_work.tree_work children {}]
set lst [RunCommand infobase::$values "server info --cluster=$active_cluster --server=$values $auth $host"] set lst [RunCommand "server info --cluster=$active_cluster --server=$values $auth $host"]
foreach l $lst { foreach l $lst {
InsertItemsWorkList $l InsertItemsWorkList $l
} }
@ -478,7 +478,7 @@ proc Run::profiles {tree host values} {
set auth "" set auth ""
} }
.frm_work.tree_work delete [ .frm_work.tree_work children {}] .frm_work.tree_work delete [ .frm_work.tree_work children {}]
set lst [RunCommand "" "profile list --cluster=$active_cluster $auth $host"] set lst [RunCommand "profile list --cluster=$active_cluster $auth $host"]
foreach l $lst { foreach l $lst {
foreach i $l { foreach i $l {
@ -513,7 +513,7 @@ proc Run::work_server_processes {tree host values} {
set auth "" set auth ""
} }
.frm_work.tree_work delete [ .frm_work.tree_work children {}] .frm_work.tree_work delete [ .frm_work.tree_work children {}]
set lst [RunCommand work_server_processes::$values "process list --cluster=$active_cluster $auth --server=$values $host"] set lst [RunCommand "process list --cluster=$active_cluster $auth --server=$values $host"]
foreach l $lst { foreach l $lst {
InsertItemsWorkList $l InsertItemsWorkList $l
} }
@ -526,7 +526,7 @@ proc Run::work_server_licenses {tree host values} {
set auth "" set auth ""
} }
.frm_work.tree_work delete [ .frm_work.tree_work children {}] .frm_work.tree_work delete [ .frm_work.tree_work children {}]
set lst [RunCommand work_server_processes::$values "process list --cluster=$active_cluster $auth --server=$values --licenses $host"] set lst [RunCommand "process list --cluster=$active_cluster $auth --server=$values --licenses $host"]
foreach l $lst { foreach l $lst {
InsertItemsWorkList $l InsertItemsWorkList $l
} }
@ -541,7 +541,7 @@ proc Run::managers {tree host values} {
set auth "" set auth ""
} }
.frm_work.tree_work delete [ .frm_work.tree_work children {}] .frm_work.tree_work delete [ .frm_work.tree_work children {}]
set lst [RunCommand cluster::$values "manager list --cluster=$active_cluster $auth $host"] set lst [RunCommand "manager list --cluster=$active_cluster $auth $host"]
foreach l $lst { foreach l $lst {
foreach i $l { foreach i $l {
set server_list [split $i ":"] set server_list [split $i ":"]
@ -576,7 +576,7 @@ proc Run::manager {tree host values} {
set auth "" set auth ""
} }
.frm_work.tree_work delete [ .frm_work.tree_work children {}] .frm_work.tree_work delete [ .frm_work.tree_work children {}]
set lst [RunCommand "" "service list --cluster=$active_cluster $auth $host"] set lst [RunCommand "service list --cluster=$active_cluster $auth $host"]
foreach l $lst { foreach l $lst {
#puts $l #puts $l
foreach i $l { foreach i $l {
@ -598,11 +598,10 @@ proc Run::agent_admins {tree host values} {
set agent_auth "" set agent_auth ""
} }
.frm_work.tree_work delete [ .frm_work.tree_work children {}] .frm_work.tree_work delete [ .frm_work.tree_work children {}]
set lst [RunCommand "" "agent admin list $agent_auth $host"] set lst [RunCommand "agent admin list $agent_auth $host"]
foreach l $lst { foreach l $lst {
InsertItemsWorkList $l InsertItemsWorkList $l
} }
return
} }
proc Run::admins {tree host values} { proc Run::admins {tree host values} {
@ -614,13 +613,11 @@ proc Run::admins {tree host values} {
} }
.frm_work.tree_work delete [ .frm_work.tree_work children {}] .frm_work.tree_work delete [ .frm_work.tree_work children {}]
set lst [ set lst [
RunCommand "" \ RunCommand "cluster admin list $auth --cluster=$active_cluster $host"
"cluster admin list $auth --cluster=$active_cluster $host"
] ]
foreach l $lst { foreach l $lst {
InsertItemsWorkList $l InsertItemsWorkList $l
} }
return
} }
proc Run::rule {tree host values} { proc Run::rule {tree host values} {
@ -631,7 +628,7 @@ proc Run::rule {tree host values} {
set auth "" set auth ""
} }
.frm_work.tree_work delete [ .frm_work.tree_work children {}] .frm_work.tree_work delete [ .frm_work.tree_work children {}]
set lst [RunCommand "" "rule list --cluster=$active_cluster $auth --server=$values $host"] set lst [RunCommand "rule list --cluster=$active_cluster $auth --server=$values $host"]
foreach l $lst { foreach l $lst {
#puts $l #puts $l
@ -711,7 +708,7 @@ proc Add::agent_admin {tree host value} {
grid rowconfigure $frm 0 -weight 1 grid rowconfigure $frm 0 -weight 1
#set frm_btn [frame .add.frm_btn -border 0] #set frm_btn [frame .add.frm_btn -border 0]
.add.frm_btn.btn_ok configure -command { .add.frm_btn.btn_ok configure -command {
RunCommand "" "agent admin register \ RunCommand "agent admin register \
--name=[.add.frm.ent_name get] \ --name=[.add.frm.ent_name get] \
--pwd=[.add.frm.ent_pwd get] \ --pwd=[.add.frm.ent_pwd get] \
--descr=[.add.frm.ent_descr get] \ --descr=[.add.frm.ent_descr get] \
@ -734,7 +731,7 @@ proc Add::admin {tree host value} {
wm title .add "Добавление администратора кластера" wm title .add "Добавление администратора кластера"
.add.frm configure -text "Добавление администратора кластера" .add.frm configure -text "Добавление администратора кластера"
.add.frm_btn.btn_ok configure -command { .add.frm_btn.btn_ok configure -command {
RunCommand "" "cluster admin register \ RunCommand "cluster admin register \
--name=[.add.frm.ent_name get] \ --name=[.add.frm.ent_name get] \
--pwd=[.add.frm.ent_pwd get] \ --pwd=[.add.frm.ent_pwd get] \
--descr=[.add.frm.ent_descr get] \ --descr=[.add.frm.ent_descr get] \
@ -848,7 +845,7 @@ proc Add::servers {tree host values} {
grid $frm.check_using -row 11 -column 1 -sticky nw -padx 5 -pady 5 grid $frm.check_using -row 11 -column 1 -sticky nw -padx 5 -pady 5
.add.frm_btn.btn_ok configure -command { .add.frm_btn.btn_ok configure -command {
RunCommand "" "server insert \ RunCommand "server insert \
--agent-host=[.add.frm.ent_agent_host get] \ --agent-host=[.add.frm.ent_agent_host get] \
--agent-port=[.add.frm.ent_agent_port get] \ --agent-port=[.add.frm.ent_agent_port get] \
--port-range=[.add.frm.ent_port_range get] \ --port-range=[.add.frm.ent_port_range get] \
@ -965,7 +962,7 @@ proc Add::infobases {tree host values} {
set db_create "" set db_create ""
} }
RunCommand "" "infobase create $db_create \ RunCommand "infobase create $db_create \
--name=[.add.frm.ent_name get] \ --name=[.add.frm.ent_name get] \
--dbms=$dbms \ --dbms=$dbms \
--db-server=[.add.frm.ent_db_server get] \ --db-server=[.add.frm.ent_db_server get] \
@ -1063,7 +1060,7 @@ proc Add::cluster {tree host values} {
grid $frm.check_kill_problem_processes -row 12 -column 1 -sticky nw -padx 5 -pady 5 grid $frm.check_kill_problem_processes -row 12 -column 1 -sticky nw -padx 5 -pady 5
.add.frm_btn.btn_ok configure -command { .add.frm_btn.btn_ok configure -command {
RunCommand "" "cluster insert \ RunCommand "cluster insert \
--host=[.add.frm.ent_host get] \ --host=[.add.frm.ent_host get] \
--port=[.add.frm.ent_port get] \ --port=[.add.frm.ent_port get] \
--name=[.add.frm.ent_name get] \ --name=[.add.frm.ent_name get] \
@ -1126,7 +1123,7 @@ proc Add::rule {tree host values} {
grid $frm.ent_priority -row 4 -column 1 -sticky nsew -padx 5 -pady 5 grid $frm.ent_priority -row 4 -column 1 -sticky nsew -padx 5 -pady 5
.add.frm_btn.btn_ok configure -command { .add.frm_btn.btn_ok configure -command {
RunCommand "" "rule insert \ RunCommand "rule insert \
--cluster=$active_cluster $auth \ --cluster=$active_cluster $auth \
--server=$server \ --server=$server \
--position=0 \ --position=0 \
@ -1205,7 +1202,7 @@ proc Add::profile {tree host values} {
.add.frm_btn.btn_ok configure -command { .add.frm_btn.btn_ok configure -command {
RunCommand "" "profile update \ RunCommand "profile update \
--cluster=$active_cluster $auth \ --cluster=$active_cluster $auth \
--name=[.add.frm.ent_name get] \ --name=[.add.frm.ent_name get] \
--descr=[.add.frm.ent_descr get] \ --descr=[.add.frm.ent_descr get] \
@ -1295,7 +1292,7 @@ proc Edit::cluster {tree host values} {
$frm configure -text "Редактирование кластера" $frm configure -text "Редактирование кластера"
set active_cluster $values set active_cluster $values
set lst [RunCommand cluster::$values "cluster info --cluster=$active_cluster $host"] set lst [RunCommand "cluster info --cluster=$active_cluster $host"]
FormFieldsDataInsert $frm $lst FormFieldsDataInsert $frm $lst
@ -1303,7 +1300,7 @@ proc Edit::cluster {tree host values} {
$frm.ent_port configure -state disable $frm.ent_port configure -state disable
.add.frm_btn.btn_ok configure -command { .add.frm_btn.btn_ok configure -command {
RunCommand "" "cluster update \ RunCommand "cluster update \
--cluster=$active_cluster $auth \ --cluster=$active_cluster $auth \
--name=[.add.frm.ent_name get] \ --name=[.add.frm.ent_name get] \
--expiration-timeout=$expiration_timeout \ --expiration-timeout=$expiration_timeout \
@ -1412,11 +1409,11 @@ proc Edit::infobase {tree host values} {
grid $frm.lbl_external_session_manager_required -row 9 -column 2 -sticky nw -padx 5 -pady 5 grid $frm.lbl_external_session_manager_required -row 9 -column 2 -sticky nw -padx 5 -pady 5
grid $frm.check_external_session_manager_required -row 9 -column 3 -sticky nw -padx 5 -pady 5 grid $frm.check_external_session_manager_required -row 9 -column 3 -sticky nw -padx 5 -pady 5
set lst [RunCommand infobase::$values "infobase info --cluster=$active_cluster --infobase=$values $auth $host"] set lst [RunCommand "infobase info --cluster=$active_cluster --infobase=$values $auth $host"]
FormFieldsDataInsert $frm $lst FormFieldsDataInsert $frm $lst
.add.frm_btn.btn_ok configure -command { .add.frm_btn.btn_ok configure -command {
RunCommand "" "infobase update \ RunCommand "infobase update \
--infobase=$infobase \ --infobase=$infobase \
--infobase-user= \ --infobase-user= \
--infobase-pwd= \ --infobase-pwd= \
@ -1477,7 +1474,7 @@ proc Edit::work_server {tree host values} {
set frm [Add::work_server $tree $host $values] set frm [Add::work_server $tree $host $values]
$frm configure -text "Редактирование рабочего сервера" $frm configure -text "Редактирование рабочего сервера"
set lst [RunCommand cluster::$values "server info --cluster=$active_cluster $auth --server=$server $host"] set lst [RunCommand "server info --cluster=$active_cluster $auth --server=$server $host"]
FormFieldsDataInsert $frm $lst FormFieldsDataInsert $frm $lst
$frm.lbl_agent_port configure -state disable $frm.lbl_agent_port configure -state disable
@ -1490,7 +1487,7 @@ proc Edit::work_server {tree host values} {
$frm.ent_cluster_port configure -state disable $frm.ent_cluster_port configure -state disable
.add.frm_btn.btn_ok configure -command { .add.frm_btn.btn_ok configure -command {
RunCommand "" "server update \ RunCommand "server update \
--server=$server \ --server=$server \
--using=$using \ --using=$using \
--infobases-limit=[.add.frm.ent_infobases_limit get] \ --infobases-limit=[.add.frm.ent_infobases_limit get] \
@ -1535,12 +1532,12 @@ proc Edit::rule {tree host values} {
$frm configure -text "Редактирование требования назначения функциональности" $frm configure -text "Редактирование требования назначения функциональности"
set lst [RunCommand "" "rule info --cluster=$active_cluster $auth --server=$server --rule=$rule $host"] set lst [RunCommand "rule info --cluster=$active_cluster $auth --server=$server --rule=$rule $host"]
FormFieldsDataInsert $frm $lst FormFieldsDataInsert $frm $lst
.add.frm_btn.btn_ok configure -command { .add.frm_btn.btn_ok configure -command {
RunCommand "" "rule update \ RunCommand "rule update \
--cluster=$active_cluster $auth \ --cluster=$active_cluster $auth \
--server=$server \ --server=$server \
--rule=$rule \ --rule=$rule \
@ -1595,7 +1592,7 @@ proc Del::admin {tree host values} {
-icon question -type yesno ] -icon question -type yesno ]
switch -- $answer { switch -- $answer {
yes { yes {
set lst [RunCommand "" "cluster admin remove --name=$values --cluster=$active_cluster $auth $host"] set lst [RunCommand "cluster admin remove --name=$values --cluster=$active_cluster $auth $host"]
#.frm_tree.tree delete "admin::$values" #.frm_tree.tree delete "admin::$values"
set cluster_user "" set cluster_user ""
set cluster_pwd "" set cluster_pwd ""
@ -1637,7 +1634,7 @@ proc Del::agent_admin {tree host values} {
-icon question -type yesno ] -icon question -type yesno ]
switch -- $answer { switch -- $answer {
yes { yes {
set lst [RunCommand "" "agent admin remove --name=$values $agent_auth $host"] set lst [RunCommand "agent admin remove --name=$values $agent_auth $host"]
#.frm_tree.tree delete "admin::$values" #.frm_tree.tree delete "admin::$values"
set agent_user "" set agent_user ""
set agent_pwd "" set agent_pwd ""
@ -1681,7 +1678,7 @@ proc Del::work_server {tree host values} {
-icon question -type yesno ] -icon question -type yesno ]
switch -- $answer { switch -- $answer {
yes { yes {
set lst [RunCommand infobase::$values "server remove --cluster=$active_cluster $auth --server=$values $host"] set lst [RunCommand "server remove --cluster=$active_cluster $auth --server=$values $host"]
.frm_tree.tree delete "work_server::$values" .frm_tree.tree delete "work_server::$values"
.frm_work.tree_work delete [ .frm_work.tree_work children {}] .frm_work.tree_work delete [ .frm_work.tree_work children {}]
} }
@ -1720,7 +1717,7 @@ proc Del::cluster {tree host values} {
-icon question -type yesno ] -icon question -type yesno ]
switch -- $answer { switch -- $answer {
yes { yes {
set lst [RunCommand infobase::$values "cluster remove --cluster=$values $auth $host"] set lst [RunCommand "cluster remove --cluster=$values $auth $host"]
$tree delete "cluster::$values" $tree delete "cluster::$values"
.frm_work.tree_work delete [ .frm_work.tree_work children {}] .frm_work.tree_work delete [ .frm_work.tree_work children {}]
} }
@ -1738,7 +1735,7 @@ proc Del::infobase {tree host values} {
-icon question -type yesno ] -icon question -type yesno ]
switch -- $answer { switch -- $answer {
yes { yes {
set lst [RunCommand infobase::$values "infobase drop --infobase=$values --cluster=$active_cluster $auth $host"] set lst [RunCommand "infobase drop --infobase=$values --cluster=$active_cluster $auth $host"]
$tree delete "infobase::$values" $tree delete "infobase::$values"
.frm_work.tree_work delete [ .frm_work.tree_work children {}] .frm_work.tree_work delete [ .frm_work.tree_work children {}]
} }
@ -1800,7 +1797,7 @@ proc Del::connections {tree host values} {
-icon question -type yesno ] -icon question -type yesno ]
switch -- $answer { switch -- $answer {
yes { yes {
set lst [RunCommand infobase::$values "connection disconnect --process=$process_id --connection=$connection_id --cluster=$active_cluster $auth $host"] set lst [RunCommand "connection disconnect --process=$process_id --connection=$connection_id --cluster=$active_cluster $auth $host"]
#$tree delete "infobase::$values" #$tree delete "infobase::$values"
.frm_work.tree_work delete [ .frm_work.tree_work children {}] .frm_work.tree_work delete [ .frm_work.tree_work children {}]
} }
@ -1834,7 +1831,7 @@ proc Del::sessions {tree host values} {
-icon question -type yesno ] -icon question -type yesno ]
switch -- $answer { switch -- $answer {
yes { yes {
set lst [RunCommand infobase::$values "session terminate --session=$session_id --cluster=$active_cluster $auth $host"] set lst [RunCommand "session terminate --session=$session_id --cluster=$active_cluster $auth $host"]
#$tree delete "infobase::$values" #$tree delete "infobase::$values"
.frm_work.tree_work delete [ .frm_work.tree_work children {}] .frm_work.tree_work delete [ .frm_work.tree_work children {}]
} }
@ -1873,7 +1870,7 @@ proc Del::rule {tree host values} {
-icon question -type yesno ] -icon question -type yesno ]
switch -- $answer { switch -- $answer {
yes { yes {
set lst [RunCommand infobase::$values "rule remove --server=$server --rule=$rule_id --cluster=$active_cluster $auth $host"] set lst [RunCommand "rule remove --server=$server --rule=$rule_id --cluster=$active_cluster $auth $host"]
#$tree delete "infobase::$values" #$tree delete "infobase::$values"
.frm_work.tree_work delete [ .frm_work.tree_work children {}] .frm_work.tree_work delete [ .frm_work.tree_work children {}]
} }
@ -1887,12 +1884,10 @@ proc Del::server {tree host values} {
-icon question -type yesno ] -icon question -type yesno ]
switch -- $answer { switch -- $answer {
yes { yes {
#set lst [RunCommand infobase::$values "cluster remove --cluster=$values $host"]
file copy [file join $dir(work) 1c_srv.cfg] [file join $dir(work) 1c_srv.cfg.bak] file copy [file join $dir(work) 1c_srv.cfg] [file join $dir(work) 1c_srv.cfg.bak]
set orig_file [open [file join $dir(work) 1c_srv.cfg.bak] "r"] set orig_file [open [file join $dir(work) 1c_srv.cfg.bak] "r"]
set file [open [file join $dir(work) 1c_srv.cfg] "w"] set file [open [file join $dir(work) 1c_srv.cfg] "w"]
while {[gets $orig_file line] >=0 } { while {[gets $orig_file line] >=0 } {
#puts $line
if { $line ne "" && $line ne "$values"} { if { $line ne "" && $line ne "$values"} {
puts $file $line puts $file $line
} }
@ -1908,4 +1903,3 @@ proc Del::server {tree host values} {
} }
} }