public OperatingSystem apply(Template from) { Builder builder = OperatingSystem.builder().description(from.getOSType()); OSType type = osTypes.get().get(from.getOSTypeId()); if (type == null) { logger.warn("Template refers to OS type ID %s but this does not exist. Template=%s Known OS types=%s", from.getOSTypeId(), from, osTypes.get()); return builder.build(); } builder.description(type.getDescription()); builder.is64Bit(type.getDescription().indexOf("64-bit") != -1); String osCategory = osCategories.get().get(type.getOSCategoryId()); if (osCategory == null) { logger.warn("OS type refers to OS category ID %s but this does not exist. OS type=%s Known OS categories=%s", type.getOSCategoryId(), type, osCategories.get()); return builder.build(); } builder.name(osCategory); OsFamily family = OsFamily.fromValue(osCategory.toLowerCase()); builder.family(family); Matcher matcher = DEFAULT_PATTERN.matcher(type.getDescription()); if (matcher.find()) { builder.version(ComputeServiceUtils.parseVersionOrReturnEmptyString(family, matcher.group(1), osVersionMap)); } return builder.build(); } }
public OperatingSystem apply(Template from) { Builder builder = OperatingSystem.builder().description(from.getOSType()); OSType type = osTypes.get().get(from.getOSTypeId()); if (type == null) { logger.warn("Template refers to OS type ID %s but this does not exist. Template=%s Known OS types=%s", from.getOSTypeId(), from, osTypes.get()); return builder.build(); } builder.description(type.getDescription()); builder.is64Bit(type.getDescription().indexOf("64-bit") != -1); String osCategory = osCategories.get().get(type.getOSCategoryId()); if (osCategory == null) { logger.warn("OS type refers to OS category ID %s but this does not exist. OS type=%s Known OS categories=%s", type.getOSCategoryId(), type, osCategories.get()); return builder.build(); } builder.name(osCategory); OsFamily family = OsFamily.fromValue(osCategory.toLowerCase()); builder.family(family); Matcher matcher = DEFAULT_PATTERN.matcher(type.getDescription()); if (matcher.find()) { builder.version(ComputeServiceUtils.parseVersionOrReturnEmptyString(family, matcher.group(1), osVersionMap)); } return builder.build(); } }
public OperatingSystem apply(Template from) { Builder builder = OperatingSystem.builder().description(from.getOSType()); OSType type = osTypes.get().get(from.getOSTypeId()); if (type == null) { logger.warn("Template refers to OS type ID %s but this does not exist. Template=%s Known OS types=%s", from.getOSTypeId(), from, osTypes.get()); return builder.build(); } builder.description(type.getDescription()); builder.is64Bit(type.getDescription().indexOf("64-bit") != -1); String osCategory = osCategories.get().get(type.getOSCategoryId()); if (osCategory == null) { logger.warn("OS type refers to OS category ID %s but this does not exist. OS type=%s Known OS categories=%s", type.getOSCategoryId(), type, osCategories.get()); return builder.build(); } builder.name(osCategory); OsFamily family = OsFamily.fromValue(osCategory.toLowerCase()); builder.family(family); Matcher matcher = DEFAULT_PATTERN.matcher(type.getDescription()); if (matcher.find()) { builder.version(ComputeServiceUtils.parseVersionOrReturnEmptyString(family, matcher.group(1), osVersionMap)); } return builder.build(); } }
assert template.getCreated() != null : template; assert template.getFormat() != null && template.getFormat() != Template.Format.UNRECOGNIZED : template; assert template.getOSType() != null : template; assert template.getOSTypeId() != null : template; assert template.getAccount() != null : template;
assert template.getCreated() != null : template; assert template.getFormat() != null && template.getFormat() != Template.Format.UNRECOGNIZED : template; assert template.getOSType() != null : template; assert template.getOSTypeId() != null : template; assert template.getAccount() != null : template;
.zone(in.getZone()) .zoneId(in.getZoneId()) .OSType(in.getOSType()) .OSTypeId(in.getOSTypeId()) .name(in.getName())
.zone(in.getZone()) .zoneId(in.getZoneId()) .OSType(in.getOSType()) .OSTypeId(in.getOSTypeId()) .name(in.getName())
.zone(in.getZone()) .zoneId(in.getZoneId()) .OSType(in.getOSType()) .OSTypeId(in.getOSTypeId()) .name(in.getName())