HADOOP-15150. in FsShell, UGI params should be overidden through env vars(-D arg). Contributed by Brahma Reddy Battula.
This commit is contained in:
parent
cdaf92c9f5
commit
08332e12d0
@ -30,6 +30,7 @@
|
||||
import org.apache.hadoop.fs.shell.Command;
|
||||
import org.apache.hadoop.fs.shell.CommandFactory;
|
||||
import org.apache.hadoop.fs.shell.FsCommand;
|
||||
import org.apache.hadoop.security.UserGroupInformation;
|
||||
import org.apache.hadoop.tools.TableListing;
|
||||
import org.apache.hadoop.tracing.TraceUtils;
|
||||
import org.apache.hadoop.util.StringUtils;
|
||||
@ -99,6 +100,7 @@ protected Help getHelp() throws IOException {
|
||||
|
||||
protected void init() throws IOException {
|
||||
getConf().setQuietMode(true);
|
||||
UserGroupInformation.setConfiguration(getConf());
|
||||
if (commandFactory == null) {
|
||||
commandFactory = new CommandFactory(getConf());
|
||||
commandFactory.addObject(new Help(), "-help");
|
||||
|
@ -75,4 +75,18 @@ public void testList() throws Exception {
|
||||
lsArgv = new String[]{"-ls", "-q", testRootDir.toString()};
|
||||
assertThat(shell.run(lsArgv), is(0));
|
||||
}
|
||||
|
||||
/*
|
||||
UGI params should take effect when we pass.
|
||||
*/
|
||||
@Test(expected = IllegalArgumentException.class)
|
||||
public void testListWithUGI() throws Exception {
|
||||
FsShell fsShell = new FsShell(new Configuration());
|
||||
//Passing Dummy such that it should through IAE
|
||||
fsShell.getConf()
|
||||
.set(CommonConfigurationKeysPublic.HADOOP_SECURITY_AUTHENTICATION,
|
||||
"DUMMYAUTH");
|
||||
String[] lsArgv = new String[] {"-ls", testRootDir.toString()};
|
||||
fsShell.run(lsArgv);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user