}
File file = new File(isosDir, fileName);
List<Statement> statements = new ImmutableList.Builder<Statement>().add(
Statements.saveHttpResponseTo(URI.create(httpUrl), isosDir, fileName)).build();
StatementList statementList = new StatementList(statements);
NodeMetadata hostNode = checkNotNull(hardcodedHostToHostNodeMetadata.apply(host.get()), "hostNode");
ListenableFuture<ExecResponse> future = runScriptOnNodeFactory.submit(hostNode, statementList,
runAsRoot(false));
Futures.getUnchecked(future);
if (expectedMd5 != null) {
String filePath = isosDir + File.separator + fileName;
ListenableFuture<ExecResponse> md5future = runScriptOnNodeFactory.submit(hostNode, new Md5(filePath),
runAsRoot(false));
ExecResponse responseMd5 = Futures.getUnchecked(md5future);
assert responseMd5.getExitStatus() == 0 : hostNode.getId() + ": " + responseMd5;
checkNotNull(responseMd5.getOutput(), "iso_md5 missing");
String actualMd5 = responseMd5.getOutput().trim();
checkState(actualMd5.equals(expectedMd5), "md5 of %s is %s but expected %s", filePath, actualMd5, expectedMd5);
}
return file.getAbsolutePath();