Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Don't create Conf. Use provided instead.

  • Loading branch information...
commit 2be90727b2c83e51c108709b58ef307dd8954e72 1 parent bcf7b68
@jghoman jghoman authored
View
4 azkaban/src/java/azkaban/jobs/builtin/JavaJobRunnerMain.java
@@ -18,8 +18,6 @@
import azkaban.common.utils.Props;
import azkaban.util.SecurityUtils;
import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.security.SecurityUtil;
-import org.apache.hadoop.security.UserGroupInformation;
import org.apache.log4j.ConsoleAppender;
import org.apache.log4j.Layout;
import org.apache.log4j.Logger;
@@ -137,7 +135,7 @@ public void run() {
}
private void runMethodAsProxyUser(Properties prop, final Object obj, final String runMethod) throws IOException, InterruptedException {
- SecurityUtils.getProxiedUser(prop, _logger).doAs(new PrivilegedExceptionAction<Void>() {
+ SecurityUtils.getProxiedUser(prop, _logger, new Configuration()).doAs(new PrivilegedExceptionAction<Void>() {
@Override
public Void run() throws Exception {
runMethod(obj, runMethod);
View
5 azkaban/src/java/azkaban/jobs/builtin/SecurePigWrapper.java
@@ -15,6 +15,7 @@
*/
package azkaban.jobs.builtin;
+import org.apache.hadoop.conf.Configuration;
import org.apache.log4j.Logger;
import org.apache.pig.Main;
@@ -28,9 +29,9 @@
public static void main(final String[] args) throws IOException, InterruptedException {
Logger logger = Logger.getRootLogger();
Properties p = new Properties();
+ Configuration conf = new Configuration();
-
- getProxiedUser(p, logger).doAs(new PrivilegedExceptionAction<Void>() {
+ getProxiedUser(p, logger, conf).doAs(new PrivilegedExceptionAction<Void>() {
@Override
public Void run() throws Exception {
Main.main(args);
View
11 azkaban/src/java/azkaban/util/SecurityUtils.java
@@ -36,16 +36,19 @@
* Create a proxied user based on the explicit user name, taking other parameters
* necessary from properties file.
*/
- public static synchronized UserGroupInformation getProxiedUser(String toProxy, Properties prop, Logger log) throws IOException {
+ public static synchronized UserGroupInformation getProxiedUser(String toProxy, Properties prop, Logger log, Configuration conf) throws IOException {
if(toProxy == null) {
throw new IllegalArgumentException("toProxy can't be null");
}
+ if(conf == null) {
+ throw new IllegalAccessError("conf can't be null");
+ }
if (loginUser == null) {
log.info("No login user. Creating login user");
String keytab = verifySecureProperty(prop, PROXY_KEYTAB_LOCATION, log);
String proxyUser = verifySecureProperty(prop, PROXY_USER, log);
- UserGroupInformation.setConfiguration(new Configuration());
+ UserGroupInformation.setConfiguration(conf);
UserGroupInformation.loginUserFromKeytab(proxyUser, keytab);
loginUser = UserGroupInformation.getLoginUser();
log.info("Logged in with user " + loginUser);
@@ -61,9 +64,9 @@ public static synchronized UserGroupInformation getProxiedUser(String toProxy, P
* Create a proxied user, taking all parameters, including which user to proxy
* from provided Properties.
*/
- public static UserGroupInformation getProxiedUser(Properties prop, Logger log) throws IOException {
+ public static UserGroupInformation getProxiedUser(Properties prop, Logger log, Configuration conf) throws IOException {
String toProxy = verifySecureProperty(prop, TO_PROXY, log);
- return getProxiedUser(toProxy, prop, log);
+ return getProxiedUser(toProxy, prop, log, conf);
}
public static String verifySecureProperty(Properties properties, String s, Logger l) throws IOException {
Please sign in to comment.
Something went wrong with that request. Please try again.