throw new ConsoleException("Inputted base image id's platform does not match inputted platform name."
+ StringResources.NEW_LINE
+ "Base Image ID Platform: " + image.getPlatformName()
- + "Platform: " + property.baseImage.getPathName());
+ + ", Input platform: " + property.baseImage.getPathName());
} else {
// property = new VMPropertyValue(image, image.getPlatform().getTemplate());
property = new VMPropertyValue(image);
} else if (c.getShortName() == "p") {
boolean check = false;
- for (Platform platform : PlatformList.getPlatformList()) {
- for (BaseImage image : platform.getImageList()) {
- if (image.getPlatform().getName().equals(c.getCurrentValue())) {
- check = true;
- if (property != null
- && !property.baseImage.getID().equals(image.getID())) {
- throw new ConsoleException("Inputted platform name does not match inputted base image id's platform."
- + StringResources.NEW_LINE
- + "Base Image ID Platform: " + image.getPlatformName()
- + "Platform: " + property.baseImage.getPathName());
- } else {
-// property = new VMPropertyValue(image, image.getPlatform().getTemplate());
- property = new VMPropertyValue(image);
+ if (property != null) {
+ // check inputted platform name
+ if ((property.baseImage.getPlatformName().equals(c.getCurrentValue())) ) {
+ check = true;
+ } else {
+ throw new ConsoleException("Inputted platform name does not match inputted base image id's platform."
+ + StringResources.NEW_LINE
+ + "Base Image ID Platform: " + property.baseImage.getPlatformName()
+ + ", Input Platform: " + c.getCurrentValue());
+ }
+
+ } else {
+ // Find property from platform's imagelist
+ for (Platform platform : PlatformList.getPlatformList()) {
+ if (platform.getName().equals(c.getCurrentValue())) {
+ for (BaseImage image : platform.getImageList()) {
+ if (image.getName().contains("standard")) {
+ check = true;
+ property = new VMPropertyValue(image);
+ break;
+ }
+ }
+ if (property == null) {
+ if (platform.getImageList().size() > 0) {
+ check = true;
+ property = new VMPropertyValue(platform.getImageList().get(0));
+ }
}
}
}
}
+// for (Platform platform : PlatformList.getPlatformList()) {
+// for (BaseImage image : platform.getImageList()) {
+// if (image.getPlatform().getName().equals(c.getCurrentValue())) {
+// check = true;
+// if (property != null
+// && !property.baseImage.getID().equals(image.getID())) {
+// throw new ConsoleException("Inputted platform name does not match inputted base image id's platform."
+// + StringResources.NEW_LINE
+// + "Base Image ID Platform: " + image.getPlatformName()
+// + "Platform: " + property.baseImage.getPathName());
+// } else {
+// property = new VMPropertyValue(image);
+// }
+// }
+// }
+// }
if (!check) {
throw new ConsoleException("The Platform (" + c.getCurrentValue() +") is not avaliable.");