1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-08-05 16:15:50 +03:00
This commit is contained in:
David Hill
2017-05-24 13:23:41 -05:00
parent ac382a5560
commit 232e819fa7
7 changed files with 1104 additions and 27 deletions

View File

@@ -7,11 +7,10 @@
# Argument 2 - Remote Server password
# Argument 3 - Command
# Argument 4 - debug flag
# Argument 5 - Command Line Prompt (optional)
# Argument 6 - Remote user name (optional)
# Argument 7 - Force a tty to be allocated (optional)
# Argument 5 - Remote user name (optional)
# Argument 6 - Force a tty to be allocated (optional)
set stty_init {cols 512 -opost};
set timeout 30
set timeout 10
set SERVER [lindex $argv 0]
set PASSWORD [lindex $argv 1]
set COMMAND [lindex $argv 2]
@@ -34,7 +33,7 @@ if { $TTYOPT != "" } {
}
log_user $DEBUG
spawn -noecho /bin/bash
expect -re {[$#>] }
#expect -re {[$#] }
if { $PASSWORD == "ssh" } {
set PASSWORD ""
@@ -43,8 +42,9 @@ if { $PASSWORD == "ssh" } {
#
# send command
#
send "ssh $TTY $USERNAME@$SERVER $COMMAND\n"
send "ssh -v $TTY $USERNAME@$SERVER '$COMMAND'\n"
expect {
"cannot access" { exit 1}
"Host key verification failed" { send_user "FAILED: Host key verification failed\n" ; exit 1}
"service not known" { send_user " FAILED: Invalid Host\n" ; exit 1}
"ssh: connect to host" { send_user " FAILED: Invalid Host\n" ; exit 1 }
@@ -58,15 +58,34 @@ expect {
}
"word: " { send "$PASSWORD\n" }
"passphrase" { send "$PASSWORD\n" }
"No such file" { send_user "FAILED: File doesn't exist\n" ; exit 1}
-re {[$#] } { exit 0 }
"command not found" { exit 3 }
# -re {[$#] } { exit 0 }
"Exit status 0" { exit 0 }
"Exit status 1" { exit 1 }
"Exit status 3" { exit 1 }
"Exit status 4" { exit 1 }
timeout { exit 2 }
"Permission denied, please try again" { send_user "FAILED: Invalid password\n" ; exit 1 }
}
expect {
"No such file" { send_user "FAILED: File doesn't exist\n" ; exit 1}
-re {[$#>] } { exit 0 }
"Permission denied" { send_user " FAILED: Invalid password\n" ; exit 1 }
"(y or n)" { send "y\n"
-re {[$#] } { exit 0 }
"command not found" { exit 3 }
# -re {[$#] } { exit 0 }
"Exit status 0" { exit 0 }
"Exit status 1" { exit 1 }
"Exit status 3" { exit 1 }
"Exit status 4" { exit 1 }
timeout { exit 2 }
"cannot access" { exit 1}
"Permission denied, please try again" { send_user "FAILED: Invalid password\n" ; exit 1 }
"(y or n)" { send "y\n"
"command not found" { exit 3 }
# expect -re {[$#] } { exit 0 }
"Exit status 0" { exit 0 }
"Exit status 1" { exit 1 }
"Exit status 3" { exit 1 }
"Exit status 4" { exit 1 }
timeout { exit 2 }
}
}
exit 0

View File

@@ -6,7 +6,7 @@
# Argument 1 - Remote Server Host Name or IP address
# Argument 2 - Remote Server root password
# Argument 3 - Command
set timeout 30
set timeout 10
set USERNAME $env(USER)"@"
set SERVER [lindex $argv 0]
set PASSWORD [lindex $argv 1]
@@ -22,9 +22,12 @@ if { $PASSWORD == "ssh" } {
#
# send command
#
expect -re {[$#] }
send "scp $USERNAME$SERVER:$FILE .\n"
#expect -re {[$#] }
send "scp -v $USERNAME$SERVER:$FILE .\n"
expect {
"Exit status 0" { exit 0 }
"Exit status 1" { exit 1 }
"100%" { send_user "DONE\n" ; exit 0 }
"authenticity" { send "yes\n"
expect {
"word: " { send "$PASSWORD\n" }
@@ -38,16 +41,18 @@ expect {
"Connection closed" { send_user "ERROR: Connection closed\n" ; exit 1 }
"word: " { send "$PASSWORD\n" }
"passphrase" { send "$PASSWORD\n" }
"scp:" { send_user "FAILED\n" ; exit 1 }
"Permission denied, please try again" { send_user "FAILED: Invalid password\n" ; exit 1 }
}
expect {
"100%" { send_user "DONE\n" }
"Exit status 0" { exit 0 }
"Exit status 1" { exit 1 }
"100%" { send_user "DONE\n" ; exit 0 }
"scp:" { send_user "FAILED\n" ; exit 1 }
"Permission denied" { send_user "FAILED: Invalid password\n" ; exit 1 }
"Permission denied, please try again" { send_user "FAILED: Invalid password\n" ; exit 1 }
"No such file or directory" { send_user "FAILED: No such file or directory\n" ; exit 1 }
"Connection refused" { send_user "ERROR: Connection refused\n" ; exit 1 }
"Connection closed" { send_user "ERROR: Connection closed\n" ; exit 1 }
}
#sleep to make sure it's finished
sleep 5
exit 0

View File

@@ -22,9 +22,11 @@ if { $PASSWORD == "ssh" } {
#
# send command
#
expect -re "# "
send "scp $FILE $USERNAME$SERVER:$FILE\n"
send "scp -v $FILE $USERNAME$SERVER:$FILE\n"
expect {
"Exit status 0" { exit 0 }
"Exit status 1" { exit 1 }
-re "100%" { send_user "DONE\n" ; sleep 2; exit 0 }
-re "authenticity" { send "yes\n"
expect {
-re "word: " { send "$PASSWORD\n" }
@@ -39,16 +41,17 @@ expect {
-re "word: " { send "$PASSWORD\n" }
-re "passphrase" { send "$PASSWORD\n" }
-re "WARNING:" { send "rm -f /root/.ssh/known_hosts" ; exit 1 }
-re "Permission denied, please try again" { send_user "FAILED: Invalid password\n" ; exit 1 }
}
expect {
-re "100%" { send_user "DONE\n" }
"Exit status 0" { exit 0 }
"Exit status 1" { exit 1 }
-re "100%" { send_user "DONE\n" ; sleep 2 ; exit 0 }
-re "scp:" { send_user "FAILED\n" ; exit 1 }
-re "Permission denied" { send_user "FAILED: Invalid password\n" ; exit 1 }
-re "Permission denied, please try again" { send_user "FAILED: Invalid password\n" ; exit 1 }
-re "No such file or directory" { send_user "FAILED: Invalid file\n" ; exit 1 }
-re "Connection refused" { send_user "FAILED: Connection refused\n" ; exit 1 }
-re "Connection closed" { send_user "ERROR: Connection closed\n" ; exit 1 }
}
#sleep to make sure it's finished
sleep 5
exit 0

View File

@@ -23,4 +23,4 @@ add_subdirectory(idbhdfs)
add_subdirectory(winport)
add_subdirectory(thrift)
add_subdirectory(querytele)
add_subdirectory(clusterTester)

View File

@@ -0,0 +1,5 @@
install(PROGRAMS columnstoreClusterTester.sh
os_detect.sh
DESTINATION ${ENGINE_BINDIR} COMPONENT platform)

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,40 @@
#!/bin/sh
#
detectOS () {
checkFile1=/etc/os-release
checkFile2=/etc/centos-release
if [ -f "$checkFile1" ]
then
osPrettyName=`cat $checkFile1 | grep PRETTY_NAME|awk -F"=" '{print $2}'`
osVersionID=`cat $checkFile1 | grep VERSION_ID | awk -F"=" '{print $2}' | awk -F"." '{print $1}' | sed 's/"//g'`
else
osPrettyName=`head -n 1 $checkFile2`
osVersionID=`echo $osPrettyName | awk -F" " '{print $3}' | awk -F"." '{print $1}'`
fi
#
osName=`echo $osPrettyName | awk -F" " '{print $1}' | sed 's/"//g'`
if [ -z "$osPrettyName" ]
then
osPrettyName=`uname -o -s -r -v`
fi
if [ -z "$osName" ] || [ -z "$osVersionID" ]
then
osTag=""
else
osTag=`echo $osName$osVersionID | awk '{print tolower($0)}'`
fi
}
#
detectOS
echo Operating System name: $osPrettyName
echo Operating System tag: $osTag
case "$osTag" in
centos6|centos7|ubuntu16|debian8|suse12)
;;
*)
echo OS not supported
exit 1
;;
esac
exit 0