public TemplateBuilder apply(TemplateBuilder b) { return b.imageDescriptionMatches(imageDescriptionRegex); }}); return (T)this;
templateBuilder.locationId(region+vm.getLocation()); if (!vm.getOs().equals("")) templateBuilder.imageDescriptionMatches(vm.getOs()); else templateBuilder.osFamily(OsFamily.UBUNTU); templateBuilder.os64Bit(vm.getIs64os());
@Test public void testUbuntuInstanceStoreGoesM3MediumNegativeLookaroundDoesntMatchTestImages() { Template template = view.getComputeService().templateBuilder() .imageMatches(EC2ImagePredicates.rootDeviceType(RootDeviceType.INSTANCE_STORE)) // need to select versions with double-digits so that lexicographic // doesn't end up prefering 9.x vs 11.x .osVersionMatches("1[012].[10][04]") // negative lookahead for daily and testing, but ensure match // ubuntu-images // http://www.regular-expressions.info/lookaround.html .imageDescriptionMatches("^(?!.*(daily|testing)).*ubuntu-images.*$").osFamily(OsFamily.UBUNTU).build(); assert template.getImage().getProviderId().startsWith("ami-") : template; assert template.getImage().getDescription().indexOf("test") == -1 : template; assert template.getImage().getDescription().indexOf("daily") == -1 : template; assertEquals(template.getImage().getOperatingSystem().getVersion(), "10.04"); assertEquals(template.getImage().getOperatingSystem().is64Bit(), false); assertEquals(template.getImage().getOperatingSystem().getFamily(), OsFamily.UBUNTU); assertEquals(template.getImage().getUserMetadata().get("rootDeviceType"), "instance-store"); assertEquals(template.getLocation().getId(), "us-east-1"); assertEquals(getCores(template.getHardware()), 1.0d); assertEquals(template.getHardware().getId(), InstanceType.M3_MEDIUM); // smallest non-deprecated supporting PV assertEquals(template.getImage().getOperatingSystem().getArch(), "paravirtual"); }
@Test public void testTemplateBuilderM1MEDIUMWithNegativeLookaroundDoesntMatchTestImages() { Template template = view.getComputeService().templateBuilder().hardwareId(InstanceType.M1_MEDIUM) // need to select versions with double-digits so that lexicographic // doesn't end up prefering 9.x vs 11.x .osVersionMatches("1[012].[10][04]") // negative lookahead for daily and testing, but ensure match // ubuntu-images // http://www.regular-expressions.info/lookaround.html .imageDescriptionMatches("^(?!.*(daily|testing)).*ubuntu-images.*$").osFamily(OsFamily.UBUNTU).build(); assert template.getImage().getProviderId().startsWith("ami-") : template; assert template.getImage().getDescription().indexOf("test") == -1 : template; assert template.getImage().getDescription().indexOf("daily") == -1 : template; assertEquals(template.getImage().getVersion(), "20100224"); assertEquals(template.getImage().getOperatingSystem().getVersion(), "10.04"); assertEquals(template.getImage().getOperatingSystem().is64Bit(), false); assertEquals(template.getImage().getOperatingSystem().getFamily(), OsFamily.UBUNTU); assertEquals(template.getImage().getUserMetadata().get("rootDeviceType"), "instance-store"); assertEquals(template.getLocation().getId(), "us-east-1"); assertEquals(getCores(template.getHardware()), 1.0d); assertEquals(template.getHardware().getId(), InstanceType.M1_MEDIUM); assertEquals(template.getImage().getOperatingSystem().getArch(), "paravirtual"); }
templateBuilder.locationId(vm.getLocation()); if (!vm.getOs().equals("")) templateBuilder.imageDescriptionMatches(vm.getOs()); else templateBuilder.osFamily(OsFamily.UBUNTU); templateBuilder.os64Bit(vm.getIs64os());
templateBuilder.locationId(node.getLocation()); if (!node.getOS().equals("")) templateBuilder.imageDescriptionMatches(node.getOS()); else templateBuilder.osFamily(OsFamily.UBUNTU); templateBuilder.os64Bit(node.getIs64os());