You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by gn...@apache.org on 2017/01/23 14:09:34 UTC
ambari git commit: AMBARI-19640. Hue - Ambari Migration is not
working in Kerberized envirionment. (Ishan Bhatt via gauravn7)
Repository: ambari
Updated Branches:
refs/heads/trunk aaa99316f -> c32eb48ed
AMBARI-19640. Hue - Ambari Migration is not working in Kerberized envirionment. (Ishan Bhatt via gauravn7)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/c32eb48e
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/c32eb48e
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/c32eb48e
Branch: refs/heads/trunk
Commit: c32eb48ed8421d0445ae7cace9421b9eb1bcc41a
Parents: aaa9931
Author: Gaurav Nagar <gr...@gmail.com>
Authored: Mon Jan 23 19:38:01 2017 +0530
Committer: Gaurav Nagar <gr...@gmail.com>
Committed: Mon Jan 23 19:38:01 2017 +0530
----------------------------------------------------------------------
...HiveHistoryQueryMigrationImplementation.java | 24 ++++++++++++++++----
.../HiveSavedQueryMigrationImplementation.java | 24 ++++++++++++++++----
.../pigjob/PigJobMigrationImplementation.java | 23 +++++++++++++++----
.../PigScriptMigrationImplementation.java | 24 ++++++++++++++++----
.../pigudf/PigUdfMigrationImplementation.java | 24 ++++++++++++++++----
5 files changed, 95 insertions(+), 24 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/c32eb48e/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/migration/hive/historyquery/HiveHistoryQueryMigrationImplementation.java
----------------------------------------------------------------------
diff --git a/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/migration/hive/historyquery/HiveHistoryQueryMigrationImplementation.java b/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/migration/hive/historyquery/HiveHistoryQueryMigrationImplementation.java
index e827b09..f154b39 100644
--- a/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/migration/hive/historyquery/HiveHistoryQueryMigrationImplementation.java
+++ b/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/migration/hive/historyquery/HiveHistoryQueryMigrationImplementation.java
@@ -50,6 +50,7 @@ import java.net.URI;
public class HiveHistoryQueryMigrationImplementation {
static final Logger logger = Logger.getLogger(HiveHistoryQueryMigrationImplementation.class);
+ final String USER_DIRECTORY = "/user";
public void wrtitetoalternatesqlfile(String dirname, String content, String instance, int i) throws IOException {
@@ -449,10 +450,16 @@ public class HiveHistoryQueryMigrationImplementation {
public Boolean run() throws Exception {
URI uri = new URI(dir);
- FileSystem fs = FileSystem.get(uri, conf, username);
-
+ FileSystem fs = FileSystem.get(conf);
Path src = new Path(dir);
Boolean b = fs.mkdirs(src);
+
+ String[] subDirs = dir.split("/");
+ String dirPath = USER_DIRECTORY;
+ for(int i=2;i<subDirs.length;i++) {
+ dirPath += "/"+subDirs[i];
+ fs.setOwner(new Path(dirPath), username, username);
+ }
return b;
}
});
@@ -483,9 +490,16 @@ public class HiveHistoryQueryMigrationImplementation {
public Boolean run() throws Exception {
URI uri = new URI(dir);
- FileSystem fs = FileSystem.get(uri, conf, username);
+ FileSystem fs = FileSystem.get(conf);
Path src = new Path(dir);
Boolean b = fs.mkdirs(src);
+
+ String[] subDirs = dir.split("/");
+ String dirPath = USER_DIRECTORY;
+ for(int i=2;i<subDirs.length;i++) {
+ dirPath += "/"+subDirs[i];
+ fs.setOwner(new Path(dirPath), username, username);
+ }
return b;
}
});
@@ -540,7 +554,7 @@ public class HiveHistoryQueryMigrationImplementation {
}
in.close();
out.close();
- fileSystem.setOwner(path, username, "hadoop");
+ fileSystem.setOwner(path, username, username);
fileSystem.close();
return null;
}
@@ -600,7 +614,7 @@ public class HiveHistoryQueryMigrationImplementation {
}
in.close();
out.close();
- fileSystem.setOwner(path, username, "hadoop");
+ fileSystem.setOwner(path, username, username);
fileSystem.close();
return null;
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/c32eb48e/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/migration/hive/savedquery/HiveSavedQueryMigrationImplementation.java
----------------------------------------------------------------------
diff --git a/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/migration/hive/savedquery/HiveSavedQueryMigrationImplementation.java b/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/migration/hive/savedquery/HiveSavedQueryMigrationImplementation.java
index 584978a..c08455d 100644
--- a/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/migration/hive/savedquery/HiveSavedQueryMigrationImplementation.java
+++ b/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/migration/hive/savedquery/HiveSavedQueryMigrationImplementation.java
@@ -52,6 +52,7 @@ import java.net.URI;
public class HiveSavedQueryMigrationImplementation {
static final Logger logger = Logger.getLogger(HiveSavedQueryMigrationImplementation.class);
+ final String USER_DIRECTORY = "/user";
private static String readAll(Reader rd) throws IOException {
StringBuilder sb = new StringBuilder();
@@ -607,10 +608,16 @@ public class HiveSavedQueryMigrationImplementation {
public Boolean run() throws Exception {
URI uri = new URI(dir);
- FileSystem fs = FileSystem.get(uri, conf, username);
-
+ FileSystem fs = FileSystem.get(conf);
Path src = new Path(dir);
Boolean b = fs.mkdirs(src);
+
+ String[] subDirs = dir.split("/");
+ String dirPath = USER_DIRECTORY;
+ for(int i=2;i<subDirs.length;i++) {
+ dirPath += "/"+subDirs[i];
+ fs.setOwner(new Path(dirPath), username, username);
+ }
return b;
}
});
@@ -640,9 +647,16 @@ public class HiveSavedQueryMigrationImplementation {
public Boolean run() throws Exception {
URI uri = new URI(dir);
- FileSystem fs = FileSystem.get(uri, conf, username);
+ FileSystem fs = FileSystem.get(conf);
Path src = new Path(dir);
Boolean b = fs.mkdirs(src);
+
+ String[] subDirs = dir.split("/");
+ String dirPath = USER_DIRECTORY;
+ for(int i=2;i<subDirs.length;i++) {
+ dirPath += "/"+subDirs[i];
+ fs.setOwner(new Path(dirPath), username, username);
+ }
return b;
}
});
@@ -695,7 +709,7 @@ public class HiveSavedQueryMigrationImplementation {
}
in.close();
out.close();
- fileSystem.setOwner(path, username, "hadoop");
+ fileSystem.setOwner(path, username, username);
fileSystem.close();
return null;
}
@@ -757,7 +771,7 @@ public class HiveSavedQueryMigrationImplementation {
}
in.close();
out.close();
- fileSystem.setOwner(path, username, "hadoop");
+ fileSystem.setOwner(path, username, username);
fileSystem.close();
return null;
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/c32eb48e/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/migration/pig/pigjob/PigJobMigrationImplementation.java
----------------------------------------------------------------------
diff --git a/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/migration/pig/pigjob/PigJobMigrationImplementation.java b/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/migration/pig/pigjob/PigJobMigrationImplementation.java
index ec39d55..1cb0471 100644
--- a/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/migration/pig/pigjob/PigJobMigrationImplementation.java
+++ b/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/migration/pig/pigjob/PigJobMigrationImplementation.java
@@ -56,6 +56,7 @@ import org.apache.ambari.view.huetoambarimigration.migration.configuration.Confi
public class PigJobMigrationImplementation {
static final Logger logger = Logger.getLogger(PigJobMigrationImplementation.class);
+ final String USER_DIRECTORY = "/user";
private static String readAll(Reader rd) throws IOException {
StringBuilder sb = new StringBuilder();
@@ -414,9 +415,16 @@ public class PigJobMigrationImplementation {
conf.set("hadoop.job.ugi", "hdfs");
URI uri = new URI(dir);
- FileSystem fs = FileSystem.get(uri, conf, username);
+ FileSystem fs = FileSystem.get(conf);
Path src = new Path(dir);
fs.mkdirs(src);
+
+ String[] subDirs = dir.split("/");
+ String dirPath = USER_DIRECTORY;
+ for(int i=2;i<subDirs.length;i++) {
+ dirPath += "/"+subDirs[i];
+ fs.setOwner(new Path(dirPath), username, username);
+ }
return null;
}
});
@@ -447,9 +455,16 @@ public class PigJobMigrationImplementation {
public Boolean run() throws Exception {
URI uri = new URI(dir);
- FileSystem fs = FileSystem.get(uri, conf, username);
+ FileSystem fs = FileSystem.get(conf);
Path src = new Path(dir);
Boolean b = fs.mkdirs(src);
+
+ String[] subDirs = dir.split("/");
+ String dirPath = USER_DIRECTORY;
+ for(int i=2;i<subDirs.length;i++) {
+ dirPath += "/"+subDirs[i];
+ fs.setOwner(new Path(dirPath), username, username);
+ }
return b;
}
});
@@ -510,7 +525,7 @@ public class PigJobMigrationImplementation {
}
in1.close();
out.close();
- fileSystemAmbari.setOwner(path, username, "hadoop");
+ fileSystemAmbari.setOwner(path, username, username);
fileSystemHue.close();
fileSystemAmbari.close();
return null;
@@ -580,7 +595,7 @@ public class PigJobMigrationImplementation {
}
in1.close();
out.close();
- fileSystemAmbari.setOwner(path, username, "hadoop");
+ fileSystemAmbari.setOwner(path, username, username);
fileSystemHue.close();
fileSystemAmbari.close();
return null;
http://git-wip-us.apache.org/repos/asf/ambari/blob/c32eb48e/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/migration/pig/pigscript/PigScriptMigrationImplementation.java
----------------------------------------------------------------------
diff --git a/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/migration/pig/pigscript/PigScriptMigrationImplementation.java b/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/migration/pig/pigscript/PigScriptMigrationImplementation.java
index 0459a30..82461ca 100644
--- a/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/migration/pig/pigscript/PigScriptMigrationImplementation.java
+++ b/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/migration/pig/pigscript/PigScriptMigrationImplementation.java
@@ -53,6 +53,7 @@ import java.net.URI;
public class PigScriptMigrationImplementation {
static final Logger logger = Logger.getLogger(PigScriptMigrationImplementation.class);
+ final String USER_DIRECTORY = "/user";
private static String readAll(Reader rd) throws IOException {
StringBuilder sb = new StringBuilder();
@@ -448,9 +449,16 @@ public class PigScriptMigrationImplementation {
public Boolean run() throws Exception {
URI uri = new URI(dir);
- FileSystem fs = FileSystem.get(uri, conf, username);
+ FileSystem fs = FileSystem.get(conf);
Path src = new Path(dir);
Boolean b = fs.mkdirs(src);
+
+ String[] subDirs = dir.split("/");
+ String dirPath = USER_DIRECTORY;
+ for(int i=2;i<subDirs.length;i++) {
+ dirPath += "/"+subDirs[i];
+ fs.setOwner(new Path(dirPath), username, username);
+ }
return b;
}
});
@@ -481,10 +489,16 @@ public class PigScriptMigrationImplementation {
public Boolean run() throws Exception {
URI uri = new URI(dir);
- FileSystem fs = FileSystem.get(uri, conf, username);
-
+ FileSystem fs = FileSystem.get(conf);
Path src = new Path(dir);
Boolean b = fs.mkdirs(src);
+
+ String[] subDirs = dir.split("/");
+ String dirPath = USER_DIRECTORY;
+ for(int i=2;i<subDirs.length;i++) {
+ dirPath += "/"+subDirs[i];
+ fs.setOwner(new Path(dirPath), username, username);
+ }
return b;
}
});
@@ -541,7 +555,7 @@ public class PigScriptMigrationImplementation {
}
in.close();
out.close();
- fileSystem.setOwner(path, username, "hadoop");
+ fileSystem.setOwner(path, username, username);
fileSystem.close();
return null;
}
@@ -600,7 +614,7 @@ public class PigScriptMigrationImplementation {
}
in.close();
out.close();
- fileSystem.setOwner(path, username, "hadoop");
+ fileSystem.setOwner(path, username, username);
fileSystem.close();
return null;
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/c32eb48e/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/migration/pig/pigudf/PigUdfMigrationImplementation.java
----------------------------------------------------------------------
diff --git a/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/migration/pig/pigudf/PigUdfMigrationImplementation.java b/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/migration/pig/pigudf/PigUdfMigrationImplementation.java
index ce51bf1..a7728a8 100644
--- a/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/migration/pig/pigudf/PigUdfMigrationImplementation.java
+++ b/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/migration/pig/pigudf/PigUdfMigrationImplementation.java
@@ -47,6 +47,7 @@ import java.net.URI;
public class PigUdfMigrationImplementation {
static final Logger logger = Logger.getLogger(PigUdfMigrationImplementation.class);
+ final String USER_DIRECTORY = "/user";
private static String readAll(Reader rd) throws IOException {
StringBuilder sb = new StringBuilder();
@@ -215,10 +216,16 @@ public class PigUdfMigrationImplementation {
public Boolean run() throws Exception {
URI uri = new URI(dir);
- FileSystem fs = FileSystem.get(uri, conf, dir);
+ FileSystem fs = FileSystem.get(conf);
Path src = new Path(dir);
Boolean b = fs.mkdirs(src);
- fs.setOwner(src,username,"hadoop");
+
+ String[] subDirs = dir.split("/");
+ String dirPath = USER_DIRECTORY;
+ for(int i=2;i<subDirs.length;i++) {
+ dirPath += "/"+subDirs[i];
+ fs.setOwner(new Path(dirPath), username, username);
+ }
return b;
}
});
@@ -252,9 +259,16 @@ public class PigUdfMigrationImplementation {
public Void run() throws Exception {
URI uri = new URI(dir);
- FileSystem fs = FileSystem.get(uri, conf, username);
+ FileSystem fs = FileSystem.get(conf);
Path src = new Path(dir);
fs.mkdirs(src);
+
+ String[] subDirs = dir.split("/");
+ String dirPath = USER_DIRECTORY;
+ for(int i=2;i<subDirs.length;i++) {
+ dirPath += "/"+subDirs[i];
+ fs.setOwner(new Path(dirPath), username, username);
+ }
return null;
}
});
@@ -308,7 +322,7 @@ public class PigUdfMigrationImplementation {
}
in1.close();
out.close();
- fileSystemAmbari.setOwner(path, username, "hadoop");
+ fileSystemAmbari.setOwner(path, username, username);
fileSystemHue.close();
fileSystemAmbari.close();
return null;
@@ -371,7 +385,7 @@ public class PigUdfMigrationImplementation {
}
in1.close();
out.close();
- fileSystemAmbari.setOwner(path, username, "hadoop");
+ fileSystemAmbari.setOwner(path, username, username);
fileSystemHue.close();
fileSystemAmbari.close();
return null;