@Override public ProfileBuilder addOptions(ProfileBuilder builder) { List<String> missingProfiles = new ArrayList<>(); List<String> profileIds = dataStore.getContainerProfiles(cntId); LOGGER.debug("Building container overlay for {} with profile: {}", cntId, profileIds); for (String profileId : profileIds) { if (version.hasProfile(profileId)) { builder.addParent(profileId); } else { missingProfiles.add(profileId); } } if (!missingProfiles.isEmpty()) { LOGGER.warn("Container overlay has missing profiles: {}", missingProfiles); builder.addAttribute("missing.profiles", missingProfiles.toString()); // builder.addConfiguration(Constants.AGENT_PID, "disabled", "true"); } return builder; } }
@Override protected Object doExecute() throws Exception { try { FabricValidations.validateProfileName(profileId); } catch (IllegalArgumentException e) { // we do not want exception in the server log, so print the error message to the console System.out.println(e.getMessage()); return null; } if (versionId != null) { profileService.getRequiredVersion(versionId); } else { versionId = fabricService.getDefaultVersionId(); } // we can only use existing parent profiles Profile[] parents = FabricCommand.getExistingProfiles(fabricService, versionId, this.parents); ProfileBuilder builder = ProfileBuilder.Factory.create(versionId, profileId); for (Profile parent : parents) { builder.addParent(parent.getId()); } profileService.createProfile(builder.getProfile()); return null; }
builder = ProfileBuilder.Factory.create(versionId, profileId); if (parentProfile != null) { builder.addParent(parentProfile.getId());
System.out.println("Found parents: " + parentProfiles); for (Profile parent : parentProfiles) { builder.addParent(parent.getId());
System.out.println("Found parents: " + parentProfiles); for (Profile parent : parentProfiles) { builder.addParent(parent.getId());
@Override protected Object doExecute() throws Exception { Version version = versionId != null ? profileService.getRequiredVersion(versionId) : fabricService.getRequiredDefaultVersion(); Profile profile = version.getRequiredProfile(profileId); // we can only change parents to existing profiles Profile[] parents = FabricCommand.getExistingProfiles(fabricService, version, parentIds); ProfileBuilder builder = ProfileBuilder.Factory.createFrom(profile); List<String> oldParents = builder.getParents(); for (Profile parent : parents) { builder.addParent(parent.getId()); } //remove old parent profiles for (String oldParent : oldParents) { if (!parentIds.contains(oldParent)) { builder.removeParent(oldParent); } } profileService.updateProfile(builder.getProfile()); return null; }
builder.addParent(parentProfile.getId());