You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pinot.apache.org by xi...@apache.org on 2020/12/25 22:21:50 UTC

[incubator-pinot] branch master updated: Adding a version option to pinot admin to show all the component versions (#6380)

This is an automated email from the ASF dual-hosted git repository.

xiangfu pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-pinot.git


The following commit(s) were added to refs/heads/master by this push:
     new fed6750  Adding a version option to pinot admin to show all the component versions (#6380)
fed6750 is described below

commit fed6750f72ff3349c57c734f5f172c4207dee01c
Author: Xiang Fu <fx...@gmail.com>
AuthorDate: Fri Dec 25 14:21:33 2020 -0800

    Adding a version option to pinot admin to show all the component versions (#6380)
---
 .../apache/pinot/tools/admin/PinotAdministrator.java   | 18 ++++++++++++++++--
 1 file changed, 16 insertions(+), 2 deletions(-)

diff --git a/pinot-tools/src/main/java/org/apache/pinot/tools/admin/PinotAdministrator.java b/pinot-tools/src/main/java/org/apache/pinot/tools/admin/PinotAdministrator.java
index 83c90da..d1fc6df 100644
--- a/pinot-tools/src/main/java/org/apache/pinot/tools/admin/PinotAdministrator.java
+++ b/pinot-tools/src/main/java/org/apache/pinot/tools/admin/PinotAdministrator.java
@@ -19,6 +19,8 @@
 package org.apache.pinot.tools.admin;
 
 import java.lang.reflect.Field;
+import java.util.Map;
+import org.apache.pinot.common.Utils;
 import org.apache.pinot.spi.plugin.PluginManager;
 import org.apache.pinot.tools.Command;
 import org.apache.pinot.tools.admin.command.AddSchemaCommand;
@@ -136,6 +138,9 @@ public class PinotAdministrator {
 
   @Option(name = "-help", required = false, help = true, aliases = {"-h", "--h", "--help"}, usage = "Print this message.")
   boolean _help = false;
+
+  @Option(name = "-version", required = false, help = true, aliases = {"-v", "--v", "--version"}, usage = "Print the version of Pinot package.")
+  boolean _version = false;
   boolean _status = false;
 
   private boolean getStatus() {
@@ -146,8 +151,9 @@ public class PinotAdministrator {
     try {
       CmdLineParser parser = new CmdLineParser(this);
       parser.parseArgument(args);
-
-      if ((_subCommand == null) || _help) {
+      if (_version) {
+        printVersion();
+      } else if ((_subCommand == null) || _help) {
         printUsage();
       } else if (_subCommand.getHelp()) {
         _subCommand.printUsage();
@@ -162,6 +168,14 @@ public class PinotAdministrator {
     }
   }
 
+  private void printVersion() {
+    LOGGER.info("List All Pinot Component Versions:");
+    Map<String, String> componentVersions = Utils.getComponentVersions();
+    for (Map.Entry<String, String> entry : componentVersions.entrySet()) {
+      LOGGER.info("Package: {}, Version: {}", entry.getKey(), entry.getValue());
+    }
+  }
+
   public static void main(String[] args) {
     PluginManager.get().init();
     PinotAdministrator pinotAdministrator = new PinotAdministrator();


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org