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 19
19
package org .apache .polaris .admintool ;
20
20
21
21
import java .util .List ;
22
+ import java .util .Map ;
22
23
import picocli .CommandLine ;
23
24
24
25
@ CommandLine .Command (
@@ -37,9 +38,26 @@ public class PurgeCommand extends BaseCommand {
37
38
@ Override
38
39
public Integer call () {
39
40
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 ;
43
61
} catch (Exception e ) {
44
62
spec .commandLine ().getErr ().println ("Purge encountered errors during operation." );
45
63
return EXIT_CODE_PURGE_ERROR ;
You can’t perform that action at this time.
0 commit comments