(host, path, source_file, teardown)
| 81 | return True |
| 82 | |
| 83 | def DeployJava(host, path, source_file, teardown): |
| 84 | (prefix, suffix, is_local) = GetPrefixAndSuffix(host) |
| 85 | cmd_arr = [] |
| 86 | file_name = os.path.basename(source_file) |
| 87 | if teardown: |
| 88 | print("clear java on {}. path: {}".format(host, path)) |
| 89 | cmd_arr.append("{} cd {}; rm {}; rm -rf {} {}".format(prefix, path, file_name, "jdk1.8.0_121", suffix)) |
| 90 | else: |
| 91 | print("deploy java on {}. path: {}".format(host, path)) |
| 92 | cmd_arr.append("{} mkdir -p {} {}".format(prefix, path, suffix)) |
| 93 | if is_local: |
| 94 | cmd_arr.append("cp {} {}".format(source_file, path)) |
| 95 | else: |
| 96 | cmd_arr.append("scp {} {}:{}".format(source_file, host, path)) |
| 97 | cmd_arr.append("{} cd {}; tar -zxvf {}; {}".format(prefix, path, file_name, suffix)) |
| 98 | for cmd in cmd_arr: |
| 99 | (returncode,output,errout) = RunWithRetunCode(cmd) |
| 100 | if returncode != 0: |
| 101 | print("execute cmd[{}] failed! error msg: {}".format(cmd, errout)) |
| 102 | return |
| 103 | print("execute cmd[{}] success".format(cmd)) |
| 104 | |
| 105 | |
| 106 | def DeployZookeeper(zk_conf, teardown): |
no test coverage detected