Skip to content

Commit

Permalink
MID-8842 ninja - improved logging
Browse files Browse the repository at this point in the history
  • Loading branch information
1azyman committed Aug 2, 2023
1 parent 70e2dc1 commit d090ab8
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import java.io.Writer;
import java.util.Collection;
import java.util.List;
import java.util.Objects;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.Callable;

Expand Down Expand Up @@ -69,6 +70,14 @@ public VerifyResult execute() throws Exception {
"Verification finished, {} critical, {} necessary, {} optional issues found",
result.getCriticalCount(), result.getNecessaryCount(), result.getOptionalCount());

if (options.getOutput() != null) {
log.info("Verification report saved to '{}'", options.getOutput().getPath());

if (Objects.equals(VerifyOptions.ReportStyle.CSV, options.getReportStyle())) {
log.info("XML dump with delta for each item saved to '{}'", options.getOutput().getPath() + VerificationReporter.DELTA_FILE_NAME_SUFFIX);
}
}

return result;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,15 @@ public ActionResult<Void> execute() throws Exception {

VerifyAction verifyAction = new VerifyAction();
verifyAction.init(context, verifyOptions);
VerifyResult verifyresult = executeAction(verifyAction);
if (!verifyresult.hasCriticalItems()) {
VerifyResult verifyResult = executeAction(verifyAction);
if (!verifyResult.hasCriticalItems()) {
log.info(Ansi.ansi().fgGreen().a("Pre-upgrade verification succeeded.").reset().toString());
} else {
log.error(Ansi.ansi().fgRed().a("Pre-upgrade verification failed with critical items.").reset().toString());
log.error(Ansi.ansi().fgRed().a("Pre-upgrade verification failed with {} critical items.").reset().toString(), verifyResult.getCriticalCount());
log.error("To get rid of critical items, please run 'verify' command, review the results and then run 'upgrade-objects' before upgrading the distribution.");
log.error("Example commands:\n\n"
+ "\tninja.sh verify --report-style csv --output verify-output.csv\n"
+ "\tninja.sh upgrade-objects --verification-file verify-output.csv\n");
return null;
}
} else {
Expand Down

0 comments on commit d090ab8

Please sign in to comment.