You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-commits@hadoop.apache.org by xy...@apache.org on 2018/07/13 18:45:36 UTC
hadoop git commit: HDDS-210. Make "-file" argument optional for ozone
getKey command. Contributed by Lokesh Jain.
Repository: hadoop
Updated Branches:
refs/heads/trunk 88625f5cd -> 103f2eeb5
HDDS-210. Make "-file" argument optional for ozone getKey command. Contributed by Lokesh Jain.
Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/103f2eeb
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/103f2eeb
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/103f2eeb
Branch: refs/heads/trunk
Commit: 103f2eeb57dbadd9abbbc25a05bb7c79b48fdc17
Parents: 88625f5
Author: Xiaoyu Yao <xy...@apache.org>
Authored: Fri Jul 13 11:44:24 2018 -0700
Committer: Xiaoyu Yao <xy...@apache.org>
Committed: Fri Jul 13 11:45:02 2018 -0700
----------------------------------------------------------------------
.../org/apache/hadoop/ozone/ozShell/TestOzoneShell.java | 12 ++++++++++++
.../hadoop/ozone/web/ozShell/keys/GetKeyHandler.java | 9 ++++++---
2 files changed, 18 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/hadoop/blob/103f2eeb/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/ozShell/TestOzoneShell.java
----------------------------------------------------------------------
diff --git a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/ozShell/TestOzoneShell.java b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/ozShell/TestOzoneShell.java
index a4b30f0..000d530 100644
--- a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/ozShell/TestOzoneShell.java
+++ b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/ozShell/TestOzoneShell.java
@@ -705,6 +705,18 @@ public class TestOzoneShell {
randFile.read(dataBytes);
}
assertEquals(dataStr, DFSUtil.bytes2String(dataBytes));
+
+ tmpPath = baseDir.getAbsolutePath() + File.separatorChar + keyName;
+ args = new String[] {"-getKey",
+ url + "/" + volumeName + "/" + bucketName + "/" + keyName, "-file",
+ baseDir.getAbsolutePath()};
+ assertEquals(0, ToolRunner.run(shell, args));
+
+ dataBytes = new byte[dataStr.length()];
+ try (FileInputStream randFile = new FileInputStream(new File(tmpPath))) {
+ randFile.read(dataBytes);
+ }
+ assertEquals(dataStr, DFSUtil.bytes2String(dataBytes));
}
@Test
http://git-wip-us.apache.org/repos/asf/hadoop/blob/103f2eeb/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/web/ozShell/keys/GetKeyHandler.java
----------------------------------------------------------------------
diff --git a/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/web/ozShell/keys/GetKeyHandler.java b/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/web/ozShell/keys/GetKeyHandler.java
index 34620b4..2d059e0 100644
--- a/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/web/ozShell/keys/GetKeyHandler.java
+++ b/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/web/ozShell/keys/GetKeyHandler.java
@@ -98,11 +98,14 @@ public class GetKeyHandler extends Handler {
Path dataFilePath = Paths.get(fileName);
File dataFile = new File(fileName);
+ if (dataFile.exists() && dataFile.isDirectory()) {
+ dataFile = new File(fileName, keyName);
+ }
if (dataFile.exists()) {
- throw new OzoneClientException(fileName +
- "exists. Download will overwrite an " +
- "existing file. Aborting.");
+ throw new OzoneClientException(
+ fileName + "exists. Download will overwrite an "
+ + "existing file. Aborting.");
}
OzoneVolume vol = client.getObjectStore().getVolume(volumeName);
---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-commits-help@hadoop.apache.org