Skip to content

Commit

Permalink
fix(pp) fixing edge push cases where content and folders from non-pus…
Browse files Browse the repository at this point in the history
…hed hosts gets dragged along by dependency, and containers in a drafted state fail to publish

ref: #30370
  • Loading branch information
wezell committed Oct 17, 2024
1 parent c7262cb commit 28cba50
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ public void handle(final File bundleFolder, final Boolean isHost) throws Excepti
List<File> contents = isHost?FileUtil.listFilesRecursively(bundleFolder, new HostBundler().getFileFilter()):
FileUtil.listFilesRecursively(bundleFolder, new ContentBundler().getFileFilter());
Collections.sort(contents);
contents = contents.stream().filter(f->f.isFile()).collect(Collectors.toList());
contents = contents.stream().filter(File::isFile).collect(Collectors.toList());
handleContents(contents, bundleFolder, isHost);
HandlerUtil.setExistingContent(config.getId(), existingContentMap);

Expand Down Expand Up @@ -326,7 +326,8 @@ private void handleContents(final Collection<File> contentsIn, final File folder
// if a host does not exist on target, skip content
if(ignoreContent(content)){
Contentlet finalContent = content;
Logger.warn(this.getClass(), "Ignoring contentlet:" + content.getIdentifier() + " | " + Try.of(()->finalContent.getTitle()).getOrElse("unknown") + " . Unable to find referenced host id:" + content.getHost());
Logger.warn(this.getClass(), "Ignoring contentlet:" + content.getIdentifier() + " | " + Try.of(
finalContent::getTitle).getOrElse("unknown") + " . Unable to find referenced host id:" + content.getHost());
continue;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ private void handleFolders(Collection<File> folders) throws DotPublishingExcepti
continue;
}

folderName = Try.of(()-> folder.getPath()).getOrNull();
folderName = Try.of(folder::getPath).getOrNull();
folderId = folderWrapper.getFolderId();
host = folderWrapper.getHost();

Expand All @@ -195,8 +195,8 @@ private void handleFolders(Collection<File> folders) throws DotPublishingExcepti
//Check Host if exists otherwise create
Host localHost = APILocator.getHostAPI().find(host.getIdentifier(), systemUser, false);
if(UtilMethods.isEmpty(()->localHost.getIdentifier())){
Logger.warn(this.getClass(), "Unable to publish folder:" + folderName + ". Unable to find referenced host id:" + folder.getHostId());
Logger.warn(this.getClass(), "Make sure the host exists with the id:" + folder.getHostId() + " before pushing the folder or run the integrity checker before pushing.");
Logger.warn(FolderHandler.class, "Unable to publish folder:" + folderName + ". Unable to find referenced host id:" + folder.getHostId());
Logger.warn(FolderHandler.class, "Make sure the host exists with the id:" + folder.getHostId() + " before pushing the folder or run the integrity checker before pushing.");
continue;

}
Expand Down Expand Up @@ -333,7 +333,7 @@ else if(!folderId.getAssetName().equals(id.getAssetName())) {
final String errorMsg = String.format("An error occurred when processing Folder in '%s': %s", workingOn,
e.getMessage());
Logger.error(this.getClass(), errorMsg);
Logger.error(this, "-- Local Folder: " + (UtilMethods.isSet(temp) ? temp.toString() : "- object is null -"));
Logger.error(this, "-- Local Folder: " + (UtilMethods.isSet(temp) ? temp : "- object is null -"));
if(UtilMethods.isSet(temp) && UtilMethods.isSet(folderName)) {
Logger.error(this, "-- folderName:" + folderName);
}
Expand Down

0 comments on commit 28cba50

Please sign in to comment.