Last active
October 11, 2015 12:57
-
-
Save etoews/3862499 to your computer and use it in GitHub Desktop.
jclouds workshop
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private void printResults() throws IOException { | |
for (ComputeService computeService: nodes.keySet()) { | |
try { | |
NodeMetadata node = nodes.get(computeService); | |
String publicAddress = node.getPublicAddresses().iterator().next(); | |
String provider = computeService.getContext().toString().contains("rackspace") ? "Rackspace" : "HP"; | |
System.out.println("Provider: " + provider); | |
if (node.getCredentials().getOptionalPrivateKey().isPresent()) { | |
Files.write(node.getCredentials().getPrivateKey(), new File("jclouds.pem"), UTF_8); | |
System.out.println(" Login: ssh -i jclouds.pem " + node.getCredentials().getUser() + "@" + publicAddress); | |
} | |
else { | |
System.out.println(" Login: ssh " + node.getCredentials().getUser() + "@" + publicAddress); | |
System.out.println(" Password: " + node.getCredentials().getPassword()); | |
} | |
System.out.println(" Go to http://" + publicAddress); | |
} | |
catch (Throwable e) { | |
e.printStackTrace(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment