You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ozone.apache.org by "will-sh (via GitHub)" <gi...@apache.org> on 2026/05/23 12:29:11 UTC

[PR] HDDS-15185. Create submodule ozone-cli-interactive [ozone]

will-sh opened a new pull request, #10348:
URL: https://github.com/apache/ozone/pull/10348

   ## What changes were proposed in this pull request?
   HDDS-15185. Create submodule ozone-cli-interactive
   
   This change introduces a dedicated Maven module `ozone-cli-interactive` for the top-level `ozone interactive` command and refactors how subcommands are wired into the interactive shell.
   
   Please describe your PR in detail:
   [HDDS-11838](https://issues.apache.org/jira/browse/HDDS-11838) / [#10134](https://github.com/apache/ozone/pull/10134) added `OzoneInteractiveShell` under `ozone-cli-shell`. Subcommands in the same module (`sh`, `tenant`, `s3`) were registered statically, while `admin`, `debug`, and `repair` were loaded at runtime via reflection (`Class.forName`). The `ozone` launcher script also stitched additional CLI classpaths at runtime for the `interactive` subcommand. That approach works but is fragile and harder to maintain.
   This PR addresses the follow-up described in [HDDS-15185](https://issues.apache.org/jira/browse/HDDS-15185) (parent: [HDDS-11825](https://issues.apache.org/jira/browse/HDDS-11825)):
   * **New module `ozone-cli-interactive`** — `OzoneInteractiveShell` is moved from `ozone-cli-shell` into this module.
   * **Static Maven dependencies** — the interactive module depends on `ozone-cli-shell`, `ozone-cli-admin`, and `ozone-cli-debug` (per Jira: **except repair**). Subcommands are registered with regular method calls (`new OzoneAdmin().getCmd()`, etc.); reflection and `addDynamicSubcommand()` are removed.
   * **Dist and launcher** — `ozone-dist` depends on `ozone-cli-interactive`; the `interactive` branch in `hadoop-ozone/dist/src/shell/ozone/ozone` sets `OZONE_RUN_ARTIFACT_NAME=ozone-cli-interactive` and drops the loop that dynamically appended admin/debug/repair/tools classpaths.
   * **License metadata** — `jar-report.txt` is updated for `ozone-cli-interactive.jar` in the distribution.
   The interactive user experience (`ozone>` prompt, JLine/Picocli REPL in `REPL.java`) is unchanged; only packaging and command registration are improved.
   
   ## What is the link to the Apache JIRA
   https://issues.apache.org/jira/browse/HDDS-15185
   
   ## How was this patch tested?
   
   * CI workflow runs on the contributor fork (`will-sh/ozone`, branch `HDDS-15185`) is successful.
   * Manual smoke test: build dist, start docker compose cluster, run `ozone interactive` and exercise `sh`, `admin`, and `debug` subcommands; confirm `repair` is not exposed as a top-level interactive subcommand per Jira scope.
   


-- 
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: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org


Re: [PR] HDDS-15185. Create submodule ozone-cli-interactive [ozone]

Posted by "adoroszlai (via GitHub)" <gi...@apache.org>.
adoroszlai merged PR #10348:
URL: https://github.com/apache/ozone/pull/10348


-- 
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: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org


Re: [PR] HDDS-15185. Create submodule ozone-cli-interactive [ozone]

Posted by "will-sh (via GitHub)" <gi...@apache.org>.
will-sh commented on PR #10348:
URL: https://github.com/apache/ozone/pull/10348#issuecomment-4534696950

   Thanks for review @smengcl @adoroszlai .
   I found a few more issues:
   1. Found a bug the tab completion in ozone interactive works for the first token (sh, s3, …) but not for deeper tokens (sh vol, sh vol create). 
   Created following task to fix it:
   https://issues.apache.org/jira/browse/HDDS-15354
   2. Should we remove or dynamically adapt the horizontal divider created by the ozone interactive command?
   Currently, the divider line is static. When a user changes their terminal window size, it causes rendering issues (either ugly line-wrapping or truncation). Removing it or making it responsive to the terminal width would fix this UI artifact. (It might need a new jira)
   ```
   bash-5.1$ ozone interactive
   ozone> 
   ───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
   ```


-- 
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: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org


Re: [PR] HDDS-15185. Create submodule ozone-cli-interactive [ozone]

Posted by "adoroszlai (via GitHub)" <gi...@apache.org>.
adoroszlai commented on code in PR #10348:
URL: https://github.com/apache/ozone/pull/10348#discussion_r3294307033


##########
hadoop-ozone/cli-interactive/src/main/java/org/apache/hadoop/ozone/shell/OzoneInteractiveShell.java:
##########
@@ -29,24 +30,18 @@
  */
 public final class OzoneInteractiveShell {
 
-  private static final Logger LOG = LoggerFactory.getLogger(OzoneInteractiveShell.class);
-
   private OzoneInteractiveShell() {
   }
 
   public static void main(String[] argv) throws Exception {
     PicocliCommandsFactory factory = new PicocliCommandsFactory();
     CommandLine topCmd = new CommandLine(new TopCommand(), factory);
 
-    // Add known subcommands statically if they are in the same module.
     topCmd.addSubcommand("sh", new OzoneShell().getCmd());
-    topCmd.addSubcommand("tenant", new org.apache.hadoop.ozone.shell.tenant.TenantShell().getCmd());
-    topCmd.addSubcommand("s3", new org.apache.hadoop.ozone.shell.s3.S3Shell().getCmd());
-
-    // Dynamically add subcommands from other modules to avoid circular dependencies.
-    addDynamicSubcommand(topCmd, "admin", "org.apache.hadoop.ozone.admin.OzoneAdmin");
-    addDynamicSubcommand(topCmd, "debug", "org.apache.hadoop.ozone.debug.OzoneDebug");
-    addDynamicSubcommand(topCmd, "repair", "org.apache.hadoop.ozone.repair.OzoneRepair");

Review Comment:
   Repair commands are "dangerous" and most need to be run with components (OM, etc.) stopped.  I don't think they should be mixed with other commands.  I can't remember a more specific reason for adding it as exception in HDDS-15185 description.



-- 
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: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org


Re: [PR] HDDS-15185. Create submodule ozone-cli-interactive [ozone]

Posted by "smengcl (via GitHub)" <gi...@apache.org>.
smengcl commented on code in PR #10348:
URL: https://github.com/apache/ozone/pull/10348#discussion_r3293426102


##########
hadoop-ozone/cli-interactive/src/main/java/org/apache/hadoop/ozone/shell/OzoneInteractiveShell.java:
##########
@@ -29,24 +30,18 @@
  */
 public final class OzoneInteractiveShell {
 
-  private static final Logger LOG = LoggerFactory.getLogger(OzoneInteractiveShell.class);
-
   private OzoneInteractiveShell() {
   }
 
   public static void main(String[] argv) throws Exception {
     PicocliCommandsFactory factory = new PicocliCommandsFactory();
     CommandLine topCmd = new CommandLine(new TopCommand(), factory);
 
-    // Add known subcommands statically if they are in the same module.
     topCmd.addSubcommand("sh", new OzoneShell().getCmd());
-    topCmd.addSubcommand("tenant", new org.apache.hadoop.ozone.shell.tenant.TenantShell().getCmd());
-    topCmd.addSubcommand("s3", new org.apache.hadoop.ozone.shell.s3.S3Shell().getCmd());
-
-    // Dynamically add subcommands from other modules to avoid circular dependencies.
-    addDynamicSubcommand(topCmd, "admin", "org.apache.hadoop.ozone.admin.OzoneAdmin");
-    addDynamicSubcommand(topCmd, "debug", "org.apache.hadoop.ozone.debug.OzoneDebug");
-    addDynamicSubcommand(topCmd, "repair", "org.apache.hadoop.ozone.repair.OzoneRepair");

Review Comment:
   add a comment line explaining why repair is ignored here?



-- 
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: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org


Re: [PR] HDDS-15185. Create submodule ozone-cli-interactive [ozone]

Posted by "adoroszlai (via GitHub)" <gi...@apache.org>.
adoroszlai commented on PR #10348:
URL: https://github.com/apache/ozone/pull/10348#issuecomment-4534647798

   Thanks @will-sh for the patch, @smengcl for the review.


-- 
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: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org


Re: [PR] HDDS-15185. Create submodule ozone-cli-interactive [ozone]

Posted by "will-sh (via GitHub)" <gi...@apache.org>.
will-sh commented on PR #10348:
URL: https://github.com/apache/ozone/pull/10348#issuecomment-4534831968

   Thx, created a task https://issues.apache.org/jira/browse/HDDS-15368 to remove the divider.


-- 
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: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org


Re: [PR] HDDS-15185. Create submodule ozone-cli-interactive [ozone]

Posted by "adoroszlai (via GitHub)" <gi...@apache.org>.
adoroszlai commented on PR #10348:
URL: https://github.com/apache/ozone/pull/10348#issuecomment-4534736212

   > 1. Found a bug the tab completion in ozone interactive works for the first token (sh, s3, …) but not for deeper tokens (sh vol, sh vol create).
   >    Created following task to fix it:
   >    https://issues.apache.org/jira/browse/HDDS-15354
   
   I also noticed that while testing this change (and confirmed that it had the same problem before, too).  Thanks for filing HDDS-15354.
   
   > 2. Should we remove or dynamically adapt the horizontal divider created by the ozone interactive command?
   >    Currently, the divider line is static. When a user changes their terminal window size, it causes rendering issues (either ugly line-wrapping or truncation). Removing it or making it responsive to the terminal width would fix this UI artifact. (It might need a new jira)
   
   Yes, would be nice.


-- 
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: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org