public static File createTmpDirectory() { try { File dir = File.createTempFile("temp", "tmp-" + UuidUtil.newUnsecureUuidString()); if (!dir.delete()) { throw new UncheckedIOException("Failed to delete temp file '" + dir.getAbsolutePath() + "'"); } if (!dir.mkdir()) { throw new UncheckedIOException("Failed to create temp directory '" + dir.getAbsolutePath() + "'"); } dir.deleteOnExit(); return dir; } catch (IOException e) { throw new UncheckedIOException(e); } }
public static File createTmpDirectory() { try { File dir = File.createTempFile("temp", "tmp-" + UuidUtil.newUnsecureUuidString()); if (!dir.delete()) { throw new UncheckedIOException("Failed to delete temp file '" + dir.getAbsolutePath() + "'"); } if (!dir.mkdir()) { throw new UncheckedIOException("Failed to create temp directory '" + dir.getAbsolutePath() + "'"); } dir.deleteOnExit(); return dir; } catch (IOException e) { throw new UncheckedIOException(e); } }
private void executeInitScript(String ip) { File initFile = newFile("init-" + newUnsecureUuidString() + ".sh"); writeText(loadInitScript(), initFile); bash.scpToRemote(ip, initFile, "init.sh"); bash.sshTTY(ip, "bash init.sh"); deleteQuiet(initFile); }