in cloud-vmware-agent/src/main/java/jetbrains/buildServer/clouds/vmware/VMWarePropertiesReader.java [133:170]
private String getPropertyValue(String propName) {
final GeneralCommandLine commandLine = new GeneralCommandLine();
if (myVMWareRPCToolPath.contains(" ") && SystemInfo.isMac) {
commandLine.setExePath("/bin/sh");
commandLine.addParameter("-c");
final String specialCommand = SPECIAL_COMMAND_FORMATS.get(myVMWareRPCToolPath);
final String param = String.format(specialCommand != null ? specialCommand : "info-get %s", propName);
commandLine.addParameter(String.format("\"%s\" %s", myVMWareRPCToolPath, param));
} else {
commandLine.setExePath(myVMWareRPCToolPath);
final String specialCommand = SPECIAL_COMMAND_FORMATS.get(myVMWareRPCToolPath);
final String param = String.format(specialCommand != null ? specialCommand : "info-get %s", propName);
commandLine.addParameter(param);
}
final CommandLineExecutor executor = new CommandLineExecutor(commandLine);
return myRetrier.execute(() -> {
final int executionTimeoutSeconds = TeamCityProperties.getInteger("teamcity.vsphere.properties.readTimeout.sec", 60);
final ExecResult result = executor.runProcess(executionTimeoutSeconds);
if (result != null) {
final String executionResult = StringUtil.trim(result.getStdout());
final StringBuilder commandOutput = new StringBuilder();
final String errorOutput = StringUtil.trim(result.getStderr());
commandOutput.append("Stdout: ").append(executionResult).append('\n');
commandOutput.append("Stderr: ").append(errorOutput).append('\n');
commandOutput.append("Exit code:").append(result.getExitCode());
if (result.getExitCode() != 0) {
LOG.warn("Got non-zero exit code for '" + commandLine.toString() + "':\n" + commandOutput.toString());
throw new RpcToolException(errorOutput);
}
return executionResult;
} else {
LOG.warn("Didn't get response for " + commandLine.toString() + " in " + executionTimeoutSeconds + " seconds.\n" +
"Consider setting agent property 'teamcity.guest.props.read.timeout.sec' to a higher value (default=5)");
return null;
}
});
}