use of org.jboss.fuse.patch.PatchService in project fuse-karaf by jboss-fuse.
the class DeleteCommand method doExecute.
@Override
protected void doExecute(PatchService service) throws Exception {
Patch patch = patchManagement.loadPatch(new PatchDetailsRequest(patchId));
if (patch == null) {
throw new PatchException("Patch '" + patchId + "' not found");
}
if (patch.getResult() != null && patch.getResult().getKarafBases().size() > 0) {
throw new PatchException("Patch '" + patchId + "' can't be deleted, as it's installed in these containers: " + patch.getResult().getKarafBases().stream().map(kb -> kb.contains("|") ? kb.split("\\s*\\|\\s*")[0] : kb).collect(Collectors.joining(", ")));
}
patchManagement.delete(patch);
System.out.println("Patch '" + patchId + "' was successfully deleted");
}
Aggregations