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.
|
HDFS-2366. Initialize WebHdfsFileSystem.ugi in object construction.
|
||||||
(szetszwo)
|
(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
|
Release 0.23.0 - Unreleased
|
||||||
|
|
||||||
INCOMPATIBLE CHANGES
|
INCOMPATIBLE CHANGES
|
||||||
|
@ -149,7 +149,9 @@ public Object run() throws Exception {
|
|||||||
DataInputStream in = new DataInputStream(
|
DataInputStream in = new DataInputStream(
|
||||||
new ByteArrayInputStream(token.getIdentifier()));
|
new ByteArrayInputStream(token.getIdentifier()));
|
||||||
id.readFields(in);
|
id.readFields(in);
|
||||||
System.out.println("Token (" + id + ") for " + token.getService());
|
if(LOG.isDebugEnabled()) {
|
||||||
|
LOG.debug("Token (" + id + ") for " + token.getService());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@ -160,22 +162,28 @@ public Object run() throws Exception {
|
|||||||
for (Token<?> token : readTokens(tokenFile, conf)) {
|
for (Token<?> token : readTokens(tokenFile, conf)) {
|
||||||
result = renewDelegationToken(webUrl,
|
result = renewDelegationToken(webUrl,
|
||||||
(Token<DelegationTokenIdentifier>) token);
|
(Token<DelegationTokenIdentifier>) token);
|
||||||
System.out.println("Renewed token via " + webUrl + " for "
|
if(LOG.isDebugEnabled()) {
|
||||||
+ token.getService() + " until: " + new Date(result));
|
LOG.debug("Renewed token via " + webUrl + " for "
|
||||||
|
+ token.getService() + " until: " + new Date(result));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else if (cancel) {
|
} else if (cancel) {
|
||||||
for (Token<?> token : readTokens(tokenFile, conf)) {
|
for (Token<?> token : readTokens(tokenFile, conf)) {
|
||||||
cancelDelegationToken(webUrl,
|
cancelDelegationToken(webUrl,
|
||||||
(Token<DelegationTokenIdentifier>) token);
|
(Token<DelegationTokenIdentifier>) token);
|
||||||
System.out.println("Cancelled token via " + webUrl + " for "
|
if(LOG.isDebugEnabled()) {
|
||||||
+ token.getService());
|
LOG.debug("Cancelled token via " + webUrl + " for "
|
||||||
|
+ token.getService());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Credentials creds = getDTfromRemote(webUrl, renewer);
|
Credentials creds = getDTfromRemote(webUrl, renewer);
|
||||||
creds.writeTokenStorageFile(tokenFile, conf);
|
creds.writeTokenStorageFile(tokenFile, conf);
|
||||||
for (Token<?> token : creds.getAllTokens()) {
|
for (Token<?> token : creds.getAllTokens()) {
|
||||||
System.out.println("Fetched token via " + webUrl + " for "
|
if(LOG.isDebugEnabled()) {
|
||||||
+ token.getService() + " into " + tokenFile);
|
LOG.debug("Fetched token via " + webUrl + " for "
|
||||||
|
+ token.getService() + " into " + tokenFile);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -184,24 +192,30 @@ public Object run() throws Exception {
|
|||||||
for (Token<?> token : readTokens(tokenFile, conf)) {
|
for (Token<?> token : readTokens(tokenFile, conf)) {
|
||||||
((DistributedFileSystem) fs)
|
((DistributedFileSystem) fs)
|
||||||
.cancelDelegationToken((Token<DelegationTokenIdentifier>) token);
|
.cancelDelegationToken((Token<DelegationTokenIdentifier>) token);
|
||||||
System.out.println("Cancelled token for "
|
if(LOG.isDebugEnabled()) {
|
||||||
+ token.getService());
|
LOG.debug("Cancelled token for "
|
||||||
|
+ token.getService());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else if (renew) {
|
} else if (renew) {
|
||||||
long result;
|
long result;
|
||||||
for (Token<?> token : readTokens(tokenFile, conf)) {
|
for (Token<?> token : readTokens(tokenFile, conf)) {
|
||||||
result = ((DistributedFileSystem) fs)
|
result = ((DistributedFileSystem) fs)
|
||||||
.renewDelegationToken((Token<DelegationTokenIdentifier>) token);
|
.renewDelegationToken((Token<DelegationTokenIdentifier>) token);
|
||||||
System.out.println("Renewed token for " + token.getService()
|
if(LOG.isDebugEnabled()) {
|
||||||
+ " until: " + new Date(result));
|
LOG.debug("Renewed token for " + token.getService()
|
||||||
|
+ " until: " + new Date(result));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Token<?> token = fs.getDelegationToken(renewer);
|
Token<?> token = fs.getDelegationToken(renewer);
|
||||||
Credentials cred = new Credentials();
|
Credentials cred = new Credentials();
|
||||||
cred.addToken(token.getService(), token);
|
cred.addToken(token.getService(), token);
|
||||||
cred.writeTokenStorageFile(tokenFile, conf);
|
cred.writeTokenStorageFile(tokenFile, conf);
|
||||||
System.out.println("Fetched token for " + token.getService()
|
if(LOG.isDebugEnabled()) {
|
||||||
+ " into " + tokenFile);
|
LOG.debug("Fetched token for " + token.getService()
|
||||||
|
+ " into " + tokenFile);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
@ -221,6 +235,11 @@ static public Credentials getDTfromRemote(String nnAddr,
|
|||||||
} else {
|
} else {
|
||||||
url.append(nnAddr).append(GetDelegationTokenServlet.PATH_SPEC);
|
url.append(nnAddr).append(GetDelegationTokenServlet.PATH_SPEC);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(LOG.isDebugEnabled()) {
|
||||||
|
LOG.debug("Retrieving token from: " + url);
|
||||||
|
}
|
||||||
|
|
||||||
URL remoteURL = new URL(url.toString());
|
URL remoteURL = new URL(url.toString());
|
||||||
SecurityUtil.fetchServiceTicket(remoteURL);
|
SecurityUtil.fetchServiceTicket(remoteURL);
|
||||||
URLConnection connection = remoteURL.openConnection();
|
URLConnection connection = remoteURL.openConnection();
|
||||||
|
Loading…
Reference in New Issue
Block a user