yuangu002 commented on a change in pull request #2565:
URL: https://github.com/apache/ozone/pull/2565#discussion_r696032635



##########
File path: 
hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/admin/nssummary/NSSummaryAdmin.java
##########
@@ -76,21 +87,39 @@ public boolean isFSOEnabled() {
   public String getReconWebAddress() {
     OzoneConfiguration conf = parent.getOzoneConf();
     String protocolPrefix = "";
-    InetSocketAddress reconSocket = null;
-    if (OzoneSecurityUtil.isHttpSecurityEnabled(conf)) {
+    HttpConfig.Policy webPolicy = getHttpPolicy(conf);
+
+    String name = null;
+
+    if (webPolicy == HttpConfig.Policy.HTTPS_ONLY) {
       protocolPrefix = "https://";;
-      reconSocket = HddsUtils.getReconHTTPSAddresses(conf);
+      name = conf.get(OZONE_RECON_HTTPS_ADDRESS_KEY,
+          OZONE_RECON_HTTPS_ADDRESS_DEFAULT);
     } else {
       protocolPrefix = "http://";;
-      reconSocket = HddsUtils.getReconHTTPAddresses(conf);
+      name = conf.get(OZONE_RECON_HTTP_ADDRESS_KEY,
+          OZONE_RECON_HTTP_ADDRESS_DEFAULT);
+    }
+
+    if (StringUtils.isEmpty(name)) {
+      return null;
+    }
+
+    String reconDefaultAddress = conf.get(OZONE_RECON_ADDRESS_KEY,
+        OZONE_RECON_ADDRESS_DEFAULT);
+    Optional<String> hostname = getHostName(reconDefaultAddress);
+    if (!hostname.isPresent()) {
+      throw new IllegalArgumentException("Invalid hostname for Recon: "
+          + reconDefaultAddress);
     }
-    return protocolPrefix + reconSocket.getHostName()
-        + ":" + reconSocket.getPort();
+
+    int port = getHostPort(name).orElse(OZONE_RECON_DATANODE_PORT_DEFAULT);
+    return protocolPrefix + hostname.get() + ":" + port;
   }
 
-  public boolean isSecurityEnabled() {
+  public boolean isHTTPSEnabled() {
     OzoneConfiguration conf = parent.getOzoneConf();
-    return OzoneSecurityUtil.isHttpSecurityEnabled(conf);
+    return getHttpPolicy(conf) == HttpConfig.Policy.HTTPS_ONLY;

Review comment:
       should we follow @avijayanhwx suggestion yesterday that if the policy is 
`HTTP_AND_HTTPS`, we will fall back to `HTTP`?




-- 
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]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to