adutra commented on code in PR #940:
URL: https://github.com/apache/polaris/pull/940#discussion_r1942443578


##########
quarkus/admin/src/main/java/org/apache/polaris/admintool/BootstrapCommand.java:
##########
@@ -30,51 +31,94 @@
     description = "Bootstraps realms and root principal credentials.")
 public class BootstrapCommand extends BaseCommand {
 
-  @CommandLine.Option(
-      names = {"-r", "--realm"},
-      paramLabel = "<realm>",
-      required = true,
-      description = "The name of a realm to bootstrap.")
-  List<String> realms;
+  @CommandLine.ArgGroup(multiplicity = "1")
+  InputOptions inputOptions;
 
-  @CommandLine.Option(
-      names = {"-c", "--credential"},
-      paramLabel = "<realm,clientId,clientSecret>",
-      description =
-          "Root principal credentials to bootstrap. Must be of the form 
'realm,clientId,clientSecret'.")
-  List<String> credentials;
+  static class InputOptions {
+
+    @CommandLine.ArgGroup(multiplicity = "1", exclusive = false)
+    StandardInputOptions stdinOptions;
+
+    @CommandLine.ArgGroup(multiplicity = "1")
+    FileInputOptions fileOptions;
+
+    static class StandardInputOptions {
+
+      @CommandLine.Option(
+          names = {"-r", "--realm"},
+          paramLabel = "<realm>",
+          required = true,
+          description = "The name of a realm to bootstrap.")
+      List<String> realms;
+
+      @CommandLine.Option(
+          names = {"-c", "--credential"},
+          paramLabel = "<realm,clientId,clientSecret>",
+          description =
+              "Root principal credentials to bootstrap. Must be of the form 
'realm,clientId,clientSecret'.")
+      List<String> credentials;
+    }
+
+    static class FileInputOptions {
+      @CommandLine.Option(
+          names = {"-f", "--credentials-file"},
+          paramLabel = "<file>",
+          description = "A file containing root principal credentials to 
bootstrap.")
+      Path file;
+    }
+  }
 
   @Override
   public Integer call() {
-    warnOnInMemory();
-
-    PolarisCredentialsBootstrap credentialsBootstrap =
-        credentials == null || credentials.isEmpty()
-            ? PolarisCredentialsBootstrap.EMPTY
-            : PolarisCredentialsBootstrap.fromList(credentials);
-
-    // Execute the bootstrap
-    Map<String, PrincipalSecretsResult> results =
-        metaStoreManagerFactory.bootstrapRealms(realms, credentialsBootstrap);
-
-    // Log any errors:
-    boolean success = true;
-    for (Map.Entry<String, PrincipalSecretsResult> result : 
results.entrySet()) {
-      if (!result.getValue().isSuccess()) {
-        String realm = result.getKey();
-        spec.commandLine()
-            .getErr()
-            .printf(
-                "Bootstrapping '%s' failed: %s%n",
-                realm, result.getValue().getReturnStatus().toString());
-        success = false;
+    try {
+      warnOnInMemory();
+
+      RootCredentialsSet rootCredentialsSet;
+      List<String> realms; // TODO Iterable

Review Comment:
   Yes, waiting for #889 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to