You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-commits@hadoop.apache.org by su...@apache.org on 2011/09/28 00:05:43 UTC

svn commit: r1176638 - in /hadoop/common/branches/branch-0.20-security-205: CHANGES.txt src/hdfs/org/apache/hadoop/hdfs/tools/DelegationTokenFetcher.java

Author: suresh
Date: Tue Sep 27 22:05:43 2011
New Revision: 1176638

URL: http://svn.apache.org/viewvc?rev=1176638&view=rev
Log:
HDFS-2373. Commands using webhdfs and hftp print unnecessary debug info on the console with security enabled. Contributed by Arpit Gupta.

Modified:
    hadoop/common/branches/branch-0.20-security-205/CHANGES.txt
    hadoop/common/branches/branch-0.20-security-205/src/hdfs/org/apache/hadoop/hdfs/tools/DelegationTokenFetcher.java

Modified: hadoop/common/branches/branch-0.20-security-205/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-0.20-security-205/CHANGES.txt?rev=1176638&r1=1176637&r2=1176638&view=diff
==============================================================================
--- hadoop/common/branches/branch-0.20-security-205/CHANGES.txt (original)
+++ hadoop/common/branches/branch-0.20-security-205/CHANGES.txt Tue Sep 27 22:05:43 2011
@@ -230,6 +230,9 @@ Release 0.20.205.0 - 2011.09.27
 
     HDFS-2375. Fix TestFileAppend4 failure. (suresh)
 
+    HDFS-2373. Commands using webhdfs and hftp print unnecessary debug 
+    info on the console with security enabled. (Arpit Gupta via suresh)
+
   IMPROVEMENTS
 
     MAPREDUCE-2928. MR-2413 improvements (Eli Collins via mattf)

Modified: hadoop/common/branches/branch-0.20-security-205/src/hdfs/org/apache/hadoop/hdfs/tools/DelegationTokenFetcher.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-0.20-security-205/src/hdfs/org/apache/hadoop/hdfs/tools/DelegationTokenFetcher.java?rev=1176638&r1=1176637&r2=1176638&view=diff
==============================================================================
--- hadoop/common/branches/branch-0.20-security-205/src/hdfs/org/apache/hadoop/hdfs/tools/DelegationTokenFetcher.java (original)
+++ hadoop/common/branches/branch-0.20-security-205/src/hdfs/org/apache/hadoop/hdfs/tools/DelegationTokenFetcher.java Tue Sep 27 22:05:43 2011
@@ -129,29 +129,37 @@ public class DelegationTokenFetcher {
           for(Token<?> token: readTokens(tokenFile, conf)) {
             if (token.isManaged()) {
               token.cancel(conf);
-              System.out.println("Cancelled token for " + token.getService());
+              if(LOG.isDebugEnabled()) {
+                LOG.debug("Cancelled token for " + token.getService());
+              }
             }
           }          
         } else if (renew) {
           for(Token<?> token: readTokens(tokenFile, conf)) {
             if (token.isManaged()) {
               token.renew(conf);
-              System.out.println("Renewed token for " + token.getService());
+              if(LOG.isDebugEnabled()) {
+                LOG.debug("Renewed token for " + token.getService());
+              }
             }
           }          
         } else {
           if (webUrl != null) {
             getDTfromRemote(webUrl, null).
               writeTokenStorageFile(tokenFile, conf);
-            System.out.println("Fetched token via http for " + webUrl);
+            if(LOG.isDebugEnabled()) {
+              LOG.debug("Fetched token via http for " + webUrl);
+            }
           } else {
             FileSystem fs = FileSystem.get(conf);
             Token<?> token = fs.getDelegationToken(ugi.getShortUserName());
             Credentials cred = new Credentials();
             cred.addToken(token.getService(), token);
             cred.writeTokenStorageFile(tokenFile, conf);
-            System.out.println("Fetched token for " + fs.getUri() + " into " +
+            if(LOG.isDebugEnabled()) {
+              LOG.debug("Fetched token for " + fs.getUri() + " into " +
                                tokenFile);
+            }
           }        
         }
         return null;
@@ -176,7 +184,9 @@ public class DelegationTokenFetcher {
       } else {
         url.append(nnAddr).append(GetDelegationTokenServlet.PATH_SPEC);
       }
-      System.out.println("Retrieving token from: " + url);
+      if(LOG.isDebugEnabled()) {
+        LOG.debug("Retrieving token from: " + url);
+      }
       URL remoteURL = new URL(url.toString());
       SecurityUtil.fetchServiceTicket(remoteURL);
       URLConnection connection = remoteURL.openConnection();