You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by mp...@apache.org on 2016/02/04 12:15:38 UTC

[1/2] ambari git commit: AMBARI-14915. Ambari Server should not use /tmp for extraction. (mpapirkovskyy)

Repository: ambari
Updated Branches:
  refs/heads/branch-2.2 16ff8f30a -> 0734caf1d
  refs/heads/trunk 4fbf172c3 -> ed3ca611b


AMBARI-14915. Ambari Server should not use /tmp for extraction. (mpapirkovskyy)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/0734caf1
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/0734caf1
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/0734caf1

Branch: refs/heads/branch-2.2
Commit: 0734caf1de23a0a8f5c54a77141d32b2631f52cb
Parents: 16ff8f3
Author: Myroslav Papirkovskyy <mp...@hortonworks.com>
Authored: Thu Feb 4 13:05:05 2016 +0200
Committer: Myroslav Papirkovskyy <mp...@hortonworks.com>
Committed: Thu Feb 4 13:05:05 2016 +0200

----------------------------------------------------------------------
 .../apache/ambari/server/configuration/Configuration.java |  8 ++++++++
 .../org/apache/ambari/server/controller/AmbariServer.java | 10 ++++++++++
 .../apache/ambari/server/controller/AmbariServerTest.java |  9 +++++++++
 3 files changed, 27 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/0734caf1/ambari-server/src/main/java/org/apache/ambari/server/configuration/Configuration.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/configuration/Configuration.java b/ambari-server/src/main/java/org/apache/ambari/server/configuration/Configuration.java
index f74073f..edcfa28 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/configuration/Configuration.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/configuration/Configuration.java
@@ -2327,6 +2327,14 @@ public class Configuration {
   }
 
   /**
+   * Ambari server temp dir
+   * @return server temp dir
+   */
+  public String getServerTempDir() {
+    return properties.getProperty(SERVER_TMP_DIR_KEY, SERVER_TMP_DIR_DEFAULT);
+  }
+
+  /**
    * Gets whether to use experiemental concurrent processing to convert
    * {@link StageEntity} instances into {@link Stage} instances. The default is
    * {@code false}.

http://git-wip-us.apache.org/repos/asf/ambari/blob/0734caf1/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariServer.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariServer.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariServer.java
index 433853b..373b7fc 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariServer.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariServer.java
@@ -248,6 +248,14 @@ public class AmbariServer {
 
   private static AmbariManagementController clusterController = null;
 
+  /**
+   * Alters system variables on base of Ambari configuration
+   */
+  static void setSystemProperties(Configuration configs) {
+    // modify location of temporary dir to avoid using default /tmp dir
+    System.setProperty("java.io.tmpdir", configs.getServerTempDir());
+  }
+
   public static AmbariManagementController getController() {
     return clusterController;
   }
