1
0
mirror of https://bitbucket.org/svk28/rac-gui synced 2024-11-13 00:56:54 +00:00

Добавлена корректная авторизация во все команды

This commit is contained in:
Sergey Kalinin 2018-06-22 14:13:19 +03:00
parent 0878dbf0b2
commit ad8ed8617b
2 changed files with 372 additions and 129 deletions

View File

@ -66,27 +66,82 @@ proc InsertItemsWorkList {lst} {
}
proc RunCommand {root 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
puts "$rac_cmd $par"
set work_list_row_count 0
set pipe [open "|$rac_cmd $par" "r"]
set lst ""
set l ""
while {[gets $pipe line]>=0} {
if {$line eq ""} {
lappend l $lst
set lst ""
} else {
lappend lst [string trim $line]
try {
set lst ""
set l ""
while {[gets $pipe line]>=0} {
#puts $line
if {$line eq ""} {
lappend l $lst
set lst ""
} else {
lappend lst [string trim $line]
}
}
close $pipe
return $l
} on error {result options} {
puts "Handle >$result< "
ErrorParcing $result $options
#RunCommand $root $par
}
close $pipe
return $l
# fileevent $pipe readable [list DebugInfo .frm_work.tree_work $pipe]
# fconfigure $pipe -buffering none -blocking no
}
proc ErrorParcing {err opt} {
global cluster_user cluster_pwd agent_user agent_pwd
switch -regexp -- $err {
"Cluster administrator is not authenticated" {
AuthorisationDialog "Администратор кластера"
.auth_win.frm_btn.btn_ok configure -command {
set cluster_user [.auth_win.frm.ent_name get]
set cluster_pwd [.auth_win.frm.ent_pwd get]
destroy .auth_win
}
#RunCommand $root $par
}
"Central server administrator is not authenticated" {
#tk_messageBox -type ok -message "Логиницоооооооооооооо!"
AuthorisationDialog "Администратор агента кластера"
.auth_win.frm_btn.btn_ok configure -command {
set agent_user [.auth_win.frm.ent_name get]
set agent_pwd [.auth_win.frm.ent_pwd get]
destroy .auth_win
}
}
}
}
proc AuthorisationDialog {txt} {
global active_cluster agent_user agent_pwd cluster_user cluster_pwd
.frm_work.tree_work delete [ .frm_work.tree_work children {}]
set frm [AddToplevel "$txt" administrator_grey_64 .auth_win]
wm title .auth_win "Авторизация"
label $frm.lbl_name -text "Имя пользователя"
entry $frm.ent_name
label $frm.lbl_pwd -text "Пароль"
entry $frm.ent_pwd
grid $frm.lbl_name -row 0 -column 0 -sticky nw -padx 5 -pady 5
grid $frm.ent_name -row 0 -column 1 -sticky nsew -padx 5 -pady 5
grid $frm.lbl_pwd -row 1 -column 0 -sticky nw -padx 5 -pady 5
grid $frm.ent_pwd -row 1 -column 1 -sticky nsew -padx 5 -pady 5
grid columnconfigure $frm 0 -weight 1
grid rowconfigure $frm 0 -weight 1
#set frm_btn [frame .add.frm_btn -border 0]
}
proc InsertClusterItems {tree id} {
set parent "cluster::$id"
$tree insert $parent end -id "infobases::$id" -text "Информационные базы" -values "$id"
@ -228,10 +283,15 @@ proc Run::services {tree host values} {
}
proc Run::infobases {tree host values} {
global active_cluster
global active_cluster cluster_user cluster_pwd
.frm_work.tree_work delete [ .frm_work.tree_work children {}]
set lst [RunCommand infobase::$values "infobase summary --cluster=$active_cluster list $host"]
if {$cluster_user ne "" && $cluster_pwd ne ""} {
set auth "--cluster-user=$cluster_user --cluster-pwd=$cluster_pwd"
} else {
set auth ""
}
set lst [RunCommand infobase::$values "infobase summary --cluster=$active_cluster $auth list $host"]
puts $lst
foreach info_bases_list $lst {
foreach i $info_bases_list {
set base_list [split $i ":"]
@ -256,9 +316,14 @@ proc Run::infobases {tree host values} {
}
proc Run::infobase {tree host values} {
global active_cluster
global active_cluster cluster_user cluster_pwd
if {$cluster_user ne "" && $cluster_pwd ne ""} {
set auth "--cluster-user=$cluster_user --cluster-pwd=$cluster_pwd"
} else {
set auth ""
}
.frm_work.tree_work delete [ .frm_work.tree_work children {}]
set lst [RunCommand infobase::$values "infobase info --cluster=$active_cluster --infobase=$values $host"]
set lst [RunCommand infobase::$values "infobase info --cluster=$active_cluster $auth --infobase=$values $host"]
foreach l $lst {
InsertItemsWorkList $l
@ -266,18 +331,30 @@ proc Run::infobase {tree host values} {
}
proc Run::List:Base {tree host values par} {
global active_cluster
global active_cluster cluster_user cluster_pwd
if {$cluster_user ne "" && $cluster_pwd ne ""} {
set auth "--cluster-user=$cluster_user --cluster-pwd=$cluster_pwd"
} else {
set auth ""
}
.frm_work.tree_work delete [ .frm_work.tree_work children {}]
set lst [RunCommand infobase::$values "$par list --cluster=$active_cluster --infobase=$values $host"]
set lst [RunCommand infobase::$values "$par list --cluster=$active_cluster $auth --infobase=$values $host"]
foreach l $lst {
InsertItemsWorkList $l
}
}
proc Run::List {tree host values par} {
global active_cluster
global active_cluster cluster_user cluster_pwd
if {$cluster_user ne "" && $cluster_pwd ne ""} {
set auth "--cluster-user=$cluster_user --cluster-pwd=$cluster_pwd"
} else {
set auth ""
}
.frm_work.tree_work delete [ .frm_work.tree_work children {}]
set lst [RunCommand infobase::$values "$par list --cluster=$active_cluster $host"]
set lst [RunCommand infobase::$values "$par list --cluster=$active_cluster $auth $host"]
foreach l $lst {
InsertItemsWorkList $l
}
@ -294,9 +371,15 @@ proc Run::connections {tree host values} {
Run::List:Base $tree $host $values connection
}
proc Run::servers {tree host values} {
global active_cluster
global active_cluster cluster_user cluster_pwd
.frm_work.tree_work delete [ .frm_work.tree_work children {}]
set lst [RunCommand infobase::$values "server list --cluster=$active_cluster $host"]
if {$cluster_user ne "" && $cluster_pwd ne ""} {
set auth "--cluster-user=$cluster_user --cluster-pwd=$cluster_pwd"
} else {
set auth ""
}
set lst [RunCommand infobase::$values "server list --cluster=$active_cluster $auth $host"]
foreach l $lst {
foreach i $l {
set server_list [split $i ":"]
@ -323,9 +406,14 @@ proc Run::servers {tree host values} {
#Run::List $tree $host $values server
}
proc Run::work_server {tree host values} {
global active_cluster work_list_row_count
global active_cluster work_list_row_count cluster_user cluster_pwd
if {$cluster_user ne "" && $cluster_pwd ne ""} {
set auth "--cluster-user=$cluster_user --cluster-pwd=$cluster_pwd"
} else {
set auth ""
}
.frm_work.tree_work delete [ .frm_work.tree_work children {}]
set lst [RunCommand infobase::$values "server info --cluster=$active_cluster --server=$values $host"]
set lst [RunCommand infobase::$values "server info --cluster=$active_cluster --server=$values $auth $host"]
foreach l $lst {
InsertItemsWorkList $l
}
@ -337,17 +425,27 @@ proc Run::processes {tree host values} {
Run::List $tree $host $values process
}
proc Run::work_server_processes {tree host values} {
global active_cluster work_list_row_count
global active_cluster work_list_row_count cluster_user cluster_pwd
if {$cluster_user ne "" && $cluster_pwd ne ""} {
set auth "--cluster-user=$cluster_user --cluster-pwd=$cluster_pwd"
} else {
set auth ""
}
.frm_work.tree_work delete [ .frm_work.tree_work children {}]
set lst [RunCommand work_server_processes::$values "process list --cluster=$active_cluster --server=$values $host"]
set lst [RunCommand work_server_processes::$values "process list --cluster=$active_cluster $auth --server=$values $host"]
foreach l $lst {
InsertItemsWorkList $l
}
}
proc Run::work_server_licenses {tree host values} {
global active_cluster work_list_row_count
global active_cluster work_list_row_count cluster_user cluster_pwd
if {$cluster_user ne "" && $cluster_pwd ne ""} {
set auth "--cluster-user=$cluster_user --cluster-pwd=$cluster_pwd"
} else {
set auth ""
}
.frm_work.tree_work delete [ .frm_work.tree_work children {}]
set lst [RunCommand work_server_processes::$values "process list --cluster=$active_cluster --server=$values --licenses $host"]
set lst [RunCommand work_server_processes::$values "process list --cluster=$active_cluster $auth --server=$values --licenses $host"]
foreach l $lst {
InsertItemsWorkList $l
}
@ -355,9 +453,14 @@ proc Run::work_server_licenses {tree host values} {
proc Run::managers {tree host values} {
#Run::List $tree $host $values manager
global active_cluster
global active_cluster work_list_row_count cluster_user cluster_pwd
if {$cluster_user ne "" && $cluster_pwd ne ""} {
set auth "--cluster-user=$cluster_user --cluster-pwd=$cluster_pwd"
} else {
set auth ""
}
.frm_work.tree_work delete [ .frm_work.tree_work children {}]
set lst [RunCommand cluster::$values "manager list --cluster=$active_cluster $host"]
set lst [RunCommand cluster::$values "manager list --cluster=$active_cluster $auth $host"]
foreach l $lst {
foreach i $l {
set server_list [split $i ":"]
@ -385,9 +488,14 @@ proc Run::managers {tree host values} {
}
proc Run::manager {tree host values} {
#Run::List $tree $host $values service
global active_cluster
global active_cluster cluster_user cluster_pwd
if {$cluster_user ne "" && $cluster_pwd ne ""} {
set auth "--cluster-user=$cluster_user --cluster-pwd=$cluster_pwd"
} else {
set auth ""
}
.frm_work.tree_work delete [ .frm_work.tree_work children {}]
set lst [RunCommand "" "service list --cluster=$active_cluster $host"]
set lst [RunCommand "" "service list --cluster=$active_cluster $auth $host"]
foreach l $lst {
#puts $l
foreach i $l {
@ -403,80 +511,46 @@ proc Run::agent_admin {tree host values} {
}
proc Run::agent_admins {tree host values} {
global active_cluster agent_user agent_pwd
.frm_work.tree_work delete [ .frm_work.tree_work children {}]
if {[info exists agent_user] == 0 || $agent_user eq ""} {
set frm [AddToplevel "Авторизация администратора агента кластера" administrator_grey_64]
label $frm.lbl_name -text "Имя пользователя"
entry $frm.ent_name
label $frm.lbl_pwd -text "Пароль"
entry $frm.ent_pwd
grid $frm.lbl_name -row 0 -column 0 -sticky nw -padx 5 -pady 5
grid $frm.ent_name -row 0 -column 1 -sticky nsew -padx 5 -pady 5
grid $frm.lbl_pwd -row 1 -column 0 -sticky nw -padx 5 -pady 5
grid $frm.ent_pwd -row 1 -column 1 -sticky nsew -padx 5 -pady 5
grid columnconfigure $frm 0 -weight 1
grid rowconfigure $frm 0 -weight 1
#set frm_btn [frame .add.frm_btn -border 0]
.add.frm_btn.btn_ok configure -command {
set agent_user [.add.frm.ent_name get]
set agent_pwd [.add.frm.ent_pwd get]
set lst [RunCommand "" "agent admin list --agent-user=$agent_user --agent-pwd=$agent_pwd $host"]
foreach l $lst {
InsertItemsWorkList $l
}
destroy .add
}
if {$agent_user ne "" && $agent_pwd ne ""} {
set agent_auth "--agent-user=$agent_user --agent-pwd=$agent_pwd"
} else {
set lst [RunCommand "" "agent admin list --agent-user=$agent_user --agent-pwd=$agent_pwd $host"]
foreach l $lst {
InsertItemsWorkList $l
}
return
set agent_auth ""
}
.frm_work.tree_work delete [ .frm_work.tree_work children {}]
set lst [RunCommand "" "agent admin list $agent_auth $host"]
foreach l $lst {
InsertItemsWorkList $l
}
return
}
proc Run::admins {tree host values} {
global active_cluster agent_user agent_pwd cluster_user cluster_pwd
.frm_work.tree_work delete [ .frm_work.tree_work children {}]
if {[info exists cluster_user] == 0 || $cluster_user eq ""} {
set frm [AddToplevel "Авторизация администратора кластера" administrator_grey_64]
label $frm.lbl_name -text "Имя пользователя"
entry $frm.ent_name
label $frm.lbl_pwd -text "Пароль"
entry $frm.ent_pwd
grid $frm.lbl_name -row 0 -column 0 -sticky nw -padx 5 -pady 5
grid $frm.ent_name -row 0 -column 1 -sticky nsew -padx 5 -pady 5
grid $frm.lbl_pwd -row 1 -column 0 -sticky nw -padx 5 -pady 5
grid $frm.ent_pwd -row 1 -column 1 -sticky nsew -padx 5 -pady 5
grid columnconfigure $frm 0 -weight 1
grid rowconfigure $frm 0 -weight 1
#set frm_btn [frame .add.frm_btn -border 0]
.add.frm_btn.btn_ok configure -command {
set cluster_user [.add.frm.ent_name get]
set cluster_pwd [.add.frm.ent_pwd get]
set lst [RunCommand "" "cluster admin list --cluster-user=$cluster_user --cluster-pwd=$cluster_pwd --cluster=$active_cluster $host"]
foreach l $lst {
InsertItemsWorkList $l
}
destroy .add
}
if {$cluster_user ne "" && $cluster_pwd ne ""} {
set auth "--cluster-user=$cluster_user --cluster-pwd=$cluster_pwd"
} else {
set lst [RunCommand "" "cluster admin list --cluster-user=$cluster_user --cluster-pwd=$cluster_pwd --cluster=$active_cluster $host"]
foreach l $lst {
InsertItemsWorkList $l
}
return
set auth ""
}
.frm_work.tree_work delete [ .frm_work.tree_work children {}]
set lst [
RunCommand "" \
"cluster admin list $auth --cluster=$active_cluster $host"
]
foreach l $lst {
InsertItemsWorkList $l
}
return
}
proc Run::rule {tree host values} {
global active_cluster
global active_cluster cluster_user cluster_pwd
if {$cluster_user ne "" && $cluster_pwd ne ""} {
set auth "--cluster-user=$cluster_user --cluster-pwd=$cluster_pwd"
} else {
set auth ""
}
.frm_work.tree_work delete [ .frm_work.tree_work children {}]
set lst [RunCommand "" "rule list --cluster=$active_cluster --server=$values $host"]
set lst [RunCommand "" "rule list --cluster=$active_cluster $auth --server=$values $host"]
foreach l $lst {
#puts $l
@ -497,7 +571,8 @@ proc Add {} {
Add::$key .frm_tree.tree $host $values
}
proc AddToplevel {lbl img} {
proc AddToplevel_ {lbl img} {
if [winfo exists .add] {destroy .add}
toplevel .add
wm title .add $lbl
@ -518,6 +593,28 @@ proc AddToplevel {lbl img} {
pack $frm_btn.btn_ok -side right -padx 10
return $frm
}
proc AddToplevel {lbl img {win_name .add}} {
set cmd "destroy $win_name"
if [winfo exists $win_name] {destroy $win_name}
toplevel $win_name
wm title $win_name $lbl
#wm iconphoto $win_name server_grey_64
ttk::label $win_name.lbl -image $img
set frm [ttk::labelframe $win_name.frm -text $lbl -labelanchor nw]
grid columnconfigure $frm 0 -weight 1
grid rowconfigure $frm 0 -weight 1
set frm_btn [frame $win_name.frm_btn -border 0]
ttk::button $frm_btn.btn_ok -image ok_grey_24 -command { }
ttk::button $frm_btn.btn_cancel -command $cmd -image quit_grey_24
grid $win_name.lbl -row 0 -column 0 -sticky nw -padx 5 -pady 10
grid $frm -row 0 -column 1 -sticky nw -padx 5 -pady 5
grid $frm_btn -row 1 -column 1 -sticky se -padx 5 -pady 5
pack $frm_btn.btn_cancel -side right
pack $frm_btn.btn_ok -side right -padx 10
return $frm
}
namespace eval Add {} {}
proc Add::agent_admins {tree host value} {
@ -572,7 +669,7 @@ proc Add::admins {tree host value} {
}
proc Add::admin {tree host value} {
global default auth active_cluster agent_user agent_pwd cluster_uer cluster_pwd
global default auth active_cluster agent_user agent_pwd cluster_user cluster_pwd
set frm [Add::agent_admin $tree $host $value]
wm title .add "Добавление администратора кластера"
.add.frm configure -text "Добавление администратора кластера"
@ -620,7 +717,13 @@ proc Add::server {} {
return $frm
}
proc Add::servers {tree host values} {
global default dedicate_managers using active_cluster
global default dedicate_managers using active_cluster cluster_user cluster_pwd
if {$cluster_user ne "" && $cluster_pwd ne ""} {
set auth "--cluster-user=$cluster_user --cluster-pwd=$cluster_pwd"
} else {
set auth ""
}
set dedicate_manager "none"
set using_central_server "normal"
#set active_cluster $values
@ -698,7 +801,7 @@ proc Add::servers {tree host values} {
--dedicate-managers=$dedicate_managers \
--safe-working-processes-memory-limit=[.add.frm.ent_safe_working_processes_memory_limit get] \
--safe-call-memory-limit=[.add.frm.ent_safe_call_memory_limit get] \
--cluster=$active_cluster $host"
--cluster=$active_cluster $auth $host"
Run::servers $tree $host $active_cluster
destroy .add
}
@ -711,8 +814,13 @@ proc Add::infobase {tree host values} {
return [Add::infobases $tree $host $values]
}
proc Add::infobases {tree host values} {
global default active_cluster
global default active_cluster agent_user agent_pwd cluster_user cluster_pwd
global security_level dbms scheduled_jobs_deny create_db license_distribution date_offset db_create
if {$cluster_user ne "" && $cluster_pwd ne ""} {
set auth "--cluster-user=$cluster_user --cluster-pwd=$cluster_pwd"
} else {
set auth ""
}
#set active_cluster $values
# установка значений по умолчанию
set license_distribution deny
@ -802,7 +910,7 @@ proc Add::infobases {tree host values} {
--security-level=$security_level \
--scheduled-jobs-deny=$scheduled_jobs_deny \
--license-distribution=$license_distribution \
--cluster=$active_cluster $host"
--cluster=$active_cluster $auth $host"
Run::infobases $tree $host $active_cluster
destroy .add
}
@ -812,7 +920,13 @@ proc Add::infobases {tree host values} {
proc Add::cluster {tree host values} {
global default lifetime_limit expiration_timeout session_fault_tolerance_level
global max_memory_size max_memory_time_limit errors_count_threshold security_level
global load_balancing_mode kill_problem_processes
global load_balancing_mode kill_problem_processes \
agent_user agent_pwd cluster_user cluster_pwd auth_agent
if {$agent_user ne "" && $agent_pwd ne ""} {
set auth_agent "--agent-user=$agent_user --agent-pwd=$agent_pwd"
} else {
set auth_agent ""
}
set lifetime_limit $default(lifetime_limit)
set expiration_timeout $default(expiration_timeout)
@ -894,7 +1008,7 @@ proc Add::cluster {tree host values} {
--load-balancing-mode=$load_balancing_mode \
--errors-count-threshold=$errors_count_threshold \
--kill-problem-processes=$kill_problem_processes \
$host"
$auth_agent $host"
Run::server $tree $host ""
destroy .add
}
@ -902,7 +1016,14 @@ proc Add::cluster {tree host values} {
}
proc Add::rule {tree host values} {
global default active_cluster infobase object_type server infobase_name rule_type
global default active_cluster infobase object_type server infobase_name rule_type \
agent_user agent_pwd cluster_user cluster_pwd
if {$cluster_user ne "" && $cluster_pwd ne ""} {
set auth "--cluster-user=$cluster_user --cluster-pwd=$cluster_pwd"
} else {
set auth ""
}
set server $values
set frm [AddToplevel "Требование назначения функциональности" functional_grey_64]
@ -938,7 +1059,7 @@ proc Add::rule {tree host values} {
.add.frm_btn.btn_ok configure -command {
RunCommand "" "rule insert \
--cluster=$active_cluster \
--cluster=$active_cluster $auth \
--server=$server \
--position=0 \
--object-type=$object_type \
@ -1004,13 +1125,19 @@ proc Edit::server {tree host value} {
proc Edit::cluster {tree host values} {
global default lifetime_limit expiration_timeout session_fault_tolerance_level
global max_memory_size max_memory_time_limit errors_count_threshold security_level
global load_balancing_mode kill_problem_processes active_cluster
global load_balancing_mode kill_problem_processes active_cluster \
agent_user agent_pwd cluster_user cluster_pwd
if {$cluster_user ne "" && $cluster_pwd ne ""} {
set auth "--cluster-user=$cluster_user --cluster-pwd=$cluster_pwd"
} else {
set auth ""
}
set frm [Add::cluster $tree $host $values]
$frm configure -text "Редактирование кластера"
set active_cluster $values
set lst [RunCommand cluster::$values "cluster info --cluster=$active_cluster $host"]
set lst [RunCommand cluster::$values "cluster info --cluster=$active_cluster $auth $host"]
FormFieldsDataInsert $frm $lst
@ -1019,7 +1146,7 @@ proc Edit::cluster {tree host values} {
.add.frm_btn.btn_ok configure -command {
RunCommand "" "cluster update \
--cluster=$active_cluster \
--cluster=$active_cluster $auth \
--name=[.add.frm.ent_name get] \
--expiration-timeout=$expiration_timeout \
--lifetime-limit=$lifetime_limit \
@ -1057,9 +1184,15 @@ proc Edit::infobases {tree host values} {
Edit::infobase $tree $host $infobase
}
proc Edit::infobase {tree host values} {
global default active_cluster infobase
global default active_cluster infobase agent_user agent_pwd cluster_user cluster_pwd
global security_level dbms scheduled_jobs_deny license_distribution date_offset
global sessions_deny
global sessions_deny
if {$cluster_user ne "" && $cluster_pwd ne ""} {
set auth "--cluster-user=$cluster_user --cluster-pwd=$cluster_pwd"
} else {
set auth ""
}
set infobase $values
set frm [Add::infobases $tree $host $values]
@ -1147,7 +1280,7 @@ proc Edit::infobase {tree host values} {
--external-session-manager-required=$external_session_manager_required \
--security-profile-name=[.add.frm.ent_security_profile get] \
--safe-mode-security-profile-name=[.add.frm.ent_safe_mode_security_profile_name get] \
--cluster=$active_cluster $host"
--cluster=$active_cluster $auth $host"
#Run::infobases $tree $host $active_cluster
destroy .add
}
@ -1174,13 +1307,19 @@ proc Edit::servers {tree host values} {
}
proc Edit::work_server {tree host values} {
global default active_cluster
global default active_cluster agent_user agent_pwd cluster_user cluster_pwd
global default dedicate_managers using
if {$cluster_user ne "" && $cluster_pwd ne ""} {
set auth "--cluster-user=$cluster_user --cluster-pwd=$cluster_pwd"
} else {
set auth ""
}
set server $values
set frm [Add::work_server $tree $host $values]
$frm configure -text "Редактирование рабочего сервера"
set lst [RunCommand cluster::$values "server info --cluster=$active_cluster --server=$server $host"]
set lst [RunCommand cluster::$values "server info --cluster=$active_cluster $auth --server=$server $host"]
FormFieldsDataInsert $frm $lst
$frm.lbl_agent_port configure -state disable
@ -1202,13 +1341,20 @@ proc Edit::work_server {tree host values} {
--dedicate-managers=$dedicate_managers \
--safe-working-processes-memory-limit=[.add.frm.ent_safe_working_processes_memory_limit get] \
--safe-call-memory-limit=[.add.frm.ent_safe_call_memory_limit get] \
--cluster=$active_cluster $host"
--cluster=$active_cluster $auth $host"
Run::servers $tree $host $active_cluster
destroy .add
}
}
proc Edit::rule {tree host values} {
global default active_cluster object_type infobase_name object_type server infobase_name rule_type rule
global default active_cluster object_type infobase_name object_type server infobase_name rule_type rule \
agent_user agent_pwd cluster_user cluster_pwd
if {$cluster_user ne "" && $cluster_pwd ne ""} {
set auth "--cluster-user=$cluster_user --cluster-pwd=$cluster_pwd"
} else {
set auth ""
}
set work_tree_id [.frm_work.tree_work selection]
set work_tree_values [.frm_work.tree_work item $work_tree_id -values]
set id [.frm_tree.tree selection]
@ -1231,13 +1377,13 @@ proc Edit::rule {tree host values} {
$frm configure -text "Редактирование требования назначения функциональности"
set lst [RunCommand "" "rule info --cluster=$active_cluster --server=$server --rule=$rule $host"]
set lst [RunCommand "" "rule info --cluster=$active_cluster $auth --server=$server --rule=$rule $host"]
FormFieldsDataInsert $frm $lst
.add.frm_btn.btn_ok configure -command {
RunCommand "" "rule update \
--cluster=$active_cluster \
--cluster=$active_cluster $auth \
--server=$server \
--rule=$rule \
--position=0 \
@ -1264,13 +1410,25 @@ proc Del {} {
namespace eval Del {} {}
proc Del::admin {tree host values} {
global active_cluster agent_user agent_pwd
global active_cluster agent_user agent_pwd cluster_user cluster_pwd
if {$cluster_user ne "" && $cluster_pwd ne ""} {
set auth "--cluster-user=$cluster_user --cluster-pwd=$cluster_pwd"
} else {
set auth ""
}
if {$agent_user ne "" && $agent_pwd ne ""} {
set agent_auth "--agent-user=$agent_user --agent-pwd=$agent_pwd"
} else {
set agent_auth ""
}
set answer [tk_messageBox -message "Удалить администратора $values?" \
-icon question -type yesno ]
switch -- $answer {
yes {
set lst [RunCommand infobase::$values "agent admin remove --agent-user=$agent_user --agent-pwd=$agent_pwd --name=$values $host"]
set lst [RunCommand "" "cluster admin remove --name=$values --cluster=$active_cluster $auth $host"]
#.frm_tree.tree delete "admin::$values"
set cluster_user ""
set cluster_pwd ""
.frm_work.tree_work delete [ .frm_work.tree_work children {}]
}
no {return}
@ -1297,13 +1455,63 @@ proc Del::admins {tree host values} {
Del::admin $tree $host $admin_id
}
proc Del::work_server {tree host values} {
proc Del::agent_admin {tree host values} {
global agent_user agent_pwd
if {$agent_user ne "" && $agent_pwd ne ""} {
set agent_auth "--agent-user=$agent_user --agent-pwd=$agent_pwd"
} else {
set agent_auth ""
}
set answer [tk_messageBox -message "Удалить администратора $values?" \
-icon question -type yesno ]
switch -- $answer {
yes {
set lst [RunCommand "" "agent admin remove --name=$values $agent_auth $host"]
#.frm_tree.tree delete "admin::$values"
set agent_user ""
set agent_pwd ""
.frm_work.tree_work delete [ .frm_work.tree_work children {}]
}
no {return}
}
}
proc Del::agent_admins {tree host values} {
global active_cluster
set work_tree_id [.frm_work.tree_work selection]
set work_tree_values [.frm_work.tree_work item $work_tree_id -values]
#puts ">$work_tree_id >$work_tree_values"
set id [.frm_tree.tree selection]
#set values [.frm_tree.tree item $id -values]
set key [lindex [split $id "::"] 0]
set column_list [.frm_work.tree_work cget -columns]
set i 0
# проверка соответсвия колонки в таблице и ключа в дереве
foreach l $column_list {
if {$l eq "name" } {
set admin_id [lindex $work_tree_values $i]
set tree .frm_work.tree_work
}
incr i
}
Del::agent_admin $tree $host $admin_id
}
proc Del::work_server {tree host values} {
global active_cluster agent_user agent_pwd cluster_user cluster_pwd
if {$cluster_user ne "" && $cluster_pwd ne ""} {
set auth "--cluster-user=$cluster_user --cluster-pwd=$cluster_pwd"
} else {
set auth ""
}
set answer [tk_messageBox -message "Удалить рабочий сервер $values?" \
-icon question -type yesno ]
switch -- $answer {
yes {
set lst [RunCommand infobase::$values "server remove --cluster=$active_cluster --server=$values $host"]
set lst [RunCommand infobase::$values "server remove --cluster=$active_cluster $auth --server=$values $host"]
.frm_tree.tree delete "work_server::$values"
.frm_work.tree_work delete [ .frm_work.tree_work children {}]
}
@ -1331,11 +1539,18 @@ proc Del::servers {tree host values} {
Del::work_server $tree $host $work_server_id
}
proc Del::cluster {tree host values} {
global agent_user agent_pwd cluster_user cluster_pwd
if {$cluster_user ne "" && $cluster_pwd ne ""} {
set auth "--cluster-user=$cluster_user --cluster-pwd=$cluster_pwd"
} else {
set auth ""
}
set answer [tk_messageBox -message "Удалить кластер $values?" \
-icon question -type yesno ]
switch -- $answer {
yes {
set lst [RunCommand infobase::$values "cluster remove --cluster=$values $host"]
set lst [RunCommand infobase::$values "cluster remove --cluster=$values $auth $host"]
$tree delete "cluster::$values"
.frm_work.tree_work delete [ .frm_work.tree_work children {}]
}
@ -1343,12 +1558,17 @@ proc Del::cluster {tree host values} {
}
}
proc Del::infobase {tree host values} {
global active_cluster
global active_cluster agent_user agent_pwd cluster_user cluster_pwd
if {$cluster_user ne "" && $cluster_pwd ne ""} {
set auth "--cluster-user=$cluster_user --cluster-pwd=$cluster_pwd"
} else {
set auth ""
}
set answer [tk_messageBox -message "Удалить информационную базу $values?" \
-icon question -type yesno ]
switch -- $answer {
yes {
set lst [RunCommand infobase::$values "infobase drop --infobase=$values --cluster=$active_cluster $host"]
set lst [RunCommand infobase::$values "infobase drop --infobase=$values --cluster=$active_cluster $auth $host"]
$tree delete "infobase::$values"
.frm_work.tree_work delete [ .frm_work.tree_work children {}]
}
@ -1378,7 +1598,13 @@ proc Del::infobases {tree host values} {
Del::infobase $tree $host $values
}
proc Del::connections {tree host values} {
global active_cluster
global active_cluster agent_user agent_pwd cluster_user cluster_pwd
if {$cluster_user ne "" && $cluster_pwd ne ""} {
set auth "--cluster-user=$cluster_user --cluster-pwd=$cluster_pwd"
} else {
set auth ""
}
set work_tree_id [.frm_work.tree_work selection]
set work_tree_values [.frm_work.tree_work item $work_tree_id -values]
#puts ">$work_tree_id >$work_tree_values"
@ -1404,7 +1630,7 @@ proc Del::connections {tree host values} {
-icon question -type yesno ]
switch -- $answer {
yes {
set lst [RunCommand infobase::$values "connection disconnect --process=$process_id --connection=$connection_id --cluster=$active_cluster $host"]
set lst [RunCommand infobase::$values "connection disconnect --process=$process_id --connection=$connection_id --cluster=$active_cluster $auth $host"]
#$tree delete "infobase::$values"
.frm_work.tree_work delete [ .frm_work.tree_work children {}]
}
@ -1413,7 +1639,12 @@ proc Del::connections {tree host values} {
}
proc Del::sessions {tree host values} {
global active_cluster
global active_cluster agent_user agent_pwd cluster_user cluster_pwd
if {$cluster_user ne "" && $cluster_pwd ne ""} {
set auth "--cluster-user=$cluster_user --cluster-pwd=$cluster_pwd"
} else {
set auth ""
}
set work_tree_id [.frm_work.tree_work selection]
set work_tree_values [.frm_work.tree_work item $work_tree_id -values]
set id [.frm_tree.tree selection]
@ -1433,7 +1664,7 @@ proc Del::sessions {tree host values} {
-icon question -type yesno ]
switch -- $answer {
yes {
set lst [RunCommand infobase::$values "session terminate --session=$session_id --cluster=$active_cluster $host"]
set lst [RunCommand infobase::$values "session terminate --session=$session_id --cluster=$active_cluster $auth $host"]
#$tree delete "infobase::$values"
.frm_work.tree_work delete [ .frm_work.tree_work children {}]
}
@ -1443,7 +1674,13 @@ proc Del::sessions {tree host values} {
proc Del::rule {tree host values} {
global active_cluster server
global active_cluster server agent_user agent_pwd cluster_user cluster_pwd
if {$cluster_user ne "" && $cluster_pwd ne ""} {
set auth "--cluster-user=$cluster_user --cluster-pwd=$cluster_pwd"
} else {
set auth ""
}
set work_tree_id [.frm_work.tree_work selection]
set work_tree_values [.frm_work.tree_work item $work_tree_id -values]
set id [.frm_tree.tree selection]
@ -1466,7 +1703,7 @@ proc Del::rule {tree host values} {
-icon question -type yesno ]
switch -- $answer {
yes {
set lst [RunCommand infobase::$values "rule remove --server=$server --rule=$rule_id --cluster=$active_cluster $host"]
set lst [RunCommand infobase::$values "rule remove --server=$server --rule=$rule_id --cluster=$active_cluster $auth $host"]
#$tree delete "infobase::$values"
.frm_work.tree_work delete [ .frm_work.tree_work children {}]
}

View File

@ -58,6 +58,10 @@ if [info exists env(LANG)] {
::msgcat::mclocale $locale
::msgcat::mcload $dir(msg)
set cluster_user ""
set cluster_pwd ""
set agent_user ""
set agent_pwd ""
## LOAD FILE ##
# Load modules but maain.tcl must last loaded
foreach modFile [lsort [glob -nocomplain [file join $dir(lib) *.tcl]]] {
@ -94,3 +98,5 @@ if [file exists [file join $dir(work) 1c_srv.cfg]] {
# #option add *Frame.Background $editor(bg) interactive
# option add *ScrollableFrame.Background $editor(bg) interactive
# option add *ScrolledWindow.Background $editor(bg) interactive