HDFS-2373. Commands using webhdfs and hftp print unnecessary debug info on the console with security enabled. Contributed by Arpit Gupta.
git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1176654 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
8e4c70fb20
commit
201b7879ba
|
@ -72,6 +72,9 @@ Trunk (unreleased changes)
|
|||
HDFS-2366. Initialize WebHdfsFileSystem.ugi in object construction.
|
||||
(szetszwo)
|
||||
|
||||
HDFS-2373. Commands using webhdfs and hftp print unnecessary debug
|
||||
info on the console with security enabled. (Arpit Gupta via suresh)
|
||||
|
||||
Release 0.23.0 - Unreleased
|
||||
|
||||
INCOMPATIBLE CHANGES
|
||||
|
|
|
@ -149,7 +149,9 @@ public class DelegationTokenFetcher {
|
|||
DataInputStream in = new DataInputStream(
|
||||
new ByteArrayInputStream(token.getIdentifier()));
|
||||
id.readFields(in);
|
||||
System.out.println("Token (" + id + ") for " + token.getService());
|
||||
if(LOG.isDebugEnabled()) {
|
||||
LOG.debug("Token (" + id + ") for " + token.getService());
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
@ -160,22 +162,28 @@ public class DelegationTokenFetcher {
|
|||
for (Token<?> token : readTokens(tokenFile, conf)) {
|
||||
result = renewDelegationToken(webUrl,
|
||||
(Token<DelegationTokenIdentifier>) token);
|
||||
System.out.println("Renewed token via " + webUrl + " for "
|
||||
+ token.getService() + " until: " + new Date(result));
|
||||
if(LOG.isDebugEnabled()) {
|
||||
LOG.debug("Renewed token via " + webUrl + " for "
|
||||
+ token.getService() + " until: " + new Date(result));
|
||||
}
|
||||
}
|
||||
} else if (cancel) {
|
||||
for (Token<?> token : readTokens(tokenFile, conf)) {
|
||||
cancelDelegationToken(webUrl,
|
||||
(Token<DelegationTokenIdentifier>) token);
|
||||
System.out.println("Cancelled token via " + webUrl + " for "
|
||||
+ token.getService());
|
||||
if(LOG.isDebugEnabled()) {
|
||||
LOG.debug("Cancelled token via " + webUrl + " for "
|
||||
+ token.getService());
|
||||
}
|
||||
}
|
||||
} else {
|
||||
Credentials creds = getDTfromRemote(webUrl, renewer);
|
||||
creds.writeTokenStorageFile(tokenFile, conf);
|
||||
for (Token<?> token : creds.getAllTokens()) {
|
||||
System.out.println("Fetched token via " + webUrl + " for "
|
||||
+ token.getService() + " into " + tokenFile);
|
||||
if(LOG.isDebugEnabled()) {
|
||||
LOG.debug("Fetched token via " + webUrl + " for "
|
||||
+ token.getService() + " into " + tokenFile);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
@ -184,24 +192,30 @@ public class DelegationTokenFetcher {
|
|||
for (Token<?> token : readTokens(tokenFile, conf)) {
|
||||
((DistributedFileSystem) fs)
|
||||
.cancelDelegationToken((Token<DelegationTokenIdentifier>) token);
|
||||
System.out.println("Cancelled token for "
|
||||
+ token.getService());
|
||||
if(LOG.isDebugEnabled()) {
|
||||
LOG.debug("Cancelled token for "
|
||||
+ token.getService());
|
||||
}
|
||||
}
|
||||
} else if (renew) {
|
||||
long result;
|
||||
for (Token<?> token : readTokens(tokenFile, conf)) {
|
||||
result = ((DistributedFileSystem) fs)
|
||||
.renewDelegationToken((Token<DelegationTokenIdentifier>) token);
|
||||
System.out.println("Renewed token for " + token.getService()
|
||||
+ " until: " + new Date(result));
|
||||
if(LOG.isDebugEnabled()) {
|
||||
LOG.debug("Renewed token for " + token.getService()
|
||||
+ " until: " + new Date(result));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
Token<?> token = fs.getDelegationToken(renewer);
|
||||
Credentials cred = new Credentials();
|
||||
cred.addToken(token.getService(), token);
|
||||
cred.writeTokenStorageFile(tokenFile, conf);
|
||||
System.out.println("Fetched token for " + token.getService()
|
||||
+ " into " + tokenFile);
|
||||
if(LOG.isDebugEnabled()) {
|
||||
LOG.debug("Fetched token for " + token.getService()
|
||||
+ " into " + tokenFile);
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
|
@ -221,6 +235,11 @@ public class DelegationTokenFetcher {
|
|||
} else {
|
||||
url.append(nnAddr).append(GetDelegationTokenServlet.PATH_SPEC);
|
||||
}
|
||||
|
||||
if(LOG.isDebugEnabled()) {
|
||||
LOG.debug("Retrieving token from: " + url);
|
||||
}
|
||||
|
||||
URL remoteURL = new URL(url.toString());
|
||||
SecurityUtil.fetchServiceTicket(remoteURL);
|
||||
URLConnection connection = remoteURL.openConnection();
|
||||
|
|
Loading…
Reference in New Issue