@@ -260,6 +268,8 @@ public class AmbariServer {
     server.setSessionIdManager(sessionIdManager);
     Server serverForAgent = new Server();
 
+    setSystemProperties(configs);
+
     DatabaseChecker.checkDBVersion();
     DatabaseChecker.checkDBConsistency();
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/0734caf1/ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariServerTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariServerTest.java b/ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariServerTest.java
index 02941b5..54f6147 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariServerTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariServerTest.java
@@ -105,6 +105,15 @@ public class AmbariServerTest {
   }
 
   @Test
+  public void testSystemProperties() throws Exception {
+    Configuration configuration = EasyMock.createNiceMock(Configuration.class);
+    expect(configuration.getServerTempDir()).andReturn("/ambari/server/temp/dir").anyTimes();
+    replay(configuration);
+    AmbariServer.setSystemProperties(configuration);
+    Assert.assertEquals(System.getProperty("java.io.tmpdir"), "/ambari/server/temp/dir");
+  }
+
+  @Test
   public void testProxyUser() throws Exception {
 
     PasswordAuthentication pa = Authenticator.requestPasswordAuthentication(


[2/2] ambari git commit: AMBARI-14915. Ambari Server should not use /tmp for extraction. (mpapirkovskyy)

Posted by mp...@apache.org.
AMBARI-14915. Ambari Server should not use /tmp for extraction. (mpapirkovskyy)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/ed3ca611
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/ed3ca611
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/ed3ca611

Branch: refs/heads/trunk
Commit: ed3ca611b98a6a68c12a735ca934a83755913b39
Parents: 4fbf172
Author: Myroslav Papirkovskyy <mp...@hortonworks.com>
Authored: Thu Feb 4 13:14:06 2016 +0200
Committer: Myroslav Papirkovskyy <mp...@hortonworks.com>
Committed: Thu Feb 4 13:14:06 2016 +0200

----------------------------------------------------------------------
 .../apache/ambari/server/configuration/Configuration.java |  8 ++++++++
 .../org/apache/ambari/server/controller/AmbariServer.java | 10 ++++++++++
 .../apache/ambari/server/controller/AmbariServerTest.java |  9 +++++++++
 3 files changed, 27 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/ed3ca611/ambari-server/src/main/java/org/apache/ambari/server/configuration/Configuration.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/configuration/Configuration.java b/ambari-server/src/main/java/org/apache/ambari/server/configuration/Configuration.java
index 4a4ae43..35e9b6f 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/configuration/Configuration.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/configuration/Configuration.java
@@ -2419,6 +2419,14 @@ public class Configuration {
   }
 
   /**
+   * Ambari server temp dir
+   * @return server temp dir
+   */
+  public String getServerTempDir() {
+    return properties.getProperty(SERVER_TMP_DIR_KEY, SERVER_TMP_DIR_DEFAULT);
+  }
+
+  /**
    * Gets whether to use experiemental concurrent processing to convert
    * {@link StageEntity} instances into {@link Stage} instances. The default is
    * {@code false}.

http://git-wip-us.apache.org/repos/asf/ambari/blob/ed3ca611/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariServer.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariServer.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariServer.java
index 9c05bf8..c7e7880 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariServer.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariServer.java
@@ -253,6 +253,14 @@ public class AmbariServer {
 
   private static AmbariManagementController clusterController = null;
 
+  /**
+   * Alters system variables on base of Ambari configuration
+   */
+  static void setSystemProperties(Configuration configs) {
+    // modify location of temporary dir to avoid using default /tmp dir
+    System.setProperty("java.io.tmpdir", configs.getServerTempDir());
+  }
+
   public static AmbariManagementController getController() {
     return clusterController;
   }
@@ -265,6 +273,8 @@ public class AmbariServer {
     server.setSessionIdManager(sessionIdManager);
     Server serverForAgent = new Server();
 
+    setSystemProperties(configs);
+
     if (System.getProperty("skipDatabaseConsistencyValidation") == null) {
       DatabaseChecker.checkDBVersion();
       DatabaseChecker.checkDBConsistency();

http://git-wip-us.apache.org/repos/asf/ambari/blob/ed3ca611/ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariServerTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariServerTest.java b/ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariServerTest.java
index 02941b5..54f6147 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariServerTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariServerTest.java
@@ -105,6 +105,15 @@ public class AmbariServerTest {
   }
 
   @Test
+  public void testSystemProperties() throws Exception {
+    Configuration configuration = EasyMock.createNiceMock(Configuration.class);
+    expect(configuration.getServerTempDir()).andReturn("/ambari/server/temp/dir").anyTimes();
+    replay(configuration);
+    AmbariServer.setSystemProperties(configuration);
+    Assert.assertEquals(System.getProperty("java.io.tmpdir"), "/ambari/server/temp/dir");
+  }
+
+  @Test
   public void testProxyUser() throws Exception {
 
     PasswordAuthentication pa = Authenticator.requestPasswordAuthentication(