Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -558,16 +558,18 @@ class Suite implements GroovyInterceptable {
Assert.assertEquals(0, code)
}

void sshExec(String username, String host, String cmd) {
void sshExec(String username, String host, String cmd, boolean alert=true) {
String command = "ssh ${username}@${host} '${cmd}'"
def cmds = ["/bin/bash", "-c", command]
logger.info("Execute: ${cmds}".toString())
Process p = cmds.execute()
def errMsg = new StringBuilder()
def msg = new StringBuilder()
p.waitForProcessOutput(msg, errMsg)
assert errMsg.length() == 0: "error occurred!" + errMsg
assert p.exitValue() == 0
if (alert) {
assert errMsg.length() == 0: "error occurred!\n" + errMsg
assert p.exitValue() == 0
}
}

List<String> getFrontendIpHttpPort() {
Expand Down Expand Up @@ -872,10 +874,15 @@ class Suite implements GroovyInterceptable {
def backendId_to_backendIP = [:]
def backendId_to_backendHttpPort = [:]
getBackendIpHttpPort(backendId_to_backendIP, backendId_to_backendHttpPort)
if(backendId_to_backendIP.size() == 1) {
logger.info("Only one backend, skip scp udf file")
return
}

def udf_file_dir = new File(udf_file_path).parent
backendId_to_backendIP.values().each { be_ip ->
sshExec ("root", be_ip, "ssh -o StrictHostKeyChecking=no root@${be_ip} \"mkdir -p ${udf_file_dir}\"")
sshExec("root", be_ip, "ssh-keygen -f '/root/.ssh/known_hosts' -R \"${be_ip}\"", false)
sshExec("root", be_ip, "ssh -o StrictHostKeyChecking=no root@${be_ip} \"mkdir -p ${udf_file_dir}\"", false)
scpFiles("root", be_ip, udf_file_path, udf_file_path, false)
}
}
Expand Down