Skip to content
Permalink
Browse files
Small improvements to the CreateServer GCE example.
  • Loading branch information
Mikołaj Zalewski authored and demobox committed Jun 9, 2014
1 parent 070e999 commit fb328b5a84040563ab0a76c29e6891cbec00c0a2
Showing 1 changed file with 6 additions and 4 deletions.
@@ -134,16 +134,17 @@ private Hardware getHardware() {
Set<? extends Hardware> profiles = computeService.listHardwareProfiles();
Hardware result = null;

for (Hardware profile: profiles) {
for (Hardware profile : profiles) {
System.out.format(" %s%n", profile);
if (profile.getId().equals(ZONE + "/f1-micro")) {
result = profile;
}
}

if (result == null) {
System.err.println("f1-micro flavor not found. Using first flavor found.%n");
System.err.println("f1-micro flavor not found. Using first flavor found:");
result = profiles.iterator().next();
System.err.format("-> %s%n", result);
}
return result;
}
@@ -159,16 +160,17 @@ private Image getImage() {
Set<? extends Image> images = computeService.listImages();
Image result = null;

for (Image image: images) {
for (Image image : images) {
System.out.format(" %s%n", image);
if (image.getOperatingSystem().getVersion().equals("debian.7.wheezy")) {
result = image;
}
}

if (result == null) {
System.err.println("Image with Debian Wheezy operating system not found. Using first image found.%n");
System.err.println("Image with Debian Wheezy operating system not found. Using first image found:");
result = images.iterator().next();
System.err.format("-> %s%n", result);
}

return result;

0 comments on commit fb328b5

Please sign in to comment.