File tree Expand file tree Collapse file tree 1 file changed +21
-3
lines changed
quarkus/admin/src/main/java/org/apache/polaris/admintool Expand file tree Collapse file tree 1 file changed +21
-3
lines changed Original file line number Diff line number Diff line change 1919package org .apache .polaris .admintool ;
2020
2121import java .util .List ;
22+ import java .util .Map ;
2223import picocli .CommandLine ;
2324
2425@ CommandLine .Command (
@@ -37,9 +38,26 @@ public class PurgeCommand extends BaseCommand {
3738 @ Override
3839 public Integer call () {
3940 try {
40- metaStoreManagerFactory .purgeRealms (realms );
41- spec .commandLine ().getOut ().println ("Purge completed successfully." );
42- return 0 ;
41+ var result = metaStoreManagerFactory .purgeRealms (realms );
42+ var failed =
43+ result .entrySet ().stream ()
44+ .filter (e -> !e .getValue ().isSuccess ())
45+ .map (Map .Entry ::getKey )
46+ .toList ();
47+ if (failed .isEmpty ()) {
48+ spec .commandLine ().getOut ().println ("Purge completed successfully." );
49+ return 0 ;
50+ }
51+
52+ var out = spec .commandLine ().getOut ();
53+ failed .forEach (
54+ r ->
55+ out .printf (
56+ "Realm %s is not bootstrapped, could not load root principal. Please run Bootstrap command.%n" ,
57+ r ));
58+
59+ spec .commandLine ().getErr ().printf ("Purge encountered errors during operation." );
60+ return EXIT_CODE_PURGE_ERROR ;
4361 } catch (Exception e ) {
4462 spec .commandLine ().getErr ().println ("Purge encountered errors during operation." );
4563 return EXIT_CODE_PURGE_ERROR ;
You can’t perform that action at this time.
0 commit comments