/** extract key to a temp file, but one per machine, scheduled for deletion afterwards; * we extract the key because chef has no way to accept passphrases at present */ synchronized static File extractKeyFile(SshMachineLocation machine) { File f = new File(getExtractedKeysDir(), machine.getAddress().getHostName()+".pem"); if (f.exists()) return f; KeyPair data = machine.findKeyPair(); if (data==null) return null; try { f.deleteOnExit(); Files.write(SecureKeys.stringPem(data), f, Charset.defaultCharset()); return f; } catch (IOException e) { throw Throwables.propagate(e); } }