You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by jo...@apache.org on 2017/04/06 18:57:50 UTC

[01/50] ambari git commit: AMBARI-20646 - Large Long Running Requests Can Slow Down the ActionScheduler (jonathanhurley)

Repository: ambari
Updated Branches:
  refs/heads/branch-feature-AMBARI-12556 70c23bcd1 -> f650e351c


AMBARI-20646 - Large Long Running Requests Can Slow Down the ActionScheduler (jonathanhurley)


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

Branch: refs/heads/branch-feature-AMBARI-12556
Commit: 1a08c4980295ebda1b71db17eb6389fb71f928fd
Parents: 320a8f5
Author: Jonathan Hurley <jh...@hortonworks.com>
Authored: Fri Mar 31 12:35:25 2017 -0400
Committer: Jonathan Hurley <jh...@hortonworks.com>
Committed: Fri Mar 31 21:14:45 2017 -0400

----------------------------------------------------------------------
 .../server/actionmanager/ActionDBAccessor.java  |  16 ++-
 .../actionmanager/ActionDBAccessorImpl.java     |  13 +-
 .../server/actionmanager/ActionScheduler.java   |   2 +-
 .../apache/ambari/server/orm/dao/StageDAO.java  |  68 ++++-----
 .../ambari/server/orm/entities/StageEntity.java |   9 +-
 .../serveraction/ServerActionExecutor.java      | 114 +++++++--------
 .../actionmanager/TestActionDBAccessorImpl.java |  27 ++--
 .../actionmanager/TestActionScheduler.java      | 139 +++++++++++--------
 .../ambari/server/orm/dao/RequestDAOTest.java   |  21 ++-
 .../serveraction/ServerActionExecutorTest.java  |   2 +-
 .../services/RetryUpgradeActionServiceTest.java |  12 +-
 11 files changed, 227 insertions(+), 196 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/1a08c498/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/ActionDBAccessor.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/ActionDBAccessor.java b/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/ActionDBAccessor.java
index 9325d03..b0550c0 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/ActionDBAccessor.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/ActionDBAccessor.java
@@ -76,17 +76,19 @@ public interface ActionDBAccessor {
                        boolean skipSupported, boolean hostUnknownState);
 
   /**
-   * Returns all the pending stages, including queued and not-queued. A stage is
-   * considered in progress if it is in progress for any host.
+   * Returns the next stage which is in-progress for every in-progress request
+   * in the system. Since stages are always synchronous, there is no reason to
+   * return more than the most recent stage per request. Returning every single
+   * stage in the requesrt would be extremely inffecient and wasteful. However,
+   * since requests can run in parallel, this method must return the most recent
+   * stage for every request. The results will be sorted by request ID.
    * <p/>
-   * The results will be sorted by request ID and then stage ID making this call
-   * expensive in some scenarios. Use {@link #getCommandsInProgressCount()} in
-   * order to determine if there are stages that are in progress before getting
-   * the stages from this method.
+   * Use {@link #getCommandsInProgressCount()} in order to determine if there
+   * are stages that are in progress before getting the stages from this method.
    *
    * @see HostRoleStatus#IN_PROGRESS_STATUSES
    */
-  public List<Stage> getStagesInProgress();
+  public List<Stage> getFirstStageInProgressPerRequest();
 
   /**
    * Returns all the pending stages in a request, including queued and not-queued. A stage is

http://git-wip-us.apache.org/repos/asf/ambari/blob/1a08c498/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/ActionDBAccessorImpl.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/ActionDBAccessorImpl.java b/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/ActionDBAccessorImpl.java
index ab4feaa..8c4eae8 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/ActionDBAccessorImpl.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/ActionDBAccessorImpl.java
@@ -285,11 +285,16 @@ public class ActionDBAccessorImpl implements ActionDBAccessor {
    * {@inheritDoc}
    */
   @Override
-  @Experimental(feature = ExperimentalFeature.PARALLEL_PROCESSING)
-  public List<Stage> getStagesInProgress() {
-    List<StageEntity> stageEntities = stageDAO.findByStatuses(
+  public List<Stage> getFirstStageInProgressPerRequest() {
+    List<StageEntity> stageEntities = stageDAO.findFirstStageByStatus(
       HostRoleStatus.IN_PROGRESS_STATUSES);
-    return getStagesForEntities(stageEntities);
+
+    List<Stage> stages = new ArrayList<>(stageEntities.size());
+    for (StageEntity stageEntity : stageEntities) {
+      stages.add(stageFactory.createExisting(stageEntity));
+    }
+
+    return stages;
   }
 
   @Experimental(feature = ExperimentalFeature.PARALLEL_PROCESSING)

http://git-wip-us.apache.org/repos/asf/ambari/blob/1a08c498/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/ActionScheduler.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/ActionScheduler.java b/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/ActionScheduler.java
index 0984c5c..758db35 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/ActionScheduler.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/ActionScheduler.java
@@ -355,7 +355,7 @@ class ActionScheduler implements Runnable {
       }
 
       Set<Long> runningRequestIds = new HashSet<>();
-      List<Stage> stages = db.getStagesInProgress();
+      List<Stage> stages = db.getFirstStageInProgressPerRequest();
       if (LOG.isDebugEnabled()) {
         LOG.debug("Scheduler wakes up");
         LOG.debug("Processing {} in progress stages ", stages.size());

http://git-wip-us.apache.org/repos/asf/ambari/blob/1a08c498/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/StageDAO.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/StageDAO.java b/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/StageDAO.java
index 5151fb3..c2919b2 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/StageDAO.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/StageDAO.java
@@ -22,10 +22,8 @@ import java.util.ArrayList;
 import java.util.Collection;
 import java.util.EnumSet;
 import java.util.HashMap;
-import java.util.LinkedList;
 import java.util.List;
 import java.util.Map;
-import java.util.Set;
 
 import javax.persistence.EntityManager;
 import javax.persistence.TypedQuery;
@@ -129,41 +127,6 @@ public class StageDAO {
     return daoUtils.selectList(query, requestId);
   }
 
-  /**
-   * Gets all of the stage IDs associated with a request.
-   *
-   * @param requestId
-   * @return the list of stage IDs.
-   */
-  @RequiresSession
-  public List<Long> findIdsByRequestId(long requestId) {
-    TypedQuery<Long> query = entityManagerProvider.get().createNamedQuery(
-        "StageEntity.findIdsByRequestId", Long.class);
-
-    query.setParameter("requestId", requestId);
-    return daoUtils.selectList(query);
-  }
-
-  /**
-   * Get the list of stage entities for the given request id and stage ids.
-   *
-   * @param requestId  the request ids
-   * @param stageIds   the set of stage ids
-   *
-   * @return the set of entities for the given ids
-   */
-  @RequiresSession
-  public List<StageEntity> findByStageIds(Long requestId, Set<Long> stageIds) {
-    List<StageEntity> stageEntities = new LinkedList<>();
-
-    for (StageEntity stage : findByRequestId(requestId)) {
-      if (stageIds.contains(stage.getStageId())) {
-        stageEntities.add(stage);
-      }
-    }
-    return stageEntities;
-  }
-
   @RequiresSession
   public List<StageEntity> findByRequestIdAndCommandStatuses(Long requestId, Collection<HostRoleStatus> statuses) {
     TypedQuery<StageEntity> query = entityManagerProvider.get().createNamedQuery(
@@ -175,17 +138,36 @@ public class StageDAO {
   }
 
   /**
+   * Finds the first stage matching any of the specified statuses for every
+   * request. For example, to find the first {@link HostRoleStatus#IN_PROGRESS}
+   * stage for every request, pass in
+   * {@link HostRoleStatus#IN_PROGRESS_STATUSES}.
    *
-   * @param statuses {@link HostRoleStatus}
-   * @return list of stage entities
+   * @param statuses
+   *          {@link HostRoleStatus}
+   * @return the list of the first matching stage for the given statuses for
+   *         every request.
    */
   @RequiresSession
-  public List<StageEntity> findByStatuses(Collection<HostRoleStatus> statuses) {
-    TypedQuery<StageEntity> query = entityManagerProvider.get().createNamedQuery(
-        "StageEntity.findByStatuses", StageEntity.class);
+  public List<StageEntity> findFirstStageByStatus(Collection<HostRoleStatus> statuses) {
+    TypedQuery<Object[]> query = entityManagerProvider.get().createNamedQuery(
+        "StageEntity.findFirstStageByStatus", Object[].class);
 
     query.setParameter("statuses", statuses);
-    return daoUtils.selectList(query);
+
+    List<Object[]> results = daoUtils.selectList(query);
+    List<StageEntity> stages = new ArrayList<>();
+
+    for (Object[] result : results) {
+      StageEntityPK stagePK = new StageEntityPK();
+      stagePK.setRequestId((Long) result[0]);
+      stagePK.setStageId((Long) result[1]);
+
+      StageEntity stage = findByPK(stagePK);
+      stages.add(stage);
+    }
+
+    return stages;
   }
 
   @RequiresSession

http://git-wip-us.apache.org/repos/asf/ambari/blob/1a08c498/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/StageEntity.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/StageEntity.java b/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/StageEntity.java
index f68338f..49c1594 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/StageEntity.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/StageEntity.java
@@ -46,17 +46,14 @@ import org.apache.ambari.server.actionmanager.HostRoleStatus;
 @IdClass(org.apache.ambari.server.orm.entities.StageEntityPK.class)
 @NamedQueries({
     @NamedQuery(
-        name = "StageEntity.findByStatuses",
-        query = "SELECT stage from StageEntity stage WHERE stage.status IN :statuses ORDER BY stage.requestId, stage.stageId"),
+        name = "StageEntity.findFirstStageByStatus",
+        query = "SELECT stage.requestId, MIN(stage.stageId) from StageEntity stage, HostRoleCommandEntity hrc WHERE hrc.status IN :statuses AND hrc.stageId = stage.stageId AND hrc.requestId = stage.requestId GROUP by stage.requestId ORDER BY stage.requestId"),
     @NamedQuery(
         name = "StageEntity.findByPK",
         query = "SELECT stage from StageEntity stage WHERE stage.requestId = :requestId AND stage.stageId = :stageId"),
     @NamedQuery(
         name = "StageEntity.findByRequestIdAndCommandStatuses",
-        query = "SELECT stage from StageEntity stage WHERE stage.status IN :statuses AND stage.requestId = :requestId ORDER BY stage.stageId"),
-    @NamedQuery(
-        name = "StageEntity.findIdsByRequestId",
-        query = "SELECT stage.stageId FROM StageEntity stage WHERE stage.requestId = :requestId ORDER BY stage.stageId ASC") })
+        query = "SELECT stage from StageEntity stage WHERE stage.status IN :statuses AND stage.requestId = :requestId ORDER BY stage.stageId") })
 public class StageEntity {
 
   @Column(name = "cluster_id", updatable = false, nullable = false)

http://git-wip-us.apache.org/repos/asf/ambari/blob/1a08c498/ambari-server/src/main/java/org/apache/ambari/server/serveraction/ServerActionExecutor.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/serveraction/ServerActionExecutor.java b/ambari-server/src/main/java/org/apache/ambari/server/serveraction/ServerActionExecutor.java
index b0be6b3..68124fc 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/serveraction/ServerActionExecutor.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/serveraction/ServerActionExecutor.java
@@ -19,11 +19,15 @@
 package org.apache.ambari.server.serveraction;
 
 import java.util.HashMap;
+import java.util.HashSet;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
+import java.util.Timer;
+import java.util.TimerTask;
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.ConcurrentMap;
+import java.util.concurrent.TimeUnit;
 
 import org.apache.ambari.server.AmbariException;
 import org.apache.ambari.server.Role;
@@ -32,13 +36,11 @@ import org.apache.ambari.server.actionmanager.ActionDBAccessor;
 import org.apache.ambari.server.actionmanager.ExecutionCommandWrapper;
 import org.apache.ambari.server.actionmanager.HostRoleCommand;
 import org.apache.ambari.server.actionmanager.HostRoleStatus;
-import org.apache.ambari.server.actionmanager.Request;
+import org.apache.ambari.server.actionmanager.Stage;
 import org.apache.ambari.server.agent.CommandReport;
 import org.apache.ambari.server.agent.ExecutionCommand;
 import org.apache.ambari.server.configuration.Configuration;
-import org.apache.ambari.server.controller.internal.CalculatedStatus;
 import org.apache.ambari.server.security.authorization.internal.InternalAuthenticationToken;
-import org.apache.ambari.server.utils.StageUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.security.core.context.SecurityContextHolder;
@@ -74,6 +76,7 @@ public class ServerActionExecutor {
   @Inject
   private static Configuration configuration;
 
+
   /**
    * Maps request IDs to "blackboards" of shared data.
    * <p/>
@@ -84,13 +87,6 @@ public class ServerActionExecutor {
     new HashMap<>();
 
   /**
-   * The hostname of the (Ambari) server.
-   * <p/>
-   * This hostname is cached so that cycles are spent querying for it more than once.
-   */
-  private final String serverHostName;
-
-  /**
    * Database accessor to query and update the database of action commands.
    */
   private final ActionDBAccessor db;
@@ -117,6 +113,13 @@ public class ServerActionExecutor {
   private Thread executorThread = null;
 
   /**
+   * A timer used to clear out {@link #requestSharedDataMap}. Since this "cache"
+   * isn't timer- or access-based, then we must periodically check it in order
+   * to clear out any stale data.
+   */
+  private final Timer cacheTimer = new Timer("server-action-executor-cache-timer", true);
+
+  /**
    * Statically initialize the Injector
    * <p/>
    * This should only be used for unit tests.
@@ -134,9 +137,12 @@ public class ServerActionExecutor {
    * @param sleepTimeMS the time (in milliseconds) to wait between polling the database for more tasks
    */
   public ServerActionExecutor(ActionDBAccessor db, long sleepTimeMS) {
-    serverHostName = StageUtils.getHostName();
     this.db = db;
     this.sleepTimeMS = (sleepTimeMS < 1) ? POLLING_TIMEOUT_MS : sleepTimeMS;
+
+    // start in 1 hour, run every hour
+    cacheTimer.schedule(new ServerActionSharedRequestEvictor(), TimeUnit.HOURS.toMillis(1),
+        TimeUnit.HOURS.toMillis(1));
   }
 
   /**
@@ -242,48 +248,6 @@ public class ServerActionExecutor {
   }
 
   /**
-   * Cleans up orphaned shared data Maps due to completed or failed request
-   * contexts. We are unable to use {@link Request#getStatus()} since this field
-   * is not populated in the database but, instead, calculated in realtime.
-   */
-  private void cleanRequestShareDataContexts() {
-    // if the cache is empty, do nothing
-    if (requestSharedDataMap.isEmpty()) {
-      return;
-    }
-
-    try {
-      // for every item in the map, get the request and check its status
-      synchronized (requestSharedDataMap) {
-        Set<Long> requestIds = requestSharedDataMap.keySet();
-        List<Request> requests = db.getRequests(requestIds);
-        for (Request request : requests) {
-          // calcuate the status from the stages and then remove from the map if
-          // necessary
-          CalculatedStatus calculatedStatus = CalculatedStatus.statusFromStages(
-              request.getStages());
-
-          // calcuate the status of the request
-          HostRoleStatus status = calculatedStatus.getStatus();
-
-          // remove the request from the map if the request is COMPLETED or
-          // FAILED
-          switch (status) {
-            case FAILED:
-            case COMPLETED:
-              requestSharedDataMap.remove(request.getRequestId());
-              break;
-            default:
-              break;
-          }
-        }
-      }
-    } catch (Exception exception) {
-      LOG.warn("Unable to clear the server-side action request cache", exception);
-    }
-  }
-
-  /**
    * A helper method to create CommandReports indicating the action/task is in progress
    *
    * @return a new CommandReport
@@ -450,8 +414,6 @@ public class ServerActionExecutor {
         }
       }
     }
-
-    cleanRequestShareDataContexts();
   }
 
   /**
@@ -599,4 +561,46 @@ public class ServerActionExecutor {
       this.executionCommand = executionCommand;
     }
   }
+
+  /**
+   * The {@link ServerActionSharedRequestEvictor} is used to clear the shared
+   * request cache periodically. This service will only run periodically and,
+   * when it does, it will try to make the least expensive call to determine if
+   * entries need to be evicted.
+   */
+  private class ServerActionSharedRequestEvictor extends TimerTask {
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public void run() {
+      // if the cache is empty, do nothing
+      if (requestSharedDataMap.isEmpty()) {
+        return;
+      }
+
+      // if the cache has requests, see if any are still in progress
+      try {
+        // find the requests in progress; there's no need to get the request
+        // itself since that could be a massive object; we just need the ID
+        Set<Long> requestsInProgress = new HashSet<>();
+        List<Stage> currentStageInProgressPerRequest = db.getFirstStageInProgressPerRequest();
+        for (Stage stage : currentStageInProgressPerRequest) {
+          requestsInProgress.add(stage.getRequestId());
+        }
+
+        // for every item in the map, get the request and check its status
+        synchronized (requestSharedDataMap) {
+          Set<Long> cachedRequestIds = requestSharedDataMap.keySet();
+          for (long cachedRequestId : cachedRequestIds) {
+            if (!requestsInProgress.contains(cachedRequestId)) {
+              requestSharedDataMap.remove(cachedRequestId);
+            }
+          }
+        }
+      } catch (Exception exception) {
+        LOG.warn("Unable to clear the server-side action request cache", exception);
+      }
+    }
+  }
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/1a08c498/ambari-server/src/test/java/org/apache/ambari/server/actionmanager/TestActionDBAccessorImpl.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/actionmanager/TestActionDBAccessorImpl.java b/ambari-server/src/test/java/org/apache/ambari/server/actionmanager/TestActionDBAccessorImpl.java
index 81eef3b..c1056dd 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/actionmanager/TestActionDBAccessorImpl.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/actionmanager/TestActionDBAccessorImpl.java
@@ -202,11 +202,11 @@ public class TestActionDBAccessorImpl {
   public void testGetStagesInProgressWithFailures() throws AmbariException {
     populateActionDB(db, hostName, requestId, stageId);
     populateActionDB(db, hostName, requestId + 1, stageId);
-    List<Stage> stages = db.getStagesInProgress();
+    List<Stage> stages = db.getFirstStageInProgressPerRequest();
     assertEquals(2, stages.size());
 
     db.abortOperation(requestId);
-    stages = db.getStagesInProgress();
+    stages = db.getFirstStageInProgressPerRequest();
     assertEquals(1, stages.size());
     assertEquals(requestId+1, stages.get(0).getRequestId());
   }
@@ -220,9 +220,9 @@ public class TestActionDBAccessorImpl {
 
     // verify stages and proper ordering
     int commandsInProgressCount = db.getCommandsInProgressCount();
-    List<Stage> stages = db.getStagesInProgress();
+    List<Stage> stages = db.getFirstStageInProgressPerRequest();
     assertEquals(18, commandsInProgressCount);
-    assertEquals(9, stages.size());
+    assertEquals(3, stages.size());
 
     long lastRequestId = Integer.MIN_VALUE;
     for (Stage stage : stages) {
@@ -235,9 +235,9 @@ public class TestActionDBAccessorImpl {
 
     // verify stages and proper ordering
     commandsInProgressCount = db.getCommandsInProgressCount();
-    stages = db.getStagesInProgress();
+    stages = db.getFirstStageInProgressPerRequest();
     assertEquals(12, commandsInProgressCount);
-    assertEquals(6, stages.size());
+    assertEquals(2, stages.size());
 
     // find the first stage, and change one command to COMPLETED
     stages.get(0).setHostRoleStatus(hostName, Role.HBASE_MASTER.toString(),
@@ -247,9 +247,9 @@ public class TestActionDBAccessorImpl {
 
     // the first stage still has at least 1 command IN_PROGRESS
     commandsInProgressCount = db.getCommandsInProgressCount();
-    stages = db.getStagesInProgress();
+    stages = db.getFirstStageInProgressPerRequest();
     assertEquals(11, commandsInProgressCount);
-    assertEquals(6, stages.size());
+    assertEquals(2, stages.size());
 
     // find the first stage, and change the other command to COMPLETED
     stages.get(0).setHostRoleStatus(hostName,
@@ -260,9 +260,9 @@ public class TestActionDBAccessorImpl {
 
     // verify stages and proper ordering
     commandsInProgressCount = db.getCommandsInProgressCount();
-    stages = db.getStagesInProgress();
+    stages = db.getFirstStageInProgressPerRequest();
     assertEquals(10, commandsInProgressCount);
-    assertEquals(5, stages.size());
+    assertEquals(2, stages.size());
   }
 
   @Test
@@ -274,15 +274,16 @@ public class TestActionDBAccessorImpl {
     }
 
     // create 1 request, 3 stages per host, each with 2 commands
-    for (int i = 0; i < 1000; i++) {
+    int requestCount = 1000;
+    for (int i = 0; i < requestCount; i++) {
       String hostName = "c64-" + i;
       populateActionDBMultipleStages(3, db, hostName, requestId + i, stageId);
     }
 
     int commandsInProgressCount = db.getCommandsInProgressCount();
-    List<Stage> stages = db.getStagesInProgress();
+    List<Stage> stages = db.getFirstStageInProgressPerRequest();
     assertEquals(6000, commandsInProgressCount);
-    assertEquals(3000, stages.size());
+    assertEquals(requestCount, stages.size());
   }
 
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/1a08c498/ambari-server/src/test/java/org/apache/ambari/server/actionmanager/TestActionScheduler.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/actionmanager/TestActionScheduler.java b/ambari-server/src/test/java/org/apache/ambari/server/actionmanager/TestActionScheduler.java
index 2b5d2f3..d7d3d40 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/actionmanager/TestActionScheduler.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/actionmanager/TestActionScheduler.java
@@ -210,13 +210,12 @@ public class TestActionScheduler {
     ActionDBAccessor db = mock(ActionDBAccessorImpl.class);
     HostRoleCommandDAO hostRoleCommandDAOMock = mock(HostRoleCommandDAO.class);
     Mockito.doNothing().when(hostRoleCommandDAOMock).publishTaskCreateEvent(anyListOf(HostRoleCommand.class));
-    List<Stage> stages = new ArrayList<>();
     Stage s = StageUtils.getATestStage(1, 977, hostname, CLUSTER_HOST_INFO,
       "{\"host_param\":\"param_value\"}", "{\"stage_param\":\"param_value\"}");
-    stages.add(s);
 
+    List<Stage> stages = Collections.singletonList(s);
     when(db.getCommandsInProgressCount()).thenReturn(stages.size());
-    when(db.getStagesInProgress()).thenReturn(stages);
+    when(db.getFirstStageInProgressPerRequest()).thenReturn(stages);
 
     RequestEntity request = mock(RequestEntity.class);
     when(request.isExclusive()).thenReturn(false);
@@ -307,20 +306,19 @@ public class TestActionScheduler {
     hostEntity.setHostName(hostname);
     hostDAO.create(hostEntity);
 
-    List<Stage> stages = new ArrayList<>();
     final Stage s = StageUtils.getATestStage(1, 977, hostname, CLUSTER_HOST_INFO,
       "{\"host_param\":\"param_value\"}", "{\"stage_param\":\"param_value\"}");
     s.addHostRoleExecutionCommand(hostname, Role.SECONDARY_NAMENODE, RoleCommand.INSTALL,
             new ServiceComponentHostInstallEvent("SECONDARY_NAMENODE", hostname, System.currentTimeMillis(), "HDP-1.2.0"),
             "cluster1", "HDFS", false, false);
     s.setHostRoleStatus(hostname, "SECONDARY_NAMENODE", HostRoleStatus.IN_PROGRESS);
-    stages.add(s);
+    List<Stage> stages = Collections.singletonList(s);
 
     ActionDBAccessor db = mock(ActionDBAccessor.class);
     HostRoleCommandDAO hostRoleCommandDAOMock = mock(HostRoleCommandDAO.class);
     Mockito.doNothing().when(hostRoleCommandDAOMock).publishTaskCreateEvent(anyListOf(HostRoleCommand.class));
     when(db.getCommandsInProgressCount()).thenReturn(stages.size());
-    when(db.getStagesInProgress()).thenReturn(stages);
+    when(db.getFirstStageInProgressPerRequest()).thenReturn(stages);
 
     RequestEntity request = mock(RequestEntity.class);
     when(request.isExclusive()).thenReturn(false);
@@ -397,10 +395,10 @@ public class TestActionScheduler {
     when(host.getState()).thenReturn(HostState.HEARTBEAT_LOST);
     when(host.getHostName()).thenReturn(hostname);
 
-    final List<Stage> stages = new ArrayList<>();
     final Stage s = StageUtils.getATestStage(1, 977, hostname, CLUSTER_HOST_INFO,
       "{\"host_param\":\"param_value\"}", "{\"stage_param\":\"param_value\"}");
-    stages.add(s);
+
+    List<Stage> stages = Collections.singletonList(s);
 
     ActionDBAccessor db = mock(ActionDBAccessor.class);
 
@@ -409,7 +407,7 @@ public class TestActionScheduler {
     when(db.getRequestEntity(anyLong())).thenReturn(request);
 
     when(db.getCommandsInProgressCount()).thenReturn(stages.size());
-    when(db.getStagesInProgress()).thenReturn(stages);
+    when(db.getFirstStageInProgressPerRequest()).thenReturn(stages);
     HostRoleCommandDAO hostRoleCommandDAOMock = mock(HostRoleCommandDAO.class);
     Mockito.doNothing().when(hostRoleCommandDAOMock).publishTaskCreateEvent(anyListOf(HostRoleCommand.class));
 
@@ -484,14 +482,13 @@ public class TestActionScheduler {
     when(serviceObj.getServiceComponent(anyString())).thenReturn(scomp);
     when(serviceObj.getCluster()).thenReturn(oneClusterMock);
 
-    final List<Stage> stages = new ArrayList<>();
     final Stage stage = stageFactory.createNew(1, "/tmp", "cluster1", 1L, "stageWith2Tasks",
       CLUSTER_HOST_INFO, "{\"command_param\":\"param_value\"}", "{\"host_param\":\"param_value\"}");
     addInstallTaskToStage(stage, hostname1, "cluster1", Role.DATANODE,
       RoleCommand.INSTALL, Service.Type.HDFS, 1);
     addInstallTaskToStage(stage, hostname2, "cluster1", Role.NAMENODE,
       RoleCommand.INSTALL, Service.Type.HDFS, 2);
-    stages.add(stage);
+    final List<Stage> stages = Collections.singletonList(stage);
 
     ActionDBAccessor db = mock(ActionDBAccessor.class);
 
@@ -500,7 +497,7 @@ public class TestActionScheduler {
     when(db.getRequestEntity(anyLong())).thenReturn(request);
 
     when(db.getCommandsInProgressCount()).thenReturn(stages.size());
-    when(db.getStagesInProgress()).thenReturn(stages);
+    when(db.getFirstStageInProgressPerRequest()).thenReturn(stages);
     HostRoleCommandDAO hostRoleCommandDAOMock = mock(HostRoleCommandDAO.class);
     Mockito.doNothing().when(hostRoleCommandDAOMock).publishTaskCreateEvent(anyListOf(HostRoleCommand.class));
 
@@ -606,10 +603,9 @@ public class TestActionScheduler {
     Clusters fsm = mock(Clusters.class);
     UnitOfWork unitOfWork = mock(UnitOfWork.class);
 
-    List<Stage> stages = new ArrayList<>();
     Map<String, String> payload = new HashMap<>();
     final Stage s = getStageWithServerAction(1, 977, payload, "test", 1200, false, false);
-    stages.add(s);
+    List<Stage> stages = Collections.singletonList(s);
 
     ActionDBAccessor db = mock(ActionDBAccessor.class);
     HostRoleCommandDAO hostRoleCommandDAOMock = mock(HostRoleCommandDAO.class);
@@ -620,7 +616,7 @@ public class TestActionScheduler {
     when(db.getRequestEntity(anyLong())).thenReturn(request);
 
     when(db.getCommandsInProgressCount()).thenReturn(stages.size());
-    when(db.getStagesInProgress()).thenReturn(stages);
+    when(db.getFirstStageInProgressPerRequest()).thenReturn(stages);
     doAnswer(new Answer<Void>() {
       @Override
       public Void answer(InvocationOnMock invocation) throws Throwable {
@@ -737,7 +733,7 @@ public class TestActionScheduler {
     when(db.getRequestEntity(anyLong())).thenReturn(request);
 
     when(db.getCommandsInProgressCount()).thenReturn(stages.size());
-    when(db.getStagesInProgress()).thenReturn(stages);
+    when(db.getFirstStageInProgressPerRequest()).thenReturn(stages);
 
     Properties properties = new Properties();
     properties.put(Configuration.PARALLEL_STAGE_EXECUTION.getKey(), "true");
@@ -766,11 +762,10 @@ public class TestActionScheduler {
     Clusters fsm = mock(Clusters.class);
     UnitOfWork unitOfWork = mock(UnitOfWork.class);
 
-    List<Stage> stages = new ArrayList<>();
     Map<String, String> payload = new HashMap<>();
     payload.put(MockServerAction.PAYLOAD_FORCE_FAIL, "timeout");
     final Stage s = getStageWithServerAction(1, 977, payload, "test", 2, false, false);
-    stages.add(s);
+    List<Stage> stages = Collections.singletonList(s);
 
     ActionDBAccessor db = mock(ActionDBAccessor.class);
     HostRoleCommandDAO hostRoleCommandDAOMock = mock(HostRoleCommandDAO.class);
@@ -781,7 +776,7 @@ public class TestActionScheduler {
     when(db.getRequestEntity(anyLong())).thenReturn(request);
 
     when(db.getCommandsInProgressCount()).thenReturn(stages.size());
-    when(db.getStagesInProgress()).thenReturn(stages);
+    when(db.getFirstStageInProgressPerRequest()).thenReturn(stages);
     doAnswer(new Answer<Void>() {
       @Override
       public Void answer(InvocationOnMock invocation) throws Throwable {
@@ -981,11 +976,10 @@ public class TestActionScheduler {
     Clusters fsm = mock(Clusters.class);
     UnitOfWork unitOfWork = mock(UnitOfWork.class);
 
-    List<Stage> stages = new ArrayList<>();
     Map<String, String> payload = new HashMap<>();
     payload.put(MockServerAction.PAYLOAD_FORCE_FAIL, "exception");
     final Stage s = getStageWithServerAction(1, 977, payload, "test", 300, false, false);
-    stages.add(s);
+    List<Stage> stages = Collections.singletonList(s);
 
     ActionDBAccessor db = mock(ActionDBAccessor.class);
     HostRoleCommandDAO hostRoleCommandDAOMock = mock(HostRoleCommandDAO.class);
@@ -996,7 +990,7 @@ public class TestActionScheduler {
     when(db.getRequestEntity(anyLong())).thenReturn(request);
 
     when(db.getCommandsInProgressCount()).thenReturn(stages.size());
-    when(db.getStagesInProgress()).thenReturn(stages);
+    when(db.getFirstStageInProgressPerRequest()).thenReturn(stages);
 
     doAnswer(new Answer<Void>() {
       @Override
@@ -1146,7 +1140,7 @@ public class TestActionScheduler {
     when(db.getRequestEntity(anyLong())).thenReturn(request);
 
     when(db.getCommandsInProgressCount()).thenReturn(stages.size());
-    when(db.getStagesInProgress()).thenReturn(stages);
+    when(db.getFirstStageInProgressPerRequest()).thenReturn(stages);
 
     Properties properties = new Properties();
     Configuration conf = new Configuration(properties);
@@ -1238,7 +1232,7 @@ public class TestActionScheduler {
     when(db.getRequestEntity(anyLong())).thenReturn(request);
 
     when(db.getCommandsInProgressCount()).thenReturn(stages.size());
-    when(db.getStagesInProgress()).thenReturn(stages);
+    when(db.getFirstStageInProgressPerRequest()).thenReturn(stages);
 
     Properties properties = new Properties();
     properties.put(Configuration.PARALLEL_STAGE_EXECUTION.getKey(), "false");
@@ -1315,7 +1309,7 @@ public class TestActionScheduler {
     when(db.getRequestEntity(anyLong())).thenReturn(request);
 
     when(db.getCommandsInProgressCount()).thenReturn(stages.size());
-    when(db.getStagesInProgress()).thenReturn(stages);
+    when(db.getFirstStageInProgressPerRequest()).thenReturn(stages);
 
     Properties properties = new Properties();
     properties.put(Configuration.PARALLEL_STAGE_EXECUTION.getKey(), "true");
@@ -1357,9 +1351,13 @@ public class TestActionScheduler {
     when(scomp.getServiceComponentHosts()).thenReturn(hosts);
 
     final List<Stage> stages = new ArrayList<>();
+
     stages.add(
         getStageWithSingleTask(
             hostname, "cluster1", Role.NAMENODE, RoleCommand.UPGRADE, Service.Type.HDFS, 1, 1, 1));
+
+    List<Stage> firstStageInProgress = Collections.singletonList(stages.get(0));
+
     stages.add(
         getStageWithSingleTask(
             hostname, "cluster1", Role.DATANODE, RoleCommand.UPGRADE, Service.Type.HDFS, 2, 2, 1));
@@ -1376,7 +1374,7 @@ public class TestActionScheduler {
     when(db.getRequestEntity(anyLong())).thenReturn(request);
 
     when(db.getCommandsInProgressCount()).thenReturn(stages.size());
-    when(db.getStagesInProgress()).thenReturn(stages);
+    when(db.getFirstStageInProgressPerRequest()).thenReturn(firstStageInProgress);
     doAnswer(new Answer<Void>() {
       @Override
       public Void answer(InvocationOnMock invocation) throws Throwable {
@@ -1517,8 +1515,6 @@ public class TestActionScheduler {
     hostDAO.create(hostEntity1);
     hostDAO.create(hostEntity2);
 
-    final List<Stage> stages = new ArrayList<>();
-
     long now = System.currentTimeMillis();
     Stage stage = stageFactory.createNew(1, "/tmp", "cluster1", 1L,
         "testRequestFailureBasedOnSuccessFactor", CLUSTER_HOST_INFO, "", "");
@@ -1545,7 +1541,7 @@ public class TestActionScheduler {
     addHostRoleExecutionCommand(now, stage, Role.GANGLIA_MONITOR, Service.Type.GANGLIA,
         RoleCommand.INSTALL, host2, "cluster1");
 
-    stages.add(stage);
+    final List<Stage> stages = Collections.singletonList(stage);
 
     HostRoleStatus[] statusesAtIterOne = {HostRoleStatus.QUEUED, HostRoleStatus.QUEUED,
         HostRoleStatus.QUEUED, HostRoleStatus.QUEUED, HostRoleStatus.FAILED,
@@ -1572,7 +1568,7 @@ public class TestActionScheduler {
     when(db.getRequestEntity(anyLong())).thenReturn(request);
 
     when(db.getCommandsInProgressCount()).thenReturn(stages.size());
-    when(db.getStagesInProgress()).thenReturn(stages);
+    when(db.getFirstStageInProgressPerRequest()).thenReturn(stages);
     doAnswer(new Answer<Void>() {
       @Override
       public Void answer(InvocationOnMock invocation) throws Throwable {
@@ -1740,7 +1736,9 @@ public class TestActionScheduler {
         "cluster1", Service.Type.HDFS.toString(), false, false);
     stage.getExecutionCommandWrapper("host3",
         Role.DATANODE.toString()).getExecutionCommand();
+
     stages.add(stage);
+    List<Stage> stageInProgress = Collections.singletonList(stage);
 
     stage.getOrderedHostRoleCommands().get(0).setTaskId(1);
     stage.getOrderedHostRoleCommands().get(1).setTaskId(2);
@@ -1758,8 +1756,8 @@ public class TestActionScheduler {
     when(request.isExclusive()).thenReturn(false);
     when(db.getRequestEntity(anyLong())).thenReturn(request);
 
-    when(db.getCommandsInProgressCount()).thenReturn(stages.size());
-    when(db.getStagesInProgress()).thenReturn(stages);
+    when(db.getCommandsInProgressCount()).thenReturn(stageInProgress.size());
+    when(db.getFirstStageInProgressPerRequest()).thenReturn(stageInProgress);
     doAnswer(new Answer<Void>() {
       @Override
       public Void answer(InvocationOnMock invocation) throws Throwable {
@@ -2013,7 +2011,7 @@ public class TestActionScheduler {
       "{\"host_param\":\"param_value\"}", "{\"stage_param\":\"param_value\"}");
 
     when(db.getCommandsInProgressCount()).thenReturn(1);
-    when(db.getStagesInProgress()).thenReturn(Collections.singletonList(s1));
+    when(db.getFirstStageInProgressPerRequest()).thenReturn(Collections.singletonList(s1));
 
     //Keep large number of attempts so that the task is not expired finally
     //Small action timeout to test rescheduling
@@ -2030,7 +2028,7 @@ public class TestActionScheduler {
     assertEquals(clusterHostInfo1, ((ExecutionCommand) (ac.get(0))).getClusterHostInfo());
 
     when(db.getCommandsInProgressCount()).thenReturn(1);
-    when(db.getStagesInProgress()).thenReturn(Collections.singletonList(s2));
+    when(db.getFirstStageInProgressPerRequest()).thenReturn(Collections.singletonList(s2));
 
     //Verify that ActionSheduler does not return cached value of cluster host info for new requestId
     ac = waitForQueueSize(hostname, aq, 1, scheduler);
@@ -2083,14 +2081,13 @@ public class TestActionScheduler {
                 "dummyService", "dummyComponent", "dummyHostname"));
     when(serviceObj.getCluster()).thenReturn(oneClusterMock);
 
-    final List<Stage> stages = new ArrayList<>();
     Stage stage1 = stageFactory.createNew(1, "/tmp", "cluster1", 1L, "stageWith2Tasks",
             CLUSTER_HOST_INFO, "", "");
     addInstallTaskToStage(stage1, hostname1, "cluster1", Role.HBASE_MASTER,
             RoleCommand.INSTALL, Service.Type.HBASE, 1);
     addInstallTaskToStage(stage1, hostname1, "cluster1", Role.HBASE_REGIONSERVER,
             RoleCommand.INSTALL, Service.Type.HBASE, 2);
-    stages.add(stage1);
+    final List<Stage> stages = Collections.singletonList(stage1);
 
     ActionDBAccessor db = mock(ActionDBAccessor.class);
 
@@ -2099,7 +2096,7 @@ public class TestActionScheduler {
     when(db.getRequestEntity(anyLong())).thenReturn(request);
 
     when(db.getCommandsInProgressCount()).thenReturn(stages.size());
-    when(db.getStagesInProgress()).thenReturn(stages);
+    when(db.getFirstStageInProgressPerRequest()).thenReturn(stages);
 
     ActionScheduler scheduler = new ActionScheduler(100, 50000, db, aq, fsm, 3,
         new HostsMap((String) null), unitOfWork, null, conf, entityManagerProviderMock,
@@ -2155,10 +2152,9 @@ public class TestActionScheduler {
     Clusters fsm = mock(Clusters.class);
     UnitOfWork unitOfWork = mock(UnitOfWork.class);
 
-    List<Stage> stages = new ArrayList<>();
     Map<String, String> payload = new HashMap<>();
     final Stage s = getStageWithServerAction(1, 977, payload, "test", 300, false, false);
-    stages.add(s);
+    List<Stage> stages = Collections.singletonList(s);
 
     ActionDBAccessor db = mock(ActionDBAccessor.class);
     HostRoleCommandDAO hostRoleCommandDAOMock = mock(HostRoleCommandDAO.class);
@@ -2169,7 +2165,7 @@ public class TestActionScheduler {
     when(db.getRequestEntity(anyLong())).thenReturn(request);
 
     when(db.getCommandsInProgressCount()).thenReturn(stages.size());
-    when(db.getStagesInProgress()).thenReturn(stages);
+    when(db.getFirstStageInProgressPerRequest()).thenReturn(stages);
     doAnswer(new Answer<Void>() {
       @Override
       public Void answer(InvocationOnMock invocation) throws Throwable {
@@ -2259,6 +2255,7 @@ public class TestActionScheduler {
     long requestId = 1;
     final List<Stage> allStages = new ArrayList<>();
     final List<Stage> stagesInProgress = new ArrayList<>();
+    final List<Stage> firstStageInProgress = new ArrayList<>();
     final List<HostRoleCommand> tasksInProgress = new ArrayList<>();
     final List<HostRoleCommandEntity> hrcEntitiesInProgress = new ArrayList<>();
 
@@ -2279,6 +2276,7 @@ public class TestActionScheduler {
         Service.Type.HDFS, namenodeCmdTaskId, 2, (int) requestId);
 
     tasksInProgress.addAll(stageWithTask.getOrderedHostRoleCommands());
+    firstStageInProgress.add(stageWithTask);
     stagesInProgress.add(stageWithTask);
     allStages.add(stageWithTask);
 
@@ -2319,7 +2317,7 @@ public class TestActionScheduler {
     when(db.getRequestEntity(anyLong())).thenReturn(request);
 
     when(db.getCommandsInProgressCount()).thenReturn(stagesInProgress.size());
-    when(db.getStagesInProgress()).thenReturn(stagesInProgress);
+    when(db.getFirstStageInProgressPerRequest()).thenReturn(stagesInProgress);
     when(db.getStagesInProgressForRequest(requestId)).thenReturn(stagesInProgress);
     when(db.getAllStages(anyLong())).thenReturn(allStages);
 
@@ -2458,26 +2456,34 @@ public class TestActionScheduler {
     long requestId2 = 2;
     long requestId3 = 3;
 
+    final List<Stage> firstStageInProgressByRequest = new ArrayList<>();
     final List<Stage> stagesInProgress = new ArrayList<>();
     int namenodeCmdTaskId = 1;
-    stagesInProgress.add(
-            getStageWithSingleTask(
-                    hostname1, "cluster1", Role.NAMENODE, RoleCommand.START,
-                    Service.Type.HDFS, namenodeCmdTaskId, 1, (int) requestId1));
-    stagesInProgress.add(
-            getStageWithSingleTask(
-                    hostname1, "cluster1", Role.DATANODE, RoleCommand.START,
-                    Service.Type.HDFS, 2, 2, (int) requestId1));
-    stagesInProgress.add(
-            getStageWithSingleTask(
-                    hostname2, "cluster1", Role.DATANODE, RoleCommand.STOP, //Exclusive
-                    Service.Type.HDFS, 3, 3, (int) requestId2));
 
-    stagesInProgress.add(
-            getStageWithSingleTask(
-                    hostname3, "cluster1", Role.DATANODE, RoleCommand.START,
-                    Service.Type.HDFS, 4, 4, (int) requestId3));
+    Stage request1Stage1 = getStageWithSingleTask(hostname1, "cluster1", Role.NAMENODE,
+        RoleCommand.START,
+        Service.Type.HDFS, namenodeCmdTaskId, 1, (int) requestId1);
+
+    Stage request1Stage2 = getStageWithSingleTask(hostname1, "cluster1", Role.DATANODE,
+        RoleCommand.START,
+        Service.Type.HDFS, 2, 2, (int) requestId1);
+
+    Stage request2Stage1 = getStageWithSingleTask(hostname2, "cluster1", Role.DATANODE,
+        RoleCommand.STOP, // Exclusive
+        Service.Type.HDFS, 3, 3, (int) requestId2);
+
+    Stage request3Stage1 = getStageWithSingleTask(hostname3, "cluster1", Role.DATANODE,
+        RoleCommand.START,
+        Service.Type.HDFS, 4, 4, (int) requestId3);
 
+    firstStageInProgressByRequest.add(request1Stage1);
+    firstStageInProgressByRequest.add(request2Stage1);
+    firstStageInProgressByRequest.add(request3Stage1);
+
+    stagesInProgress.add(request1Stage1);
+    stagesInProgress.add(request1Stage2);
+    stagesInProgress.add(request2Stage1);
+    stagesInProgress.add(request3Stage1);
 
     Host host1 = mock(Host.class);
     when(fsm.getHost(anyString())).thenReturn(host1);
@@ -2498,7 +2504,7 @@ public class TestActionScheduler {
     HostRoleCommandDAO hostRoleCommandDAOMock = mock(HostRoleCommandDAO.class);
     Mockito.doNothing().when(hostRoleCommandDAOMock).publishTaskCreateEvent(anyListOf(HostRoleCommand.class));
     when(db.getCommandsInProgressCount()).thenReturn(stagesInProgress.size());
-    when(db.getStagesInProgress()).thenReturn(stagesInProgress);
+    when(db.getFirstStageInProgressPerRequest()).thenReturn(firstStageInProgressByRequest);
 
     List<HostRoleCommand> requestTasks = new ArrayList<>();
     for (Stage stage : stagesInProgress) {
@@ -2585,6 +2591,10 @@ public class TestActionScheduler {
     Assert.assertFalse(startedRequests.containsKey(requestId3));
 
     stagesInProgress.remove(0);
+    firstStageInProgressByRequest.clear();
+    firstStageInProgressByRequest.add(request1Stage2);
+    firstStageInProgressByRequest.add(request2Stage1);
+    firstStageInProgressByRequest.add(request3Stage1);
 
     scheduler.doWork();
 
@@ -2595,6 +2605,9 @@ public class TestActionScheduler {
     // Execution of request 2
 
     stagesInProgress.remove(0);
+    firstStageInProgressByRequest.clear();
+    firstStageInProgressByRequest.add(request2Stage1);
+    firstStageInProgressByRequest.add(request3Stage1);
 
     scheduler.doWork();
 
@@ -2605,6 +2618,8 @@ public class TestActionScheduler {
     // Execution of request 3
 
     stagesInProgress.remove(0);
+    firstStageInProgressByRequest.clear();
+    firstStageInProgressByRequest.add(request3Stage1);
 
     scheduler.doWork();
 
@@ -2715,6 +2730,7 @@ public class TestActionScheduler {
     Stage stage = null;
     Stage stage2 = null;
     final List<Stage> stages = new ArrayList<>();
+    final List<Stage> firstStageInProgress = new ArrayList<>();
     stages.add(stage = getStageWithSingleTask(hostname1, "cluster1", Role.NAMENODE,
         RoleCommand.STOP, Service.Type.HDFS, 1, 1, 1));
 
@@ -2735,6 +2751,9 @@ public class TestActionScheduler {
     HostRoleCommand command = stage.getOrderedHostRoleCommands().iterator().next();
     command.setStatus(HostRoleStatus.FAILED);
 
+    // still in progress even though 1 task has been failed
+    firstStageInProgress.add(stage);
+
     ActionDBAccessor db = mock(ActionDBAccessor.class);
     HostRoleCommandDAO hostRoleCommandDAOMock = mock(HostRoleCommandDAO.class);
     Mockito.doNothing().when(hostRoleCommandDAOMock).publishTaskCreateEvent(anyListOf(HostRoleCommand.class));
@@ -2743,8 +2762,8 @@ public class TestActionScheduler {
     when(request.isExclusive()).thenReturn(false);
     when(db.getRequestEntity(anyLong())).thenReturn(request);
 
-    when(db.getCommandsInProgressCount()).thenReturn(stages.size());
-    when(db.getStagesInProgress()).thenReturn(stages);
+    when(db.getCommandsInProgressCount()).thenReturn(firstStageInProgress.size());
+    when(db.getFirstStageInProgressPerRequest()).thenReturn(firstStageInProgress);
 
     doAnswer(new Answer<Void>() {
       @Override

http://git-wip-us.apache.org/repos/asf/ambari/blob/1a08c498/ambari-server/src/test/java/org/apache/ambari/server/orm/dao/RequestDAOTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/orm/dao/RequestDAOTest.java b/ambari-server/src/test/java/org/apache/ambari/server/orm/dao/RequestDAOTest.java
index 9b62671..17cebc3 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/orm/dao/RequestDAOTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/orm/dao/RequestDAOTest.java
@@ -42,6 +42,7 @@ import org.apache.ambari.server.orm.entities.RequestEntity;
 import org.apache.ambari.server.orm.entities.ResourceEntity;
 import org.apache.ambari.server.orm.entities.ResourceTypeEntity;
 import org.apache.ambari.server.orm.entities.StageEntity;
+import org.apache.ambari.server.orm.entities.StageEntityPK;
 import org.apache.ambari.server.security.authorization.ResourceType;
 import org.junit.After;
 import org.junit.Assert;
@@ -124,7 +125,25 @@ public class RequestDAOTest {
     group.add(4L);
 
     // !!! accepted
-    List<StageEntity> stages = stageDAO.findByStageIds(requestEntity.getRequestId(), group);
+    List<StageEntity> stages = new ArrayList<>();
+    StageEntityPK primaryKey = new StageEntityPK();
+    primaryKey.setRequestId(requestEntity.getRequestId());
+    primaryKey.setStageId(2L);
+
+    StageEntity stage = stageDAO.findByPK(primaryKey);
+    Assert.assertNotNull(stage);
+    stages.add(stage);
+
+    primaryKey.setStageId(3L);
+    stage = stageDAO.findByPK(primaryKey);
+    Assert.assertNotNull(stage);
+    stages.add(stage);
+
+    primaryKey.setStageId(4L);
+    stage = stageDAO.findByPK(primaryKey);
+    Assert.assertNotNull(stage);
+    stages.add(stage);
+
     CalculatedStatus calc3 = CalculatedStatus.statusFromStageEntities(stages);
 
     // !!! aggregated

http://git-wip-us.apache.org/repos/asf/ambari/blob/1a08c498/ambari-server/src/test/java/org/apache/ambari/server/serveraction/ServerActionExecutorTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/serveraction/ServerActionExecutorTest.java b/ambari-server/src/test/java/org/apache/ambari/server/serveraction/ServerActionExecutorTest.java
index 44d5b63..2feef41 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/serveraction/ServerActionExecutorTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/serveraction/ServerActionExecutorTest.java
@@ -268,7 +268,7 @@ public class ServerActionExecutorTest {
   private ActionDBAccessor createMockActionDBAccessor(final Request request, final List<Stage> stages) {
     ActionDBAccessor db = mock(ActionDBAccessor.class);
 
-    when(db.getStagesInProgress()).thenReturn(stages);
+    when(db.getFirstStageInProgressPerRequest()).thenReturn(stages);
     doAnswer(new Answer() {
       @Override
       public Object answer(InvocationOnMock invocation) throws Throwable {

http://git-wip-us.apache.org/repos/asf/ambari/blob/1a08c498/ambari-server/src/test/java/org/apache/ambari/server/state/services/RetryUpgradeActionServiceTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/state/services/RetryUpgradeActionServiceTest.java b/ambari-server/src/test/java/org/apache/ambari/server/state/services/RetryUpgradeActionServiceTest.java
index e2ce6e7..2c0b507 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/state/services/RetryUpgradeActionServiceTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/state/services/RetryUpgradeActionServiceTest.java
@@ -20,7 +20,6 @@ package org.apache.ambari.server.state.services;
 import java.sql.SQLException;
 import java.util.ArrayList;
 import java.util.Collections;
-import java.util.HashSet;
 import java.util.List;
 
 import org.apache.ambari.server.AmbariException;
@@ -42,6 +41,7 @@ import org.apache.ambari.server.orm.entities.RepositoryVersionEntity;
 import org.apache.ambari.server.orm.entities.RequestEntity;
 import org.apache.ambari.server.orm.entities.StackEntity;
 import org.apache.ambari.server.orm.entities.StageEntity;
+import org.apache.ambari.server.orm.entities.StageEntityPK;
 import org.apache.ambari.server.orm.entities.UpgradeEntity;
 import org.apache.ambari.server.state.Cluster;
 import org.apache.ambari.server.state.Clusters;
@@ -148,9 +148,11 @@ public class RetryUpgradeActionServiceTest {
     }
 
     // Case 4: Cluster with an active upgrade that contains a failed task in HOLDING_FAILED that does NOT meet conditions to be retried.
-    List<StageEntity> stages = stageDAO.findByStageIds(upgradeRequestId, new HashSet<Long>(){{ add(stageId); }});
-    Assert.assertTrue(!stages.isEmpty() && stages.size() == 1);
-    StageEntity stageEntity = stages.get(0);
+    StageEntityPK primaryKey = new StageEntityPK();
+    primaryKey.setRequestId(upgradeRequestId);
+    primaryKey.setStageId(stageId);
+
+    StageEntity stageEntity = stageDAO.findByPK(primaryKey);
 
     HostRoleCommandEntity hrc2 = new HostRoleCommandEntity();
     hrc2.setStage(stageEntity);
@@ -202,7 +204,7 @@ public class RetryUpgradeActionServiceTest {
 
     // Ensure that task 2 transitioned from HOLDING_TIMEDOUT to PENDING
     Assert.assertEquals(HostRoleStatus.PENDING, hostRoleCommandDAO.findByPK(hrc2.getTaskId()).getStatus());
-    
+
     // Case 7: Cluster with an active upgrade that contains a failed task in HOLDING_FAILED that was already retried and has now expired.
     now = System.currentTimeMillis();
     hrc2.setOriginalStartTime(now - (timeoutMins * 60000) - 1);


[47/50] ambari git commit: AMBARI-20685 - Upgrade Progress Dialog Executes Query Which Causes StackOverflow in JPA (jonathanhurley)

Posted by jo...@apache.org.
AMBARI-20685 - Upgrade Progress Dialog Executes Query Which Causes StackOverflow in JPA (jonathanhurley)


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

Branch: refs/heads/branch-feature-AMBARI-12556
Commit: 92894811ec18ce5eae9aa10071f3bad022d4bcf5
Parents: e8c506f
Author: Jonathan Hurley <jh...@hortonworks.com>
Authored: Wed Apr 5 16:29:22 2017 -0400
Committer: Jonathan Hurley <jh...@hortonworks.com>
Committed: Thu Apr 6 11:41:58 2017 -0400

----------------------------------------------------------------------
 .../internal/StageResourceProvider.java         |  4 +-
 .../internal/UpgradeItemResourceProvider.java   | 61 +++++++++-----------
 .../ambari/server/orm/entities/StageEntity.java | 19 +++---
 .../server/orm/entities/StageEntityPK.java      | 35 +++++------
 .../ambari/server/state/UpgradeHelper.java      | 48 ---------------
 5 files changed, 55 insertions(+), 112 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/92894811/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/StageResourceProvider.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/StageResourceProvider.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/StageResourceProvider.java
index 8759844..db9a0e2 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/StageResourceProvider.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/StageResourceProvider.java
@@ -216,7 +216,7 @@ public class StageResourceProvider extends AbstractControllerResourceProvider im
 
     List<StageEntity> entities = dao.findAll(request, predicate);
     for (StageEntity entity : entities) {
-      results.add(toResource(cache, entity, propertyIds));
+      results.add(StageResourceProvider.toResource(cache, entity, propertyIds));
     }
 
     cache.clear();
@@ -273,7 +273,7 @@ public class StageResourceProvider extends AbstractControllerResourceProvider im
    *
    * @return the new resource
    */
-  private Resource toResource(
+  static Resource toResource(
       Map<Long, Map<Long, HostRoleCommandStatusSummaryDTO>> cache,
       StageEntity entity,
       Set<String> requestedIds) {

http://git-wip-us.apache.org/repos/asf/ambari/blob/92894811/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/UpgradeItemResourceProvider.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/UpgradeItemResourceProvider.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/UpgradeItemResourceProvider.java
index bf0fa33..21b6c64 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/UpgradeItemResourceProvider.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/UpgradeItemResourceProvider.java
@@ -41,6 +41,8 @@ import org.apache.ambari.server.controller.spi.Resource;
 import org.apache.ambari.server.controller.spi.SystemException;
 import org.apache.ambari.server.controller.spi.UnsupportedPropertyException;
 import org.apache.ambari.server.controller.utilities.PropertyHelper;
+import org.apache.ambari.server.orm.dao.HostRoleCommandDAO;
+import org.apache.ambari.server.orm.dao.HostRoleCommandStatusSummaryDTO;
 import org.apache.ambari.server.orm.dao.StageDAO;
 import org.apache.ambari.server.orm.dao.UpgradeDAO;
 import org.apache.ambari.server.orm.entities.StageEntity;
@@ -53,7 +55,6 @@ import org.apache.ambari.server.security.authorization.AuthorizationHelper;
 import org.apache.ambari.server.security.authorization.ResourceType;
 import org.apache.ambari.server.security.authorization.RoleAuthorization;
 import org.apache.ambari.server.state.Cluster;
-import org.apache.ambari.server.state.UpgradeHelper;
 import org.apache.ambari.server.utils.SecretReference;
 import org.apache.commons.lang.StringUtils;
 
@@ -84,12 +85,8 @@ public class UpgradeItemResourceProvider extends ReadOnlyResourceProvider {
   @Inject
   private static StageDAO s_stageDao;
 
-  /**
-   * Used to generated the correct tasks and stages during an upgrade.
-   */
   @Inject
-  private static UpgradeHelper s_upgradeHelper;
-
+  private static HostRoleCommandDAO s_hostRoleCommandDAO;
 
   static {
     // properties
@@ -232,38 +229,36 @@ public class UpgradeItemResourceProvider extends ReadOnlyResourceProvider {
         }
       }
 
+      Map<Long, HostRoleCommandStatusSummaryDTO> requestAggregateCounts = s_hostRoleCommandDAO.findAggregateCounts(requestId);
+      Map<Long, Map<Long, HostRoleCommandStatusSummaryDTO>> cache = new HashMap<>();
+      cache.put(requestId, requestAggregateCounts);
+
       // !!! need to do some lookup for stages, so use a stageid -> resource for
       // when that happens
-      Map<Long, Resource> resultMap = new HashMap<>();
-
       for (UpgradeItemEntity entity : entities) {
-        Resource r = toResource(entity, requestPropertyIds);
-        resultMap.put(entity.getStageId(), r);
-      }
-
-      if (!resultMap.isEmpty()) {
-        if (null != clusterName) {
-          Set<Resource> stages = s_upgradeHelper.getStageResources(clusterName,
-              requestId, new ArrayList<>(resultMap.keySet()));
-
-          for (Resource stage : stages) {
-            Long l = (Long) stage.getPropertyValue(StageResourceProvider.STAGE_STAGE_ID);
-
-            Resource r = resultMap.get(l);
-            if (null != r) {
-              for (String propertyId : StageResourceProvider.PROPERTY_IDS) {
-                // Attempt to mask any passwords in fields that are property maps.
-                Object value = stage.getPropertyValue(propertyId);
-                if (StageResourceProvider.PROPERTIES_TO_MASK_PASSWORD_IN.contains(propertyId) &&
-                    value.getClass().equals(String.class) && !StringUtils.isBlank((String) value)) {
-                  value = SecretReference.maskPasswordInPropertyMap((String) value);
-                }
-                setResourceProperty(r, STAGE_MAPPED_IDS.get(propertyId), value, requestPropertyIds);
-              }
-            }
+        Resource upgradeItemResource = toResource(entity, requestPropertyIds);
+
+        StageEntityPK stagePrimaryKey = new StageEntityPK();
+        stagePrimaryKey.setRequestId(requestId);
+        stagePrimaryKey.setStageId(entity.getStageId());
+
+        StageEntity stageEntity = s_stageDao.findByPK(stagePrimaryKey);
+        Resource stageResource = StageResourceProvider.toResource(cache, stageEntity,
+            StageResourceProvider.PROPERTY_IDS);
+
+        for (String propertyId : StageResourceProvider.PROPERTY_IDS) {
+          // Attempt to mask any passwords in fields that are property maps.
+          Object value = stageResource.getPropertyValue(propertyId);
+          if (StageResourceProvider.PROPERTIES_TO_MASK_PASSWORD_IN.contains(propertyId)
+              && value.getClass().equals(String.class) && !StringUtils.isBlank((String) value)) {
+            value = SecretReference.maskPasswordInPropertyMap((String) value);
           }
+
+          setResourceProperty(upgradeItemResource, STAGE_MAPPED_IDS.get(propertyId), value,
+              requestPropertyIds);
         }
-        results.addAll(resultMap.values());
+
+        results.add(upgradeItemResource);
       }
     }
     return results;

http://git-wip-us.apache.org/repos/asf/ambari/blob/92894811/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/StageEntity.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/StageEntity.java b/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/StageEntity.java
index 49c1594..d035729 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/StageEntity.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/StageEntity.java
@@ -43,43 +43,42 @@ import org.apache.ambari.server.actionmanager.HostRoleStatus;
 
 @Entity
 @Table(name = "stage")
-@IdClass(org.apache.ambari.server.orm.entities.StageEntityPK.class)
+@IdClass(StageEntityPK.class)
 @NamedQueries({
     @NamedQuery(
         name = "StageEntity.findFirstStageByStatus",
         query = "SELECT stage.requestId, MIN(stage.stageId) from StageEntity stage, HostRoleCommandEntity hrc WHERE hrc.status IN :statuses AND hrc.stageId = stage.stageId AND hrc.requestId = stage.requestId GROUP by stage.requestId ORDER BY stage.requestId"),
     @NamedQuery(
-        name = "StageEntity.findByPK",
-        query = "SELECT stage from StageEntity stage WHERE stage.requestId = :requestId AND stage.stageId = :stageId"),
-    @NamedQuery(
         name = "StageEntity.findByRequestIdAndCommandStatuses",
         query = "SELECT stage from StageEntity stage WHERE stage.status IN :statuses AND stage.requestId = :requestId ORDER BY stage.stageId") })
 public class StageEntity {
 
-  @Column(name = "cluster_id", updatable = false, nullable = false)
   @Basic
+  @Column(name = "cluster_id", updatable = false, nullable = false)
   private Long clusterId = Long.valueOf(-1L);
 
-  @Column(name = "request_id", insertable = false, updatable = false, nullable = false)
   @Id
+  @Column(name = "request_id", insertable = false, updatable = false, nullable = false)
   private Long requestId;
 
-  @Column(name = "stage_id", nullable = false)
   @Id
+  @Column(name = "stage_id", insertable = true, updatable = false, nullable = false)
   private Long stageId = 0L;
 
+  @Basic
   @Column(name = "skippable", nullable = false)
   private Integer skippable = Integer.valueOf(0);
 
+  @Basic
   @Column(name = "supports_auto_skip_failure", nullable = false)
   private Integer supportsAutoSkipOnFailure = Integer.valueOf(0);
 
-  @Column(name = "log_info")
   @Basic
+  @Column(name = "log_info")
   private String logInfo = "";
 
-  @Column(name = "request_context")
   @Basic
+  @Column(name = "request_context")
   private String requestContext = "";
 
   @Basic
@@ -107,8 +106,8 @@ public class StageEntity {
   @Basic(fetch = FetchType.LAZY)
   private byte[] commandParamsStage;
 
-  @Column(name = "host_params")
   @Basic
+  @Column(name = "host_params")
   private byte[] hostParamsStage;
 
   /**

http://git-wip-us.apache.org/repos/asf/ambari/blob/92894811/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/StageEntityPK.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/StageEntityPK.java b/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/StageEntityPK.java
index 34d175c..c0ccc65 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/StageEntityPK.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/StageEntityPK.java
@@ -19,16 +19,15 @@
 package org.apache.ambari.server.orm.entities;
 
 import java.io.Serializable;
+import java.util.Objects;
 
-import javax.persistence.Column;
-import javax.persistence.Id;
+import org.apache.commons.lang.builder.EqualsBuilder;
 
 @SuppressWarnings("serial")
 public class StageEntityPK implements Serializable {
   private Long requestId;
+  private Long stageId;
 
-  @Id
-  @Column(name = "request_id")
   public Long getRequestId() {
     return requestId;
   }
@@ -37,10 +36,6 @@ public class StageEntityPK implements Serializable {
     this.requestId = requestId;
   }
 
-  private Long stageId;
-
-  @Id
-  @Column(name = "stage_id")
   public Long getStageId() {
     return stageId;
   }
@@ -50,23 +45,25 @@ public class StageEntityPK implements Serializable {
   }
 
   @Override
-  public boolean equals(Object o) {
-    if (this == o) return true;
-    if (o == null || getClass() != o.getClass()) return false;
-
-    StageEntityPK that = (StageEntityPK) o;
+  public boolean equals(Object object) {
+    if (this == object) {
+      return true;
+    }
 
-    if (requestId != null ? !requestId.equals(that.requestId) : that.requestId != null) return false;
-    if (stageId != null ? !stageId.equals(that.stageId) : that.stageId != null) return false;
+    if (object == null || getClass() != object.getClass()) {
+      return false;
+    }
 
-    return true;
+    StageEntityPK that = (StageEntityPK) object;
+    EqualsBuilder equalsBuilder = new EqualsBuilder();
+    equalsBuilder.append(requestId, that.requestId);
+    equalsBuilder.append(stageId, that.stageId);
+    return equalsBuilder.isEquals();
   }
 
   @Override
   public int hashCode() {
-    int result = requestId != null ? requestId.hashCode() : 0;
-    result = 31 * result + (stageId != null ? stageId.hashCode() : 0);
-    return result;
+    return Objects.hash(requestId, stageId);
   }
 
   /**

http://git-wip-us.apache.org/repos/asf/ambari/blob/92894811/ambari-server/src/main/java/org/apache/ambari/server/state/UpgradeHelper.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/state/UpgradeHelper.java b/ambari-server/src/main/java/org/apache/ambari/server/state/UpgradeHelper.java
index eee913a..5a8c25e 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/state/UpgradeHelper.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/state/UpgradeHelper.java
@@ -30,7 +30,6 @@ import java.util.regex.Pattern;
 
 import org.apache.ambari.server.AmbariException;
 import org.apache.ambari.server.api.services.AmbariMetaInfo;
-import org.apache.ambari.server.controller.internal.StageResourceProvider;
 import org.apache.ambari.server.controller.internal.TaskResourceProvider;
 import org.apache.ambari.server.controller.predicate.AndPredicate;
 import org.apache.ambari.server.controller.spi.ClusterController;
@@ -667,53 +666,6 @@ public class UpgradeHelper {
   }
 
   /**
-   * Gets a set of Stages resources to aggregate an UpgradeItem with Stage.
-   *
-   * @param clusterName the cluster name
-   * @param requestId the request id containing the stages
-   * @param stageIds the list of stages to fetch
-   * @return the list of Stage resources
-   * @throws UnsupportedPropertyException
-   * @throws NoSuchResourceException
-   * @throws NoSuchParentResourceException
-   * @throws SystemException
-   */
-  // !!! FIXME this feels very wrong
-  public Set<Resource> getStageResources(String clusterName, Long requestId, List<Long> stageIds)
-      throws UnsupportedPropertyException, NoSuchResourceException, NoSuchParentResourceException, SystemException {
-    ClusterController clusterController = ClusterControllerHelper.getClusterController();
-
-    Request request = PropertyHelper.getReadRequest();
-
-
-    Predicate p1 = new PredicateBuilder().property(StageResourceProvider.STAGE_CLUSTER_NAME).equals(clusterName).toPredicate();
-    Predicate p2 = new PredicateBuilder().property(StageResourceProvider.STAGE_REQUEST_ID).equals(requestId).toPredicate();
-    Predicate p3 = null;
-
-    if (1 == stageIds.size()) {
-      p3 = new PredicateBuilder().property(StageResourceProvider.STAGE_STAGE_ID).equals(stageIds.get(0)).toPredicate();
-    } else if (stageIds.size() > 0) {
-      PredicateBuilder pb = new PredicateBuilder();
-
-      int i = 0;
-      for (Long stageId : stageIds) {
-        if (i++ < stageIds.size()-1) {
-          pb = pb.property(StageResourceProvider.STAGE_STAGE_ID).equals(stageId).or();
-        } else {
-          pb.property(StageResourceProvider.STAGE_STAGE_ID).equals(stageId);
-        }
-      }
-
-      p3 = pb.toPredicate();
-    }
-
-    QueryResponse response = clusterController.getResources(Resource.Type.Stage,
-        request, new AndPredicate(p1, p2, p3));
-
-    return response.getResources();
-  }
-
-  /**
    * Get a single resource for the task with the given parameters.
    * @param clusterName Cluster Name
    * @param requestId Request Id


[21/50] ambari git commit: AMBARI-20656.Coordinator and bundle should retain job.properties in submission modal window(M Madhan Mohan Reddy via padmapriyanitt)

Posted by jo...@apache.org.
AMBARI-20656.Coordinator and bundle should retain job.properties in submission modal window(M Madhan Mohan Reddy via padmapriyanitt)


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

Branch: refs/heads/branch-feature-AMBARI-12556
Commit: 900070d8e4ed7bfae200831bd5d4adb58efcc715
Parents: 8f8fc11
Author: padmapriyanitt <pa...@gmail.com>
Authored: Tue Apr 4 12:00:04 2017 +0530
Committer: padmapriyanitt <pa...@gmail.com>
Committed: Tue Apr 4 12:00:04 2017 +0530

----------------------------------------------------------------------
 .../src/main/resources/ui/app/components/bundle-config.js          | 1 +
 .../wfmanager/src/main/resources/ui/app/components/coord-config.js | 1 +
 .../main/resources/ui/app/templates/components/bundle-config.hbs   | 2 +-
 .../main/resources/ui/app/templates/components/coord-config.hbs    | 2 +-
 4 files changed, 4 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/900070d8/contrib/views/wfmanager/src/main/resources/ui/app/components/bundle-config.js
----------------------------------------------------------------------
diff --git a/contrib/views/wfmanager/src/main/resources/ui/app/components/bundle-config.js b/contrib/views/wfmanager/src/main/resources/ui/app/components/bundle-config.js
index 7c63b47..99f4fa7 100644
--- a/contrib/views/wfmanager/src/main/resources/ui/app/components/bundle-config.js
+++ b/contrib/views/wfmanager/src/main/resources/ui/app/components/bundle-config.js
@@ -46,6 +46,7 @@ export default Ember.Component.extend(Ember.Evented, Validations, {
   propertyExtractor : Ember.inject.service('property-extractor'),
   fileBrowser : Ember.inject.service('file-browser'),
   workspaceManager : Ember.inject.service('workspace-manager'),
+  jobConfigProperties: Ember.A([]),
   initialize : function(){
     var self = this;
     this.set('errors', Ember.A([]));

http://git-wip-us.apache.org/repos/asf/ambari/blob/900070d8/contrib/views/wfmanager/src/main/resources/ui/app/components/coord-config.js
----------------------------------------------------------------------
diff --git a/contrib/views/wfmanager/src/main/resources/ui/app/components/coord-config.js b/contrib/views/wfmanager/src/main/resources/ui/app/components/coord-config.js
index e8f8cc1..fba4db5 100644
--- a/contrib/views/wfmanager/src/main/resources/ui/app/components/coord-config.js
+++ b/contrib/views/wfmanager/src/main/resources/ui/app/components/coord-config.js
@@ -50,6 +50,7 @@ export default Ember.Component.extend(Validations, Ember.Evented, {
   propertyExtractor : Ember.inject.service('property-extractor'),
   workspaceManager : Ember.inject.service('workspace-manager'),
   showErrorMessage: Ember.computed.alias('saveAttempted'),
+  jobConfigProperties: Ember.A([]),
   datasetsForInputs : Ember.computed('coordinator.datasets.[]','coordinator.dataOutputs.[]',function(){
     var datasetsForInputs = Ember.copy(this.get('coordinator.datasets'));
     this.get('coordinator.dataOutputs').forEach((dataOutput)=>{

http://git-wip-us.apache.org/repos/asf/ambari/blob/900070d8/contrib/views/wfmanager/src/main/resources/ui/app/templates/components/bundle-config.hbs
----------------------------------------------------------------------
diff --git a/contrib/views/wfmanager/src/main/resources/ui/app/templates/components/bundle-config.hbs b/contrib/views/wfmanager/src/main/resources/ui/app/templates/components/bundle-config.hbs
index 39ab06d..b674990 100644
--- a/contrib/views/wfmanager/src/main/resources/ui/app/templates/components/bundle-config.hbs
+++ b/contrib/views/wfmanager/src/main/resources/ui/app/templates/components/bundle-config.hbs
@@ -124,7 +124,7 @@
   {{hdfs-browser closeFileBrowser="closeFileBrowser" selectFileCallback=selectFileCallback filePath=filePath}}
 {{/if}}
 {{#if showingJobConfig}}
-  {{job-config type='bundle' closeJobConfigs="closeBundleSubmitConfig" jobFilePath=bundleFilePath openFileBrowser="openFileBrowser" closeFileBrowser="closeFileBrowser" jobConfigs=bundleConfigs containsParameteriedPaths=containsParameteriedPaths}}
+  {{job-config type='bundle' closeJobConfigs="closeBundleSubmitConfig" jobFilePath=bundleFilePath openFileBrowser="openFileBrowser" closeFileBrowser="closeFileBrowser" jobConfigs=bundleConfigs containsParameteriedPaths=containsParameteriedPaths jobConfigProperties=jobConfigProperties}}
 {{/if}}
 {{#if showingResetConfirmation}}
   {{#confirmation-dialog title="Confirm Bundle Reset"

http://git-wip-us.apache.org/repos/asf/ambari/blob/900070d8/contrib/views/wfmanager/src/main/resources/ui/app/templates/components/coord-config.hbs
----------------------------------------------------------------------
diff --git a/contrib/views/wfmanager/src/main/resources/ui/app/templates/components/coord-config.hbs b/contrib/views/wfmanager/src/main/resources/ui/app/templates/components/coord-config.hbs
index 0e35d0e..3b1b6a9 100644
--- a/contrib/views/wfmanager/src/main/resources/ui/app/templates/components/coord-config.hbs
+++ b/contrib/views/wfmanager/src/main/resources/ui/app/templates/components/coord-config.hbs
@@ -339,7 +339,7 @@
     parameterizedWorkflowPath=parameterizedWorkflowPath
     extractProperties="extractProperties" containsParameteriedPaths=containsParameteriedPaths
     jobFilePath=coordinatorFilePath openFileBrowser="openFileBrowser"
-    closeFileBrowser="closeFileBrowser" jobConfigs=coordinatorConfigs isDryrun=dryrun}}
+    closeFileBrowser="closeFileBrowser" jobConfigs=coordinatorConfigs isDryrun=dryrun jobConfigProperties=jobConfigProperties}}
 {{/if}}
 {{#if showingResetConfirmation}}
 {{#confirmation-dialog title="Confirm Coordinator Reset"


[15/50] ambari git commit: AMBARI-20625. Hadoop QA javac warnings increase check is broken -- fix for ambari-server

Posted by jo...@apache.org.
AMBARI-20625. Hadoop QA javac warnings increase check is broken -- fix for ambari-server


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

Branch: refs/heads/branch-feature-AMBARI-12556
Commit: 8f95262d43726e80a2922313d97c68db1ae4c2f4
Parents: c5e5999
Author: Attila Doroszlai <ad...@hortonworks.com>
Authored: Thu Mar 30 15:24:55 2017 +0200
Committer: Attila Doroszlai <ad...@hortonworks.com>
Committed: Mon Apr 3 20:26:04 2017 +0200

----------------------------------------------------------------------
 dev-support/test-patch.sh | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/8f95262d/dev-support/test-patch.sh
----------------------------------------------------------------------
diff --git a/dev-support/test-patch.sh b/dev-support/test-patch.sh
index 294c840..9b6d83e 100755
--- a/dev-support/test-patch.sh
+++ b/dev-support/test-patch.sh
@@ -261,8 +261,8 @@ prebuildWithoutPatch () {
   echo ""
   echo ""
   echo "Compiling $(pwd)"
-  echo "$MVN clean test -DskipTests -D${PROJECT_NAME}PatchProcess > $PATCH_DIR/trunkJavacWarnings.txt 2>&1"
-  $MVN clean test -DskipTests -D${PROJECT_NAME}PatchProcess > $PATCH_DIR/trunkJavacWarnings.txt 2>&1
+  echo "$MVN clean test -DskipTests -Dxlint=all -D${PROJECT_NAME}PatchProcess > $PATCH_DIR/trunkJavacWarnings.txt 2>&1"
+  $MVN clean test -DskipTests -Dxlint=all -D${PROJECT_NAME}PatchProcess > $PATCH_DIR/trunkJavacWarnings.txt 2>&1
   if [[ $? != 0 ]] ; then
     echo "Top-level trunk compilation is broken?"
     JIRA_COMMENT="$JIRA_COMMENT
@@ -385,8 +385,8 @@ checkJavacWarnings () {
   echo "======================================================================"
   echo ""
   echo ""
-  echo "$MVN clean test -DskipTests -D${PROJECT_NAME}PatchProcess > $PATCH_DIR/patchJavacWarnings.txt 2>&1"
-  $MVN clean test -DskipTests -D${PROJECT_NAME}PatchProcess > $PATCH_DIR/patchJavacWarnings.txt 2>&1
+  echo "$MVN clean test -DskipTests -Dxlint=all -D${PROJECT_NAME}PatchProcess > $PATCH_DIR/patchJavacWarnings.txt 2>&1"
+  $MVN clean test -DskipTests -Dxlint=all -D${PROJECT_NAME}PatchProcess > $PATCH_DIR/patchJavacWarnings.txt 2>&1
   if [[ $? != 0 ]] ; then
     JIRA_COMMENT="$JIRA_COMMENT
 


[44/50] ambari git commit: AMBARI-20591 In case of HA-enabled cluster on shutting down Active Master, Ambari rest api call and HBase quick links show two Active Masters (dsen)

Posted by jo...@apache.org.
AMBARI-20591 In case of HA-enabled cluster on shutting down Active Master, Ambari rest api call and HBase quick links show two Active Masters (dsen)


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

Branch: refs/heads/branch-feature-AMBARI-12556
Commit: c11d0045214249e16ba1564c94e6fc6ec4e04d83
Parents: 8e15ba6
Author: Dmytro Sen <ds...@apache.org>
Authored: Thu Apr 6 15:13:52 2017 +0300
Committer: Dmytro Sen <ds...@apache.org>
Committed: Thu Apr 6 15:13:52 2017 +0300

----------------------------------------------------------------------
 .../state/services/MetricsRetrievalService.java | 29 ++++++++-
 .../services/MetricsRetrievalServiceTest.java   | 63 ++++++++++++++++++++
 2 files changed, 91 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/c11d0045/ambari-server/src/main/java/org/apache/ambari/server/state/services/MetricsRetrievalService.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/state/services/MetricsRetrievalService.java b/ambari-server/src/main/java/org/apache/ambari/server/state/services/MetricsRetrievalService.java
index 79e0e25..59ec15b 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/state/services/MetricsRetrievalService.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/state/services/MetricsRetrievalService.java
@@ -18,6 +18,7 @@
 package org.apache.ambari.server.state.services;
 
 import java.io.BufferedReader;
+import java.io.IOException;
 import java.io.InputStream;
 import java.io.InputStreamReader;
 import java.lang.Thread.UncaughtExceptionHandler;
@@ -441,7 +442,12 @@ public class MetricsRetrievalService extends AbstractService {
         if (null != m_ttlUrlCache) {
           m_ttlUrlCache.put(m_url, m_url);
         }
-
+      } catch (IOException exception)
+      {
+        LOG.debug("Removing cached values for url {}", m_url);
+        // need to ensure old values are removed because they could be not valid if the state have changed.
+        removeCachedMetricsForCurrentURL();
+        logException(exception, m_url);
       } catch (Exception exception) {
         logException(exception, m_url);
       } finally {
@@ -454,6 +460,11 @@ public class MetricsRetrievalService extends AbstractService {
     }
 
     /**
+     * Removes metric values for current URL from cache.
+     */
+    protected abstract void removeCachedMetricsForCurrentURL();
+
+    /**
      * Reads data from the specified {@link InputStream} and processes that into
      * a cachable value. The value will then be cached by this method.
      *
@@ -536,6 +547,14 @@ public class MetricsRetrievalService extends AbstractService {
      * {@inheritDoc}
      */
     @Override
+    protected void removeCachedMetricsForCurrentURL() {
+      m_cache.invalidate(m_url);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
     protected void processInputStreamAndCacheResult(InputStream inputStream) throws Exception {
       JMXMetricHolder jmxMetricHolder = m_jmxObjectReader.readValue(inputStream);
       m_cache.put(m_url, jmxMetricHolder);
@@ -575,6 +594,14 @@ public class MetricsRetrievalService extends AbstractService {
      * {@inheritDoc}
      */
     @Override
+    protected void removeCachedMetricsForCurrentURL() {
+      m_cache.invalidate(m_url);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
     protected void processInputStreamAndCacheResult(InputStream inputStream) throws Exception {
       Type type = new TypeToken<Map<Object, Object>>() {}.getType();
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/c11d0045/ambari-server/src/test/java/org/apache/ambari/server/state/services/MetricsRetrievalServiceTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/state/services/MetricsRetrievalServiceTest.java b/ambari-server/src/test/java/org/apache/ambari/server/state/services/MetricsRetrievalServiceTest.java
index 784ba92..ea204aa 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/state/services/MetricsRetrievalServiceTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/state/services/MetricsRetrievalServiceTest.java
@@ -17,6 +17,7 @@
  */
 package org.apache.ambari.server.state.services;
 
+import java.io.IOException;
 import java.io.InputStream;
 import java.util.Map;
 
@@ -117,6 +118,68 @@ public class MetricsRetrievalServiceTest extends EasyMockSupport {
   }
 
   /**
+   * Test removing cached values if request failed with IOException.
+   */
+  @Test
+  public void testRemovingValuesFromCacheOnFail() throws Exception {
+
+    Configuration configuration = m_injector.getInstance(Configuration.class);
+    configuration.setProperty(
+            Configuration.METRIC_RETRIEVAL_SERVICE_REQUEST_TTL.getKey(), "1");
+
+    InputStream jmxInputStream = IOUtils.toInputStream("{ \"beans\": [] }");
+    InputStream restInputStream = IOUtils.toInputStream("{}");
+
+    StreamProvider streamProvider = createNiceMock(StreamProvider.class);
+
+    EasyMock.expect(streamProvider.readFrom(JMX_URL)).andReturn(jmxInputStream).once();
+    EasyMock.expect(streamProvider.readFrom(REST_URL)).andReturn(restInputStream).once();
+
+    EasyMock.expect(streamProvider.readFrom(JMX_URL)).andThrow(new IOException()).once();
+    EasyMock.expect(streamProvider.readFrom(REST_URL)).andThrow(new IOException()).once();
+
+    replayAll();
+
+    m_service.doStart();
+
+    // make the service synchronous
+    m_service.setThreadPoolExecutor(new SynchronousThreadPoolExecutor());
+
+    JMXMetricHolder jmxMetricHolder = m_service.getCachedJMXMetric(JMX_URL);
+    Assert.assertNull(jmxMetricHolder);
+
+    Map<String, String> restMetrics = m_service.getCachedRESTMetric(REST_URL);
+    Assert.assertNull(restMetrics);
+
+    m_service.submitRequest(MetricSourceType.JMX, streamProvider, JMX_URL);
+    jmxMetricHolder = m_service.getCachedJMXMetric(JMX_URL);
+    Assert.assertNotNull(jmxMetricHolder);
+
+    m_service.submitRequest(MetricSourceType.REST, streamProvider, REST_URL);
+    restMetrics = m_service.getCachedRESTMetric(REST_URL);
+    Assert.assertNotNull(restMetrics);
+
+
+    jmxMetricHolder = m_service.getCachedJMXMetric(JMX_URL);
+    Assert.assertNotNull(jmxMetricHolder);
+
+    restMetrics = m_service.getCachedRESTMetric(REST_URL);
+    Assert.assertNotNull(restMetrics);
+
+    Thread.sleep(1000);
+
+    m_service.submitRequest(MetricSourceType.JMX, streamProvider, JMX_URL);
+    jmxMetricHolder = m_service.getCachedJMXMetric(JMX_URL);
+    Assert.assertNull(jmxMetricHolder);
+
+    m_service.submitRequest(MetricSourceType.REST, streamProvider, REST_URL);
+    restMetrics = m_service.getCachedRESTMetric(REST_URL);
+    Assert.assertNull(restMetrics);
+
+    verifyAll();
+  }
+
+  /**
    * Tests that many requests to the same URL do not invoke the stream provider
    * more than once.
    */


[32/50] ambari git commit: AMBARI-20671 Host checks: incorrect message for single host warnings. (ababiichuk)

Posted by jo...@apache.org.
AMBARI-20671 Host checks: incorrect message for single host warnings. (ababiichuk)


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

Branch: refs/heads/branch-feature-AMBARI-12556
Commit: 6ee881bcf22016fa0213a11a13fc3b93356caabf
Parents: 36629d5
Author: ababiichuk <ab...@hortonworks.com>
Authored: Tue Apr 4 19:22:31 2017 +0300
Committer: ababiichuk <ab...@hortonworks.com>
Committed: Tue Apr 4 19:22:31 2017 +0300

----------------------------------------------------------------------
 .../app/controllers/wizard/step3_controller.js  |  3 +-
 .../main/host/details/actions/check_host.js     | 86 +++++---------------
 .../wizard/step3/step3_host_warnings_popup.hbs  |  6 +-
 .../test/controllers/wizard/step3_test.js       | 34 --------
 4 files changed, 24 insertions(+), 105 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/6ee881bc/ambari-web/app/controllers/wizard/step3_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/wizard/step3_controller.js b/ambari-web/app/controllers/wizard/step3_controller.js
index 7a07253..c282451 100644
--- a/ambari-web/app/controllers/wizard/step3_controller.js
+++ b/ambari-web/app/controllers/wizard/step3_controller.js
@@ -787,8 +787,7 @@ App.WizardStep3Controller = Em.Controller.extend(App.ReloadPopupMixin, App.Check
           hosts: hostsJDKContext,
           hostsLong: hostsJDKContext,
           hostsNames: hostsJDKNames,
-          category: 'jdk',
-          onSingleHost: false
+          category: 'jdk'
         });
       }
       this.set('jdkCategoryWarnings', jdkWarnings);

http://git-wip-us.apache.org/repos/asf/ambari/blob/6ee881bc/ambari-web/app/mixins/main/host/details/actions/check_host.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/mixins/main/host/details/actions/check_host.js b/ambari-web/app/mixins/main/host/details/actions/check_host.js
index fbee24c..c0ebf02 100644
--- a/ambari-web/app/mixins/main/host/details/actions/check_host.js
+++ b/ambari-web/app/mixins/main/host/details/actions/check_host.js
@@ -53,7 +53,6 @@ App.CheckHostMixin = Em.Mixin.create({
    *  hosts: string[],
    *  hostsLong: string[],
    *  hostsNames: string[],
-   *  onSingleHost: boolean
    * }} checkWarning
    */
 
@@ -309,8 +308,7 @@ App.CheckHostMixin = Em.Mixin.create({
         hosts: hostsContext,
         hostsLong: hostsContext,
         hostsNames: hostsRepoNames,
-        category: 'repositories',
-        onSingleHost: false
+        category: 'repositories'
       });
     }
     if (hostsDiskContext.length > 0) { // disk space warning exist
@@ -319,8 +317,7 @@ App.CheckHostMixin = Em.Mixin.create({
         hosts: hostsDiskContext,
         hostsLong: hostsDiskContext,
         hostsNames: hostsDiskNames,
-        category: 'disk',
-        onSingleHost: false
+        category: 'disk'
       });
     }
     if (thpContext.length > 0) { // THP warning existed
@@ -329,8 +326,7 @@ App.CheckHostMixin = Em.Mixin.create({
         hosts: thpContext,
         hostsLong: thpContext,
         hostsNames: thpHostsNames,
-        category: 'thp',
-        onSingleHost: false
+        category: 'thp'
       });
     }
 
@@ -373,8 +369,7 @@ App.CheckHostMixin = Em.Mixin.create({
               name: name,
               hosts: [contextMessage],
               hostsLong: [contextMessageLong],
-              hostsNames: [targetHostName],
-              onSingleHost: true
+              hostsNames: [targetHostName]
             };
             this.get("hostCheckWarnings").push(hostInfo);
           } else {
@@ -382,7 +377,6 @@ App.CheckHostMixin = Em.Mixin.create({
               hostInfo.hosts.push(contextMessage);
               hostInfo.hostsLong.push(contextMessageLong);
               hostInfo.hostsNames.push(targetHostName);
-              hostInfo.onSingleHost = false;
             }
           }
         }
@@ -549,14 +543,12 @@ App.CheckHostMixin = Em.Mixin.create({
         if (warning) {
           warning.hosts.push(hostName);
           warning.hostsLong.push(hostName);
-          warning.onSingleHost = false;
         } else {
           warningCategories.fileFoldersWarnings[path.name] = warning = {
             name: path.name,
             hosts: [hostName],
             hostsLong: [hostName],
-            category: 'fileFolders',
-            onSingleHost: true
+            category: 'fileFolders'
           };
         }
         host.warnings.push(warning);
@@ -572,15 +564,13 @@ App.CheckHostMixin = Em.Mixin.create({
             warning.hosts.push(hostName);
             warning.hostsLong.push(hostName);
             warning.version = _package.version;
-            warning.onSingleHost = false;
           } else {
             warningCategories.packagesWarnings[_package.name] = warning = {
               name: _package.name,
               version: _package.version,
               hosts: [hostName],
               hostsLong: [hostName],
-              category: 'packages',
-              onSingleHost: true
+              category: 'packages'
             };
           }
           host.warnings.push(warning);
@@ -606,7 +596,6 @@ App.CheckHostMixin = Em.Mixin.create({
           if (warning) {
             warning.hosts.push(hostName);
             warning.hostsLong.push(hostName);
-            warning.onSingleHost = false;
           } else {
             warningCategories.processesWarnings[process.pid] = warning = {
               name: (process.command.substr(0, 35) + '...'),
@@ -618,8 +607,7 @@ App.CheckHostMixin = Em.Mixin.create({
               command: '<table><tr><td style="word-break: break-all;">' +
               ((process.command.length < 500) ? process.command : process.command.substr(0, 230) + '...' +
               '<p style="text-align: center">................</p>' +
-              '...' + process.command.substr(-230)) + '</td></tr></table>',
-              onSingleHost: true
+              '...' + process.command.substr(-230)) + '</td></tr></table>'
             };
           }
           host.warnings.push(warning);
@@ -634,14 +622,12 @@ App.CheckHostMixin = Em.Mixin.create({
             if (warning) {
               warning.hosts.push(hostName);
               warning.hostsLong.push(hostName);
-              warning.onSingleHost = false;
             } else {
               warningCategories.servicesWarnings[service.name] = warning = {
                 name: service.name,
                 hosts: [hostName],
                 hostsLong: [hostName],
-                category: 'services',
-                onSingleHost: true
+                category: 'services'
               };
             }
             host.warnings.push(warning);
@@ -656,14 +642,12 @@ App.CheckHostMixin = Em.Mixin.create({
           if (warning) {
             warning.hosts.push(hostName);
             warning.hostsLong.push(hostName);
-            warning.onSingleHost = false;
           } else {
             warningCategories.usersWarnings[user.name] = warning = {
               name: user.name,
               hosts: [hostName],
               hostsLong: [hostName],
-              category: 'users',
-              onSingleHost: true
+              category: 'users'
             };
           }
           host.warnings.push(warning);
@@ -677,14 +661,12 @@ App.CheckHostMixin = Em.Mixin.create({
         if (warning) {
           warning.hosts.push(hostName);
           warning.hostsLong.push(hostName);
-          warning.onSingleHost = false;
         } else {
           warning = {
             name: umask,
             hosts: [hostName],
             hostsLong: [hostName],
-            category: 'misc',
-            onSingleHost: true
+            category: 'misc'
           };
           warnings.push(warning);
         }
@@ -698,14 +680,12 @@ App.CheckHostMixin = Em.Mixin.create({
         if (warning) {
           warning.hosts.push(hostName);
           warning.hostsLong.push(hostName);
-          warning.onSingleHost = false;
         } else {
           warning = {
             name: name,
             hosts: [hostName],
             hostsLong: [hostName],
-            category: 'firewall',
-            onSingleHost: true
+            category: 'firewall'
           };
           warnings.push(warning);
         }
@@ -718,15 +698,13 @@ App.CheckHostMixin = Em.Mixin.create({
           if (warning) {
             warning.hosts.push(hostName);
             warning.hostsLong.push(hostName);
-            warning.onSingleHost = false;
           } else {
             warningCategories.alternativeWarnings[alternative.name] = warning = {
               name: alternative.name,
               target: alternative.target,
               hosts: [hostName],
               hostsLong: [hostName],
-              category: 'alternatives',
-              onSingleHost: true
+              category: 'alternatives'
             };
           }
           host.warnings.push(warning);
@@ -739,14 +717,12 @@ App.CheckHostMixin = Em.Mixin.create({
         if (warning) {
           warning.hosts.push(hostName);
           warning.hostsLong.push(hostName);
-          warning.onSingleHost = false;
         } else {
           warning = {
             name: name,
             hosts: [hostName],
             hostsLong: [hostName],
-            category: 'reverseLookup',
-            onSingleHost: true
+            category: 'reverseLookup'
           };
           warnings.push(warning);
         }
@@ -810,14 +786,12 @@ App.CheckHostMixin = Em.Mixin.create({
         if (warning) {
           warning.hosts.push(_host.Hosts.host_name);
           warning.hostsLong.push(_host.Hosts.host_name);
-          warning.onSingleHost = false;
         } else {
           warningCategories.fileFoldersWarnings[path.name] = warning = {
             name: path.name,
             hosts: [_host.Hosts.host_name],
             hostsLong: [_host.Hosts.host_name],
-            category: 'fileFolders',
-            onSingleHost: true
+            category: 'fileFolders'
           };
         }
         host.warnings.push(warning);
@@ -833,15 +807,13 @@ App.CheckHostMixin = Em.Mixin.create({
             warning.hosts.push(_host.Hosts.host_name);
             warning.hostsLong.push(_host.Hosts.host_name);
             warning.version = _package.version;
-            warning.onSingleHost = false;
           } else {
             warningCategories.packagesWarnings[_package.name] = warning = {
               name: _package.name,
               version: _package.version,
               hosts: [_host.Hosts.host_name],
               hostsLong: [_host.Hosts.host_name],
-              category: 'packages',
-              onSingleHost: true
+              category: 'packages'
             };
           }
           host.warnings.push(warning);
@@ -858,7 +830,6 @@ App.CheckHostMixin = Em.Mixin.create({
           if (warning) {
             warning.hosts.push(_host.Hosts.host_name);
             warning.hostsLong.push(_host.Hosts.host_name);
-            warning.onSingleHost = false;
           } else {
             warningCategories.processesWarnings[process.pid] = warning = {
               name: (process.command.substr(0, 35) + '...'),
@@ -870,8 +841,7 @@ App.CheckHostMixin = Em.Mixin.create({
               command: '<table><tr><td style="word-break: break-all;">' +
               ((process.command.length < 500) ? process.command : process.command.substr(0, 230) + '...' +
               '<p style="text-align: center">................</p>' +
-              '...' + process.command.substr(-230)) + '</td></tr></table>',
-              onSingleHost: true
+              '...' + process.command.substr(-230)) + '</td></tr></table>'
             };
           }
           host.warnings.push(warning);
@@ -888,14 +858,12 @@ App.CheckHostMixin = Em.Mixin.create({
             if (warning) {
               warning.hosts.push(_host.Hosts.host_name);
               warning.hostsLong.push(_host.Hosts.host_name);
-              warning.onSingleHost = false;
             } else {
               warningCategories.servicesWarnings[service.name] = warning = {
                 name: service.name,
                 hosts: [_host.Hosts.host_name],
                 hostsLong: [_host.Hosts.host_name],
-                category: 'services',
-                onSingleHost: true
+                category: 'services'
               };
             }
             host.warnings.push(warning);
@@ -911,14 +879,12 @@ App.CheckHostMixin = Em.Mixin.create({
           if (warning) {
             warning.hosts.push(_host.Hosts.host_name);
             warning.hostsLong.push(_host.Hosts.host_name);
-            warning.onSingleHost = false;
           } else {
             warningCategories.usersWarnings[user.name] = warning = {
               name: user.name,
               hosts: [_host.Hosts.host_name],
               hostsLong: [_host.Hosts.host_name],
-              category: 'users',
-              onSingleHost: true
+              category: 'users'
             };
           }
           host.warnings.push(warning);
@@ -932,14 +898,12 @@ App.CheckHostMixin = Em.Mixin.create({
         if (warning) {
           warning.hosts.push(_host.Hosts.host_name);
           warning.hostsLong.push(_host.Hosts.host_name);
-          warning.onSingleHost = false;
         } else {
           warning = {
             name: umask,
             hosts: [_host.Hosts.host_name],
             hostsLong: [_host.Hosts.host_name],
-            category: 'misc',
-            onSingleHost: true
+            category: 'misc'
           };
           warnings.push(warning);
         }
@@ -953,14 +917,12 @@ App.CheckHostMixin = Em.Mixin.create({
         if (warning) {
           warning.hosts.push(_host.Hosts.host_name);
           warning.hostsLong.push(_host.Hosts.host_name);
-          warning.onSingleHost = false;
         } else {
           warning = {
             name: name,
             hosts: [_host.Hosts.host_name],
             hostsLong: [_host.Hosts.host_name],
-            category: 'firewall',
-            onSingleHost: true
+            category: 'firewall'
           };
           warnings.push(warning);
         }
@@ -973,15 +935,13 @@ App.CheckHostMixin = Em.Mixin.create({
           if (warning) {
             warning.hosts.push(_host.Hosts.host_name);
             warning.hostsLong.push(_host.Hosts.host_name);
-            warning.onSingleHost = false;
           } else {
             warningCategories.alternativeWarnings[alternative.name] = warning = {
               name: alternative.name,
               target: alternative.target,
               hosts: [_host.Hosts.host_name],
               hostsLong: [_host.Hosts.host_name],
-              category: 'alternatives',
-              onSingleHost: true
+              category: 'alternatives'
             };
           }
           host.warnings.push(warning);
@@ -994,14 +954,12 @@ App.CheckHostMixin = Em.Mixin.create({
         if (warning) {
           warning.hosts.push(_host.Hosts.host_name);
           warning.hostsLong.push(_host.Hosts.host_name);
-          warning.onSingleHost = false;
         } else {
           warning = {
             name: name,
             hosts: [_host.Hosts.host_name],
             hostsLong: [_host.Hosts.host_name],
-            category: 'reverseLookup',
-            onSingleHost: true
+            category: 'reverseLookup'
           };
           warnings.push(warning);
         }

http://git-wip-us.apache.org/repos/asf/ambari/blob/6ee881bc/ambari-web/app/templates/wizard/step3/step3_host_warnings_popup.hbs
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates/wizard/step3/step3_host_warnings_popup.hbs b/ambari-web/app/templates/wizard/step3/step3_host_warnings_popup.hbs
index e8c5201..07ff31b 100644
--- a/ambari-web/app/templates/wizard/step3/step3_host_warnings_popup.hbs
+++ b/ambari-web/app/templates/wizard/step3/step3_host_warnings_popup.hbs
@@ -90,11 +90,7 @@
                         <td>{{category.action}}
                           <a href="javascript:void(null);" rel='HostsListTooltip' {{bindAttr data-original-title="warning.hostsList"}} {{action showHostsPopup warning.hostsLong}} {{QAAttr "host-with-warning-link"}}>
                             {{warning.hosts.length}}
-                            {{#if warning.onSingleHost}}
-                              {{t installer.step3.hostWarningsPopup.host}}
-                            {{else}}
-                              {{t installer.step3.hostWarningsPopup.hosts}}
-                            {{/if}}
+                            {{pluralize warning.hosts.length singular="t:installer.step3.hostWarningsPopup.host" plular="t:installer.step3.hostWarningsPopup.hosts"}}
                           </a>
                         </td>
                       </tr>

http://git-wip-us.apache.org/repos/asf/ambari/blob/6ee881bc/ambari-web/test/controllers/wizard/step3_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/wizard/step3_test.js b/ambari-web/test/controllers/wizard/step3_test.js
index fa90065..b8bc794 100644
--- a/ambari-web/test/controllers/wizard/step3_test.js
+++ b/ambari-web/test/controllers/wizard/step3_test.js
@@ -1292,7 +1292,6 @@ describe('App.WizardStep3Controller', function () {
                   {
                     name: 'n1',
                     hosts: ['c1'],
-                    onSingleHost: true,
                     category: 'fileFolders'
                   }
                 ],
@@ -1314,7 +1313,6 @@ describe('App.WizardStep3Controller', function () {
                   {
                     name: 'n1',
                     hosts: ['c1', 'c2'],
-                    onSingleHost: false,
                     category: 'fileFolders'
                   }
                 ],
@@ -1359,7 +1357,6 @@ describe('App.WizardStep3Controller', function () {
                   {
                     name: 'n1',
                     hosts: ['c1'],
-                    onSingleHost: true,
                     category: 'services'
                   }
                 ],
@@ -1384,7 +1381,6 @@ describe('App.WizardStep3Controller', function () {
                   {
                     name: 'n1',
                     hosts: ['c1', 'c2'],
-                    onSingleHost: false,
                     category: 'services'
                   }
                 ],
@@ -1422,7 +1418,6 @@ describe('App.WizardStep3Controller', function () {
                   {
                     name: 'n1',
                     hosts: ['c1'],
-                    onSingleHost: true,
                     category: 'users'
                   }
                 ],
@@ -1446,7 +1441,6 @@ describe('App.WizardStep3Controller', function () {
                   {
                     name: 'n1',
                     hosts: ['c1', 'c2'],
-                    onSingleHost: false,
                     category: 'users'
                   }
                 ],
@@ -1484,7 +1478,6 @@ describe('App.WizardStep3Controller', function () {
                   {
                     name: 'n1',
                     hosts: ['c1'],
-                    onSingleHost: true,
                     category: 'alternatives'
                   }
                 ],
@@ -1508,7 +1501,6 @@ describe('App.WizardStep3Controller', function () {
                   {
                     name: 'n1',
                     hosts: ['c1', 'c2'],
-                    onSingleHost: false,
                     category: 'alternatives'
                   }
                 ],
@@ -1556,7 +1548,6 @@ describe('App.WizardStep3Controller', function () {
                   {
                     pid: 'n1',
                     hosts: ['c1'],
-                    onSingleHost: true,
                     category: 'processes'
                   }
                 ],
@@ -1580,7 +1571,6 @@ describe('App.WizardStep3Controller', function () {
                   {
                     pid: 'n1',
                     hosts: ['c1', 'c2'],
-                    onSingleHost: false,
                     category: 'processes'
                   }
                 ],
@@ -1634,7 +1624,6 @@ describe('App.WizardStep3Controller', function () {
       expect(warnings.length).to.equal(1);
       expect(warnings[0].hosts).to.eql(['c1']);
       expect(warnings[0].hostsLong).to.eql(['c1']);
-      expect(warnings[0].onSingleHost).to.equal(true);
 
     });
 
@@ -1667,7 +1656,6 @@ describe('App.WizardStep3Controller', function () {
       expect(warnings.length).to.equal(1);
       expect(warnings[0].hosts).to.eql(['c1']);
       expect(warnings[0].hostsLong).to.eql(['c1']);
-      expect(warnings[0].onSingleHost).to.equal(true);
 
     });
 
@@ -1683,7 +1671,6 @@ describe('App.WizardStep3Controller', function () {
       expect(warnings.length).to.equal(1);
       expect(warnings[0].hosts).to.eql(['c1', 'c2']);
       expect(warnings[0].hostsLong).to.eql(['c1', 'c2']);
-      expect(warnings[0].onSingleHost).to.equal(false);
 
     });
 
@@ -1710,7 +1697,6 @@ describe('App.WizardStep3Controller', function () {
       expect(warnings.length).to.equal(1);
       expect(warnings[0].hosts).to.eql(['c1']);
       expect(warnings[0].hostsLong).to.eql(['c1']);
-      expect(warnings[0].onSingleHost).to.equal(true);
 
     });
 
@@ -1726,7 +1712,6 @@ describe('App.WizardStep3Controller', function () {
       expect(warnings.length).to.equal(1);
       expect(warnings[0].hosts).to.eql(['c1', 'c2']);
       expect(warnings[0].hostsLong).to.eql(['c1', 'c2']);
-      expect(warnings[0].onSingleHost).to.equal(false);
 
     });
   });
@@ -1784,7 +1769,6 @@ describe('App.WizardStep3Controller', function () {
                   {
                     name: 'n1',
                     hosts: ['c1'],
-                    onSingleHost: true,
                     category: 'fileFolders'
                   }
                 ],
@@ -1806,7 +1790,6 @@ describe('App.WizardStep3Controller', function () {
                   {
                     name: 'n1',
                     hosts: ['c1', 'c2'],
-                    onSingleHost: false,
                     category: 'fileFolders'
                   }
                 ],
@@ -1850,7 +1833,6 @@ describe('App.WizardStep3Controller', function () {
                   {
                     name: 'n1',
                     hosts: ['c1'],
-                    onSingleHost: true,
                     category: 'services'
                   }
                 ],
@@ -1872,7 +1854,6 @@ describe('App.WizardStep3Controller', function () {
                   {
                     name: 'n1',
                     hosts: ['c1', 'c2'],
-                    onSingleHost: false,
                     category: 'services'
                   }
                 ],
@@ -1906,7 +1887,6 @@ describe('App.WizardStep3Controller', function () {
                   {
                     name: 'n1',
                     hosts: ['c1'],
-                    onSingleHost: true,
                     category: 'users'
                   }
                 ],
@@ -1928,7 +1908,6 @@ describe('App.WizardStep3Controller', function () {
                   {
                     name: 'n1',
                     hosts: ['c1', 'c2'],
-                    onSingleHost: false,
                     category: 'users'
                   }
                 ],
@@ -1962,7 +1941,6 @@ describe('App.WizardStep3Controller', function () {
                   {
                     name: 'n1',
                     hosts: ['c1'],
-                    onSingleHost: true,
                     category: 'alternatives'
                   }
                 ],
@@ -1984,7 +1962,6 @@ describe('App.WizardStep3Controller', function () {
                   {
                     name: 'n1',
                     hosts: ['c1', 'c2'],
-                    onSingleHost: false,
                     category: 'alternatives'
                   }
                 ],
@@ -2028,7 +2005,6 @@ describe('App.WizardStep3Controller', function () {
                   {
                     pid: 'n1',
                     hosts: ['c1'],
-                    onSingleHost: true,
                     category: 'processes'
                   }
                 ],
@@ -2050,7 +2026,6 @@ describe('App.WizardStep3Controller', function () {
                   {
                     pid: 'n1',
                     hosts: ['c1', 'c2'],
-                    onSingleHost: false,
                     category: 'processes'
                   }
                 ],
@@ -2099,7 +2074,6 @@ describe('App.WizardStep3Controller', function () {
       expect(warnings.length).to.equal(1);
       expect(warnings[0].hosts).to.eql(['c1']);
       expect(warnings[0].hostsLong).to.eql(['c1']);
-      expect(warnings[0].onSingleHost).to.equal(true);
 
     });
 
@@ -2132,7 +2106,6 @@ describe('App.WizardStep3Controller', function () {
       expect(warnings.length).to.equal(1);
       expect(warnings[0].hosts).to.eql(['c1']);
       expect(warnings[0].hostsLong).to.eql(['c1']);
-      expect(warnings[0].onSingleHost).to.equal(true);
 
     });
 
@@ -2148,7 +2121,6 @@ describe('App.WizardStep3Controller', function () {
       expect(warnings.length).to.equal(1);
       expect(warnings[0].hosts).to.eql(['c1', 'c2']);
       expect(warnings[0].hostsLong).to.eql(['c1', 'c2']);
-      expect(warnings[0].onSingleHost).to.equal(false);
 
     });
 
@@ -2175,7 +2147,6 @@ describe('App.WizardStep3Controller', function () {
       expect(warnings.length).to.equal(1);
       expect(warnings[0].hosts).to.eql(['c1']);
       expect(warnings[0].hostsLong).to.eql(['c1']);
-      expect(warnings[0].onSingleHost).to.equal(true);
 
     });
 
@@ -2191,7 +2162,6 @@ describe('App.WizardStep3Controller', function () {
       expect(warnings.length).to.equal(1);
       expect(warnings[0].hosts).to.eql(['c1', 'c2']);
       expect(warnings[0].hostsLong).to.eql(['c1', 'c2']);
-      expect(warnings[0].onSingleHost).to.equal(false);
 
     });
 
@@ -3097,10 +3067,6 @@ describe('App.WizardStep3Controller', function () {
       expect(this.warnings.hostsNames.toArray()).to.be.eql(['h1', 'h4', 'h7']);
     });
 
-    it('warning appears on many hosts', function () {
-      expect(this.warnings.onSingleHost).to.be.false;
-    });
-
     it('validation context for hosts is valid', function () {
       var hosts = this.warnings.hosts;
       var expected = [


[31/50] ambari git commit: AMBARI-20669 Enable values binding for data attribute helper. (ababiichuk)

Posted by jo...@apache.org.
AMBARI-20669 Enable values binding for data attribute helper. (ababiichuk)


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

Branch: refs/heads/branch-feature-AMBARI-12556
Commit: 36629d52bc5ed552f30a47bac625305db88aba57
Parents: dd2c2d0
Author: ababiichuk <ab...@hortonworks.com>
Authored: Tue Apr 4 17:26:03 2017 +0300
Committer: ababiichuk <ab...@hortonworks.com>
Committed: Tue Apr 4 18:12:35 2017 +0300

----------------------------------------------------------------------
 ambari-web/app/utils/helper.js | 60 ++++++++++++++++++++++++++-----------
 1 file changed, 42 insertions(+), 18 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/36629d52/ambari-web/app/utils/helper.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/utils/helper.js b/ambari-web/app/utils/helper.js
index 30c0762..03a2e82 100644
--- a/ambari-web/app/utils/helper.js
+++ b/ambari-web/app/utils/helper.js
@@ -374,27 +374,51 @@ Em.Handlebars.registerHelper('highlight', function (property, words, fn) {
  * <div {{QAAttr "someText-and-{someProperty::another-text}"}}></div>
  *
  */
-Em.Handlebars.registerHelper('QAAttr', function(text, data) {
-  var self = this;
-  var textToReplace = text.match(/\{(.*?)\}/g);
+Em.Handlebars.registerHelper('QAAttr', function (text, options) {
+  const textToReplace = text.match(/\{(.*?)\}/g);
+  let attributes;
   if (textToReplace) {
-    textToReplace.forEach(function (t) {
-      var value,
-        expression = t.slice(1, t.length - 1),
-        conditionals = Em.View._parsePropertyPath(expression);
-      if (conditionals.classNames) {
-        var sourceValue = Em.Handlebars.getPath(self, conditionals.path, data);
-        value = sourceValue ? conditionals.className : conditionals.falsyClassName;
-      } else {
-        value = Em.Handlebars.getPath(self, expression, data);
-      }
-      if (Em.isNone(value)) {
-        value = '';
-      }
-      text = text.replace(t, value);
+    const id = ++Em.$.uuid,
+      expressions = textToReplace.map((str) => {
+        const parsed = Em.View._parsePropertyPath(str.slice(1, str.length - 1)),
+          normalized = Ember.Handlebars.normalizePath(this, parsed.path, options.data),
+          {classNames, className, falsyClassName} = parsed,
+          {root, path} = normalized;
+        return {src: str, classNames, className, falsyClassName, root, path};
+      }),
+      observer = () => {
+        let dataQA = text;
+        for (let i = expressions.length; i--;) {
+          const el = Em.tryInvoke(options.data.view, '$', [`[${attributes}]`]);
+          let e = expressions[i];
+          if (!el || el.length === 0) {
+            Em.removeObserver(e.root, e.path, invoker);
+            break;
+          }
+          let value,
+            sourceValue = Em.Handlebars.getPath(e.root, e.path, options.data);
+          if (e.classNames) {
+            value = sourceValue ? e.className : e.falsyClassName;
+          } else {
+            value = sourceValue;
+          }
+          if (Em.isNone(value)) {
+            value = '';
+          }
+          dataQA = dataQA.replace(e.src, value);
+          el.attr('data-qa', dataQA);
+        }
+      },
+      invoker = () => Em.run.once(observer);
+    attributes = `data-qa-bind-id="${id}"`;
+    expressions.forEach((e) => {
+      Em.addObserver(e.root, e.path, invoker);
     });
+    Em.run.next(observer);
+  } else {
+    attributes = `data-qa="${text}"`;
   }
-  return new Em.Handlebars.SafeString('data-qa="' + text + '"');
+  return new Em.Handlebars.SafeString(attributes);
 });
 
 /**


[26/50] ambari git commit: AMBARI-20659.Notification widgets position have been fixed and size have been reduced.(Venkata Sairam via padmapriyanitt)

Posted by jo...@apache.org.
AMBARI-20659.Notification widgets position have been fixed and size have been reduced.(Venkata Sairam via padmapriyanitt)


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

Branch: refs/heads/branch-feature-AMBARI-12556
Commit: 92e5b590c99daf71996f95e2a8c45a76fd20df82
Parents: 1984868
Author: padmapriyanitt <pa...@gmail.com>
Authored: Tue Apr 4 15:09:30 2017 +0530
Committer: padmapriyanitt <pa...@gmail.com>
Committed: Tue Apr 4 15:09:30 2017 +0530

----------------------------------------------------------------------
 .../hive20/src/main/resources/ui/app/styles/app.scss  | 14 ++++++++++++--
 .../ui/app/templates/components/alert-message.hbs     |  6 +++---
 2 files changed, 15 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/92e5b590/contrib/views/hive20/src/main/resources/ui/app/styles/app.scss
----------------------------------------------------------------------
diff --git a/contrib/views/hive20/src/main/resources/ui/app/styles/app.scss b/contrib/views/hive20/src/main/resources/ui/app/styles/app.scss
index e083922..650c1d6 100644
--- a/contrib/views/hive20/src/main/resources/ui/app/styles/app.scss
+++ b/contrib/views/hive20/src/main/resources/ui/app/styles/app.scss
@@ -681,7 +681,7 @@ pre {
 }
 
 .flash-messages-wrap {
-  position: absolute;
+  position: fixed;
   width: 40%;
   min-width: 575px;
   left: 50%;
@@ -693,12 +693,16 @@ pre {
   border-radius: $border-radius-large;
   .alert-icon {
     float: left;
+    position: relative;
+    bottom: 1px;
+    left: 10px;
     margin-right: 15px;
+    max-height: 15px;
   }
 
   .alert-message-wrap {
     display: table;
-    min-height: 56px;
+    min-height: 25px;
     .alert-message {
       display: table-cell;
       vertical-align: middle;
@@ -707,6 +711,12 @@ pre {
 
 }
 
+.wrap-message {
+  span {
+    line-height: 1.9em;
+  }
+}
+
 .jobs-status {
   border-top: 1px solid darken($body-bg, 10%);
   border-bottom: 1px solid darken($body-bg, 10%);

http://git-wip-us.apache.org/repos/asf/ambari/blob/92e5b590/contrib/views/hive20/src/main/resources/ui/app/templates/components/alert-message.hbs
----------------------------------------------------------------------
diff --git a/contrib/views/hive20/src/main/resources/ui/app/templates/components/alert-message.hbs b/contrib/views/hive20/src/main/resources/ui/app/templates/components/alert-message.hbs
index 2f114f9..abc66ec 100644
--- a/contrib/views/hive20/src/main/resources/ui/app/templates/components/alert-message.hbs
+++ b/contrib/views/hive20/src/main/resources/ui/app/templates/components/alert-message.hbs
@@ -19,9 +19,9 @@
 <div class={{alert-message-context-class flash.type "clearfix alert alert-dismissible alert-"}}>
   <button type="button" class="close" {{action "closeAlert"}}>&times;</button>
   <div class="alert-icon wrap-message">
-    {{#fa-stack size=2}}
-      {{fa-icon "circle-thin" stack=2}}
-      {{fa-icon (alert-message-icon-class flash.type) stack=1}}
+    {{#fa-stack size=1}}
+      {{fa-icon "circle-thin" stack=2 size=1}}
+      {{fa-icon (alert-message-icon-class flash.type) stack=1  size=1}}
     {{/fa-stack}}
   </div>
   <div class="alert-message-wrap wrap-message">


[28/50] ambari git commit: AMBARI-20413.The Zoom feature in WFM, hides the WF completely either with Maximum and Min(M Madhan Nohan Reddy via padmapriyanitt)

Posted by jo...@apache.org.
AMBARI-20413.The Zoom feature in WFM, hides the WF completely either with Maximum and Min(M Madhan Nohan Reddy via padmapriyanitt)


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

Branch: refs/heads/branch-feature-AMBARI-12556
Commit: e0e8a041be2fa8896ba429ad481be3935efe1e1e
Parents: 4004ee8
Author: padmapriyanitt <pa...@gmail.com>
Authored: Tue Apr 4 16:26:18 2017 +0530
Committer: padmapriyanitt <pa...@gmail.com>
Committed: Tue Apr 4 16:26:18 2017 +0530

----------------------------------------------------------------------
 .../resources/ui/app/domain/cytoscape-flow-renderer.js   | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/e0e8a041/contrib/views/wfmanager/src/main/resources/ui/app/domain/cytoscape-flow-renderer.js
----------------------------------------------------------------------
diff --git a/contrib/views/wfmanager/src/main/resources/ui/app/domain/cytoscape-flow-renderer.js b/contrib/views/wfmanager/src/main/resources/ui/app/domain/cytoscape-flow-renderer.js
index bfe59e2..af84f86 100644
--- a/contrib/views/wfmanager/src/main/resources/ui/app/domain/cytoscape-flow-renderer.js
+++ b/contrib/views/wfmanager/src/main/resources/ui/app/domain/cytoscape-flow-renderer.js
@@ -48,8 +48,6 @@ var CytoscapeRenderer= Ember.Object.extend({
     };
 
     this.cy.panzoom( defaults );
-    //this.cy.center();
-    this.cy.pan({x:200,y:50});
     this._addEvents(this.cy);
     var self = this;
     this.get("context").$('.overlay-transition-content').popover({
@@ -69,6 +67,14 @@ var CytoscapeRenderer= Ember.Object.extend({
   _setCyOverflow() {
     Ember.set(this.get("cyOverflow"), "overflown", this.cy.elements().renderedBoundingBox().y2 > this.cy.height());
   },
+  _setGraphCenter() {
+    var startDataNode = this.get("dataNodes").filterBy("data.type", "start");
+    if (startDataNode[0] && startDataNode[0].data.id) {
+      var startNode = this.cy.$("#" + startDataNode[0].data.id);
+      this.cy.center();
+      this.cy.pan({y:50});
+    }
+  },
   _getShape(nodeType) {
     switch(nodeType) {
       case 'start' :
@@ -394,6 +400,7 @@ var CytoscapeRenderer= Ember.Object.extend({
     this.cy.endBatch();
     this.cy.layout(this.get("layoutConfigs"));
     this._setCyOverflow();
+    this._setGraphCenter();
   },
 
   initRenderer(callback, settings){


[41/50] ambari git commit: AMBARI-20548. Grafana dashboard changes for some new llap daemon metrics (vivekratnavel)

Posted by jo...@apache.org.
AMBARI-20548. Grafana dashboard changes for some new llap daemon metrics (vivekratnavel)


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

Branch: refs/heads/branch-feature-AMBARI-12556
Commit: e61d111245fd7631a4fd0a2d572d88b3f86a4b5f
Parents: 7d0baec
Author: Vivek Ratnavel Subramanian <vi...@gmail.com>
Authored: Wed Apr 5 15:43:26 2017 -0700
Committer: Vivek Ratnavel Subramanian <vi...@gmail.com>
Committed: Wed Apr 5 15:43:26 2017 -0700

----------------------------------------------------------------------
 .../HDP/grafana-llapdaemon-daemons.json         | 313 ++++++++++++++-----
 1 file changed, 231 insertions(+), 82 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/e61d1112/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/package/files/grafana-dashboards/HDP/grafana-llapdaemon-daemons.json
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/package/files/grafana-dashboards/HDP/grafana-llapdaemon-daemons.json b/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/package/files/grafana-dashboards/HDP/grafana-llapdaemon-daemons.json
index 2f69868..849f296 100644
--- a/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/package/files/grafana-dashboards/HDP/grafana-llapdaemon-daemons.json
+++ b/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/package/files/grafana-dashboards/HDP/grafana-llapdaemon-daemons.json
@@ -1189,7 +1189,7 @@
             "threshold2": null,
             "threshold2Color": "rgba(234, 112, 112, 0.22)"
           },
-          "id": 29,
+          "id": 14,
           "isNew": true,
           "legend": {
             "avg": false,
@@ -1214,21 +1214,21 @@
           "steppedLine": false,
           "targets": [
             {
-              "aggregator": "max",
-              "alias": "95th Percentile",
+              "aggregator": "sum",
+              "alias": "MemHeapUsed",
               "app": "llapdaemon",
               "downsampleAggregator": "avg",
               "errors": {},
-              "metric": "io.IOMetrics.PercentileDecodingTime_30s95thPercentileLatency",
+              "metric": "jvm.JvmMetrics.MemHeapUsedM",
               "precision": "default",
-              "refId": "B",
+              "refId": "C",
               "templatedHost": "",
               "transform": "none"
             }
           ],
           "timeFrom": null,
           "timeShift": null,
-          "title": "95th Percentile Column Decoding Time (30s interval)",
+          "title": "Total JVM Heap Used",
           "tooltip": {
             "shared": false,
             "value_type": "cumulative"
@@ -1238,7 +1238,7 @@
           "x-axis": true,
           "y-axis": true,
           "y_formats": [
-            "ms",
+            "mbytes",
             "short"
           ]
         },
@@ -1261,7 +1261,7 @@
             "threshold2": null,
             "threshold2Color": "rgba(234, 112, 112, 0.22)"
           },
-          "id": 30,
+          "id": 15,
           "isNew": true,
           "legend": {
             "avg": false,
@@ -1286,21 +1286,21 @@
           "steppedLine": false,
           "targets": [
             {
-              "aggregator": "max",
-              "alias": "Max",
+              "aggregator": "sum",
+              "alias": "MemNonHeapUsed",
               "app": "llapdaemon",
               "downsampleAggregator": "avg",
               "errors": {},
-              "metric": "io.IOMetrics.MaxDecodingTime",
+              "metric": "jvm.JvmMetrics.MemNonHeapUsedM",
               "precision": "default",
-              "refId": "A",
+              "refId": "C",
               "templatedHost": "",
               "transform": "none"
             }
           ],
           "timeFrom": null,
           "timeShift": null,
-          "title": "Max Column Decoding Time",
+          "title": "Total JVM Non-Heap Used",
           "tooltip": {
             "shared": false,
             "value_type": "cumulative"
@@ -1310,19 +1310,10 @@
           "x-axis": true,
           "y-axis": true,
           "y_formats": [
-            "ms",
+            "mbytes",
             "short"
           ]
-        }
-      ],
-      "showTitle": true,
-      "title": "IO Elevator Metrics"
-    },
-    {
-      "collapse": true,
-      "editable": true,
-      "height": "250px",
-      "panels": [
+        },
         {
           "aliasColors": {},
           "bars": false,
@@ -1342,7 +1333,7 @@
             "threshold2": null,
             "threshold2Color": "rgba(234, 112, 112, 0.22)"
           },
-          "id": 14,
+          "id": 12,
           "isNew": true,
           "legend": {
             "avg": false,
@@ -1367,21 +1358,21 @@
           "steppedLine": false,
           "targets": [
             {
-              "aggregator": "sum",
-              "alias": "MemHeapUsed",
+              "aggregator": "max",
+              "alias": "GcTotalExtraSleepTime",
               "app": "llapdaemon",
               "downsampleAggregator": "avg",
               "errors": {},
-              "metric": "jvm.JvmMetrics.MemHeapUsedM",
+              "metric": "jvm.JvmMetrics.GcTotalExtraSleepTime",
               "precision": "default",
-              "refId": "C",
+              "refId": "A",
               "templatedHost": "",
-              "transform": "none"
+              "transform": "diff"
             }
           ],
           "timeFrom": null,
           "timeShift": null,
-          "title": "Total JVM Heap Used",
+          "title": "Max GcTotalExtraSleepTime",
           "tooltip": {
             "shared": false,
             "value_type": "cumulative"
@@ -1391,7 +1382,7 @@
           "x-axis": true,
           "y-axis": true,
           "y_formats": [
-            "mbytes",
+            "ms",
             "short"
           ]
         },
@@ -1408,19 +1399,22 @@
             "leftMin": 0,
             "rightLogBase": 1,
             "rightMax": null,
-            "rightMin": null,
+            "rightMin": 0,
             "threshold1": null,
             "threshold1Color": "rgba(216, 200, 27, 0.27)",
             "threshold2": null,
-            "threshold2Color": "rgba(234, 112, 112, 0.22)"
+            "threshold2Color": "rgba(234, 112, 112, 0.22)",
+            "thresholdLine": false
           },
-          "id": 15,
+          "id": 13,
           "isNew": true,
+          "leftYAxisLabel": "",
           "legend": {
             "avg": false,
             "current": false,
             "max": false,
             "min": false,
+            "rightSide": false,
             "show": false,
             "total": false,
             "values": false
@@ -1433,27 +1427,29 @@
           "pointradius": 5,
           "points": false,
           "renderer": "flot",
+          "rightYAxisLabel": "",
           "seriesOverrides": [],
           "span": 6,
           "stack": false,
           "steppedLine": false,
           "targets": [
             {
-              "aggregator": "sum",
-              "alias": "MemNonHeapUsed",
+              "aggregator": "max",
+              "alias": "GcTimeMillis",
               "app": "llapdaemon",
               "downsampleAggregator": "avg",
               "errors": {},
-              "metric": "jvm.JvmMetrics.MemNonHeapUsedM",
+              "hide": false,
+              "metric": "jvm.JvmMetrics.GcTimeMillis",
               "precision": "default",
-              "refId": "C",
+              "refId": "A",
               "templatedHost": "",
-              "transform": "none"
+              "transform": "diff"
             }
           ],
           "timeFrom": null,
           "timeShift": null,
-          "title": "Total JVM Non-Heap Used",
+          "title": "Max GcTimeMillis",
           "tooltip": {
             "shared": false,
             "value_type": "cumulative"
@@ -1463,7 +1459,7 @@
           "x-axis": true,
           "y-axis": true,
           "y_formats": [
-            "mbytes",
+            "ms",
             "short"
           ]
         },
@@ -1486,7 +1482,7 @@
             "threshold2": null,
             "threshold2Color": "rgba(234, 112, 112, 0.22)"
           },
-          "id": 12,
+          "id": 43,
           "isNew": true,
           "legend": {
             "avg": false,
@@ -1512,20 +1508,20 @@
           "targets": [
             {
               "aggregator": "max",
-              "alias": "GcTotalExtraSleepTime",
+              "alias": "ThreadsWaiting",
               "app": "llapdaemon",
               "downsampleAggregator": "avg",
               "errors": {},
-              "metric": "jvm.JvmMetrics.GcTotalExtraSleepTime",
+              "metric": "jvm.JvmMetrics.ThreadsWaiting",
               "precision": "default",
-              "refId": "A",
+              "refId": "B",
               "templatedHost": "",
-              "transform": "diff"
+              "transform": "none"
             }
           ],
           "timeFrom": null,
           "timeShift": null,
-          "title": "Max GcTotalExtraSleepTime",
+          "title": "Max JVM Threads Waiting",
           "tooltip": {
             "shared": false,
             "value_type": "cumulative"
@@ -1535,7 +1531,7 @@
           "x-axis": true,
           "y-axis": true,
           "y_formats": [
-            "ms",
+            "short",
             "short"
           ]
         },
@@ -1552,22 +1548,19 @@
             "leftMin": 0,
             "rightLogBase": 1,
             "rightMax": null,
-            "rightMin": 0,
+            "rightMin": null,
             "threshold1": null,
             "threshold1Color": "rgba(216, 200, 27, 0.27)",
             "threshold2": null,
-            "threshold2Color": "rgba(234, 112, 112, 0.22)",
-            "thresholdLine": false
+            "threshold2Color": "rgba(234, 112, 112, 0.22)"
           },
-          "id": 13,
+          "id": 44,
           "isNew": true,
-          "leftYAxisLabel": "",
           "legend": {
             "avg": false,
             "current": false,
             "max": false,
             "min": false,
-            "rightSide": false,
             "show": false,
             "total": false,
             "values": false
@@ -1580,7 +1573,6 @@
           "pointradius": 5,
           "points": false,
           "renderer": "flot",
-          "rightYAxisLabel": "",
           "seriesOverrides": [],
           "span": 6,
           "stack": false,
@@ -1588,21 +1580,20 @@
           "targets": [
             {
               "aggregator": "max",
-              "alias": "GcTimeMillis",
+              "alias": "ThreadsTimedWaiting",
               "app": "llapdaemon",
               "downsampleAggregator": "avg",
               "errors": {},
-              "hide": false,
-              "metric": "jvm.JvmMetrics.GcTimeMillis",
+              "metric": "jvm.JvmMetrics.ThreadsTimedWaiting",
               "precision": "default",
-              "refId": "A",
+              "refId": "B",
               "templatedHost": "",
-              "transform": "diff"
+              "transform": "none"
             }
           ],
           "timeFrom": null,
           "timeShift": null,
-          "title": "Max GcTimeMillis",
+          "title": "Max JVM Threads Timed Waiting",
           "tooltip": {
             "shared": false,
             "value_type": "cumulative"
@@ -1612,7 +1603,7 @@
           "x-axis": true,
           "y-axis": true,
           "y_formats": [
-            "ms",
+            "short",
             "short"
           ]
         },
@@ -1759,6 +1750,89 @@
             "short",
             "short"
           ]
+        }
+      ],
+      "showTitle": true,
+      "title": "JVM Metrics"
+    },
+    {
+      "title": "OFFHEAP METRICS",
+      "height": "250px",
+      "editable": true,
+      "collapse": true,
+      "panels": [
+        {
+          "aliasColors": {},
+          "bars": false,
+          "datasource": null,
+          "editable": true,
+          "error": false,
+          "fill": 1,
+          "grid": {
+            "leftLogBase": 1,
+            "leftMax": null,
+            "leftMin": 0,
+            "rightLogBase": 1,
+            "rightMax": null,
+            "rightMin": null,
+            "threshold1": null,
+            "threshold1Color": "rgba(216, 200, 27, 0.27)",
+            "threshold2": null,
+            "threshold2Color": "rgba(234, 112, 112, 0.22)"
+          },
+          "id": 47,
+          "isNew": true,
+          "legend": {
+            "avg": false,
+            "current": false,
+            "max": false,
+            "min": false,
+            "show": false,
+            "total": false,
+            "values": false
+          },
+          "lines": true,
+          "linewidth": 1,
+          "links": [],
+          "nullPointMode": "connected",
+          "percentage": false,
+          "pointradius": 5,
+          "points": false,
+          "renderer": "flot",
+          "seriesOverrides": [],
+          "span": 6,
+          "stack": false,
+          "steppedLine": false,
+          "targets": [
+            {
+              "aggregator": "none",
+              "alias": "DirectBufferMemoryUsed",
+              "app": "llapdaemon",
+              "downsampleAggregator": "avg",
+              "errors": {},
+              "metric": "jvm.LlapDaemonJVMMetrics.LlapDaemonDirectBufferMemoryUsed",
+              "precision": "default",
+              "refId": "C",
+              "templatedHost": "",
+              "transform": "none",
+              "seriesAggregator": "none"
+            }
+          ],
+          "timeFrom": null,
+          "timeShift": null,
+          "title": "Direct Buffer Memory Used",
+          "tooltip": {
+            "shared": false,
+            "value_type": "cumulative"
+          },
+          "transparent": true,
+          "type": "graph",
+          "x-axis": true,
+          "y-axis": true,
+          "y_formats": [
+            "bytes",
+            "short"
+          ]
         },
         {
           "aliasColors": {},
@@ -1779,7 +1853,7 @@
             "threshold2": null,
             "threshold2Color": "rgba(234, 112, 112, 0.22)"
           },
-          "id": 43,
+          "id": 46,
           "isNew": true,
           "legend": {
             "avg": false,
@@ -1804,21 +1878,22 @@
           "steppedLine": false,
           "targets": [
             {
-              "aggregator": "max",
-              "alias": "ThreadsWaiting",
+              "aggregator": "none",
+              "alias": "DirectBufferTotalCapacity",
               "app": "llapdaemon",
               "downsampleAggregator": "avg",
               "errors": {},
-              "metric": "jvm.JvmMetrics.ThreadsWaiting",
+              "metric": "jvm.LlapDaemonJVMMetrics.LlapDaemonDirectBufferTotalCapacity",
               "precision": "default",
-              "refId": "B",
+              "refId": "C",
               "templatedHost": "",
-              "transform": "none"
+              "transform": "none",
+              "seriesAggregator": "none"
             }
           ],
           "timeFrom": null,
           "timeShift": null,
-          "title": "Max JVM Threads Waiting",
+          "title": "Direct Buffer Total Capacity",
           "tooltip": {
             "shared": false,
             "value_type": "cumulative"
@@ -1828,7 +1903,7 @@
           "x-axis": true,
           "y-axis": true,
           "y_formats": [
-            "short",
+            "bytes",
             "short"
           ]
         },
@@ -1851,7 +1926,7 @@
             "threshold2": null,
             "threshold2Color": "rgba(234, 112, 112, 0.22)"
           },
-          "id": 44,
+          "id": 48,
           "isNew": true,
           "legend": {
             "avg": false,
@@ -1876,21 +1951,22 @@
           "steppedLine": false,
           "targets": [
             {
-              "aggregator": "max",
-              "alias": "ThreadsTimedWaiting",
+              "aggregator": "none",
+              "alias": "MappedBufferMemoryUsed",
               "app": "llapdaemon",
               "downsampleAggregator": "avg",
               "errors": {},
-              "metric": "jvm.JvmMetrics.ThreadsTimedWaiting",
+              "metric": "jvm.LlapDaemonJVMMetrics.LlapDaemonMappedBufferMemoryUsed",
               "precision": "default",
-              "refId": "B",
+              "refId": "C",
               "templatedHost": "",
-              "transform": "none"
+              "transform": "none",
+              "seriesAggregator": "none"
             }
           ],
           "timeFrom": null,
           "timeShift": null,
-          "title": "Max JVM Threads Timed Waiting",
+          "title": "Mapped Buffer Memory Used",
           "tooltip": {
             "shared": false,
             "value_type": "cumulative"
@@ -1900,13 +1976,85 @@
           "x-axis": true,
           "y-axis": true,
           "y_formats": [
-            "short",
+            "bytes",
+            "short"
+          ]
+        },
+        {
+          "aliasColors": {},
+          "bars": false,
+          "datasource": null,
+          "editable": true,
+          "error": false,
+          "fill": 1,
+          "grid": {
+            "leftLogBase": 1,
+            "leftMax": null,
+            "leftMin": 0,
+            "rightLogBase": 1,
+            "rightMax": null,
+            "rightMin": null,
+            "threshold1": null,
+            "threshold1Color": "rgba(216, 200, 27, 0.27)",
+            "threshold2": null,
+            "threshold2Color": "rgba(234, 112, 112, 0.22)"
+          },
+          "id": 49,
+          "isNew": true,
+          "legend": {
+            "avg": false,
+            "current": false,
+            "max": false,
+            "min": false,
+            "show": false,
+            "total": false,
+            "values": false
+          },
+          "lines": true,
+          "linewidth": 1,
+          "links": [],
+          "nullPointMode": "connected",
+          "percentage": false,
+          "pointradius": 5,
+          "points": false,
+          "renderer": "flot",
+          "seriesOverrides": [],
+          "span": 6,
+          "stack": false,
+          "steppedLine": false,
+          "targets": [
+            {
+              "aggregator": "none",
+              "alias": "MappedBufferTotalCapacity",
+              "app": "llapdaemon",
+              "downsampleAggregator": "avg",
+              "errors": {},
+              "metric": "jvm.LlapDaemonJVMMetrics.LlapDaemonMappedBufferTotalCapacity",
+              "precision": "default",
+              "refId": "C",
+              "templatedHost": "",
+              "transform": "none",
+              "seriesAggregator": "none"
+            }
+          ],
+          "timeFrom": null,
+          "timeShift": null,
+          "title": "Mapped Buffer Total Capacity",
+          "tooltip": {
+            "shared": false,
+            "value_type": "cumulative"
+          },
+          "transparent": true,
+          "type": "graph",
+          "x-axis": true,
+          "y-axis": true,
+          "y_formats": [
+            "bytes",
             "short"
           ]
         }
       ],
-      "showTitle": true,
-      "title": "JVM Metrics"
+      "showTitle": true
     }
   ],
   "time": {
@@ -1968,7 +2116,8 @@
         "allFormat": "glob",
         "current": {
           "text": "All",
-          "value": ""
+          "value": "",
+          "tags": []
         },
         "datasource": null,
         "includeAll": true,


[06/50] ambari git commit: AMBARI-20652. HDP 3.0 TP - add Pig client: configs, metainfo, descriptors, service advisor and etc.(vbrodetskyi)

Posted by jo...@apache.org.
AMBARI-20652. HDP 3.0 TP - add Pig client: configs, metainfo, descriptors, service advisor and etc.(vbrodetskyi)


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

Branch: refs/heads/branch-feature-AMBARI-12556
Commit: 9fec5ac5ae9208f18d9e4180d8482dc14f05c8b3
Parents: 0ffb42b
Author: Vitaly Brodetskyi <vb...@hortonworks.com>
Authored: Mon Apr 3 15:37:51 2017 +0300
Committer: Vitaly Brodetskyi <vb...@hortonworks.com>
Committed: Mon Apr 3 15:38:44 2017 +0300

----------------------------------------------------------------------
 .../PIG/0.16.1.3.0/configuration/pig-env.xml    |  41 +++++
 .../PIG/0.16.1.3.0/configuration/pig-log4j.xml  |  65 +++++++
 .../0.16.1.3.0/configuration/pig-properties.xml |  93 ++++++++++
 .../PIG/0.16.1.3.0/kerberos.json                |  17 ++
 .../common-services/PIG/0.16.1.3.0/metainfo.xml | 101 +++++++++++
 .../PIG/0.16.1.3.0/package/files/pigSmoke.sh    |  18 ++
 .../PIG/0.16.1.3.0/package/scripts/params.py    |  31 ++++
 .../0.16.1.3.0/package/scripts/params_linux.py  | 104 +++++++++++
 .../package/scripts/params_windows.py           |  45 +++++
 .../PIG/0.16.1.3.0/package/scripts/pig.py       |  80 +++++++++
 .../0.16.1.3.0/package/scripts/pig_client.py    |  71 ++++++++
 .../0.16.1.3.0/package/scripts/service_check.py | 142 +++++++++++++++
 .../PIG/0.16.1.3.0/service_advisor.py           | 171 +++++++++++++++++++
 .../stacks/HDP/3.0/services/PIG/metainfo.xml    |  27 +++
 14 files changed, 1006 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/9fec5ac5/ambari-server/src/main/resources/common-services/PIG/0.16.1.3.0/configuration/pig-env.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/PIG/0.16.1.3.0/configuration/pig-env.xml b/ambari-server/src/main/resources/common-services/PIG/0.16.1.3.0/configuration/pig-env.xml
new file mode 100644
index 0000000..11afa11
--- /dev/null
+++ b/ambari-server/src/main/resources/common-services/PIG/0.16.1.3.0/configuration/pig-env.xml
@@ -0,0 +1,41 @@
+<?xml version="1.0"?>
+<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
+<!--
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+-->
+<configuration supports_adding_forbidden="true">
+  <!-- pig-env.sh -->
+  <property>
+    <name>content</name>
+    <display-name>pig-env template</display-name>
+    <description>This is the jinja template for pig-env.sh file</description>
+    <value>
+JAVA_HOME={{java64_home}}
+HADOOP_HOME=${HADOOP_HOME:-{{hadoop_home}}}
+
+if [ -d "/usr/lib/tez" ]; then
+  PIG_OPTS="$PIG_OPTS -Dmapreduce.framework.name=yarn"
+fi
+    </value>
+    <value-attributes>
+      <type>content</type>
+    </value-attributes>
+    <on-ambari-upgrade add="fallse"/>
+  </property>
+</configuration>

http://git-wip-us.apache.org/repos/asf/ambari/blob/9fec5ac5/ambari-server/src/main/resources/common-services/PIG/0.16.1.3.0/configuration/pig-log4j.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/PIG/0.16.1.3.0/configuration/pig-log4j.xml b/ambari-server/src/main/resources/common-services/PIG/0.16.1.3.0/configuration/pig-log4j.xml
new file mode 100644
index 0000000..e5ff9b6
--- /dev/null
+++ b/ambari-server/src/main/resources/common-services/PIG/0.16.1.3.0/configuration/pig-log4j.xml
@@ -0,0 +1,65 @@
+<?xml version="1.0"?>
+<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
+<!--
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+-->
+<configuration supports_final="false" supports_adding_forbidden="true">
+  <property>
+    <name>content</name>
+    <display-name>pig-log4j template</display-name>
+    <description>Custom log4j.properties</description>
+    <value>
+#
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+#
+#
+
+# ***** Set root logger level to DEBUG and its only appender to A.
+log4j.logger.org.apache.pig=info, A
+
+# ***** A is set to be a ConsoleAppender.
+log4j.appender.A=org.apache.log4j.ConsoleAppender
+# ***** A uses PatternLayout.
+log4j.appender.A.layout=org.apache.log4j.PatternLayout
+log4j.appender.A.layout.ConversionPattern=%-4r [%t] %-5p %c %x - %m%n
+    </value>
+    <value-attributes>
+      <type>content</type>
+      <show-property-name>false</show-property-name>
+    </value-attributes>
+    <on-ambari-upgrade add="false"/>
+  </property>
+</configuration>

http://git-wip-us.apache.org/repos/asf/ambari/blob/9fec5ac5/ambari-server/src/main/resources/common-services/PIG/0.16.1.3.0/configuration/pig-properties.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/PIG/0.16.1.3.0/configuration/pig-properties.xml b/ambari-server/src/main/resources/common-services/PIG/0.16.1.3.0/configuration/pig-properties.xml
new file mode 100644
index 0000000..fb43f6e
--- /dev/null
+++ b/ambari-server/src/main/resources/common-services/PIG/0.16.1.3.0/configuration/pig-properties.xml
@@ -0,0 +1,93 @@
+<?xml version="1.0"?>
+<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
+<!--
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+-->
+<configuration supports_final="false" supports_adding_forbidden="true">
+  <property>
+    <name>content</name>
+    <display-name>pig-properties template</display-name>
+    <description>Describe all the Pig agent configurations</description>
+    <value>
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+# Pig default configuration file. All values can be overwritten by pig.properties and command line arguments.
+# see bin/pig -help
+
+# brief logging (no timestamps)
+brief=false
+
+# debug level, INFO is default
+debug=INFO
+
+# verbose print all log messages to screen (default to print only INFO and above to screen)
+verbose=false
+
+# exectype local|mapreduce|tez, mapreduce is default
+exectype=tez
+
+# Enable insertion of information about script into hadoop job conf
+pig.script.info.enabled=true
+
+# Do not spill temp files smaller than this size (bytes)
+pig.spill.size.threshold=5000000
+
+# EXPERIMENT: Activate garbage collection when spilling a file bigger than this size (bytes)
+# This should help reduce the number of files being spilled.
+pig.spill.gc.activation.size=40000000
+
+# the following two parameters are to help estimate the reducer number
+pig.exec.reducers.bytes.per.reducer=1000000000
+pig.exec.reducers.max=999
+
+# Temporary location to store the intermediate data.
+pig.temp.dir=/tmp/
+
+# Threshold for merging FRJoin fragment files
+pig.files.concatenation.threshold=100
+pig.optimistic.files.concatenation=false;
+
+pig.disable.counter=false
+
+hcat.bin=/usr/bin/hcat
+
+    </value>
+    <value-attributes>
+      <type>content</type>
+      <empty-value-valid>true</empty-value-valid>
+      <show-property-name>false</show-property-name>
+    </value-attributes>
+    <on-ambari-upgrade add="false"/>
+  </property>
+</configuration>

http://git-wip-us.apache.org/repos/asf/ambari/blob/9fec5ac5/ambari-server/src/main/resources/common-services/PIG/0.16.1.3.0/kerberos.json
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/PIG/0.16.1.3.0/kerberos.json b/ambari-server/src/main/resources/common-services/PIG/0.16.1.3.0/kerberos.json
new file mode 100644
index 0000000..22dd6cb
--- /dev/null
+++ b/ambari-server/src/main/resources/common-services/PIG/0.16.1.3.0/kerberos.json
@@ -0,0 +1,17 @@
+{
+  "services": [
+    {
+      "name": "PIG",
+      "components": [
+        {
+          "name": "PIG",
+          "identities": [
+            {
+              "name": "/HDFS/NAMENODE/hdfs"
+            }
+          ]
+        }
+      ]
+    }
+  ]
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/9fec5ac5/ambari-server/src/main/resources/common-services/PIG/0.16.1.3.0/metainfo.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/PIG/0.16.1.3.0/metainfo.xml b/ambari-server/src/main/resources/common-services/PIG/0.16.1.3.0/metainfo.xml
new file mode 100644
index 0000000..041255a
--- /dev/null
+++ b/ambari-server/src/main/resources/common-services/PIG/0.16.1.3.0/metainfo.xml
@@ -0,0 +1,101 @@
+<?xml version="1.0"?>
+<!--
+   Licensed to the Apache Software Foundation (ASF) under one or more
+   contributor license agreements.  See the NOTICE file distributed with
+   this work for additional information regarding copyright ownership.
+   The ASF licenses this file to You under the Apache License, Version 2.0
+   (the "License"); you may not use this file except in compliance with
+   the License.  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+-->
+<metainfo>
+  <schemaVersion>2.0</schemaVersion>
+  <services>
+    <service>
+      <name>PIG</name>
+      <displayName>Pig</displayName>
+      <comment>Scripting platform for analyzing large datasets</comment>
+      <version>0.16.1.3.0</version>
+      <components>
+        <component>
+          <name>PIG</name>
+          <displayName>Pig Client</displayName>
+          <category>CLIENT</category>
+          <cardinality>0+</cardinality>
+          <versionAdvertised>true</versionAdvertised>
+          <commandScript>
+            <script>scripts/pig_client.py</script>
+            <scriptType>PYTHON</scriptType>
+            <timeout>1200</timeout>
+          </commandScript>
+          <configFiles>
+            <configFile>
+              <type>env</type>
+              <fileName>pig-env.sh</fileName>
+              <dictionaryName>pig-env</dictionaryName>
+            </configFile>
+            <configFile>
+              <type>env</type>
+              <fileName>log4j.properties</fileName>
+              <dictionaryName>pig-log4j</dictionaryName>
+            </configFile>
+            <configFile>
+              <type>env</type>
+              <fileName>pig.properties</fileName>
+              <dictionaryName>pig-properties</dictionaryName>
+            </configFile>                         
+          </configFiles>          
+        </component>
+      </components>
+      <osSpecifics>
+        <osSpecific>
+          <osFamily>redhat7,amazon2015,redhat6,suse11,suse12</osFamily>
+          <packages>
+            <package>
+              <name>pig_${stack_version}</name>
+            </package>
+            <package>
+              <name>datafu_${stack_version}</name>
+            </package>
+          </packages>
+        </osSpecific>
+        <osSpecific>
+          <osFamily>debian7,ubuntu12,ubuntu14,ubuntu16</osFamily>
+          <packages>
+            <package>
+              <name>pig-${stack_version}</name>
+            </package>
+            <package>
+              <name>datafu-${stack_version}</name>
+            </package>
+          </packages>
+        </osSpecific>
+      </osSpecifics>
+
+      <commandScript>
+        <script>scripts/service_check.py</script>
+        <scriptType>PYTHON</scriptType>
+        <timeout>300</timeout>
+      </commandScript>
+
+      <requiredServices>
+        <service>YARN</service>
+        <service>TEZ</service>
+      </requiredServices>
+
+      <configuration-dependencies>
+        <config-type>pig-env</config-type>
+        <config-type>pig-log4j</config-type>
+        <config-type>pig-properties</config-type>
+      </configuration-dependencies>
+
+    </service>
+  </services>
+</metainfo>

http://git-wip-us.apache.org/repos/asf/ambari/blob/9fec5ac5/ambari-server/src/main/resources/common-services/PIG/0.16.1.3.0/package/files/pigSmoke.sh
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/PIG/0.16.1.3.0/package/files/pigSmoke.sh b/ambari-server/src/main/resources/common-services/PIG/0.16.1.3.0/package/files/pigSmoke.sh
new file mode 100644
index 0000000..a22456e
--- /dev/null
+++ b/ambari-server/src/main/resources/common-services/PIG/0.16.1.3.0/package/files/pigSmoke.sh
@@ -0,0 +1,18 @@
+/*Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements.  See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License.  You may obtain a copy of the License at
+
+     http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License */
+
+A = load 'passwd' using PigStorage(':');
+B = foreach A generate \$0 as id;
+store B into 'pigsmoke.out';

http://git-wip-us.apache.org/repos/asf/ambari/blob/9fec5ac5/ambari-server/src/main/resources/common-services/PIG/0.16.1.3.0/package/scripts/params.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/PIG/0.16.1.3.0/package/scripts/params.py b/ambari-server/src/main/resources/common-services/PIG/0.16.1.3.0/package/scripts/params.py
new file mode 100644
index 0000000..3aebda0
--- /dev/null
+++ b/ambari-server/src/main/resources/common-services/PIG/0.16.1.3.0/package/scripts/params.py
@@ -0,0 +1,31 @@
+"""
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+Ambari Agent
+
+"""
+from ambari_commons import OSCheck
+from resource_management.libraries.functions.default import default
+from resource_management.libraries.functions.copy_tarball import get_sysprep_skip_copy_tarballs_hdfs
+
+if OSCheck.is_windows_family():
+  from params_windows import *
+else:
+  from params_linux import *
+
+sysprep_skip_copy_tarballs_hdfs = get_sysprep_skip_copy_tarballs_hdfs()
+

http://git-wip-us.apache.org/repos/asf/ambari/blob/9fec5ac5/ambari-server/src/main/resources/common-services/PIG/0.16.1.3.0/package/scripts/params_linux.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/PIG/0.16.1.3.0/package/scripts/params_linux.py b/ambari-server/src/main/resources/common-services/PIG/0.16.1.3.0/package/scripts/params_linux.py
new file mode 100644
index 0000000..5af1274
--- /dev/null
+++ b/ambari-server/src/main/resources/common-services/PIG/0.16.1.3.0/package/scripts/params_linux.py
@@ -0,0 +1,104 @@
+"""
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+Ambari Agent
+
+"""
+
+from resource_management.libraries.script.script import Script
+from resource_management.libraries.resources.hdfs_resource import HdfsResource
+from resource_management.libraries.functions import conf_select
+from resource_management.libraries.functions import stack_select
+from resource_management.libraries.functions import StackFeature
+from resource_management.libraries.functions.stack_features import check_stack_feature
+from resource_management.libraries.functions.version import format_stack_version
+from resource_management.libraries.functions.format import format
+from resource_management.libraries.functions.default import default
+from resource_management.libraries.functions import get_kinit_path
+from resource_management.libraries.functions.get_not_managed_resources import get_not_managed_resources
+
+# server configurations
+config = Script.get_config()
+tmp_dir = Script.get_tmp_dir()
+
+stack_name = default("/hostLevelParams/stack_name", None)
+stack_root = Script.get_stack_root()
+
+stack_version_unformatted = config['hostLevelParams']['stack_version']
+stack_version_formatted = format_stack_version(stack_version_unformatted)
+
+# New Cluster Stack Version that is defined during the RESTART of a Rolling Upgrade
+version = default("/commandParams/version", None)
+
+# hadoop default parameters
+hadoop_conf_dir = conf_select.get_hadoop_conf_dir()
+hadoop_bin_dir = stack_select.get_hadoop_dir("bin")
+pig_conf_dir = "/etc/pig/conf"
+hadoop_home = '/usr'
+pig_bin_dir = ""
+
+# hadoop parameters for stack versions supporting rolling_upgrade
+if stack_version_formatted and check_stack_feature(StackFeature.ROLLING_UPGRADE, stack_version_formatted):
+  pig_conf_dir = format("{stack_root}/current/pig-client/conf")
+  hadoop_home = stack_select.get_hadoop_dir("home")
+  pig_bin_dir = format("{stack_root}/current/pig-client/bin")
+
+hdfs_user = config['configurations']['hadoop-env']['hdfs_user']
+hdfs_principal_name = config['configurations']['hadoop-env']['hdfs_principal_name']
+hdfs_user_keytab = config['configurations']['hadoop-env']['hdfs_user_keytab']
+smokeuser = config['configurations']['cluster-env']['smokeuser']
+smokeuser_principal = config['configurations']['cluster-env']['smokeuser_principal_name']
+smoke_hdfs_user_mode = 0770
+user_group = config['configurations']['cluster-env']['user_group']
+security_enabled = config['configurations']['cluster-env']['security_enabled']
+smoke_user_keytab = config['configurations']['cluster-env']['smokeuser_keytab']
+kinit_path_local = get_kinit_path(default('/configurations/kerberos-env/executable_search_paths', None))
+pig_env_sh_template = config['configurations']['pig-env']['content']
+
+# not supporting 32 bit jdk.
+java64_home = config['hostLevelParams']['java_home']
+
+pig_properties = config['configurations']['pig-properties']['content']
+
+log4j_props = config['configurations']['pig-log4j']['content']
+
+
+
+hdfs_site = config['configurations']['hdfs-site']
+default_fs = config['configurations']['core-site']['fs.defaultFS']
+
+dfs_type = default("/commandParams/dfs_type", "")
+
+import functools
+#create partial functions with common arguments for every HdfsResource call
+#to create hdfs directory we need to call params.HdfsResource in code
+HdfsResource = functools.partial(
+  HdfsResource,
+  user=hdfs_user,
+  hdfs_resource_ignore_file = "/var/lib/ambari-agent/data/.hdfs_resource_ignore",
+  security_enabled = security_enabled,
+  keytab = hdfs_user_keytab,
+  kinit_path_local = kinit_path_local,
+  hadoop_bin_dir = hadoop_bin_dir,
+  hadoop_conf_dir = hadoop_conf_dir,
+  principal_name = hdfs_principal_name,
+  hdfs_site = hdfs_site,
+  default_fs = default_fs,
+  immutable_paths = get_not_managed_resources(),
+  dfs_type = dfs_type
+ )
+

http://git-wip-us.apache.org/repos/asf/ambari/blob/9fec5ac5/ambari-server/src/main/resources/common-services/PIG/0.16.1.3.0/package/scripts/params_windows.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/PIG/0.16.1.3.0/package/scripts/params_windows.py b/ambari-server/src/main/resources/common-services/PIG/0.16.1.3.0/package/scripts/params_windows.py
new file mode 100644
index 0000000..bd9654f
--- /dev/null
+++ b/ambari-server/src/main/resources/common-services/PIG/0.16.1.3.0/package/scripts/params_windows.py
@@ -0,0 +1,45 @@
+"""
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+Ambari Agent
+
+"""
+from resource_management.libraries.script.script import Script
+
+# server configurations
+config = Script.get_config()
+
+stack_root = None
+pig_home = None
+pig_conf_dir = None
+try:
+  stack_root = os.path.abspath(os.path.join(os.environ["HADOOP_HOME"],".."))
+  pig_home = os.environ['PIG_HOME']
+  pig_conf_dir = os.path.join(pig_home,'conf')
+except:
+  pass
+
+pig_properties = config['configurations']['pig-properties']['content']
+
+if (('pig-log4j' in config['configurations']) and ('content' in config['configurations']['pig-log4j'])):
+  log4j_props = config['configurations']['pig-log4j']['content']
+else:
+  log4j_props = None
+
+hadoop_user = config["configurations"]["cluster-env"]["hadoop.user.name"]
+pig_user = hadoop_user
+hdfs_user = hadoop_user

http://git-wip-us.apache.org/repos/asf/ambari/blob/9fec5ac5/ambari-server/src/main/resources/common-services/PIG/0.16.1.3.0/package/scripts/pig.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/PIG/0.16.1.3.0/package/scripts/pig.py b/ambari-server/src/main/resources/common-services/PIG/0.16.1.3.0/package/scripts/pig.py
new file mode 100644
index 0000000..b6825d5
--- /dev/null
+++ b/ambari-server/src/main/resources/common-services/PIG/0.16.1.3.0/package/scripts/pig.py
@@ -0,0 +1,80 @@
+"""
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+Ambari Agent
+
+"""
+import os
+from resource_management.core.resources.system import Directory, File
+from resource_management.core.source import InlineTemplate
+from resource_management.libraries.functions.format import format
+from ambari_commons import OSConst
+from ambari_commons.os_family_impl import OsFamilyFuncImpl, OsFamilyImpl
+
+@OsFamilyFuncImpl(os_family=OsFamilyImpl.DEFAULT)
+def pig():
+  import params
+
+  Directory( params.pig_conf_dir,
+    create_parents = True,
+    owner = params.hdfs_user,
+    group = params.user_group
+  )
+
+  File(format("{pig_conf_dir}/pig-env.sh"),
+    owner=params.hdfs_user,
+    mode=0755,
+    content=InlineTemplate(params.pig_env_sh_template)
+  )
+
+  # pig_properties is always set to a default even if it's not in the payload
+  File(format("{params.pig_conf_dir}/pig.properties"),
+              mode=0644,
+              group=params.user_group,
+              owner=params.hdfs_user,
+              content=params.pig_properties
+  )
+
+  if (params.log4j_props != None):
+    File(format("{params.pig_conf_dir}/log4j.properties"),
+      mode=0644,
+      group=params.user_group,
+      owner=params.hdfs_user,
+      content=params.log4j_props
+    )
+  elif (os.path.exists(format("{params.pig_conf_dir}/log4j.properties"))):
+    File(format("{params.pig_conf_dir}/log4j.properties"),
+      mode=0644,
+      group=params.user_group,
+      owner=params.hdfs_user
+    )
+
+@OsFamilyFuncImpl(os_family=OSConst.WINSRV_FAMILY)
+def pig():
+  import params
+  File(os.path.join(params.pig_conf_dir, "pig.properties"),
+       mode="f",
+       owner=params.pig_user,
+       content=params.pig_properties
+  )
+
+  if (params.log4j_props != None):
+    File(os.path.join(params.pig_conf_dir, "log4j.properties"),
+         mode='f',
+         owner=params.pig_user,
+         content=params.log4j_props
+    )
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/9fec5ac5/ambari-server/src/main/resources/common-services/PIG/0.16.1.3.0/package/scripts/pig_client.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/PIG/0.16.1.3.0/package/scripts/pig_client.py b/ambari-server/src/main/resources/common-services/PIG/0.16.1.3.0/package/scripts/pig_client.py
new file mode 100644
index 0000000..6fdcef8
--- /dev/null
+++ b/ambari-server/src/main/resources/common-services/PIG/0.16.1.3.0/package/scripts/pig_client.py
@@ -0,0 +1,71 @@
+"""
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+Ambari Agent
+
+"""
+
+import sys
+import os
+from resource_management.libraries.script.script import Script
+from resource_management.libraries.functions import conf_select, stack_select
+from resource_management.libraries.functions.constants import StackFeature
+from resource_management.libraries.functions.stack_features import check_stack_feature
+from pig import pig
+from ambari_commons import OSConst
+from ambari_commons.os_family_impl import OsFamilyFuncImpl, OsFamilyImpl
+from resource_management.libraries.functions.default import default
+from resource_management.core.exceptions import ClientComponentHasNoStatus
+
+class PigClient(Script):
+  def configure(self, env):
+    import params
+    env.set_params(params)
+    pig()
+
+  def status(self, env):
+    raise ClientComponentHasNoStatus()
+
+@OsFamilyImpl(os_family=OsFamilyImpl.DEFAULT)
+class PigClientLinux(PigClient):
+  def get_component_name(self):
+    return "hadoop-client"
+
+  def pre_upgrade_restart(self, env, upgrade_type=None):
+    import params
+    env.set_params(params)
+
+    if params.version and check_stack_feature(StackFeature.ROLLING_UPGRADE, params.version): 
+      conf_select.select(params.stack_name, "pig", params.version)
+      conf_select.select(params.stack_name, "hadoop", params.version)
+      stack_select.select("hadoop-client", params.version) # includes pig-client
+
+  def install(self, env):
+    self.install_packages(env)
+    self.configure(env)
+
+@OsFamilyImpl(os_family=OSConst.WINSRV_FAMILY)
+class PigClientWindows(PigClient):
+
+  def install(self, env):
+    import params
+    if params.pig_home is None:
+      self.install_packages(env)
+    self.configure(env)
+
+if __name__ == "__main__":
+  PigClient().execute()

http://git-wip-us.apache.org/repos/asf/ambari/blob/9fec5ac5/ambari-server/src/main/resources/common-services/PIG/0.16.1.3.0/package/scripts/service_check.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/PIG/0.16.1.3.0/package/scripts/service_check.py b/ambari-server/src/main/resources/common-services/PIG/0.16.1.3.0/package/scripts/service_check.py
new file mode 100644
index 0000000..ba4082e
--- /dev/null
+++ b/ambari-server/src/main/resources/common-services/PIG/0.16.1.3.0/package/scripts/service_check.py
@@ -0,0 +1,142 @@
+"""
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+Ambari Agent
+
+"""
+
+import os
+
+from resource_management.core.resources.system import Execute, File
+from resource_management.core.source import InlineTemplate, StaticFile
+from resource_management.libraries.functions.copy_tarball import copy_to_hdfs
+from resource_management.libraries.functions.format import format
+from resource_management.libraries.functions import StackFeature
+from resource_management.libraries.functions.stack_features import check_stack_feature
+from resource_management.libraries.resources.execute_hadoop import ExecuteHadoop
+from resource_management.libraries.resources.hdfs_resource import HdfsResource
+from resource_management.libraries.script.script import Script
+from ambari_commons import OSConst
+from ambari_commons.os_family_impl import OsFamilyFuncImpl, OsFamilyImpl
+
+class PigServiceCheck(Script):
+  pass
+
+@OsFamilyImpl(os_family=OsFamilyImpl.DEFAULT)
+class PigServiceCheckLinux(PigServiceCheck):
+  def service_check(self, env):
+    import params
+    env.set_params(params)
+
+    input_file = format('/user/{smokeuser}/passwd')
+    output_dir = format('/user/{smokeuser}/pigsmoke.out')
+
+    params.HdfsResource(format("/user/{smokeuser}"),
+                        type="directory",
+                        action="create_on_execute",
+                        owner=params.smokeuser,
+                        mode=params.smoke_hdfs_user_mode,
+                        )
+
+    params.HdfsResource(output_dir,
+                        type="directory",
+                        action="delete_on_execute",
+                        owner=params.smokeuser,
+                        )
+    params.HdfsResource(input_file,
+                        type="file",
+                        source="/etc/passwd",
+                        action="create_on_execute",
+                        owner=params.smokeuser,
+    )
+    params.HdfsResource(None, action="execute")
+ 
+    if params.security_enabled:
+      kinit_cmd = format("{kinit_path_local} -kt {smoke_user_keytab} {smokeuser_principal};")
+      Execute(kinit_cmd,
+        user=params.smokeuser
+      )
+
+    File( format("{tmp_dir}/pigSmoke.sh"),
+      content = StaticFile("pigSmoke.sh"),
+      mode = 0755
+    )
+
+    # check for Pig-on-M/R
+    Execute( format("pig {tmp_dir}/pigSmoke.sh"),
+      tries     = 3,
+      try_sleep = 5,
+      path      = format('{pig_bin_dir}:/usr/sbin:/sbin:/usr/local/bin:/bin:/usr/bin'),
+      user      = params.smokeuser,
+      logoutput = True
+    )
+
+    test_cmd = format("fs -test -e {output_dir}")
+    ExecuteHadoop( test_cmd,
+      user      = params.smokeuser,
+      conf_dir = params.hadoop_conf_dir,
+      bin_dir = params.hadoop_bin_dir
+    )
+
+    if params.stack_version_formatted and check_stack_feature(StackFeature.PIG_ON_TEZ, params.stack_version_formatted):
+      # cleanup results from previous test
+      params.HdfsResource(output_dir,
+                          type="directory",
+                          action="delete_on_execute",
+                          owner=params.smokeuser,
+      )
+      params.HdfsResource(input_file,
+                          type="file",
+                          source="/etc/passwd",
+                          action="create_on_execute",
+                          owner=params.smokeuser,
+      )
+
+      # Check for Pig-on-Tez
+      resource_created = copy_to_hdfs(
+        "tez", params.user_group,
+        params.hdfs_user,
+        skip=params.sysprep_skip_copy_tarballs_hdfs)
+      if resource_created:
+        params.HdfsResource(None, action="execute")
+
+      Execute(format("pig -x tez {tmp_dir}/pigSmoke.sh"),
+        tries     = 3,
+        try_sleep = 5,
+        path      = format('{pig_bin_dir}:/usr/sbin:/sbin:/usr/local/bin:/bin:/usr/bin'),
+        user      = params.smokeuser,
+        logoutput = True
+      )
+
+      ExecuteHadoop(test_cmd,
+        user      = params.smokeuser,
+        conf_dir = params.hadoop_conf_dir,
+        bin_dir = params.hadoop_bin_dir
+      )
+
+@OsFamilyImpl(os_family=OSConst.WINSRV_FAMILY)
+class PigServiceCheckWindows(PigServiceCheck):
+  def service_check(self, env):
+    import params
+    env.set_params(params)
+    smoke_cmd = os.path.join(params.stack_root,"Run-SmokeTests.cmd")
+    service = "PIG"
+    Execute(format("cmd /C {smoke_cmd} {service}", smoke_cmd=smoke_cmd, service=service), logoutput=True, user=params.pig_user, timeout=300)
+
+if __name__ == "__main__":
+  PigServiceCheck().execute()
+

http://git-wip-us.apache.org/repos/asf/ambari/blob/9fec5ac5/ambari-server/src/main/resources/common-services/PIG/0.16.1.3.0/service_advisor.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/PIG/0.16.1.3.0/service_advisor.py b/ambari-server/src/main/resources/common-services/PIG/0.16.1.3.0/service_advisor.py
new file mode 100644
index 0000000..8f89c5d
--- /dev/null
+++ b/ambari-server/src/main/resources/common-services/PIG/0.16.1.3.0/service_advisor.py
@@ -0,0 +1,171 @@
+#!/usr/bin/env ambari-python-wrap
+"""
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+"""
+
+# Python imports
+import imp
+import os
+import traceback
+import re
+import socket
+import fnmatch
+
+
+from resource_management.core.logger import Logger
+
+SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
+STACKS_DIR = os.path.join(SCRIPT_DIR, '../../../stacks/')
+PARENT_FILE = os.path.join(STACKS_DIR, 'service_advisor.py')
+
+try:
+  with open(PARENT_FILE, 'rb') as fp:
+    service_advisor = imp.load_module('service_advisor', fp, PARENT_FILE, ('.py', 'rb', imp.PY_SOURCE))
+except Exception as e:
+  traceback.print_exc()
+  print "Failed to load parent"
+
+class PigServiceAdvisor(service_advisor.ServiceAdvisor):
+
+  def __init__(self, *args, **kwargs):
+    self.as_super = super(PigServiceAdvisor, self)
+    self.as_super.__init__(*args, **kwargs)
+
+    # Always call these methods
+    self.modifyMastersWithMultipleInstances()
+    self.modifyCardinalitiesDict()
+    self.modifyHeapSizeProperties()
+    self.modifyNotValuableComponents()
+    self.modifyComponentsNotPreferableOnServer()
+    self.modifyComponentLayoutSchemes()
+
+  def modifyMastersWithMultipleInstances(self):
+    """
+    Modify the set of masters with multiple instances.
+    Must be overriden in child class.
+    """
+    # Nothing to do
+    pass
+
+  def modifyCardinalitiesDict(self):
+    """
+    Modify the dictionary of cardinalities.
+    Must be overriden in child class.
+    """
+    # Nothing to do
+    pass
+
+  def modifyHeapSizeProperties(self):
+    """
+    Modify the dictionary of heap size properties.
+    Must be overriden in child class.
+    """
+    pass
+
+  def modifyNotValuableComponents(self):
+    """
+    Modify the set of components whose host assignment is based on other services.
+    Must be overriden in child class.
+    """
+    # Nothing to do
+    pass
+
+  def modifyComponentsNotPreferableOnServer(self):
+    """
+    Modify the set of components that are not preferable on the server.
+    Must be overriden in child class.
+    """
+    # Nothing to do
+    pass
+
+  def modifyComponentLayoutSchemes(self):
+    """
+    Modify layout scheme dictionaries for components.
+    The scheme dictionary basically maps the number of hosts to
+    host index where component should exist.
+    Must be overriden in child class.
+    """
+    # Nothing to do
+    pass
+
+  def getServiceComponentLayoutValidations(self, services, hosts):
+    """
+    Get a list of errors.
+    Must be overriden in child class.
+    """
+
+    return []
+
+  def getServiceConfigurationRecommendations(self, configurations, clusterData, services, hosts):
+    """
+    Entry point.
+    Must be overriden in child class.
+    """
+    #Logger.info("Class: %s, Method: %s. Recommending Service Configurations." %
+    #            (self.__class__.__name__, inspect.stack()[0][3]))
+
+    recommender = PigRecommender()
+
+
+  def getServiceConfigurationsValidationItems(self, configurations, recommendedDefaults, services, hosts):
+    """
+    Entry point.
+    Validate configurations for the service. Return a list of errors.
+    The code for this function should be the same for each Service Advisor.
+    """
+    #Logger.info("Class: %s, Method: %s. Validating Configurations." %
+    #            (self.__class__.__name__, inspect.stack()[0][3]))
+
+    validator = PigValidator()
+    # Calls the methods of the validator using arguments,
+    # method(siteProperties, siteRecommendations, configurations, services, hosts)
+    return validator.validateListOfConfigUsingMethod(configurations, recommendedDefaults, services, hosts, validator.validators)
+
+
+
+class PigRecommender(service_advisor.ServiceAdvisor):
+  """
+  Pig Recommender suggests properties when adding the service for the first time or modifying configs via the UI.
+  """
+
+  def __init__(self, *args, **kwargs):
+    self.as_super = super(PigRecommender, self)
+    self.as_super.__init__(*args, **kwargs)
+
+
+
+
+
+
+
+class PigValidator(service_advisor.ServiceAdvisor):
+  """
+  Pig Validator checks the correctness of properties whenever the service is first added or the user attempts to
+  change configs via the UI.
+  """
+
+  def __init__(self, *args, **kwargs):
+    self.as_super = super(PigValidator, self)
+    self.as_super.__init__(*args, **kwargs)
+
+    self.validators = []
+
+
+
+
+
+

http://git-wip-us.apache.org/repos/asf/ambari/blob/9fec5ac5/ambari-server/src/main/resources/stacks/HDP/3.0/services/PIG/metainfo.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/3.0/services/PIG/metainfo.xml b/ambari-server/src/main/resources/stacks/HDP/3.0/services/PIG/metainfo.xml
new file mode 100644
index 0000000..fd664d0
--- /dev/null
+++ b/ambari-server/src/main/resources/stacks/HDP/3.0/services/PIG/metainfo.xml
@@ -0,0 +1,27 @@
+<?xml version="1.0"?>
+<!--
+   Licensed to the Apache Software Foundation (ASF) under one or more
+   contributor license agreements.  See the NOTICE file distributed with
+   this work for additional information regarding copyright ownership.
+   The ASF licenses this file to You under the Apache License, Version 2.0
+   (the "License"); you may not use this file except in compliance with
+   the License.  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+-->
+<metainfo>
+  <schemaVersion>2.0</schemaVersion>
+  <services>
+    <service>
+      <name>PIG</name>
+      <version>0.16.1.3.0</version>
+      <extends>common-services/PIG/0.16.1.3.0</extends>
+    </service>
+  </services>
+</metainfo>


[43/50] ambari git commit: AMBARI-20677.Centering workflows for zoom breaks when multiple tabs exists(M Madhan Mohan Reddy via padmapriyanitt)

Posted by jo...@apache.org.
AMBARI-20677.Centering workflows for zoom breaks when multiple tabs exists(M Madhan Mohan Reddy via padmapriyanitt)


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

Branch: refs/heads/branch-feature-AMBARI-12556
Commit: 8e15ba6ad3ee9e8ce653ca717f4fa97e2d09889a
Parents: 2ee12f4
Author: padmapriyanitt <pa...@gmail.com>
Authored: Thu Apr 6 12:16:39 2017 +0530
Committer: padmapriyanitt <pa...@gmail.com>
Committed: Thu Apr 6 12:16:39 2017 +0530

----------------------------------------------------------------------
 .../resources/ui/app/components/designer-workspace.js  |  1 +
 .../main/resources/ui/app/components/flow-designer.js  |  3 +++
 .../resources/ui/app/domain/cytoscape-flow-renderer.js | 13 ++++++++++---
 3 files changed, 14 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/8e15ba6a/contrib/views/wfmanager/src/main/resources/ui/app/components/designer-workspace.js
----------------------------------------------------------------------
diff --git a/contrib/views/wfmanager/src/main/resources/ui/app/components/designer-workspace.js b/contrib/views/wfmanager/src/main/resources/ui/app/components/designer-workspace.js
index 980904f..de1eb0e 100644
--- a/contrib/views/wfmanager/src/main/resources/ui/app/components/designer-workspace.js
+++ b/contrib/views/wfmanager/src/main/resources/ui/app/components/designer-workspace.js
@@ -305,6 +305,7 @@ export default Ember.Component.extend({
       if(tab.type === 'wf' && tab.context){
         CommonUtils.setTestContext(tab.context);
         tab.context.resize();
+        tab.context.centerGraph();
       }else if(tab.type === 'dashboard'){
         this.sendAction('showDashboard');
       }

http://git-wip-us.apache.org/repos/asf/ambari/blob/8e15ba6a/contrib/views/wfmanager/src/main/resources/ui/app/components/flow-designer.js
----------------------------------------------------------------------
diff --git a/contrib/views/wfmanager/src/main/resources/ui/app/components/flow-designer.js b/contrib/views/wfmanager/src/main/resources/ui/app/components/flow-designer.js
index fa7c861..cccf6d0 100644
--- a/contrib/views/wfmanager/src/main/resources/ui/app/components/flow-designer.js
+++ b/contrib/views/wfmanager/src/main/resources/ui/app/components/flow-designer.js
@@ -248,6 +248,9 @@ export default Ember.Component.extend(FindNodeMixin, Validations, {
   resize(){
     this.flowRenderer.resize();
   },
+  centerGraph(){
+    this.flowRenderer.setGraphCenter();
+  },
   cleanupFlowRenderer:function(){
     this.set('renderNodeTransitions',false);
     this.flowRenderer.cleanup();

http://git-wip-us.apache.org/repos/asf/ambari/blob/8e15ba6a/contrib/views/wfmanager/src/main/resources/ui/app/domain/cytoscape-flow-renderer.js
----------------------------------------------------------------------
diff --git a/contrib/views/wfmanager/src/main/resources/ui/app/domain/cytoscape-flow-renderer.js b/contrib/views/wfmanager/src/main/resources/ui/app/domain/cytoscape-flow-renderer.js
index af84f86..03f0ae1 100644
--- a/contrib/views/wfmanager/src/main/resources/ui/app/domain/cytoscape-flow-renderer.js
+++ b/contrib/views/wfmanager/src/main/resources/ui/app/domain/cytoscape-flow-renderer.js
@@ -67,11 +67,18 @@ var CytoscapeRenderer= Ember.Object.extend({
   _setCyOverflow() {
     Ember.set(this.get("cyOverflow"), "overflown", this.cy.elements().renderedBoundingBox().y2 > this.cy.height());
   },
-  _setGraphCenter() {
+  setGraphCenter() {
+    if (this.cy && !this.centered){
+      Ember.run.later(this, function() {
+        this._setGraphCenterOnStartNode();
+      },50);
+    }
+  },
+  _setGraphCenterOnStartNode() {
     var startDataNode = this.get("dataNodes").filterBy("data.type", "start");
     if (startDataNode[0] && startDataNode[0].data.id) {
       var startNode = this.cy.$("#" + startDataNode[0].data.id);
-      this.cy.center();
+      this.cy.center(startNode);
       this.cy.pan({y:50});
     }
   },
@@ -400,7 +407,7 @@ var CytoscapeRenderer= Ember.Object.extend({
     this.cy.endBatch();
     this.cy.layout(this.get("layoutConfigs"));
     this._setCyOverflow();
-    this._setGraphCenter();
+    this._setGraphCenterOnStartNode();
   },
 
   initRenderer(callback, settings){


[04/50] ambari git commit: AMBARI-20596. Cleanup temporary files needed for downloading client configurations response (Attila Magyar via adoroszlai)

Posted by jo...@apache.org.
AMBARI-20596. Cleanup temporary files needed for downloading client configurations response (Attila Magyar via adoroszlai)


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

Branch: refs/heads/branch-feature-AMBARI-12556
Commit: fc36391cf6e2b6aec04476af46eceaf91ceed01b
Parents: 3bab212
Author: Attila Magyar <am...@hortonworks.com>
Authored: Mon Apr 3 12:05:16 2017 +0200
Committer: Attila Doroszlai <ad...@hortonworks.com>
Committed: Mon Apr 3 12:05:16 2017 +0200

----------------------------------------------------------------------
 .../libraries/script/script.py                  |  8 +++--
 .../internal/ClientConfigResourceProvider.java  | 35 +++++++++++++++-----
 .../ClientConfigResourceProviderTest.java       | 11 +++---
 .../stacks/2.0.6/HDFS/test_hdfs_client.py       | 11 +++---
 4 files changed, 44 insertions(+), 21 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/fc36391c/ambari-common/src/main/python/resource_management/libraries/script/script.py
----------------------------------------------------------------------
diff --git a/ambari-common/src/main/python/resource_management/libraries/script/script.py b/ambari-common/src/main/python/resource_management/libraries/script/script.py
index fad14fd..5fa9ec4 100644
--- a/ambari-common/src/main/python/resource_management/libraries/script/script.py
+++ b/ambari-common/src/main/python/resource_management/libraries/script/script.py
@@ -874,6 +874,7 @@ class Script(object):
     Directory(self.get_tmp_dir(), create_parents = True)
 
     conf_tmp_dir = tempfile.mkdtemp(dir=self.get_tmp_dir())
+    os.chmod(conf_tmp_dir, 0700)
     output_filename = os.path.join(self.get_tmp_dir(), config['commandParams']['output_file'])
 
     try:
@@ -881,22 +882,23 @@ class Script(object):
         for filename, dict in file_dict.iteritems():
           XmlConfig(filename,
                     conf_dir=conf_tmp_dir,
-                    mode=0644,
+                    mode=0600,
                     **self.generate_configs_get_xml_file_content(filename, dict)
           )
       for file_dict in env_configs_list:
         for filename,dicts in file_dict.iteritems():
           File(os.path.join(conf_tmp_dir, filename),
-               mode=0644,
+               mode=0600,
                content=InlineTemplate(self.generate_configs_get_template_file_content(filename, dicts)))
 
       for file_dict in properties_configs_list:
         for filename, dict in file_dict.iteritems():
           PropertiesFile(os.path.join(conf_tmp_dir, filename),
-                         mode=0644,
+                         mode=0600,
                          properties=self.generate_configs_get_xml_file_dict(filename, dict)
           )
       with closing(tarfile.open(output_filename, "w:gz")) as tar:
+        os.chmod(output_filename, 0600)
         try:
           tar.add(conf_tmp_dir, arcname=os.path.basename("."))
         finally:

http://git-wip-us.apache.org/repos/asf/ambari/blob/fc36391c/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ClientConfigResourceProvider.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ClientConfigResourceProvider.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ClientConfigResourceProvider.java
index e98c062..e42bd45 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ClientConfigResourceProvider.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ClientConfigResourceProvider.java
@@ -213,6 +213,7 @@ public class ClientConfigResourceProvider extends AbstractControllerResourceProv
     String TMP_PATH = configMap.get(Configuration.SERVER_TMP_DIR.getKey());
     String pythonCmd = configMap.get(Configuration.AMBARI_PYTHON_WRAP.getKey());
     List<String> pythonCompressFilesCmds = new ArrayList<>();
+    List<File> commandFiles = new ArrayList<>();
 
     for (ServiceComponentHostResponse response : componentMap.values()){
 
@@ -444,8 +445,7 @@ public class ClientConfigResourceProvider extends AbstractControllerResourceProv
         jsonContent.put("clusterName", cluster.getClusterName());
         jsonConfigurations = gson.toJson(jsonContent);
 
-        File jsonFileName = new File(TMP_PATH + File.separator + componentName + "-configuration.json");
-        File tmpDirectory = new File(jsonFileName.getParent());
+        File tmpDirectory = new File(TMP_PATH);
         if (!tmpDirectory.exists()) {
           try {
             tmpDirectory.mkdirs();
@@ -455,22 +455,33 @@ public class ClientConfigResourceProvider extends AbstractControllerResourceProv
             throw new SystemException("Failed to get temporary directory to store configurations", se);
           }
         }
+        File jsonFile = File.createTempFile(componentName, "-configuration.json", tmpDirectory);
+        try {
+          jsonFile.setWritable(true, true);
+          jsonFile.setReadable(true, true);
+        } catch (SecurityException e) {
+          throw new SystemException("Failed to set permission", e);
+        }
+
         PrintWriter printWriter = null;
         try {
-          printWriter = new PrintWriter(jsonFileName.getAbsolutePath());
+          printWriter = new PrintWriter(jsonFile.getAbsolutePath());
           printWriter.print(jsonConfigurations);
           printWriter.close();
         } catch (FileNotFoundException e) {
           throw new SystemException("Failed to write configurations to json file ", e);
         }
 
-        String cmd = pythonCmd + " " + commandScriptAbsolute + " generate_configs " + jsonFileName.getAbsolutePath() + " " +
+        String cmd = pythonCmd + " " + commandScriptAbsolute + " generate_configs " + jsonFile.getAbsolutePath() + " " +
           packageFolderAbsolute + " " + TMP_PATH + File.separator + "structured-out.json" + " INFO " + TMP_PATH;
 
+        commandFiles.add(jsonFile);
         pythonCompressFilesCmds.add(cmd);
 
       } catch (AmbariException e) {
         throw new SystemException("Controller error ", e);
+      } catch (IOException e) {
+        throw new SystemException("Controller error ", e);
       }
     }
 
@@ -483,11 +494,17 @@ public class ClientConfigResourceProvider extends AbstractControllerResourceProv
     ExecutorService processExecutor = Executors.newFixedThreadPool(threadPoolSize);
 
     // put all threads that starts process to compress each component config files in the executor
-    List<CommandLineThreadWrapper> pythonCmdThreads = executeCommands(processExecutor, pythonCompressFilesCmds);
-
-    // wait for all threads to finish
-    Integer timeout =  configs.getExternalScriptTimeout();
-    waitForAllThreadsToJoin(processExecutor, pythonCmdThreads, timeout);
+    try {
+      List<CommandLineThreadWrapper> pythonCmdThreads = executeCommands(processExecutor, pythonCompressFilesCmds);
+
+      // wait for all threads to finish
+      Integer timeout = configs.getExternalScriptTimeout();
+      waitForAllThreadsToJoin(processExecutor, pythonCmdThreads, timeout);
+    } finally {
+      for (File each : commandFiles) {
+        each.delete();
+      }
+    }
 
     if (StringUtils.isEmpty(requestComponentName)) {
       TarUtils tarUtils;

http://git-wip-us.apache.org/repos/asf/ambari/blob/fc36391c/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/ClientConfigResourceProviderTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/ClientConfigResourceProviderTest.java b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/ClientConfigResourceProviderTest.java
index 8f0c66f..c2ee4d6 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/ClientConfigResourceProviderTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/ClientConfigResourceProviderTest.java
@@ -19,6 +19,7 @@
 package org.apache.ambari.server.controller.internal;
 
 import static org.easymock.EasyMock.anyObject;
+import static org.easymock.EasyMock.anyString;
 import static org.easymock.EasyMock.createMock;
 import static org.easymock.EasyMock.createNiceMock;
 import static org.easymock.EasyMock.expect;
@@ -26,7 +27,6 @@ import static org.easymock.EasyMock.expectLastCall;
 import static org.easymock.EasyMock.replay;
 import static org.easymock.EasyMock.verify;
 import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
 import static org.powermock.api.mockito.PowerMockito.whenNew;
 
 import java.io.ByteArrayInputStream;
@@ -359,6 +359,9 @@ public class ClientConfigResourceProviderTest {
     expect(configHelper.createUserGroupsMap(stackId, cluster, desiredConfigMap)).andReturn(userGroupsMap).anyTimes();
 
     PowerMock.expectNew(File.class, new Class<?>[]{String.class}, anyObject(String.class)).andReturn(newFile).anyTimes();
+    PowerMock.mockStatic(File.class);
+    expect(File.createTempFile(anyString(), anyString(), anyObject(File.class))).andReturn(newFile);
+
     String commandLine = "ambari-python-wrap /tmp/stacks/S1/V1/PIG/package/null generate_configs "+newFile  +
       " /tmp/stacks/S1/V1/PIG/package /var/lib/ambari-server/tmp/structured-out.json " +
             "INFO /var/lib/ambari-server/tmp";
@@ -397,8 +400,7 @@ public class ClientConfigResourceProviderTest {
 
     Set<Resource> resources = provider.getResources(request, predicate);
     assertFalse(resources.isEmpty());
-    String str = FileUtils.readFileToString(newFile);
-    assertTrue(str.contains("\"user_groups\":\"{\\\"hdfsUser\\\":[\\\"hdfsGroup\\\"]}"));
+    assertFalse(newFile.exists());
 
     // verify
     verify(managementController, clusters, cluster, ambariMetaInfo, stackId, componentInfo,commandScriptDefinition,
@@ -574,8 +576,9 @@ public class ClientConfigResourceProviderTest {
     userSet.add("hdfs");
     expect(configHelper.getPropertyValuesWithPropertyType(stackId, PropertyInfo.PropertyType.USER, cluster, desiredConfigMap)).andReturn(userSet);
     PowerMock.expectNew(File.class, new Class<?>[]{String.class}, anyObject(String.class)).andReturn(mockFile).anyTimes();
+    PowerMock.mockStatic(File.class);
+    expect(File.createTempFile(anyString(), anyString(), anyObject(File.class))).andReturn(PowerMock.createNiceMock(File.class));
     PowerMock.createNiceMockAndExpectNew(PrintWriter.class, anyObject());
-    expect(mockFile.getParent()).andReturn("");
     PowerMock.mockStatic(Runtime.class);
     expect(mockFile.exists()).andReturn(true);
     String commandLine = "ambari-python-wrap " + commonServicesPath + "/PIG/package/null generate_configs null " +

http://git-wip-us.apache.org/repos/asf/ambari/blob/fc36391c/ambari-server/src/test/python/stacks/2.0.6/HDFS/test_hdfs_client.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/stacks/2.0.6/HDFS/test_hdfs_client.py b/ambari-server/src/test/python/stacks/2.0.6/HDFS/test_hdfs_client.py
index b2636ab..85098fa 100644
--- a/ambari-server/src/test/python/stacks/2.0.6/HDFS/test_hdfs_client.py
+++ b/ambari-server/src/test/python/stacks/2.0.6/HDFS/test_hdfs_client.py
@@ -32,6 +32,7 @@ from resource_management.libraries.script.script import Script
 @patch.object(tempfile,"mkdtemp", new = MagicMock(return_value='/tmp/123'))
 @patch.object(contextlib,"closing", new = MagicMock())
 @patch("os.path.exists", new = MagicMock(return_value=True))
+@patch("os.chmod", new = MagicMock(return_value=True))
 class Test(RMFTestCase):
   COMMON_SERVICES_PACKAGE_DIR = "HDFS/2.1.0.2.0/package"
   STACK_VERSION = "2.0.6"
@@ -49,25 +50,25 @@ class Test(RMFTestCase):
                               )
     self.assertResourceCalled('XmlConfig', 'hdfs-site.xml',
                               conf_dir = '/tmp/123',
-                              mode=0644,
+                              mode=0600,
                               configuration_attributes = self.getConfig()['configuration_attributes']['hdfs-site'],
                               configurations = self.getConfig()['configurations']['hdfs-site'],
                               )
     self.assertResourceCalled('File', '/tmp/123/hadoop-env.sh',
-                              mode=0644,
+                              mode=0600,
                               content = InlineTemplate(self.getConfig()['configurations']['hadoop-env']['content']),
                               )
     self.assertResourceCalled('File', '/tmp/123/log4j.properties',
-                              mode=0644,
+                              mode=0600,
                               content = InlineTemplate(self.getConfig()['configurations']['hdfs-log4j']['content']+
                                                        self.getConfig()['configurations']['yarn-log4j']['content']),
                               )
     self.assertResourceCalled('PropertiesFile', '/tmp/123/runtime.properties',
-                              mode=0644,
+                              mode=0600,
                               properties = UnknownConfigurationMock(),
     )
     self.assertResourceCalled('PropertiesFile', '/tmp/123/startup.properties',
-                              mode=0644,
+                              mode=0600,
                               properties = UnknownConfigurationMock(),
     )
     self.assertResourceCalled('Directory', '/tmp/123',


[27/50] ambari git commit: AMBARI-20662.Need to auto populate the workflow parameters if its already defined in the global space.(M Madhan Mohan Reddy via padmapriyanitt)

Posted by jo...@apache.org.
AMBARI-20662.Need to auto populate the workflow parameters if its already defined in the global space.(M Madhan Mohan Reddy via padmapriyanitt)


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

Branch: refs/heads/branch-feature-AMBARI-12556
Commit: 4004ee89c989241ac5c6d439f02a06ee0dd61f03
Parents: 92e5b59
Author: padmapriyanitt <pa...@gmail.com>
Authored: Tue Apr 4 16:21:27 2017 +0530
Committer: padmapriyanitt <pa...@gmail.com>
Committed: Tue Apr 4 16:21:27 2017 +0530

----------------------------------------------------------------------
 .../wfmanager/src/main/resources/ui/app/components/job-config.js | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/4004ee89/contrib/views/wfmanager/src/main/resources/ui/app/components/job-config.js
----------------------------------------------------------------------
diff --git a/contrib/views/wfmanager/src/main/resources/ui/app/components/job-config.js b/contrib/views/wfmanager/src/main/resources/ui/app/components/job-config.js
index e9c7c15..6aed9da 100644
--- a/contrib/views/wfmanager/src/main/resources/ui/app/components/job-config.js
+++ b/contrib/views/wfmanager/src/main/resources/ui/app/components/job-config.js
@@ -121,15 +121,17 @@ export default Ember.Component.extend(Validations, {
       if (value!== Constants.defaultNameNodeValue && value!==Constants.rmDefaultValue){
         var propName = value.trim().substring(2, value.length-1);
         var isRequired = true;
+        var val = null;
         if(jobParams && jobParams.configuration && jobParams.configuration.property){
           var param = jobParams.configuration.property.findBy('name', propName);
           if(param && param.value){
             isRequired = false;
+            val = param.value;
           }else {
             isRequired = true;
           }
         }
-        let val = null, tabData = self.get("tabInfo");
+        let tabData = self.get("tabInfo");
         if(tabData && tabData.isImportedFromDesigner && tabData.configuration && tabData.configuration.settings && tabData.configuration.settings.configuration && tabData.configuration.settings.configuration.property) {
           let propVal = tabData.configuration.settings.configuration.property.findBy('name', propName);
           if(propVal) {


[33/50] ambari git commit: AMBARI-20592 ServicePresences check should also check for services dropped from a release (dili)

Posted by jo...@apache.org.
AMBARI-20592 ServicePresences check should also check for services dropped from a release (dili)


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

Branch: refs/heads/branch-feature-AMBARI-12556
Commit: 3ca41f26205de3ac6c316dde749abcedf4082509
Parents: 6ee881b
Author: Di Li <di...@apache.org>
Authored: Tue Apr 4 13:58:58 2017 -0400
Committer: Di Li <di...@apache.org>
Committed: Tue Apr 4 13:58:58 2017 -0400

----------------------------------------------------------------------
 .../ambari/server/checks/CheckDescription.java  |  5 +-
 .../server/checks/ServicePresenceCheck.java     | 52 +++++++++++++++++---
 .../server/checks/ServicePresenceCheckTest.java | 41 ++++++++++++---
 3 files changed, 83 insertions(+), 15 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/3ca41f26/ambari-server/src/main/java/org/apache/ambari/server/checks/CheckDescription.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/checks/CheckDescription.java b/ambari-server/src/main/java/org/apache/ambari/server/checks/CheckDescription.java
index 71c5857..e17185f 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/checks/CheckDescription.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/checks/CheckDescription.java
@@ -280,9 +280,12 @@ public class CheckDescription {
             "This service does not support upgrades and must be removed before the upgrade can continue. " +
             "After upgrading, %s can be reinstalled")
         .put(ServicePresenceCheck.KEY_SERVICE_REMOVED,
+             "The %s service is currently installed on the cluster. " +
+             "This service is removed from the new release and must be removed before the upgrade can continue.")
+        .put(ServicePresenceCheck.KEY_SERVICE_REPLACED,
             "The %s service is currently installed on the cluster. " +
             "This service is removed from the new release and must be removed before the upgrade can continue. " +
-            "After upgrading, %s can be installed").build());
+            "After upgrading, %s can be installed as the replacement.").build());
 
   public static CheckDescription RANGER_SERVICE_AUDIT_DB_CHECK = new CheckDescription("RANGER_SERVICE_AUDIT_DB_CHECK",
     PrereqCheckType.SERVICE,

http://git-wip-us.apache.org/repos/asf/ambari/blob/3ca41f26/ambari-server/src/main/java/org/apache/ambari/server/checks/ServicePresenceCheck.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/checks/ServicePresenceCheck.java b/ambari-server/src/main/java/org/apache/ambari/server/checks/ServicePresenceCheck.java
index ed38882..5ff1f0b 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/checks/ServicePresenceCheck.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/checks/ServicePresenceCheck.java
@@ -46,7 +46,9 @@ public class ServicePresenceCheck extends AbstractCheckDescriptor{
 
   private static final Logger LOG = LoggerFactory.getLogger(ServicePresenceCheck.class);
 
+  static final String KEY_SERVICE_REPLACED = "service_replaced";
   static final String KEY_SERVICE_REMOVED = "service_removed";
+
   /*
    * List of services that do not support upgrade
    * services must be removed before the stack upgrade
@@ -59,6 +61,11 @@ public class ServicePresenceCheck extends AbstractCheckDescriptor{
   static final String REMOVED_SERVICES_PROPERTY_NAME = "removed-service-names";
 
   /*
+   * List of services replaced by other services in the new release
+   * */
+  static final String REPLACED_SERVICES_PROPERTY_NAME = "replaced-service-names";
+
+  /*
    * Such as Spark to Spark2
    */
   static final String NEW_SERVICES_PROPERTY_NAME = "new-service-names";
@@ -73,7 +80,9 @@ public class ServicePresenceCheck extends AbstractCheckDescriptor{
     Set<String> installedServices = cluster.getServices().keySet();
 
     List<String> noUpgradeSupportServices = getNoUpgradeSupportServices(request);
-    Map<String, String> removedServices = getRemovedServices(request);
+    Map<String, String> replacedServices = getReplacedServices(request);
+    List<String> removedServices = getRemovedServices(request);
+
     List<String> failReasons = new ArrayList<>();
 
     String reason = getFailReason(prerequisiteCheck, request);
@@ -85,8 +94,8 @@ public class ServicePresenceCheck extends AbstractCheckDescriptor{
       }
     }
 
-    reason = getFailReason(KEY_SERVICE_REMOVED, prerequisiteCheck, request);
-    for (Map.Entry<String, String> entry : removedServices.entrySet()) {
+    reason = getFailReason(KEY_SERVICE_REPLACED, prerequisiteCheck, request);
+    for (Map.Entry<String, String> entry : replacedServices.entrySet()) {
       String removedService = entry.getKey();
       if(installedServices.contains(removedService.toUpperCase())){
         prerequisiteCheck.getFailedOn().add(removedService);
@@ -96,6 +105,15 @@ public class ServicePresenceCheck extends AbstractCheckDescriptor{
       }
     }
 
+    reason = getFailReason(KEY_SERVICE_REMOVED, prerequisiteCheck, request);
+    for(String service: removedServices){
+      if (installedServices.contains(service.toUpperCase())){
+        prerequisiteCheck.getFailedOn().add(service);
+        String msg = String.format(reason, service);
+        failReasons.add(msg);
+      }
+    }
+
     if(!failReasons.isEmpty()){
       prerequisiteCheck.setStatus(PrereqCheckStatus.FAIL);
       prerequisiteCheck.setFailReason(StringUtils.join(failReasons, '\n'));
@@ -138,28 +156,46 @@ public class ServicePresenceCheck extends AbstractCheckDescriptor{
   }
 
   /**
+  +   * @return service names
+  +   * */
+  private List<String> getRemovedServices(PrereqCheckRequest request){
+    List<String> result = new ArrayList<String>();
+    String value = getPropertyValue(request, REMOVED_SERVICES_PROPERTY_NAME);
+    if (null != value){
+      String[] services = value.split(",");
+      for(String service: services){
+        service = service.trim();
+        if (!service.isEmpty()){
+          result.add(service);
+        }
+      }
+    }
+    return result;
+  }
+
+  /**
    * @return service names and new service names map
    * */
-  private Map<String, String> getRemovedServices(PrereqCheckRequest request) throws AmbariException{
+  private Map<String, String> getReplacedServices(PrereqCheckRequest request) throws AmbariException{
     Map<String, String> result = new LinkedHashMap<>();
-    String value = getPropertyValue(request, REMOVED_SERVICES_PROPERTY_NAME);
+    String value = getPropertyValue(request, REPLACED_SERVICES_PROPERTY_NAME);
     String newValue = getPropertyValue(request, NEW_SERVICES_PROPERTY_NAME);
     if(value == null && newValue == null){
       return result; //no need to check removed services as they are not specified in the upgrade xml file.
     } else {
       if (value == null || newValue == null){
-        throw new AmbariException(String.format("Both %s and %s list must be specified in the upgrade XML file.", REMOVED_SERVICES_PROPERTY_NAME, NEW_SERVICES_PROPERTY_NAME));
+        throw new AmbariException(String.format("Both %s and %s list must be specified in the upgrade XML file.", REPLACED_SERVICES_PROPERTY_NAME, NEW_SERVICES_PROPERTY_NAME));
       } else {
         List<String> oldServices = Arrays.asList(value.split(","));
         List<String> newServices = Arrays.asList(newValue.split(","));
         if (oldServices.size() != newServices.size()){
-          throw new AmbariException(String.format("%s must have the same number of services as the %s list.", NEW_SERVICES_PROPERTY_NAME, REMOVED_SERVICES_PROPERTY_NAME));
+          throw new AmbariException(String.format("%s must have the same number of services as the %s list.", NEW_SERVICES_PROPERTY_NAME, REPLACED_SERVICES_PROPERTY_NAME));
         } else {
           for (int i = 0; i < oldServices.size(); i++){
             String oldService = oldServices.get(i).trim();
             String newService = newServices.get(i).trim();
             if (oldService.isEmpty() || newService.isEmpty()) {
-              throw new AmbariException(String.format("Make sure both %s and %s list only contain comma separated list of services.", NEW_SERVICES_PROPERTY_NAME, REMOVED_SERVICES_PROPERTY_NAME));
+              throw new AmbariException(String.format("Make sure both %s and %s list only contain comma separated list of services.", NEW_SERVICES_PROPERTY_NAME, REPLACED_SERVICES_PROPERTY_NAME));
             } else {
               result.put(oldService, newService);
             }

http://git-wip-us.apache.org/repos/asf/ambari/blob/3ca41f26/ambari-server/src/test/java/org/apache/ambari/server/checks/ServicePresenceCheckTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/checks/ServicePresenceCheckTest.java b/ambari-server/src/test/java/org/apache/ambari/server/checks/ServicePresenceCheckTest.java
index d89f0e5..ed2fcb9 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/checks/ServicePresenceCheckTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/checks/ServicePresenceCheckTest.java
@@ -64,7 +64,8 @@ public class ServicePresenceCheckTest {
 
     Map<String, String> checkProperties = new HashMap<>();
     checkProperties.put(ServicePresenceCheck.NO_UPGRADE_SUPPORT_SERVICES_PROPERTY_NAME,"MyServiceOne, MyServiceTwo");
-    checkProperties.put(ServicePresenceCheck.REMOVED_SERVICES_PROPERTY_NAME,"OldServiceOne, OldServiceTwo");
+    checkProperties.put(ServicePresenceCheck.REMOVED_SERVICES_PROPERTY_NAME,"RemovedServiceOne, RemovedServiceTwo");
+    checkProperties.put(ServicePresenceCheck.REPLACED_SERVICES_PROPERTY_NAME,"OldServiceOne, OldServiceTwo");
     checkProperties.put(ServicePresenceCheck.NEW_SERVICES_PROPERTY_NAME,"NewServiceOne, NewServiceTwo");
 
     PrerequisiteCheckConfig prerequisiteCheckConfig = Mockito.mock(PrerequisiteCheckConfig.class);
@@ -105,7 +106,7 @@ public class ServicePresenceCheckTest {
   }
 
   @Test
-  public void testPerformHasRemovedServices() throws Exception {
+  public void testPerformHasReplacedServices() throws Exception {
     final Cluster cluster = Mockito.mock(Cluster.class);
     Mockito.when(cluster.getClusterId()).thenReturn(1L);
     Mockito.when(m_clusters.getCluster("cluster")).thenReturn(cluster);
@@ -116,7 +117,7 @@ public class ServicePresenceCheckTest {
     Mockito.when(cluster.getServices()).thenReturn(services);
 
     Map<String, String> checkProperties = new HashMap<>();
-    checkProperties.put(ServicePresenceCheck.REMOVED_SERVICES_PROPERTY_NAME,"Atlas, OldService");
+    checkProperties.put(ServicePresenceCheck.REPLACED_SERVICES_PROPERTY_NAME,"Atlas, OldService");
     checkProperties.put(ServicePresenceCheck.NEW_SERVICES_PROPERTY_NAME,"Atlas2, NewService");
 
     PrerequisiteCheckConfig prerequisiteCheckConfig = Mockito.mock(PrerequisiteCheckConfig.class);
@@ -132,6 +133,32 @@ public class ServicePresenceCheckTest {
   }
 
   @Test
+  public void testPerformHasRemovedServices() throws Exception {
+    final Cluster cluster = Mockito.mock(Cluster.class);
+    Mockito.when(cluster.getClusterId()).thenReturn(1L);
+    Mockito.when(m_clusters.getCluster("cluster")).thenReturn(cluster);
+
+    Map<String, Service> services = new HashMap<String, Service>();
+    services.put("ATLAS", Mockito.mock(Service.class));
+    services.put("OLDSERVICE", Mockito.mock(Service.class));
+    Mockito.when(cluster.getServices()).thenReturn(services);
+
+    Map<String, String> checkProperties = new HashMap<String, String>();
+    checkProperties.put(ServicePresenceCheck.REMOVED_SERVICES_PROPERTY_NAME,"OldService");
+
+    PrerequisiteCheckConfig prerequisiteCheckConfig = Mockito.mock(PrerequisiteCheckConfig.class);
+    Mockito.when(prerequisiteCheckConfig.getCheckProperties(
+        m_check.getClass().getName())).thenReturn(checkProperties);
+
+    PrerequisiteCheck check = new PrerequisiteCheck(null, null);
+    PrereqCheckRequest request = new PrereqCheckRequest("cluster");
+    request.setPrerequisiteCheckConfig(prerequisiteCheckConfig);
+
+    m_check.perform(check, request);
+    Assert.assertEquals(PrereqCheckStatus.FAIL, check.getStatus());
+  }
+
+  @Test
   public void testPerformMixOne() throws Exception {
     final Cluster cluster = Mockito.mock(Cluster.class);
     Mockito.when(cluster.getClusterId()).thenReturn(1L);
@@ -139,12 +166,14 @@ public class ServicePresenceCheckTest {
 
     Map<String, Service> services = new HashMap<>();
     services.put("ATLAS", Mockito.mock(Service.class));
+    services.put("REMOVEDSERVICE", Mockito.mock(Service.class));
     Mockito.when(cluster.getServices()).thenReturn(services);
 
     Map<String, String> checkProperties = new HashMap<>();
     checkProperties.put(ServicePresenceCheck.NO_UPGRADE_SUPPORT_SERVICES_PROPERTY_NAME,"MyServiceOne, MyServiceTwo");
-    checkProperties.put(ServicePresenceCheck.REMOVED_SERVICES_PROPERTY_NAME,"Atlas, OldService");
+    checkProperties.put(ServicePresenceCheck.REPLACED_SERVICES_PROPERTY_NAME,"Atlas, OldService");
     checkProperties.put(ServicePresenceCheck.NEW_SERVICES_PROPERTY_NAME,"Atlas2, NewService");
+    checkProperties.put(ServicePresenceCheck.REMOVED_SERVICES_PROPERTY_NAME,"RemovedService");
 
     PrerequisiteCheckConfig prerequisiteCheckConfig = Mockito.mock(PrerequisiteCheckConfig.class);
     Mockito.when(prerequisiteCheckConfig.getCheckProperties(
@@ -170,7 +199,7 @@ public class ServicePresenceCheckTest {
 
     Map<String, String> checkProperties = new HashMap<>();
     checkProperties.put(ServicePresenceCheck.NO_UPGRADE_SUPPORT_SERVICES_PROPERTY_NAME,"Atlas, MyService");
-    checkProperties.put(ServicePresenceCheck.REMOVED_SERVICES_PROPERTY_NAME,"OldService");
+    checkProperties.put(ServicePresenceCheck.REPLACED_SERVICES_PROPERTY_NAME,"OldService");
     checkProperties.put(ServicePresenceCheck.NEW_SERVICES_PROPERTY_NAME,"NewService");
 
     PrerequisiteCheckConfig prerequisiteCheckConfig = Mockito.mock(PrerequisiteCheckConfig.class);
@@ -200,7 +229,7 @@ public class ServicePresenceCheckTest {
 
     Map<String, String> checkProperties = new HashMap<>();
     checkProperties.put(ServicePresenceCheck.NO_UPGRADE_SUPPORT_SERVICES_PROPERTY_NAME,"Atlas, HDFS");
-    checkProperties.put(ServicePresenceCheck.REMOVED_SERVICES_PROPERTY_NAME,"Storm, Ranger");
+    checkProperties.put(ServicePresenceCheck.REPLACED_SERVICES_PROPERTY_NAME,"Storm, Ranger");
     checkProperties.put(ServicePresenceCheck.NEW_SERVICES_PROPERTY_NAME,"Storm2, Ranger2");
 
     PrerequisiteCheckConfig prerequisiteCheckConfig = Mockito.mock(PrerequisiteCheckConfig.class);


[25/50] ambari git commit: AMBARI-20664. Remove hardcoding of /usr/hdp by AMBARI-20543 needed for IBM Power (aonishuk)

Posted by jo...@apache.org.
AMBARI-20664. Remove hardcoding of /usr/hdp by AMBARI-20543 needed for IBM Power (aonishuk)


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

Branch: refs/heads/branch-feature-AMBARI-12556
Commit: 19848685efdac9731c820b0c7902725e5eafa829
Parents: 1022fdb
Author: Andrew Onishuk <ao...@hortonworks.com>
Authored: Tue Apr 4 11:41:31 2017 +0300
Committer: Andrew Onishuk <ao...@hortonworks.com>
Committed: Tue Apr 4 11:41:31 2017 +0300

----------------------------------------------------------------------
 .../common-services/HDFS/2.1.0.2.0/configuration/hadoop-env.xml    | 2 +-
 .../common-services/TEZ/0.4.0.2.1/configuration/tez-site.xml       | 2 +-
 .../common-services/TEZ/0.4.0.2.1/package/scripts/params_linux.py  | 2 ++
 .../YARN/2.1.0.2.0/configuration-mapred/mapred-site.xml            | 2 +-
 .../common-services/YARN/2.1.0.2.0/package/scripts/params_linux.py | 1 +
 .../resources/stacks/HDP/2.0.6/hooks/before-ANY/scripts/params.py  | 1 +
 .../stacks/HDP/2.2/services/HDFS/configuration/hadoop-env.xml      | 2 +-
 .../stacks/HDP/2.3/services/HDFS/configuration/hadoop-env.xml      | 2 +-
 .../stacks/HDP/2.4/services/HDFS/configuration/hadoop-env.xml      | 2 +-
 .../stacks/HDP/2.6/services/HDFS/configuration/hadoop-env.xml      | 2 +-
 10 files changed, 11 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/19848685/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/configuration/hadoop-env.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/configuration/hadoop-env.xml b/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/configuration/hadoop-env.xml
index 4b4008d..bb671cc 100644
--- a/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/configuration/hadoop-env.xml
+++ b/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/configuration/hadoop-env.xml
@@ -368,7 +368,7 @@ fi
 export HADOOP_LIBEXEC_DIR={{hadoop_libexec_dir}}
 
 #Mostly required for hadoop 2.0
-export JAVA_LIBRARY_PATH=${JAVA_LIBRARY_PATH}:/usr/lib/hadoop/lib/native/Linux-{{architecture}}-64:/usr/hdp/current/hadoop-client/lib/native/Linux-{{architecture}}-64
+export JAVA_LIBRARY_PATH=${JAVA_LIBRARY_PATH}:{{hadoop_lib_home}}/native/Linux-{{architecture}}-64
 
 {% if is_datanode_max_locked_memory_set %}
 # Fix temporary bug, when ulimit from conf files is not picked up, without full relogin. 

http://git-wip-us.apache.org/repos/asf/ambari/blob/19848685/ambari-server/src/main/resources/common-services/TEZ/0.4.0.2.1/configuration/tez-site.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/TEZ/0.4.0.2.1/configuration/tez-site.xml b/ambari-server/src/main/resources/common-services/TEZ/0.4.0.2.1/configuration/tez-site.xml
index d883ec2..c6ddfa5 100644
--- a/ambari-server/src/main/resources/common-services/TEZ/0.4.0.2.1/configuration/tez-site.xml
+++ b/ambari-server/src/main/resources/common-services/TEZ/0.4.0.2.1/configuration/tez-site.xml
@@ -174,7 +174,7 @@
   </property>
   <property>
     <name>tez.am.env</name>
-    <value>LD_LIBRARY_PATH=/usr/lib/hadoop/lib/native:/usr/lib/hadoop/lib/native/Linux-{{architecture}}-64:/usr/hdp/current/hadoop-client/lib/native/Linux-{{architecture}}-64</value>
+    <value>LD_LIBRARY_PATH={{hadoop_lib_home}}/native/Linux-{{architecture}}-64</value>
     <description>
         Additional execution environment entries for tez. This is not an additive property. You must preserve the original value if
         you want to have access to native libraries.

http://git-wip-us.apache.org/repos/asf/ambari/blob/19848685/ambari-server/src/main/resources/common-services/TEZ/0.4.0.2.1/package/scripts/params_linux.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/TEZ/0.4.0.2.1/package/scripts/params_linux.py b/ambari-server/src/main/resources/common-services/TEZ/0.4.0.2.1/package/scripts/params_linux.py
index 5a028bd..4d63685 100644
--- a/ambari-server/src/main/resources/common-services/TEZ/0.4.0.2.1/package/scripts/params_linux.py
+++ b/ambari-server/src/main/resources/common-services/TEZ/0.4.0.2.1/package/scripts/params_linux.py
@@ -47,6 +47,8 @@ stack_version_formatted = format_stack_version(stack_version_unformatted)
 # New Cluster Stack Version that is defined during the RESTART of a Rolling Upgrade
 version = default("/commandParams/version", None)
 
+hadoop_lib_home = stack_select.get_hadoop_dir("lib")
+
 # default hadoop parameters
 hadoop_home = '/usr'
 hadoop_bin_dir = stack_select.get_hadoop_dir("bin")

http://git-wip-us.apache.org/repos/asf/ambari/blob/19848685/ambari-server/src/main/resources/common-services/YARN/2.1.0.2.0/configuration-mapred/mapred-site.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/YARN/2.1.0.2.0/configuration-mapred/mapred-site.xml b/ambari-server/src/main/resources/common-services/YARN/2.1.0.2.0/configuration-mapred/mapred-site.xml
index e2ef1b1..a7d8cd6 100644
--- a/ambari-server/src/main/resources/common-services/YARN/2.1.0.2.0/configuration-mapred/mapred-site.xml
+++ b/ambari-server/src/main/resources/common-services/YARN/2.1.0.2.0/configuration-mapred/mapred-site.xml
@@ -438,7 +438,7 @@
   </property>
   <property>
     <name>mapreduce.admin.user.env</name>
-    <value>LD_LIBRARY_PATH=/usr/lib/hadoop/lib/native:/usr/lib/hadoop/lib/native/Linux-{{architecture}}-64:/usr/hdp/current/hadoop-client/lib/native/Linux-{{architecture}}-64</value>
+    <value>LD_LIBRARY_PATH={{hadoop_lib_home}}/native/Linux-{{architecture}}-64</value>
     <description>
       Additional execution environment entries for map and reduce task processes.
       This is not an additive property. You must preserve the original value if

http://git-wip-us.apache.org/repos/asf/ambari/blob/19848685/ambari-server/src/main/resources/common-services/YARN/2.1.0.2.0/package/scripts/params_linux.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/YARN/2.1.0.2.0/package/scripts/params_linux.py b/ambari-server/src/main/resources/common-services/YARN/2.1.0.2.0/package/scripts/params_linux.py
index a4de8fa..88be29c 100644
--- a/ambari-server/src/main/resources/common-services/YARN/2.1.0.2.0/package/scripts/params_linux.py
+++ b/ambari-server/src/main/resources/common-services/YARN/2.1.0.2.0/package/scripts/params_linux.py
@@ -90,6 +90,7 @@ hostname = config['hostname']
 hadoop_libexec_dir = stack_select.get_hadoop_dir("libexec")
 hadoop_bin = stack_select.get_hadoop_dir("sbin")
 hadoop_bin_dir = stack_select.get_hadoop_dir("bin")
+hadoop_lib_home = stack_select.get_hadoop_dir("lib")
 hadoop_conf_dir = conf_select.get_hadoop_conf_dir()
 hadoop_yarn_home = '/usr/lib/hadoop-yarn'
 hadoop_mapred2_jar_location = "/usr/lib/hadoop-mapreduce"

http://git-wip-us.apache.org/repos/asf/ambari/blob/19848685/ambari-server/src/main/resources/stacks/HDP/2.0.6/hooks/before-ANY/scripts/params.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.0.6/hooks/before-ANY/scripts/params.py b/ambari-server/src/main/resources/stacks/HDP/2.0.6/hooks/before-ANY/scripts/params.py
index cab9102..4052d1d 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.0.6/hooks/before-ANY/scripts/params.py
+++ b/ambari-server/src/main/resources/stacks/HDP/2.0.6/hooks/before-ANY/scripts/params.py
@@ -106,6 +106,7 @@ mapreduce_libs_path = "/usr/lib/hadoop-mapreduce/*"
 hdfs_user_nofile_limit = default("/configurations/hadoop-env/hdfs_user_nofile_limit", "128000")
 hadoop_home = stack_select.get_hadoop_dir("home", force_latest_on_upgrade=True)
 hadoop_libexec_dir = stack_select.get_hadoop_dir("libexec", force_latest_on_upgrade=True)
+hadoop_lib_home = stack_select.get_hadoop_dir("lib")
 
 hadoop_conf_empty_dir = "/etc/hadoop/conf.empty"
 hadoop_secure_dn_user = hdfs_user

http://git-wip-us.apache.org/repos/asf/ambari/blob/19848685/ambari-server/src/main/resources/stacks/HDP/2.2/services/HDFS/configuration/hadoop-env.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.2/services/HDFS/configuration/hadoop-env.xml b/ambari-server/src/main/resources/stacks/HDP/2.2/services/HDFS/configuration/hadoop-env.xml
index bf7d750..6574bc5 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.2/services/HDFS/configuration/hadoop-env.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.2/services/HDFS/configuration/hadoop-env.xml
@@ -169,7 +169,7 @@ fi
 export HADOOP_LIBEXEC_DIR={{hadoop_libexec_dir}}
 
 # Mostly required for hadoop 2.0
-export JAVA_LIBRARY_PATH=${JAVA_LIBRARY_PATH}:/usr/lib/hadoop/lib/native/Linux-{{architecture}}-64:/usr/hdp/current/hadoop-client/lib/native/Linux-{{architecture}}-64
+export JAVA_LIBRARY_PATH=${JAVA_LIBRARY_PATH}:{{hadoop_lib_home}}/native/Linux-{{architecture}}-64
 
 export HADOOP_OPTS="-Dhdp.version=$HDP_VERSION $HADOOP_OPTS"
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/19848685/ambari-server/src/main/resources/stacks/HDP/2.3/services/HDFS/configuration/hadoop-env.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.3/services/HDFS/configuration/hadoop-env.xml b/ambari-server/src/main/resources/stacks/HDP/2.3/services/HDFS/configuration/hadoop-env.xml
index 99d38e2..1bfd2fe 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.3/services/HDFS/configuration/hadoop-env.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.3/services/HDFS/configuration/hadoop-env.xml
@@ -143,7 +143,7 @@ export HADOOP_CLASSPATH=${HADOOP_CLASSPATH}${JAVA_JDBC_LIBS}
 export HADOOP_LIBEXEC_DIR={{hadoop_libexec_dir}}
 
 # Mostly required for hadoop 2.0
-export JAVA_LIBRARY_PATH=${JAVA_LIBRARY_PATH}:/usr/lib/hadoop/lib/native/Linux-{{architecture}}-64:/usr/hdp/current/hadoop-client/lib/native/Linux-{{architecture}}-64
+export JAVA_LIBRARY_PATH=${JAVA_LIBRARY_PATH}:{{hadoop_lib_home}}/native/Linux-{{architecture}}-64
 
 export HADOOP_OPTS="-Dhdp.version=$HDP_VERSION $HADOOP_OPTS"
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/19848685/ambari-server/src/main/resources/stacks/HDP/2.4/services/HDFS/configuration/hadoop-env.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.4/services/HDFS/configuration/hadoop-env.xml b/ambari-server/src/main/resources/stacks/HDP/2.4/services/HDFS/configuration/hadoop-env.xml
index 99d38e2..1bfd2fe 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.4/services/HDFS/configuration/hadoop-env.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.4/services/HDFS/configuration/hadoop-env.xml
@@ -143,7 +143,7 @@ export HADOOP_CLASSPATH=${HADOOP_CLASSPATH}${JAVA_JDBC_LIBS}
 export HADOOP_LIBEXEC_DIR={{hadoop_libexec_dir}}
 
 # Mostly required for hadoop 2.0
-export JAVA_LIBRARY_PATH=${JAVA_LIBRARY_PATH}:/usr/lib/hadoop/lib/native/Linux-{{architecture}}-64:/usr/hdp/current/hadoop-client/lib/native/Linux-{{architecture}}-64
+export JAVA_LIBRARY_PATH=${JAVA_LIBRARY_PATH}:{{hadoop_lib_home}}/native/Linux-{{architecture}}-64
 
 export HADOOP_OPTS="-Dhdp.version=$HDP_VERSION $HADOOP_OPTS"
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/19848685/ambari-server/src/main/resources/stacks/HDP/2.6/services/HDFS/configuration/hadoop-env.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.6/services/HDFS/configuration/hadoop-env.xml b/ambari-server/src/main/resources/stacks/HDP/2.6/services/HDFS/configuration/hadoop-env.xml
index ee7478b..04b9304 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.6/services/HDFS/configuration/hadoop-env.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.6/services/HDFS/configuration/hadoop-env.xml
@@ -143,7 +143,7 @@
       export HADOOP_LIBEXEC_DIR={{hadoop_libexec_dir}}
 
       # Mostly required for hadoop 2.0
-      export JAVA_LIBRARY_PATH=${JAVA_LIBRARY_PATH}:/usr/lib/hadoop/lib/native/Linux-{{architecture}}-64:/usr/hdp/current/hadoop-client/lib/native/Linux-{{architecture}}-64
+      export JAVA_LIBRARY_PATH=${JAVA_LIBRARY_PATH}:{{hadoop_lib_home}}/native/Linux-{{architecture}}-64
 
       export HADOOP_OPTS="-Dhdp.version=$HDP_VERSION $HADOOP_OPTS"
 


[39/50] ambari git commit: AMBARI-20681 Select Version step of installer: repo URL validation message issues. (ababiichuk)

Posted by jo...@apache.org.
AMBARI-20681 Select Version step of installer: repo URL validation message issues. (ababiichuk)


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

Branch: refs/heads/branch-feature-AMBARI-12556
Commit: 6c0b38e00b49eb1f7ac879053ee161496c971a3f
Parents: 3b25533
Author: ababiichuk <ab...@hortonworks.com>
Authored: Wed Apr 5 15:05:29 2017 +0300
Committer: ababiichuk <ab...@hortonworks.com>
Committed: Wed Apr 5 15:05:29 2017 +0300

----------------------------------------------------------------------
 ambari-web/app/views/wizard/step1_view.js | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/6c0b38e0/ambari-web/app/views/wizard/step1_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/wizard/step1_view.js b/ambari-web/app/views/wizard/step1_view.js
index 0161985..584f621 100644
--- a/ambari-web/app/views/wizard/step1_view.js
+++ b/ambari-web/app/views/wizard/step1_view.js
@@ -213,9 +213,12 @@ App.WizardStep1View = Em.View.extend({
   popoverView: Em.View.extend({
     tagName: 'i',
     classNameBindings: ['repository.validationClassName'],
-    attributeBindings: ['repository.errorTitle:title', 'repository.errorContent:data-content'],
+    attributeBindings: ['repository.errorTitle:data-original-title', 'repository.errorContent:data-content'],
     didInsertElement: function () {
-      App.popover($(this.get('element')), {'trigger': 'hover'});
+      App.popover($(this.get('element')), {
+        template: '<div class="popover"><div class="arrow"></div><div class="popover-inner"><h3 class="popover-title"></h3><div class="popover-content"></div></div></div>',
+        trigger: 'hover'
+      });
     }
   }),
 


[12/50] ambari git commit: AMBARI-20579. Ambari-server failed to stop (aonishuk)

Posted by jo...@apache.org.
AMBARI-20579. Ambari-server failed to stop (aonishuk)


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

Branch: refs/heads/branch-feature-AMBARI-12556
Commit: d5249c6113cb005796bd4b1db7687e6f67cdc9cf
Parents: ad11804
Author: Andrew Onishuk <ao...@hortonworks.com>
Authored: Mon Apr 3 17:33:11 2017 +0300
Committer: Andrew Onishuk <ao...@hortonworks.com>
Committed: Mon Apr 3 17:33:11 2017 +0300

----------------------------------------------------------------------
 ambari-server/src/main/python/ambari-server.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/d5249c61/ambari-server/src/main/python/ambari-server.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/python/ambari-server.py b/ambari-server/src/main/python/ambari-server.py
index c985d65..87cc6c2 100755
--- a/ambari-server/src/main/python/ambari-server.py
+++ b/ambari-server/src/main/python/ambari-server.py
@@ -175,10 +175,10 @@ def stop(args):
     logger.info("Waiting for server stop...")
 
     if not wait_for_server_to_stop(SERVER_STOP_TIMEOUT):
-      err = "Ambari-server failed to stop"
+      err = "Ambari-server failed to stop gracefully. Sending SIGKILL to it"
       print err
       logger.error(err)
-      raise FatalException(1, err)
+      os.kill(pid, signal.SIGKILL)
 
     pid_file_path = os.path.join(configDefaults.PID_DIR, PID_NAME)
     os.remove(pid_file_path)


[09/50] ambari git commit: AMBARI-19149. Code cleanup: StringBuffer

Posted by jo...@apache.org.
AMBARI-19149. Code cleanup: StringBuffer


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

Branch: refs/heads/branch-feature-AMBARI-12556
Commit: f389293bfb3c9aa1594d3853bf127a1e521e2587
Parents: 09b0b46
Author: Attila Doroszlai <ad...@hortonworks.com>
Authored: Mon Apr 3 14:22:05 2017 +0200
Committer: Attila Doroszlai <ad...@hortonworks.com>
Committed: Mon Apr 3 15:28:21 2017 +0200

----------------------------------------------------------------------
 .../java/org/apache/ambari/server/events/HostsRemovedEvent.java    | 2 +-
 .../ambari/server/security/encryption/CredentialProvider.java      | 2 +-
 .../apache/ambari/server/state/stack/StackRoleCommandOrder.java    | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/f389293b/ambari-server/src/main/java/org/apache/ambari/server/events/HostsRemovedEvent.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/events/HostsRemovedEvent.java b/ambari-server/src/main/java/org/apache/ambari/server/events/HostsRemovedEvent.java
index 4145860..5d59b14 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/events/HostsRemovedEvent.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/events/HostsRemovedEvent.java
@@ -79,7 +79,7 @@ public class HostsRemovedEvent extends AmbariEvent {
    */
   @Override
   public String toString() {
-    final StringBuffer sb = new StringBuffer("HostsRemovedEvent{");
+    final StringBuilder sb = new StringBuilder("HostsRemovedEvent{");
     sb.append("m_clusters=").append(m_clusters);
     sb.append(", m_hosts=").append(m_hosts);
     sb.append('}');

http://git-wip-us.apache.org/repos/asf/ambari/blob/f389293b/ambari-server/src/main/java/org/apache/ambari/server/security/encryption/CredentialProvider.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/security/encryption/CredentialProvider.java b/ambari-server/src/main/java/org/apache/ambari/server/security/encryption/CredentialProvider.java
index 0521aa1..de74ad0 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/security/encryption/CredentialProvider.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/security/encryption/CredentialProvider.java
@@ -93,7 +93,7 @@ public class CredentialProvider {
   }
 
   private String generatePassword(int length) {
-    StringBuffer sb = new StringBuffer();
+    StringBuilder sb = new StringBuilder();
     Random r = new Random();
     for (int i = 0; i < length; i++) {
       sb.append(chars[r.nextInt(chars.length)]);

http://git-wip-us.apache.org/repos/asf/ambari/blob/f389293b/ambari-server/src/main/java/org/apache/ambari/server/state/stack/StackRoleCommandOrder.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/state/stack/StackRoleCommandOrder.java b/ambari-server/src/main/java/org/apache/ambari/server/state/stack/StackRoleCommandOrder.java
index 9f9ded6..5e245af 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/state/stack/StackRoleCommandOrder.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/state/stack/StackRoleCommandOrder.java
@@ -152,7 +152,7 @@ public class StackRoleCommandOrder {
 		for (String depKey : deps.keySet()) {
 		  Object depValue = deps.get(depKey);
 		  if (depValue instanceof Collection) {
-			StringBuffer buffer = new StringBuffer();
+			StringBuilder buffer = new StringBuilder();
 			for (Object o : ((Collection) depValue)) {
 				if (buffer.length() > 0) {
           buffer.append(",");


[22/50] ambari git commit: AMBARI-20658.Click of 'NEW JOB' button doesn't create new worksheet tab. (Venkata Sairam via padmapriyanitt)

Posted by jo...@apache.org.
AMBARI-20658.Click of 'NEW JOB' button doesn't create new worksheet tab. (Venkata Sairam via padmapriyanitt)


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

Branch: refs/heads/branch-feature-AMBARI-12556
Commit: 40a2065581b338cb4789521a91c45f6a21a677d1
Parents: 900070d
Author: padmapriyanitt <pa...@gmail.com>
Authored: Tue Apr 4 12:06:36 2017 +0530
Committer: padmapriyanitt <pa...@gmail.com>
Committed: Tue Apr 4 12:06:36 2017 +0530

----------------------------------------------------------------------
 .../hive20/src/main/resources/ui/app/routes/queries/new.js      | 5 ++++-
 .../ui/app/templates/components/top-application-bar.hbs         | 2 +-
 2 files changed, 5 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/40a20655/contrib/views/hive20/src/main/resources/ui/app/routes/queries/new.js
----------------------------------------------------------------------
diff --git a/contrib/views/hive20/src/main/resources/ui/app/routes/queries/new.js b/contrib/views/hive20/src/main/resources/ui/app/routes/queries/new.js
index b48b8df..76a7439 100644
--- a/contrib/views/hive20/src/main/resources/ui/app/routes/queries/new.js
+++ b/contrib/views/hive20/src/main/resources/ui/app/routes/queries/new.js
@@ -22,10 +22,13 @@ export default Ember.Route.extend({
   beforeModel() {
     let existingWorksheets = this.store.peekAll('worksheet');
     let newWorksheetName = 'worksheet';
-    if(!this.controllerFor("queries").worksheetCount) {
+    if(!this.controllerFor("queries").worksheetCount && !existingWorksheets.get("length")) {
       newWorksheetName = newWorksheetName + 1;
     } else {
       let id = parseInt(this.controllerFor("queries").worksheetCount);
+      if(!id){
+        id = existingWorksheets.get("length")+1;
+      }
       newWorksheetName = newWorksheetName + id;
     }
     let newWorksheetTitle = newWorksheetName.capitalize();

http://git-wip-us.apache.org/repos/asf/ambari/blob/40a20655/contrib/views/hive20/src/main/resources/ui/app/templates/components/top-application-bar.hbs
----------------------------------------------------------------------
diff --git a/contrib/views/hive20/src/main/resources/ui/app/templates/components/top-application-bar.hbs b/contrib/views/hive20/src/main/resources/ui/app/templates/components/top-application-bar.hbs
index f163dca..8cdb779 100644
--- a/contrib/views/hive20/src/main/resources/ui/app/templates/components/top-application-bar.hbs
+++ b/contrib/views/hive20/src/main/resources/ui/app/templates/components/top-application-bar.hbs
@@ -27,7 +27,7 @@
   {{#if (not (or service askPassword))}}
     <span class="pull-right">
       {{#link-to 'queries.new' class="btn btn-sm btn-success"}}{{fa-icon "plus"}} NEW JOB{{/link-to}}
-        {{#link-to 'databases.newtable' class="btn btn-sm btn-success"}}{{fa-icon "plus"}} NEW TABLE{{/link-to}}
+      {{#link-to 'databases.newtable' class="btn btn-sm btn-success"}}{{fa-icon "plus"}} NEW TABLE{{/link-to}}
     </span>
   {{/if}}
 </h3>


[08/50] ambari git commit: AMBARI-20571. Remove property atlas.cluster.name from hive-site during HDP stack upgrades (aonishuk)

Posted by jo...@apache.org.
AMBARI-20571. Remove property atlas.cluster.name from hive-site during HDP stack upgrades (aonishuk)


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

Branch: refs/heads/branch-feature-AMBARI-12556
Commit: 09b0b46cc66169b9741c9833cdb42196690b5fd3
Parents: 6892e43
Author: Andrew Onishuk <ao...@hortonworks.com>
Authored: Mon Apr 3 16:18:23 2017 +0300
Committer: Andrew Onishuk <ao...@hortonworks.com>
Committed: Mon Apr 3 16:18:23 2017 +0300

----------------------------------------------------------------------
 .../main/resources/stacks/HDP/2.3/upgrades/config-upgrade.xml  | 6 ++++++
 .../stacks/HDP/2.3/upgrades/nonrolling-upgrade-2.5.xml         | 6 ++++++
 .../stacks/HDP/2.3/upgrades/nonrolling-upgrade-2.6.xml         | 6 ++++++
 .../src/main/resources/stacks/HDP/2.3/upgrades/upgrade-2.5.xml | 1 +
 .../src/main/resources/stacks/HDP/2.3/upgrades/upgrade-2.6.xml | 1 +
 .../main/resources/stacks/HDP/2.4/upgrades/config-upgrade.xml  | 5 +++++
 .../stacks/HDP/2.4/upgrades/nonrolling-upgrade-2.5.xml         | 6 ++++++
 .../stacks/HDP/2.4/upgrades/nonrolling-upgrade-2.6.xml         | 6 ++++++
 .../src/main/resources/stacks/HDP/2.4/upgrades/upgrade-2.5.xml | 1 +
 .../src/main/resources/stacks/HDP/2.4/upgrades/upgrade-2.6.xml | 1 +
 .../main/resources/stacks/HDP/2.5/upgrades/config-upgrade.xml  | 6 ++++++
 .../stacks/HDP/2.5/upgrades/nonrolling-upgrade-2.5.xml         | 6 ++++++
 .../stacks/HDP/2.5/upgrades/nonrolling-upgrade-2.6.xml         | 6 ++++++
 .../src/main/resources/stacks/HDP/2.5/upgrades/upgrade-2.5.xml | 6 ++++++
 .../src/main/resources/stacks/HDP/2.5/upgrades/upgrade-2.6.xml | 1 +
 15 files changed, 64 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/09b0b46c/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/config-upgrade.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/config-upgrade.xml b/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/config-upgrade.xml
index b1bbb32..63cf5f5 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/config-upgrade.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/config-upgrade.xml
@@ -204,6 +204,12 @@
             <type>hive-site</type>
             <set key="hive.enforce.bucketing" value="true"/>
           </definition>
+
+          <definition xsi:type="configure" id="hdp_2_5_0_0_remove_atlas_cluster_name">
+            <type>hive-site</type>
+            <transfer operation="delete" delete-key="atlas.cluster.name"/>
+          </definition>
+
         </changes>
       </component>
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/09b0b46c/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/nonrolling-upgrade-2.5.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/nonrolling-upgrade-2.5.xml b/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/nonrolling-upgrade-2.5.xml
index adccac0..73a4f5e 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/nonrolling-upgrade-2.5.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/nonrolling-upgrade-2.5.xml
@@ -393,6 +393,12 @@
         </task>
       </execute-stage>
 
+      <execute-stage service="HIVE" component="HIVE_SERVER" title="Updating Hive properties">
+        <task xsi:type="configure" id="hdp_2_5_0_0_remove_atlas_cluster_name">
+          <summary>Removing atlas.cluster.name property</summary>
+        </task>
+      </execute-stage>
+
       <!--OOZIE-->
       <execute-stage service="OOZIE" component="OOZIE_SERVER" title="Apply config changes for Oozie Server">
         <task xsi:type="server_action" class="org.apache.ambari.server.serveraction.upgrades.OozieConfigCalculation">

http://git-wip-us.apache.org/repos/asf/ambari/blob/09b0b46c/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/nonrolling-upgrade-2.6.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/nonrolling-upgrade-2.6.xml b/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/nonrolling-upgrade-2.6.xml
index b5dce2d..3a7df7d 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/nonrolling-upgrade-2.6.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/nonrolling-upgrade-2.6.xml
@@ -472,6 +472,12 @@
         </task>
       </execute-stage>
 
+      <execute-stage service="HIVE" component="HIVE_SERVER" title="Updating Hive properties">
+        <task xsi:type="configure" id="hdp_2_5_0_0_remove_atlas_cluster_name">
+          <summary>Removing atlas.cluster.name property</summary>
+        </task>
+      </execute-stage>
+
       <!--OOZIE-->
       <execute-stage service="OOZIE" component="OOZIE_SERVER" title="Apply config changes for Oozie Server">
         <task xsi:type="server_action" class="org.apache.ambari.server.serveraction.upgrades.OozieConfigCalculation">

http://git-wip-us.apache.org/repos/asf/ambari/blob/09b0b46c/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/upgrade-2.5.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/upgrade-2.5.xml b/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/upgrade-2.5.xml
index 9396f80..ca612b8 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/upgrade-2.5.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/upgrade-2.5.xml
@@ -860,6 +860,7 @@
           <task xsi:type="configure" id="hdp_2_4_0_0_hive_server_configure_authentication"/>
           <task xsi:type="configure" id="hdp_2_5_0_0_remove_ranger_hive_audit_db" />
           <task xsi:type="configure" id="hive_log4j_parameterize" />
+          <task xsi:type="configure" id="hdp_2_5_0_0_remove_atlas_cluster_name" />
 
           <!-- Remove Atlas configs that were incorrectly added to hive-site instead of Atlas' application.properties. -->
           <task xsi:type="configure" id="hdp_2_5_0_0_remove_hive_atlas_configs" />

http://git-wip-us.apache.org/repos/asf/ambari/blob/09b0b46c/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/upgrade-2.6.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/upgrade-2.6.xml b/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/upgrade-2.6.xml
index 7917343..1fbf81e 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/upgrade-2.6.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/upgrade-2.6.xml
@@ -891,6 +891,7 @@
         <pre-upgrade>
           <task xsi:type="configure" id="hdp_2_4_0_0_hive_server_configure_authentication"/>
           <task xsi:type="configure" id="hdp_2_5_0_0_remove_ranger_hive_audit_db" />
+          <task xsi:type="configure" id="hdp_2_5_0_0_remove_atlas_cluster_name" />
 
           <!-- Remove Atlas configs that were incorrectly added to hive-site instead of Atlas' application.properties. -->
           <task xsi:type="configure" id="hdp_2_5_0_0_remove_hive_atlas_configs" />

http://git-wip-us.apache.org/repos/asf/ambari/blob/09b0b46c/ambari-server/src/main/resources/stacks/HDP/2.4/upgrades/config-upgrade.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.4/upgrades/config-upgrade.xml b/ambari-server/src/main/resources/stacks/HDP/2.4/upgrades/config-upgrade.xml
index 48a2d96..2345d08 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.4/upgrades/config-upgrade.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.4/upgrades/config-upgrade.xml
@@ -106,6 +106,11 @@
             <type>hive-site</type>
             <set key="hive.enforce.bucketing" value="true"/>
           </definition>
+
+          <definition xsi:type="configure" id="hdp_2_5_0_0_remove_atlas_cluster_name">
+            <type>hive-site</type>
+            <transfer operation="delete" delete-key="atlas.cluster.name"/>
+          </definition>
          </changes>
       </component>
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/09b0b46c/ambari-server/src/main/resources/stacks/HDP/2.4/upgrades/nonrolling-upgrade-2.5.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.4/upgrades/nonrolling-upgrade-2.5.xml b/ambari-server/src/main/resources/stacks/HDP/2.4/upgrades/nonrolling-upgrade-2.5.xml
index cd63651..bb6506e 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.4/upgrades/nonrolling-upgrade-2.5.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.4/upgrades/nonrolling-upgrade-2.5.xml
@@ -419,6 +419,12 @@
         </task>
       </execute-stage>
 
+      <execute-stage service="HIVE" component="HIVE_SERVER" title="Updating Hive properties">
+        <task xsi:type="configure" id="hdp_2_5_0_0_remove_atlas_cluster_name">
+          <summary>Removing atlas.cluster.name property</summary>
+        </task>
+      </execute-stage>
+
      <!-- HBASE -->
       <execute-stage service="HBASE" component="HBASE_MASTER" title="Apply config changes for Hbase Master">
         <task xsi:type="configure" id="hdp_2_5_0_0_remove_ranger_hbase_audit_db"/>

http://git-wip-us.apache.org/repos/asf/ambari/blob/09b0b46c/ambari-server/src/main/resources/stacks/HDP/2.4/upgrades/nonrolling-upgrade-2.6.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.4/upgrades/nonrolling-upgrade-2.6.xml b/ambari-server/src/main/resources/stacks/HDP/2.4/upgrades/nonrolling-upgrade-2.6.xml
index df05749..c6c3a0d 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.4/upgrades/nonrolling-upgrade-2.6.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.4/upgrades/nonrolling-upgrade-2.6.xml
@@ -513,6 +513,12 @@
         </task>
       </execute-stage>
 
+      <execute-stage service="HIVE" component="HIVE_SERVER" title="Updating Hive properties">
+        <task xsi:type="configure" id="hdp_2_5_0_0_remove_atlas_cluster_name">
+          <summary>Removing atlas.cluster.name property</summary>
+        </task>
+      </execute-stage>
+
       <!-- HBASE -->
       <execute-stage service="HBASE" component="HBASE_MASTER" title="Apply config changes for Hbase Master">
         <task xsi:type="configure" id="hdp_2_5_0_0_remove_ranger_hbase_audit_db"/>

http://git-wip-us.apache.org/repos/asf/ambari/blob/09b0b46c/ambari-server/src/main/resources/stacks/HDP/2.4/upgrades/upgrade-2.5.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.4/upgrades/upgrade-2.5.xml b/ambari-server/src/main/resources/stacks/HDP/2.4/upgrades/upgrade-2.5.xml
index a642320..4654ac8 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.4/upgrades/upgrade-2.5.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.4/upgrades/upgrade-2.5.xml
@@ -861,6 +861,7 @@
             <summary>Update hive-env content</summary>
           </task>
           <task xsi:type="configure" id="hive_log4j_parameterize" />
+          <task xsi:type="configure" id="hdp_2_5_0_0_remove_atlas_cluster_name" />
         </pre-upgrade>
 
         <pre-downgrade/>

http://git-wip-us.apache.org/repos/asf/ambari/blob/09b0b46c/ambari-server/src/main/resources/stacks/HDP/2.4/upgrades/upgrade-2.6.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.4/upgrades/upgrade-2.6.xml b/ambari-server/src/main/resources/stacks/HDP/2.4/upgrades/upgrade-2.6.xml
index ee8e10e..ec7d8b8 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.4/upgrades/upgrade-2.6.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.4/upgrades/upgrade-2.6.xml
@@ -899,6 +899,7 @@
           <task xsi:type="configure" id="hive_log4j_parameterize" />
 
           <task xsi:type="configure" id="hdp_2_6_0_0_hive_set_hive_enforce_bucketing_property" />
+          <task xsi:type="configure" id="hdp_2_5_0_0_remove_atlas_cluster_name" />
 
         </pre-upgrade>
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/09b0b46c/ambari-server/src/main/resources/stacks/HDP/2.5/upgrades/config-upgrade.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.5/upgrades/config-upgrade.xml b/ambari-server/src/main/resources/stacks/HDP/2.5/upgrades/config-upgrade.xml
index 090e66f..b70b9df 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.5/upgrades/config-upgrade.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.5/upgrades/config-upgrade.xml
@@ -432,6 +432,7 @@
             <regex-replace key="content" find="property.llap.daemon.log.maxbackupindex = ([0-9]+)" replace-with="property.llap.daemon.log.maxbackupindex = {{hive_llap_log_maxbackupindex}}"/>
           </definition>
 
+
           <definition xsi:type="configure" id="hdp_2_6_0_0_hive_set_hive_enforce_bucketing_property">
             <type>hive-site</type>
             <set key="hive.enforce.bucketing" value="true"/>
@@ -481,6 +482,11 @@
             <transfer operation="copy" from-type="hive-site" from-key="hive.tez.container.size" to-key="hive.tez.container.size" default-value="682"  if-type="hive-interactive-site" if-key="hive.tez.container.size" if-key-state="absent"/>
           </definition>
 
+          <definition xsi:type="configure" id="hdp_2_5_0_0_remove_atlas_cluster_name">
+            <type>hive-site</type>
+            <transfer operation="delete" delete-key="atlas.cluster.name"/>
+          </definition>
+
         </changes>
 
       </component>

http://git-wip-us.apache.org/repos/asf/ambari/blob/09b0b46c/ambari-server/src/main/resources/stacks/HDP/2.5/upgrades/nonrolling-upgrade-2.5.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.5/upgrades/nonrolling-upgrade-2.5.xml b/ambari-server/src/main/resources/stacks/HDP/2.5/upgrades/nonrolling-upgrade-2.5.xml
index 6f7fbd0..95ca3a2 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.5/upgrades/nonrolling-upgrade-2.5.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.5/upgrades/nonrolling-upgrade-2.5.xml
@@ -292,6 +292,12 @@
         </task>
       </execute-stage>
 
+      <execute-stage service="HIVE" component="HIVE_SERVER" title="Updating Hive properties">
+        <task xsi:type="configure" id="hdp_2_5_0_0_remove_atlas_cluster_name">
+          <summary>Removing atlas.cluster.name property</summary>
+        </task>
+      </execute-stage>
+
       <!-- STORM -->
       <execute-stage service="STORM" component="NIMBUS" title="Apply config changes for Storm">
         <task xsi:type="configure" id="hdp_2_5_0_0_remove_empty_storm_topology_submission_notifier_plugin_class"/>

http://git-wip-us.apache.org/repos/asf/ambari/blob/09b0b46c/ambari-server/src/main/resources/stacks/HDP/2.5/upgrades/nonrolling-upgrade-2.6.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.5/upgrades/nonrolling-upgrade-2.6.xml b/ambari-server/src/main/resources/stacks/HDP/2.5/upgrades/nonrolling-upgrade-2.6.xml
index c5024b6..05ecb2c 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.5/upgrades/nonrolling-upgrade-2.6.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.5/upgrades/nonrolling-upgrade-2.6.xml
@@ -569,6 +569,12 @@
           <summary>Updating the Hive Log4J2 properties to include parameterizations</summary>
         </task>
       </execute-stage>
+
+      <execute-stage service="HIVE" component="HIVE_SERVER" title="Updating Hive properties">
+        <task xsi:type="configure" id="hdp_2_5_0_0_remove_atlas_cluster_name">
+          <summary>Removing atlas.cluster.name property</summary>
+        </task>
+      </execute-stage>
       
       <!-- SPARK -->
       <execute-stage service="SPARK" component="LIVY_SERVER" title="Apply config changes for Livy Server">

http://git-wip-us.apache.org/repos/asf/ambari/blob/09b0b46c/ambari-server/src/main/resources/stacks/HDP/2.5/upgrades/upgrade-2.5.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.5/upgrades/upgrade-2.5.xml b/ambari-server/src/main/resources/stacks/HDP/2.5/upgrades/upgrade-2.5.xml
index ab8e8b5..37f92fd 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.5/upgrades/upgrade-2.5.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.5/upgrades/upgrade-2.5.xml
@@ -729,6 +729,12 @@
       </component>
 
       <component name="HIVE_SERVER">
+        <pre-upgrade>
+          <task xsi:type="configure" id="hdp_2_5_0_0_remove_atlas_cluster_name" />
+        </pre-upgrade>
+
+        <pre-downgrade />
+
         <upgrade>
           <task xsi:type="restart-task" />
         </upgrade>

http://git-wip-us.apache.org/repos/asf/ambari/blob/09b0b46c/ambari-server/src/main/resources/stacks/HDP/2.5/upgrades/upgrade-2.6.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.5/upgrades/upgrade-2.6.xml b/ambari-server/src/main/resources/stacks/HDP/2.5/upgrades/upgrade-2.6.xml
index e2482e5..0dab6f4 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.5/upgrades/upgrade-2.6.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.5/upgrades/upgrade-2.6.xml
@@ -813,6 +813,7 @@
           <task xsi:type="configure" id="hive_llap_log4j_parameterize" />
           <task xsi:type="configure" id="hdp_2_6_0_0_hive_set_hive_enforce_bucketing_property" />
           <task xsi:type="configure" id="hdp_2_6_0_0_copy_hive_tez_container_size_to_hiveInteractive" />
+          <task xsi:type="configure" id="hdp_2_5_0_0_remove_atlas_cluster_name" />
         </pre-upgrade>
         
         <pre-downgrade />


[42/50] ambari git commit: AMBARI-20676.User should be able to visualize inherited properties while submitting the workflow .(M Madhan Mohan Reddy via padmapriyanitt)

Posted by jo...@apache.org.
AMBARI-20676.User should be able to visualize inherited properties while submitting the workflow
.(M Madhan Mohan Reddy via padmapriyanitt)


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

Branch: refs/heads/branch-feature-AMBARI-12556
Commit: 2ee12f4c4af62d5ce004e869f5a248e982a4245f
Parents: e61d111
Author: padmapriyanitt <pa...@gmail.com>
Authored: Thu Apr 6 12:12:24 2017 +0530
Committer: padmapriyanitt <pa...@gmail.com>
Committed: Thu Apr 6 12:12:24 2017 +0530

----------------------------------------------------------------------
 .../resources/ui/app/components/job-config.js   | 23 +++++++++-------
 .../src/main/resources/ui/app/routes/index.js   |  5 +++-
 .../ui/app/services/workflow-manager-configs.js | 27 +++++++++++++++++++
 .../services/workflow-manager-configs-test.js   | 28 ++++++++++++++++++++
 4 files changed, 72 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/2ee12f4c/contrib/views/wfmanager/src/main/resources/ui/app/components/job-config.js
----------------------------------------------------------------------
diff --git a/contrib/views/wfmanager/src/main/resources/ui/app/components/job-config.js b/contrib/views/wfmanager/src/main/resources/ui/app/components/job-config.js
index 6aed9da..326cf38 100644
--- a/contrib/views/wfmanager/src/main/resources/ui/app/components/job-config.js
+++ b/contrib/views/wfmanager/src/main/resources/ui/app/components/job-config.js
@@ -35,6 +35,7 @@ const Validations = buildValidations({
 
 
 export default Ember.Component.extend(Validations, {
+  workflowManagerConfigs : Ember.inject.service('workflow-manager-configs'),
   systemConfigs : Ember.A([]),
   showingFileBrowser : false,
   overwritePath : false,
@@ -118,10 +119,10 @@ export default Ember.Component.extend(Validations, {
     var jobProperties = [];
     var jobParams = this.get("jobConfigs").params, self = this;
     this.get("jobProps").forEach(function(value) {
-      if (value!== Constants.defaultNameNodeValue && value!==Constants.rmDefaultValue){
-        var propName = value.trim().substring(2, value.length-1);
-        var isRequired = true;
-        var val = null;
+      var propName = value.trim().substring(2, value.length-1);
+      var isRequired = true;
+      var val = null;
+      if (value!== Constants.defaultNameNodeValue && value!==Constants.rmDefaultValue) {
         if(jobParams && jobParams.configuration && jobParams.configuration.property){
           var param = jobParams.configuration.property.findBy('name', propName);
           if(param && param.value){
@@ -138,13 +139,15 @@ export default Ember.Component.extend(Validations, {
             val = propVal.value
           }
         }
-        var prop= Ember.Object.create({
-          name: propName,
-          value: val,
-          isRequired : isRequired
-        });
-        jobProperties.push(prop);
+      } else {
+        val = self.get("workflowManagerConfigs").getWfmConfigs()[propName];
       }
+      var prop= Ember.Object.create({
+        name: propName,
+        value: val,
+        isRequired : isRequired
+      });
+      jobProperties.push(prop);
     });
     return jobProperties;
   },

http://git-wip-us.apache.org/repos/asf/ambari/blob/2ee12f4c/contrib/views/wfmanager/src/main/resources/ui/app/routes/index.js
----------------------------------------------------------------------
diff --git a/contrib/views/wfmanager/src/main/resources/ui/app/routes/index.js b/contrib/views/wfmanager/src/main/resources/ui/app/routes/index.js
index 6d94dfe..8e7f5d4 100644
--- a/contrib/views/wfmanager/src/main/resources/ui/app/routes/index.js
+++ b/contrib/views/wfmanager/src/main/resources/ui/app/routes/index.js
@@ -18,10 +18,13 @@
 import Ember from 'ember';
 
 export default Ember.Route.extend({
+    workflowManagerConfigs : Ember.inject.service('workflow-manager-configs'),
     afterModel(){
       let workflowManagerConfigsPromise = this.getWorkflowManagerConfigs();
       workflowManagerConfigsPromise.then(function(data){
-        this.invokeServiceChecksPromises(JSON.parse(data));
+        var jsonData = JSON.parse(data);
+        this.get('workflowManagerConfigs').setWfmConfigs(jsonData);
+        this.invokeServiceChecksPromises(jsonData);
       }.bind(this)).catch(function(errors){
         this.controllerFor('index').set('errors', errors);
       }.bind(this));

http://git-wip-us.apache.org/repos/asf/ambari/blob/2ee12f4c/contrib/views/wfmanager/src/main/resources/ui/app/services/workflow-manager-configs.js
----------------------------------------------------------------------
diff --git a/contrib/views/wfmanager/src/main/resources/ui/app/services/workflow-manager-configs.js b/contrib/views/wfmanager/src/main/resources/ui/app/services/workflow-manager-configs.js
new file mode 100644
index 0000000..fdd7d99
--- /dev/null
+++ b/contrib/views/wfmanager/src/main/resources/ui/app/services/workflow-manager-configs.js
@@ -0,0 +1,27 @@
+/*
+*    Licensed to the Apache Software Foundation (ASF) under one or more
+*    contributor license agreements.  See the NOTICE file distributed with
+*    this work for additional information regarding copyright ownership.
+*    The ASF licenses this file to You under the Apache License, Version 2.0
+*    (the "License"); you may not use this file except in compliance with
+*    the License.  You may obtain a copy of the License at
+*
+*        http://www.apache.org/licenses/LICENSE-2.0
+*
+*    Unless required by applicable law or agreed to in writing, software
+*    distributed under the License is distributed on an "AS IS" BASIS,
+*    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+*    See the License for the specific language governing permissions and
+*    limitations under the License.
+*/
+import Ember from 'ember';
+
+export default Ember.Service.extend({
+  wfmConfigs: null,
+	setWfmConfigs(wfmConfigs){
+    this.set("wfmConfigs", wfmConfigs);
+	},
+	getWfmConfigs(){
+    return this.get("wfmConfigs");
+	}
+});

http://git-wip-us.apache.org/repos/asf/ambari/blob/2ee12f4c/contrib/views/wfmanager/src/main/resources/ui/tests/unit/services/workflow-manager-configs-test.js
----------------------------------------------------------------------
diff --git a/contrib/views/wfmanager/src/main/resources/ui/tests/unit/services/workflow-manager-configs-test.js b/contrib/views/wfmanager/src/main/resources/ui/tests/unit/services/workflow-manager-configs-test.js
new file mode 100644
index 0000000..a25fdc8
--- /dev/null
+++ b/contrib/views/wfmanager/src/main/resources/ui/tests/unit/services/workflow-manager-configs-test.js
@@ -0,0 +1,28 @@
+/*
+ *    Licensed to the Apache Software Foundation (ASF) under one or more
+ *    contributor license agreements.  See the NOTICE file distributed with
+ *    this work for additional information regarding copyright ownership.
+ *    The ASF licenses this file to You under the Apache License, Version 2.0
+ *    (the "License"); you may not use this file except in compliance with
+ *    the License.  You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *    Unless required by applicable law or agreed to in writing, software
+ *    distributed under the License is distributed on an "AS IS" BASIS,
+ *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *    See the License for the specific language governing permissions and
+ *    limitations under the License.
+ */
+import { moduleFor, test } from 'ember-qunit';
+
+moduleFor('service:workflow-manager-configs', 'Unit | Service | workflow manager configs', {
+  // Specify the other units that are required for this test.
+  // needs: ['service:foo']
+});
+
+// Replace this with your real tests.
+test('it exists', function(assert) {
+  let service = this.subject();
+  assert.ok(service);
+});


[03/50] ambari git commit: AMBARI-20636 Allow users to add custom configs for Ranger service in all plugins (mugdha)

Posted by jo...@apache.org.
AMBARI-20636 Allow users to add custom configs for Ranger service in all plugins (mugdha)


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

Branch: refs/heads/branch-feature-AMBARI-12556
Commit: 3bab2125fc9570398ed1514aa11d9b1d910ecde1
Parents: b88512e
Author: Mugdha Varadkar <mu...@apache.org>
Authored: Fri Mar 31 14:45:55 2017 +0530
Committer: Mugdha Varadkar <mu...@apache.org>
Committed: Mon Apr 3 11:40:04 2017 +0530

----------------------------------------------------------------------
 .../libraries/functions/setup_ranger_plugin_xml.py  | 16 ++++++++++++++--
 .../ATLAS/0.1.0.2.3/package/scripts/params.py       |  5 +++++
 .../0.96.0.2.0/package/scripts/params_linux.py      |  6 +++++-
 .../HDFS/2.1.0.2.0/package/scripts/params_linux.py  |  6 +++++-
 .../HDFS/3.0.0.3.0/package/scripts/params_linux.py  |  6 +++++-
 .../HIVE/0.12.0.2.0/package/scripts/params_linux.py |  6 +++++-
 .../HIVE/2.1.0.3.0/package/scripts/params_linux.py  |  6 +++++-
 .../KAFKA/0.8.1/package/scripts/params.py           |  6 +++++-
 .../KNOX/0.5.0.2.2/package/scripts/params_linux.py  |  8 ++++++--
 .../RANGER_KMS/0.5.0.2.3/package/scripts/params.py  |  5 +++++
 .../STORM/0.9.1/package/scripts/params_linux.py     |  6 +++++-
 .../YARN/2.1.0.2.0/package/scripts/params_linux.py  |  6 +++++-
 .../YARN/3.0.0.3.0/package/scripts/params_linux.py  |  6 +++++-
 13 files changed, 75 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/3bab2125/ambari-common/src/main/python/resource_management/libraries/functions/setup_ranger_plugin_xml.py
----------------------------------------------------------------------
diff --git a/ambari-common/src/main/python/resource_management/libraries/functions/setup_ranger_plugin_xml.py b/ambari-common/src/main/python/resource_management/libraries/functions/setup_ranger_plugin_xml.py
index 04a5bb1..c510dac 100644
--- a/ambari-common/src/main/python/resource_management/libraries/functions/setup_ranger_plugin_xml.py
+++ b/ambari-common/src/main/python/resource_management/libraries/functions/setup_ranger_plugin_xml.py
@@ -17,7 +17,7 @@ See the License for the specific language governing permissions and
 limitations under the License.
 
 """
-__all__ = ["setup_ranger_plugin", "get_audit_configs"]
+__all__ = ["setup_ranger_plugin", "get_audit_configs", "generate_ranger_service_config"]
 
 import os
 import ambari_simplejson as json
@@ -279,4 +279,16 @@ def get_audit_configs(config):
     audit_jdbc_url = format('jdbc:sqlanywhere:database={xa_audit_db_name};host={xa_db_host}')
     jdbc_driver = "sap.jdbc4.sqlanywhere.IDriver"
 
-  return jdbc_jar_name, previous_jdbc_jar_name, audit_jdbc_url, jdbc_driver
\ No newline at end of file
+  return jdbc_jar_name, previous_jdbc_jar_name, audit_jdbc_url, jdbc_driver
+
+def generate_ranger_service_config(ranger_plugin_properties):
+  custom_service_config_dict = {}
+  ranger_plugin_properties_copy = {}
+  ranger_plugin_properties_copy.update(ranger_plugin_properties)
+
+  for key, value in ranger_plugin_properties_copy.iteritems():
+    if key.startswith("ranger.service.config.param."):
+      modify_key_name = key.replace("ranger.service.config.param.","")
+      custom_service_config_dict[modify_key_name] = value
+
+  return custom_service_config_dict

http://git-wip-us.apache.org/repos/asf/ambari/blob/3bab2125/ambari-server/src/main/resources/common-services/ATLAS/0.1.0.2.3/package/scripts/params.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/ATLAS/0.1.0.2.3/package/scripts/params.py b/ambari-server/src/main/resources/common-services/ATLAS/0.1.0.2.3/package/scripts/params.py
index 21d172b..bf4848b 100644
--- a/ambari-server/src/main/resources/common-services/ATLAS/0.1.0.2.3/package/scripts/params.py
+++ b/ambari-server/src/main/resources/common-services/ATLAS/0.1.0.2.3/package/scripts/params.py
@@ -33,6 +33,7 @@ from resource_management.libraries.functions.stack_features import check_stack_f
 from resource_management.libraries.functions import StackFeature
 from resource_management.libraries.functions.is_empty import is_empty
 from resource_management.libraries.functions.expect import expect
+from resource_management.libraries.functions.setup_ranger_plugin_xml import generate_ranger_service_config
 
 
 def configs_for_ha(atlas_hosts, metadata_port, is_atlas_ha_enabled, metadata_protocol):
@@ -395,6 +396,10 @@ if stack_supports_atlas_ranger_plugin and enable_ranger_atlas:
     'ambari.service.check.user' : policy_user
   }
 
+  custom_ranger_service_config = generate_ranger_service_config(ranger_plugin_properties)
+  if len(custom_ranger_service_config) > 0:
+    atlas_repository_configuration.update(custom_ranger_service_config)
+
   if security_enabled:
     atlas_repository_configuration['policy.download.auth.users'] = metadata_user
     atlas_repository_configuration['tag.download.auth.users'] = metadata_user

http://git-wip-us.apache.org/repos/asf/ambari/blob/3bab2125/ambari-server/src/main/resources/common-services/HBASE/0.96.0.2.0/package/scripts/params_linux.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/HBASE/0.96.0.2.0/package/scripts/params_linux.py b/ambari-server/src/main/resources/common-services/HBASE/0.96.0.2.0/package/scripts/params_linux.py
index 268d81c..e78bfc2 100644
--- a/ambari-server/src/main/resources/common-services/HBASE/0.96.0.2.0/package/scripts/params_linux.py
+++ b/ambari-server/src/main/resources/common-services/HBASE/0.96.0.2.0/package/scripts/params_linux.py
@@ -41,7 +41,7 @@ from resource_management.libraries.functions.get_not_managed_resources import ge
 from resource_management.libraries.script.script import Script
 from resource_management.libraries.functions.expect import expect
 from ambari_commons.ambari_metrics_helper import select_metric_collector_hosts_from_hostnames
-from resource_management.libraries.functions.setup_ranger_plugin_xml import get_audit_configs
+from resource_management.libraries.functions.setup_ranger_plugin_xml import get_audit_configs, generate_ranger_service_config
 
 # server configurations
 config = Script.get_config()
@@ -366,6 +366,10 @@ if enable_ranger_hbase:
     'assetType': '2'
   }
 
+  custom_ranger_service_config = generate_ranger_service_config(ranger_plugin_properties)
+  if len(custom_ranger_service_config) > 0:
+    hbase_ranger_plugin_config.update(custom_ranger_service_config)
+
   if stack_supports_ranger_kerberos and security_enabled:
     hbase_ranger_plugin_config['policy.download.auth.users'] = hbase_user
     hbase_ranger_plugin_config['tag.download.auth.users'] = hbase_user

http://git-wip-us.apache.org/repos/asf/ambari/blob/3bab2125/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/scripts/params_linux.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/scripts/params_linux.py b/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/scripts/params_linux.py
index 41f44c3..b8785f3 100644
--- a/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/scripts/params_linux.py
+++ b/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/scripts/params_linux.py
@@ -44,7 +44,7 @@ from resource_management.libraries.functions.get_lzo_packages import get_lzo_pac
 from resource_management.libraries.functions.hdfs_utils import is_https_enabled_in_hdfs
 from resource_management.libraries.functions import is_empty
 from resource_management.libraries.functions.get_architecture import get_architecture
-from resource_management.libraries.functions.setup_ranger_plugin_xml import get_audit_configs
+from resource_management.libraries.functions.setup_ranger_plugin_xml import get_audit_configs, generate_ranger_service_config
 
 config = Script.get_config()
 tmp_dir = Script.get_tmp_dir()
@@ -515,6 +515,10 @@ if enable_ranger_hdfs:
     'assetType': '1'
   }
 
+  custom_ranger_service_config = generate_ranger_service_config(ranger_plugin_properties)
+  if len(custom_ranger_service_config) > 0:
+    hdfs_ranger_plugin_config.update(custom_ranger_service_config)
+
   if stack_supports_ranger_kerberos and security_enabled:
     hdfs_ranger_plugin_config['policy.download.auth.users'] = hdfs_user
     hdfs_ranger_plugin_config['tag.download.auth.users'] = hdfs_user

http://git-wip-us.apache.org/repos/asf/ambari/blob/3bab2125/ambari-server/src/main/resources/common-services/HDFS/3.0.0.3.0/package/scripts/params_linux.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/HDFS/3.0.0.3.0/package/scripts/params_linux.py b/ambari-server/src/main/resources/common-services/HDFS/3.0.0.3.0/package/scripts/params_linux.py
index 62a5edd..4fa6f0c 100644
--- a/ambari-server/src/main/resources/common-services/HDFS/3.0.0.3.0/package/scripts/params_linux.py
+++ b/ambari-server/src/main/resources/common-services/HDFS/3.0.0.3.0/package/scripts/params_linux.py
@@ -43,7 +43,7 @@ from resource_management.libraries.functions.format_jvm_option import format_jvm
 from resource_management.libraries.functions.get_lzo_packages import get_lzo_packages
 from resource_management.libraries.functions.hdfs_utils import is_https_enabled_in_hdfs
 from resource_management.libraries.functions import is_empty
-from resource_management.libraries.functions.setup_ranger_plugin_xml import get_audit_configs
+from resource_management.libraries.functions.setup_ranger_plugin_xml import get_audit_configs, generate_ranger_service_config
 
 config = Script.get_config()
 tmp_dir = Script.get_tmp_dir()
@@ -511,6 +511,10 @@ if enable_ranger_hdfs:
     'assetType': '1'
   }
 
+  custom_ranger_service_config = generate_ranger_service_config(ranger_plugin_properties)
+  if len(custom_ranger_service_config) > 0:
+    hdfs_ranger_plugin_config.update(custom_ranger_service_config)
+
   if stack_supports_ranger_kerberos and security_enabled:
     hdfs_ranger_plugin_config['policy.download.auth.users'] = hdfs_user
     hdfs_ranger_plugin_config['tag.download.auth.users'] = hdfs_user

http://git-wip-us.apache.org/repos/asf/ambari/blob/3bab2125/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/params_linux.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/params_linux.py b/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/params_linux.py
index 880ddc5..84bac38 100644
--- a/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/params_linux.py
+++ b/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/params_linux.py
@@ -43,7 +43,7 @@ from resource_management.libraries.functions.expect import expect
 from resource_management.libraries import functions
 from resource_management.libraries.functions.setup_atlas_hook import has_atlas_in_cluster
 from ambari_commons.ambari_metrics_helper import select_metric_collector_hosts_from_hostnames
-from resource_management.libraries.functions.setup_ranger_plugin_xml import get_audit_configs
+from resource_management.libraries.functions.setup_ranger_plugin_xml import get_audit_configs, generate_ranger_service_config
 from resource_management.libraries.functions.get_architecture import get_architecture
 
 from resource_management.core.utils import PasswordString
@@ -786,6 +786,10 @@ if enable_ranger_hive:
     'assetType': '3'
   }
 
+  custom_ranger_service_config = generate_ranger_service_config(ranger_plugin_properties)
+  if len(custom_ranger_service_config) > 0:
+    hive_ranger_plugin_config.update(custom_ranger_service_config)
+
   if stack_supports_ranger_kerberos and security_enabled:
     hive_ranger_plugin_config['policy.download.auth.users'] = hive_user
     hive_ranger_plugin_config['tag.download.auth.users'] = hive_user

http://git-wip-us.apache.org/repos/asf/ambari/blob/3bab2125/ambari-server/src/main/resources/common-services/HIVE/2.1.0.3.0/package/scripts/params_linux.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/HIVE/2.1.0.3.0/package/scripts/params_linux.py b/ambari-server/src/main/resources/common-services/HIVE/2.1.0.3.0/package/scripts/params_linux.py
index 880ddc5..84bac38 100644
--- a/ambari-server/src/main/resources/common-services/HIVE/2.1.0.3.0/package/scripts/params_linux.py
+++ b/ambari-server/src/main/resources/common-services/HIVE/2.1.0.3.0/package/scripts/params_linux.py
@@ -43,7 +43,7 @@ from resource_management.libraries.functions.expect import expect
 from resource_management.libraries import functions
 from resource_management.libraries.functions.setup_atlas_hook import has_atlas_in_cluster
 from ambari_commons.ambari_metrics_helper import select_metric_collector_hosts_from_hostnames
-from resource_management.libraries.functions.setup_ranger_plugin_xml import get_audit_configs
+from resource_management.libraries.functions.setup_ranger_plugin_xml import get_audit_configs, generate_ranger_service_config
 from resource_management.libraries.functions.get_architecture import get_architecture
 
 from resource_management.core.utils import PasswordString
@@ -786,6 +786,10 @@ if enable_ranger_hive:
     'assetType': '3'
   }
 
+  custom_ranger_service_config = generate_ranger_service_config(ranger_plugin_properties)
+  if len(custom_ranger_service_config) > 0:
+    hive_ranger_plugin_config.update(custom_ranger_service_config)
+
   if stack_supports_ranger_kerberos and security_enabled:
     hive_ranger_plugin_config['policy.download.auth.users'] = hive_user
     hive_ranger_plugin_config['tag.download.auth.users'] = hive_user

http://git-wip-us.apache.org/repos/asf/ambari/blob/3bab2125/ambari-server/src/main/resources/common-services/KAFKA/0.8.1/package/scripts/params.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/KAFKA/0.8.1/package/scripts/params.py b/ambari-server/src/main/resources/common-services/KAFKA/0.8.1/package/scripts/params.py
index b338add..5b9db89 100644
--- a/ambari-server/src/main/resources/common-services/KAFKA/0.8.1/package/scripts/params.py
+++ b/ambari-server/src/main/resources/common-services/KAFKA/0.8.1/package/scripts/params.py
@@ -34,7 +34,7 @@ from resource_management.libraries.functions import stack_select
 from resource_management.libraries.functions import conf_select
 from resource_management.libraries.functions import get_kinit_path
 from resource_management.libraries.functions.get_not_managed_resources import get_not_managed_resources
-from resource_management.libraries.functions.setup_ranger_plugin_xml import get_audit_configs
+from resource_management.libraries.functions.setup_ranger_plugin_xml import get_audit_configs, generate_ranger_service_config
 
 # server configurations
 config = Script.get_config()
@@ -255,6 +255,10 @@ if enable_ranger_kafka and is_supported_kafka_ranger:
     'assetType': '1'
   }
 
+  custom_ranger_service_config = generate_ranger_service_config(ranger_plugin_properties)
+  if len(custom_ranger_service_config) > 0:
+    ranger_plugin_config.update(custom_ranger_service_config)
+
   if stack_supports_ranger_kerberos and security_enabled:
     ranger_plugin_config['policy.download.auth.users'] = kafka_user
     ranger_plugin_config['tag.download.auth.users'] = kafka_user

http://git-wip-us.apache.org/repos/asf/ambari/blob/3bab2125/ambari-server/src/main/resources/common-services/KNOX/0.5.0.2.2/package/scripts/params_linux.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/KNOX/0.5.0.2.2/package/scripts/params_linux.py b/ambari-server/src/main/resources/common-services/KNOX/0.5.0.2.2/package/scripts/params_linux.py
index 8beb2c0..5c07fa4 100644
--- a/ambari-server/src/main/resources/common-services/KNOX/0.5.0.2.2/package/scripts/params_linux.py
+++ b/ambari-server/src/main/resources/common-services/KNOX/0.5.0.2.2/package/scripts/params_linux.py
@@ -38,7 +38,7 @@ from resource_management.libraries.functions.stack_features import check_stack_f
 from resource_management.libraries.functions.stack_features import get_stack_feature_version
 from resource_management.libraries.functions.constants import StackFeature
 from resource_management.libraries.functions import is_empty
-from resource_management.libraries.functions.setup_ranger_plugin_xml import get_audit_configs
+from resource_management.libraries.functions.setup_ranger_plugin_xml import get_audit_configs, generate_ranger_service_config
 
 # server configurations
 config = Script.get_config()
@@ -356,7 +356,11 @@ if enable_ranger_knox:
     'name': repo_name,
     'repositoryType': 'knox',
     'assetType': '5',
-    }
+  }
+
+  custom_ranger_service_config = generate_ranger_service_config(ranger_plugin_properties)
+  if len(custom_ranger_service_config) > 0:
+    knox_ranger_plugin_config.update(custom_ranger_service_config)
 
   if stack_supports_ranger_kerberos and security_enabled:
     knox_ranger_plugin_config['policy.download.auth.users'] = knox_user

http://git-wip-us.apache.org/repos/asf/ambari/blob/3bab2125/ambari-server/src/main/resources/common-services/RANGER_KMS/0.5.0.2.3/package/scripts/params.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/RANGER_KMS/0.5.0.2.3/package/scripts/params.py b/ambari-server/src/main/resources/common-services/RANGER_KMS/0.5.0.2.3/package/scripts/params.py
index db59973..f2abe80 100755
--- a/ambari-server/src/main/resources/common-services/RANGER_KMS/0.5.0.2.3/package/scripts/params.py
+++ b/ambari-server/src/main/resources/common-services/RANGER_KMS/0.5.0.2.3/package/scripts/params.py
@@ -28,6 +28,7 @@ from resource_management.libraries.functions.stack_features import get_stack_fea
 from resource_management.libraries.functions import StackFeature
 from resource_management.libraries.functions.get_bare_principal import get_bare_principal
 from resource_management.libraries.functions.is_empty import is_empty
+from resource_management.libraries.functions.setup_ranger_plugin_xml import generate_ranger_service_config
 
 config  = Script.get_config()
 tmp_dir = Script.get_tmp_dir()
@@ -260,6 +261,10 @@ if stack_supports_ranger_kerberos:
       rangerkms_principal = rangerkms_principal.replace('_HOST', kms_host.lower())
   kms_plugin_config['policy.download.auth.users'] = format('keyadmin,{rangerkms_bare_principal}')
 
+custom_ranger_service_config = generate_ranger_service_config(config['configurations']['kms-properties'])
+if len(custom_ranger_service_config) > 0:
+  kms_plugin_config.update(custom_ranger_service_config)
+
 kms_ranger_plugin_repo = {
   'isEnabled' : 'true',
   'configs' : kms_plugin_config,

http://git-wip-us.apache.org/repos/asf/ambari/blob/3bab2125/ambari-server/src/main/resources/common-services/STORM/0.9.1/package/scripts/params_linux.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/STORM/0.9.1/package/scripts/params_linux.py b/ambari-server/src/main/resources/common-services/STORM/0.9.1/package/scripts/params_linux.py
index 5d8a5f3..44b256e 100644
--- a/ambari-server/src/main/resources/common-services/STORM/0.9.1/package/scripts/params_linux.py
+++ b/ambari-server/src/main/resources/common-services/STORM/0.9.1/package/scripts/params_linux.py
@@ -41,7 +41,7 @@ from resource_management.libraries.functions.expect import expect
 from resource_management.libraries.functions.setup_atlas_hook import has_atlas_in_cluster
 from resource_management.libraries.functions import is_empty
 from ambari_commons.ambari_metrics_helper import select_metric_collector_hosts_from_hostnames
-from resource_management.libraries.functions.setup_ranger_plugin_xml import get_audit_configs
+from resource_management.libraries.functions.setup_ranger_plugin_xml import get_audit_configs, generate_ranger_service_config
 
 # server configurations
 config = Script.get_config()
@@ -344,6 +344,10 @@ if enable_ranger_storm:
     'assetType': '6'
   }
 
+  custom_ranger_service_config = generate_ranger_service_config(ranger_plugin_properties)
+  if len(custom_ranger_service_config) > 0:
+    storm_ranger_plugin_config.update(custom_ranger_service_config)
+
   if stack_supports_ranger_kerberos and security_enabled:
     policy_user = format('{storm_user},{storm_bare_jaas_principal}')
     storm_ranger_plugin_config['policy.download.auth.users'] = policy_user

http://git-wip-us.apache.org/repos/asf/ambari/blob/3bab2125/ambari-server/src/main/resources/common-services/YARN/2.1.0.2.0/package/scripts/params_linux.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/YARN/2.1.0.2.0/package/scripts/params_linux.py b/ambari-server/src/main/resources/common-services/YARN/2.1.0.2.0/package/scripts/params_linux.py
index 03d3fb2..a4de8fa 100644
--- a/ambari-server/src/main/resources/common-services/YARN/2.1.0.2.0/package/scripts/params_linux.py
+++ b/ambari-server/src/main/resources/common-services/YARN/2.1.0.2.0/package/scripts/params_linux.py
@@ -35,7 +35,7 @@ from resource_management.libraries.functions.default import default
 from resource_management.libraries import functions
 from resource_management.libraries.functions import is_empty
 from resource_management.libraries.functions.get_architecture import get_architecture
-from resource_management.libraries.functions.setup_ranger_plugin_xml import get_audit_configs
+from resource_management.libraries.functions.setup_ranger_plugin_xml import get_audit_configs, generate_ranger_service_config
 
 import status_params
 
@@ -459,6 +459,10 @@ if enable_ranger_yarn and is_supported_yarn_ranger:
     'assetType': '1'
   }
 
+  custom_ranger_service_config = generate_ranger_service_config(ranger_plugin_properties)
+  if len(custom_ranger_service_config) > 0:
+    ranger_plugin_config.update(custom_ranger_service_config)
+
   if stack_supports_ranger_kerberos:
     ranger_plugin_config['ambari.service.check.user'] = policy_user
     ranger_plugin_config['hadoop.security.authentication'] = 'kerberos' if security_enabled else 'simple'

http://git-wip-us.apache.org/repos/asf/ambari/blob/3bab2125/ambari-server/src/main/resources/common-services/YARN/3.0.0.3.0/package/scripts/params_linux.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/YARN/3.0.0.3.0/package/scripts/params_linux.py b/ambari-server/src/main/resources/common-services/YARN/3.0.0.3.0/package/scripts/params_linux.py
index d069722..a8cdda9 100644
--- a/ambari-server/src/main/resources/common-services/YARN/3.0.0.3.0/package/scripts/params_linux.py
+++ b/ambari-server/src/main/resources/common-services/YARN/3.0.0.3.0/package/scripts/params_linux.py
@@ -35,7 +35,7 @@ from resource_management.libraries.functions.default import default
 from resource_management.libraries import functions
 from resource_management.libraries.functions import is_empty
 from resource_management.libraries.functions.get_architecture import get_architecture
-from resource_management.libraries.functions.setup_ranger_plugin_xml import get_audit_configs
+from resource_management.libraries.functions.setup_ranger_plugin_xml import get_audit_configs, generate_ranger_service_config
 import status_params
 
 # a map of the Ambari role to the component name
@@ -456,6 +456,10 @@ if enable_ranger_yarn and is_supported_yarn_ranger:
     'assetType': '1'
   }
 
+  custom_ranger_service_config = generate_ranger_service_config(ranger_plugin_properties)
+  if len(custom_ranger_service_config) > 0:
+    ranger_plugin_config.update(custom_ranger_service_config)
+
   if stack_supports_ranger_kerberos:
     ranger_plugin_config['ambari.service.check.user'] = policy_user
     ranger_plugin_config['hadoop.security.authentication'] = 'kerberos' if security_enabled else 'simple'


[20/50] ambari git commit: AMBARI-20653.Bad user experience in workflow credential creation.(M Madhan Mohan Reddy via padmapriyanitt)

Posted by jo...@apache.org.
AMBARI-20653.Bad user experience in workflow credential creation.(M Madhan Mohan Reddy via padmapriyanitt)


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

Branch: refs/heads/branch-feature-AMBARI-12556
Commit: 8f8fc11d34bd2a72cff194e22e176913d874fc10
Parents: e945bb1
Author: padmapriyanitt <pa...@gmail.com>
Authored: Tue Apr 4 11:55:13 2017 +0530
Committer: padmapriyanitt <pa...@gmail.com>
Committed: Tue Apr 4 11:55:13 2017 +0530

----------------------------------------------------------------------
 .../ui/app/components/workflow-credentials.js          |  2 +-
 .../src/main/resources/ui/app/styles/app.less          |  3 ---
 .../ui/app/templates/components/credentials-config.hbs |  2 +-
 .../app/templates/components/workflow-credentials.hbs  | 13 ++++++++-----
 4 files changed, 10 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/8f8fc11d/contrib/views/wfmanager/src/main/resources/ui/app/components/workflow-credentials.js
----------------------------------------------------------------------
diff --git a/contrib/views/wfmanager/src/main/resources/ui/app/components/workflow-credentials.js b/contrib/views/wfmanager/src/main/resources/ui/app/components/workflow-credentials.js
index 1072ca4..1f1fc04 100644
--- a/contrib/views/wfmanager/src/main/resources/ui/app/components/workflow-credentials.js
+++ b/contrib/views/wfmanager/src/main/resources/ui/app/components/workflow-credentials.js
@@ -23,7 +23,7 @@ export default Ember.Component.extend(Ember.Evented, {
   initialize : function(){
     this.get('credentialsList').clear();
     this.get('childComponents').clear();
-    this.set('credentialsList', Ember.copy(this.get('workflowCredentials')));
+    this.set('credentialsList', this.get('workflowCredentials'));
   }.on('init'),
   rendered : function(){
     this.$('#workflow_credentials_dialog').modal({

http://git-wip-us.apache.org/repos/asf/ambari/blob/8f8fc11d/contrib/views/wfmanager/src/main/resources/ui/app/styles/app.less
----------------------------------------------------------------------
diff --git a/contrib/views/wfmanager/src/main/resources/ui/app/styles/app.less b/contrib/views/wfmanager/src/main/resources/ui/app/styles/app.less
index 673ae6a..3c5e720 100644
--- a/contrib/views/wfmanager/src/main/resources/ui/app/styles/app.less
+++ b/contrib/views/wfmanager/src/main/resources/ui/app/styles/app.less
@@ -1267,9 +1267,6 @@ input:invalid {
     color: @defaultRed;
     cursor: pointer;
 }
-.credential-list {
-  margin-top: 37px;
-}
 .credential-list .fa-trash-o{
   color: @defaultRed;
   cursor: pointer;

http://git-wip-us.apache.org/repos/asf/ambari/blob/8f8fc11d/contrib/views/wfmanager/src/main/resources/ui/app/templates/components/credentials-config.hbs
----------------------------------------------------------------------
diff --git a/contrib/views/wfmanager/src/main/resources/ui/app/templates/components/credentials-config.hbs b/contrib/views/wfmanager/src/main/resources/ui/app/templates/components/credentials-config.hbs
index 366920d..555bf98 100644
--- a/contrib/views/wfmanager/src/main/resources/ui/app/templates/components/credentials-config.hbs
+++ b/contrib/views/wfmanager/src/main/resources/ui/app/templates/components/credentials-config.hbs
@@ -66,7 +66,7 @@
         </div>
       </div>
       <div class="col-xs-24 pull-right">
-        <input class="btn btn-default marginright5" type="button" {{action "cancel"}} value="Cancel">
+        <button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
         {{#if (eq mode 'create')}}
           <input class="btn btn-primary" type="button" {{action "add"}} value="Add">
         {{else}}

http://git-wip-us.apache.org/repos/asf/ambari/blob/8f8fc11d/contrib/views/wfmanager/src/main/resources/ui/app/templates/components/workflow-credentials.hbs
----------------------------------------------------------------------
diff --git a/contrib/views/wfmanager/src/main/resources/ui/app/templates/components/workflow-credentials.hbs b/contrib/views/wfmanager/src/main/resources/ui/app/templates/components/workflow-credentials.hbs
index 464221f..fa47612 100644
--- a/contrib/views/wfmanager/src/main/resources/ui/app/templates/components/workflow-credentials.hbs
+++ b/contrib/views/wfmanager/src/main/resources/ui/app/templates/components/workflow-credentials.hbs
@@ -24,13 +24,16 @@
       </div>
       <div class="modal-body">
         <div class=" panel panel-default">
-          <div class="panel-heading">Credentials</div>
-          <div class="panel-body handlerPanel">
-            <div id="credential-action-bar" class="form-group pull-right">
+          <div class="panel-heading clearfix">
+            <div class="pull-left paddingtop7">Credentials</div>
+            <div id="credential-action-bar" class="pull-right">
               <button id="dataset-create-btn" {{action 'createCredentials'}} type="button" class="btn btn-default">
                 <i class="fa fa-plus-circle"></i> Add
               </button>
             </div>
+          </div>
+          <div class="panel-body handlerPanel">
+
             <div class="paddingtop10">
               <ul class="list-group credential-list">
                 {{#each credentialsList as |credential index|}}
@@ -57,10 +60,10 @@
           {{#credentials-config credential=currentCredentials showCredentials="showCredentials" update="updateCredentials" mode="edit" cancel="cancelEditMode"}}{{/credentials-config}}
         {{/if}}
       </div>
-      <div class="modal-footer">
+      <!-- <div class="modal-footer">
         <button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
         <button type="button" class="btn btn-primary" {{action "saveCredentials"}}>Save</button>
-      </div>
+      </div> -->
     </div>
   </div>
 </div>


[07/50] ambari git commit: AMBARI-20654.Workflow should retain job.properties in submission modal window.(M Madhan Mohan Reddy via padmapriyanitt)

Posted by jo...@apache.org.
AMBARI-20654.Workflow should retain job.properties in submission modal window.(M Madhan Mohan Reddy via padmapriyanitt)


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

Branch: refs/heads/branch-feature-AMBARI-12556
Commit: 6892e43522e40722a62d142eed8c2dfd14ac68f2
Parents: 9fec5ac
Author: padmapriyanitt <pa...@gmail.com>
Authored: Mon Apr 3 18:21:47 2017 +0530
Committer: padmapriyanitt <pa...@gmail.com>
Committed: Mon Apr 3 18:21:47 2017 +0530

----------------------------------------------------------------------
 .../src/main/resources/ui/app/components/flow-designer.js     | 1 +
 .../src/main/resources/ui/app/components/job-config.js        | 7 +++++++
 .../resources/ui/app/templates/components/flow-designer.hbs   | 2 +-
 3 files changed, 9 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/6892e435/contrib/views/wfmanager/src/main/resources/ui/app/components/flow-designer.js
----------------------------------------------------------------------
diff --git a/contrib/views/wfmanager/src/main/resources/ui/app/components/flow-designer.js b/contrib/views/wfmanager/src/main/resources/ui/app/components/flow-designer.js
index 5f885e7..fa7c861 100644
--- a/contrib/views/wfmanager/src/main/resources/ui/app/components/flow-designer.js
+++ b/contrib/views/wfmanager/src/main/resources/ui/app/components/flow-designer.js
@@ -114,6 +114,7 @@ export default Ember.Component.extend(FindNodeMixin, Validations, {
   showingStreamImport:false,
   fileInfo:Ember.Object.create(),
   isDraft: false,
+  jobConfigProperties: Ember.A([]),
   saveJobService : Ember.inject.service('save-job'),
   initialize : function(){
     var id = 'cy-' + Math.ceil(Math.random() * 1000);

http://git-wip-us.apache.org/repos/asf/ambari/blob/6892e435/contrib/views/wfmanager/src/main/resources/ui/app/components/job-config.js
----------------------------------------------------------------------
diff --git a/contrib/views/wfmanager/src/main/resources/ui/app/components/job-config.js b/contrib/views/wfmanager/src/main/resources/ui/app/components/job-config.js
index 15c1fbf..e9c7c15 100644
--- a/contrib/views/wfmanager/src/main/resources/ui/app/components/job-config.js
+++ b/contrib/views/wfmanager/src/main/resources/ui/app/components/job-config.js
@@ -68,6 +68,12 @@ export default Ember.Component.extend(Validations, {
     var configProperties = [];
     configProperties.pushObjects(this.extractJobParams());
     configProperties.pushObjects(this.extractJobProperties());
+    configProperties.forEach((configProperty)=>{
+      var oldConfigProp = this.jobConfigProperties.filterBy('name', configProperty.name);
+      if (oldConfigProp.length > 0) {
+          configProperty.value = oldConfigProp[0].value;
+      }
+    }, this);
     return configProperties;
   }),
   initialize :function(){
@@ -174,6 +180,7 @@ export default Ember.Component.extend(Validations, {
       return;
     };
     this.set('jobFilePath', Ember.copy(this.get('filePath')));
+    this.set("jobConfigProperties", Ember.copy(this.get("configMap")));
     var url = Ember.ENV.API_URL + "/submitJob?app.path=" + this.get("filePath") + "&overwrite=" + this.get("overwritePath");
     url = url + "&jobType=" + this.get('displayName').toUpperCase();
     var submitConfigs = this.get("configMap");

http://git-wip-us.apache.org/repos/asf/ambari/blob/6892e435/contrib/views/wfmanager/src/main/resources/ui/app/templates/components/flow-designer.hbs
----------------------------------------------------------------------
diff --git a/contrib/views/wfmanager/src/main/resources/ui/app/templates/components/flow-designer.hbs b/contrib/views/wfmanager/src/main/resources/ui/app/templates/components/flow-designer.hbs
index 0da9f71..429e874 100644
--- a/contrib/views/wfmanager/src/main/resources/ui/app/templates/components/flow-designer.hbs
+++ b/contrib/views/wfmanager/src/main/resources/ui/app/templates/components/flow-designer.hbs
@@ -273,7 +273,7 @@
   {{save-wf type='wf' close="closeSaveWorkflow" jobFilePath=workflowFilePath openFileBrowser="openFileBrowser" closeFileBrowser="closeFileBrowser" jobConfigs=configForSave}}
 {{/if}}
 {{#if showingWorkflowConfigProps}}
-  {{job-config type='wf' closeJobConfigs="closeWorkflowSubmitConfigs" jobFilePath=workflowFilePath tabInfo=tabInfo openFileBrowser="openFileBrowser" closeFileBrowser="closeFileBrowser" jobConfigs=workflowSubmitConfigs isDryrun=dryrun}}
+  {{job-config type='wf' closeJobConfigs="closeWorkflowSubmitConfigs" jobFilePath=workflowFilePath tabInfo=tabInfo openFileBrowser="openFileBrowser" closeFileBrowser="closeFileBrowser" jobConfigs=workflowSubmitConfigs isDryrun=dryrun jobConfigProperties=jobConfigProperties}}
 {{/if}}
 {{#if showGlobalConfig}}
   {{#global-config closeGlobalConfig="closeWorkflowGlobalProps" saveGlobalConfig="saveGlobalConfig" actionModel=globalConfig}}{{/global-config}}


[29/50] ambari git commit: AMBARI-20629 Take Ambari Cluster Name as a property in Ranger plugin configs (mugdha)

Posted by jo...@apache.org.
AMBARI-20629 Take Ambari Cluster Name as a property in Ranger plugin configs (mugdha)


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

Branch: refs/heads/branch-feature-AMBARI-12556
Commit: d711d7a1f90074ab65431e6f58c6551e224df43b
Parents: e0e8a04
Author: Mugdha Varadkar <mu...@apache.org>
Authored: Tue Apr 4 10:33:57 2017 +0530
Committer: Mugdha Varadkar <mu...@apache.org>
Committed: Tue Apr 4 18:15:09 2017 +0530

----------------------------------------------------------------------
 .../0.96.0.2.0/package/scripts/params_linux.py  |   3 +
 .../2.1.0.2.0/package/scripts/params_linux.py   |   5 +-
 .../configuration/ranger-hdfs-audit.xml         |   9 ++
 .../3.0.0.3.0/package/scripts/params_linux.py   |   3 +
 .../configuration/ranger-hive-audit.xml         |   9 ++
 .../KAFKA/0.8.1/package/scripts/params.py       |   3 +
 .../0.5.0.2.2/package/scripts/params_linux.py   |   3 +
 .../0.5.0.2.3/package/scripts/params.py         |   5 +-
 .../2.1.0.2.0/package/scripts/params_linux.py   |   3 +
 .../configuration/ranger-yarn-audit.xml         |   9 ++
 .../3.0.0.3.0/package/scripts/params_linux.py   |   3 +
 .../ATLAS/configuration/ranger-atlas-audit.xml  |  33 ++++++
 .../HBASE/configuration/ranger-hbase-audit.xml  |  33 ++++++
 .../HDFS/configuration/ranger-hdfs-audit.xml    |  33 ++++++
 .../HIVE/configuration/ranger-hive-audit.xml    |  33 ++++++
 .../KAFKA/configuration/ranger-kafka-audit.xml  |  33 ++++++
 .../KNOX/configuration/ranger-knox-audit.xml    |  33 ++++++
 .../configuration/ranger-kms-audit.xml          |  33 ++++++
 .../STORM/configuration/ranger-storm-audit.xml  |  33 ++++++
 .../YARN/configuration/ranger-yarn-audit.xml    |  33 ++++++
 .../stacks/HDP/2.6/upgrades/config-upgrade.xml  | 108 +++++++++++++++++++
 .../HDP/2.6/upgrades/nonrolling-upgrade-2.6.xml |  53 ++++++++-
 .../stacks/HDP/2.6/upgrades/upgrade-2.6.xml     |  33 ++++++
 23 files changed, 540 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/d711d7a1/ambari-server/src/main/resources/common-services/HBASE/0.96.0.2.0/package/scripts/params_linux.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/HBASE/0.96.0.2.0/package/scripts/params_linux.py b/ambari-server/src/main/resources/common-services/HBASE/0.96.0.2.0/package/scripts/params_linux.py
index e78bfc2..3177643 100644
--- a/ambari-server/src/main/resources/common-services/HBASE/0.96.0.2.0/package/scripts/params_linux.py
+++ b/ambari-server/src/main/resources/common-services/HBASE/0.96.0.2.0/package/scripts/params_linux.py
@@ -408,6 +408,9 @@ if enable_ranger_hbase:
   if has_ranger_admin and stack_supports_ranger_audit_db and xa_audit_db_flavor.lower() == 'sqla':
     xa_audit_db_is_enabled = False
 
+# need this to capture cluster name from where ranger hbase plugin is enabled
+cluster_name = config['clusterName']
+
 # ranger hbase plugin section end
 
 create_hbase_home_directory = check_stack_feature(StackFeature.HBASE_HOME_DIRECTORY, stack_version_formatted)

http://git-wip-us.apache.org/repos/asf/ambari/blob/d711d7a1/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/scripts/params_linux.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/scripts/params_linux.py b/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/scripts/params_linux.py
index b8785f3..f0566d7 100644
--- a/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/scripts/params_linux.py
+++ b/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/scripts/params_linux.py
@@ -547,4 +547,7 @@ if enable_ranger_hdfs:
   if has_ranger_admin and stack_supports_ranger_audit_db and xa_audit_db_flavor.lower() == 'sqla':
     xa_audit_db_is_enabled = False
 
-# ranger hdfs plugin section end
+# need this to capture cluster name from where ranger hdfs plugin is enabled
+cluster_name = config['clusterName']
+
+# ranger hdfs plugin section end
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/d711d7a1/ambari-server/src/main/resources/common-services/HDFS/3.0.0.3.0/configuration/ranger-hdfs-audit.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/HDFS/3.0.0.3.0/configuration/ranger-hdfs-audit.xml b/ambari-server/src/main/resources/common-services/HDFS/3.0.0.3.0/configuration/ranger-hdfs-audit.xml
index 731b136..02b195f 100644
--- a/ambari-server/src/main/resources/common-services/HDFS/3.0.0.3.0/configuration/ranger-hdfs-audit.xml
+++ b/ambari-server/src/main/resources/common-services/HDFS/3.0.0.3.0/configuration/ranger-hdfs-audit.xml
@@ -120,4 +120,13 @@
     </value-attributes>
     <on-ambari-upgrade add="false"/>
   </property>
+  <property>
+    <name>ranger.plugin.hdfs.ambari.cluster.name</name>
+    <value>{{cluster_name}}</value>
+    <description>Capture cluster name from where Ranger hdfs plugin is enabled.</description>
+    <value-attributes>
+      <empty-value-valid>true</empty-value-valid>
+    </value-attributes>
+    <on-ambari-upgrade add="false"/>
+  </property>
 </configuration>

http://git-wip-us.apache.org/repos/asf/ambari/blob/d711d7a1/ambari-server/src/main/resources/common-services/HDFS/3.0.0.3.0/package/scripts/params_linux.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/HDFS/3.0.0.3.0/package/scripts/params_linux.py b/ambari-server/src/main/resources/common-services/HDFS/3.0.0.3.0/package/scripts/params_linux.py
index 4fa6f0c..58bb65f 100644
--- a/ambari-server/src/main/resources/common-services/HDFS/3.0.0.3.0/package/scripts/params_linux.py
+++ b/ambari-server/src/main/resources/common-services/HDFS/3.0.0.3.0/package/scripts/params_linux.py
@@ -543,4 +543,7 @@ if enable_ranger_hdfs:
   if has_ranger_admin and stack_supports_ranger_audit_db and xa_audit_db_flavor.lower() == 'sqla':
     xa_audit_db_is_enabled = False
 
+# need this to capture cluster name from where ranger hdfs plugin is enabled
+cluster_name = config['clusterName']
+
 # ranger hdfs plugin section end

http://git-wip-us.apache.org/repos/asf/ambari/blob/d711d7a1/ambari-server/src/main/resources/common-services/HIVE/2.1.0.3.0/configuration/ranger-hive-audit.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/HIVE/2.1.0.3.0/configuration/ranger-hive-audit.xml b/ambari-server/src/main/resources/common-services/HIVE/2.1.0.3.0/configuration/ranger-hive-audit.xml
index 95edb38..fc1c5ad 100644
--- a/ambari-server/src/main/resources/common-services/HIVE/2.1.0.3.0/configuration/ranger-hive-audit.xml
+++ b/ambari-server/src/main/resources/common-services/HIVE/2.1.0.3.0/configuration/ranger-hive-audit.xml
@@ -118,4 +118,13 @@
     </value-attributes>
     <on-ambari-upgrade add="false"/>
   </property>
+  <property>
+    <name>ranger.plugin.hive.ambari.cluster.name</name>
+    <value>{{cluster_name}}</value>
+    <description>Capture cluster name from where Ranger hive plugin is enabled.</description>
+    <value-attributes>
+      <empty-value-valid>true</empty-value-valid>
+    </value-attributes>
+    <on-ambari-upgrade add="false"/>
+  </property>
 </configuration>

http://git-wip-us.apache.org/repos/asf/ambari/blob/d711d7a1/ambari-server/src/main/resources/common-services/KAFKA/0.8.1/package/scripts/params.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/KAFKA/0.8.1/package/scripts/params.py b/ambari-server/src/main/resources/common-services/KAFKA/0.8.1/package/scripts/params.py
index 5b9db89..32f18f2 100644
--- a/ambari-server/src/main/resources/common-services/KAFKA/0.8.1/package/scripts/params.py
+++ b/ambari-server/src/main/resources/common-services/KAFKA/0.8.1/package/scripts/params.py
@@ -296,6 +296,9 @@ if enable_ranger_kafka and is_supported_kafka_ranger:
   if has_ranger_admin and stack_supports_ranger_audit_db and xa_audit_db_flavor.lower() == 'sqla':
     xa_audit_db_is_enabled = False
 
+# need this to capture cluster name from where ranger kafka plugin is enabled
+cluster_name = config['clusterName']
+
 # ranger kafka plugin section end
 
 namenode_hosts = default("/clusterHostInfo/namenode_host", [])

http://git-wip-us.apache.org/repos/asf/ambari/blob/d711d7a1/ambari-server/src/main/resources/common-services/KNOX/0.5.0.2.2/package/scripts/params_linux.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/KNOX/0.5.0.2.2/package/scripts/params_linux.py b/ambari-server/src/main/resources/common-services/KNOX/0.5.0.2.2/package/scripts/params_linux.py
index 5c07fa4..4558069 100644
--- a/ambari-server/src/main/resources/common-services/KNOX/0.5.0.2.2/package/scripts/params_linux.py
+++ b/ambari-server/src/main/resources/common-services/KNOX/0.5.0.2.2/package/scripts/params_linux.py
@@ -390,6 +390,9 @@ if enable_ranger_knox:
   if has_ranger_admin and stack_supports_ranger_audit_db and xa_audit_db_flavor == 'sqla':
     xa_audit_db_is_enabled = False
 
+# need this to capture cluster name from where ranger knox plugin is enabled
+cluster_name = config['clusterName']
+
 # ranger knox plugin end section
 
 hdfs_user = config['configurations']['hadoop-env']['hdfs_user'] if has_namenode else None

http://git-wip-us.apache.org/repos/asf/ambari/blob/d711d7a1/ambari-server/src/main/resources/common-services/RANGER_KMS/0.5.0.2.3/package/scripts/params.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/RANGER_KMS/0.5.0.2.3/package/scripts/params.py b/ambari-server/src/main/resources/common-services/RANGER_KMS/0.5.0.2.3/package/scripts/params.py
index f2abe80..9fe0a61 100755
--- a/ambari-server/src/main/resources/common-services/RANGER_KMS/0.5.0.2.3/package/scripts/params.py
+++ b/ambari-server/src/main/resources/common-services/RANGER_KMS/0.5.0.2.3/package/scripts/params.py
@@ -293,4 +293,7 @@ ranger_kms_ssl_passwd = config['configurations']['ranger-kms-site']['ranger.serv
 ranger_kms_ssl_enabled = config['configurations']['ranger-kms-site']['ranger.service.https.attrib.ssl.enabled']
 
 xa_audit_hdfs_is_enabled = default("/configurations/ranger-kms-audit/xasecure.audit.destination.hdfs", False)
-namenode_host = default("/clusterHostInfo/namenode_host", [])
\ No newline at end of file
+namenode_host = default("/clusterHostInfo/namenode_host", [])
+
+# need this to capture cluster name from where ranger kms plugin is enabled
+cluster_name = config['clusterName']
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/d711d7a1/ambari-server/src/main/resources/common-services/YARN/2.1.0.2.0/package/scripts/params_linux.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/YARN/2.1.0.2.0/package/scripts/params_linux.py b/ambari-server/src/main/resources/common-services/YARN/2.1.0.2.0/package/scripts/params_linux.py
index 88be29c..3579fcb 100644
--- a/ambari-server/src/main/resources/common-services/YARN/2.1.0.2.0/package/scripts/params_linux.py
+++ b/ambari-server/src/main/resources/common-services/YARN/2.1.0.2.0/package/scripts/params_linux.py
@@ -500,4 +500,7 @@ if enable_ranger_yarn and is_supported_yarn_ranger:
   if has_ranger_admin and stack_supports_ranger_audit_db and xa_audit_db_flavor == 'sqla':
     xa_audit_db_is_enabled = False
 
+# need this to capture cluster name from where ranger yarn plugin is enabled
+cluster_name = config['clusterName']
+
 # ranger yarn plugin end section

http://git-wip-us.apache.org/repos/asf/ambari/blob/d711d7a1/ambari-server/src/main/resources/common-services/YARN/3.0.0.3.0/configuration/ranger-yarn-audit.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/YARN/3.0.0.3.0/configuration/ranger-yarn-audit.xml b/ambari-server/src/main/resources/common-services/YARN/3.0.0.3.0/configuration/ranger-yarn-audit.xml
index a6b1baa..7a865b8 100644
--- a/ambari-server/src/main/resources/common-services/YARN/3.0.0.3.0/configuration/ranger-yarn-audit.xml
+++ b/ambari-server/src/main/resources/common-services/YARN/3.0.0.3.0/configuration/ranger-yarn-audit.xml
@@ -174,4 +174,13 @@
     </value-attributes>
     <on-ambari-upgrade add="false"/>
   </property>
+  <property>
+    <name>ranger.plugin.yarn.ambari.cluster.name</name>
+    <value>{{cluster_name}}</value>
+    <description>Capture cluster name from where Ranger yarn plugin is enabled.</description>
+    <value-attributes>
+      <empty-value-valid>true</empty-value-valid>
+    </value-attributes>
+    <on-ambari-upgrade add="false"/>
+  </property>
 </configuration>

http://git-wip-us.apache.org/repos/asf/ambari/blob/d711d7a1/ambari-server/src/main/resources/common-services/YARN/3.0.0.3.0/package/scripts/params_linux.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/YARN/3.0.0.3.0/package/scripts/params_linux.py b/ambari-server/src/main/resources/common-services/YARN/3.0.0.3.0/package/scripts/params_linux.py
index a8cdda9..66194ed 100644
--- a/ambari-server/src/main/resources/common-services/YARN/3.0.0.3.0/package/scripts/params_linux.py
+++ b/ambari-server/src/main/resources/common-services/YARN/3.0.0.3.0/package/scripts/params_linux.py
@@ -496,4 +496,7 @@ if enable_ranger_yarn and is_supported_yarn_ranger:
   if has_ranger_admin and stack_supports_ranger_audit_db and xa_audit_db_flavor == 'sqla':
     xa_audit_db_is_enabled = False
 
+# need this to capture cluster name from where ranger yarn plugin is enabled
+cluster_name = config['clusterName']
+
 # ranger yarn plugin end section

http://git-wip-us.apache.org/repos/asf/ambari/blob/d711d7a1/ambari-server/src/main/resources/stacks/HDP/2.6/services/ATLAS/configuration/ranger-atlas-audit.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.6/services/ATLAS/configuration/ranger-atlas-audit.xml b/ambari-server/src/main/resources/stacks/HDP/2.6/services/ATLAS/configuration/ranger-atlas-audit.xml
new file mode 100644
index 0000000..ecf9f9d
--- /dev/null
+++ b/ambari-server/src/main/resources/stacks/HDP/2.6/services/ATLAS/configuration/ranger-atlas-audit.xml
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+-->
+<configuration>
+
+  <property>
+    <name>ranger.plugin.atlas.ambari.cluster.name</name>
+    <value>{{cluster_name}}</value>
+    <description>Capture cluster name from where Ranger atlas plugin is enabled.</description>
+    <value-attributes>
+      <empty-value-valid>true</empty-value-valid>
+    </value-attributes>
+    <on-ambari-upgrade add="false"/>
+  </property>
+
+</configuration>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/d711d7a1/ambari-server/src/main/resources/stacks/HDP/2.6/services/HBASE/configuration/ranger-hbase-audit.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.6/services/HBASE/configuration/ranger-hbase-audit.xml b/ambari-server/src/main/resources/stacks/HDP/2.6/services/HBASE/configuration/ranger-hbase-audit.xml
new file mode 100644
index 0000000..f7ff00f
--- /dev/null
+++ b/ambari-server/src/main/resources/stacks/HDP/2.6/services/HBASE/configuration/ranger-hbase-audit.xml
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+-->
+<configuration>
+
+  <property>
+    <name>ranger.plugin.hbase.ambari.cluster.name</name>
+    <value>{{cluster_name}}</value>
+    <description>Capture cluster name from where Ranger hbase plugin is enabled.</description>
+    <value-attributes>
+      <empty-value-valid>true</empty-value-valid>
+    </value-attributes>
+    <on-ambari-upgrade add="false"/>
+  </property>
+
+</configuration>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/d711d7a1/ambari-server/src/main/resources/stacks/HDP/2.6/services/HDFS/configuration/ranger-hdfs-audit.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.6/services/HDFS/configuration/ranger-hdfs-audit.xml b/ambari-server/src/main/resources/stacks/HDP/2.6/services/HDFS/configuration/ranger-hdfs-audit.xml
new file mode 100644
index 0000000..dbc5b5d
--- /dev/null
+++ b/ambari-server/src/main/resources/stacks/HDP/2.6/services/HDFS/configuration/ranger-hdfs-audit.xml
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+-->
+<configuration>
+
+  <property>
+    <name>ranger.plugin.hdfs.ambari.cluster.name</name>
+    <value>{{cluster_name}}</value>
+    <description>Capture cluster name from where Ranger hdfs plugin is enabled.</description>
+    <value-attributes>
+      <empty-value-valid>true</empty-value-valid>
+    </value-attributes>
+    <on-ambari-upgrade add="false"/>
+  </property>
+
+</configuration>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/d711d7a1/ambari-server/src/main/resources/stacks/HDP/2.6/services/HIVE/configuration/ranger-hive-audit.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.6/services/HIVE/configuration/ranger-hive-audit.xml b/ambari-server/src/main/resources/stacks/HDP/2.6/services/HIVE/configuration/ranger-hive-audit.xml
new file mode 100644
index 0000000..e1b2bf9
--- /dev/null
+++ b/ambari-server/src/main/resources/stacks/HDP/2.6/services/HIVE/configuration/ranger-hive-audit.xml
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+-->
+<configuration>
+
+  <property>
+    <name>ranger.plugin.hive.ambari.cluster.name</name>
+    <value>{{cluster_name}}</value>
+    <description>Capture cluster name from where Ranger hive plugin is enabled.</description>
+    <value-attributes>
+      <empty-value-valid>true</empty-value-valid>
+    </value-attributes>
+    <on-ambari-upgrade add="false"/>
+  </property>
+
+</configuration>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/d711d7a1/ambari-server/src/main/resources/stacks/HDP/2.6/services/KAFKA/configuration/ranger-kafka-audit.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.6/services/KAFKA/configuration/ranger-kafka-audit.xml b/ambari-server/src/main/resources/stacks/HDP/2.6/services/KAFKA/configuration/ranger-kafka-audit.xml
new file mode 100644
index 0000000..440b44e
--- /dev/null
+++ b/ambari-server/src/main/resources/stacks/HDP/2.6/services/KAFKA/configuration/ranger-kafka-audit.xml
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+-->
+<configuration>
+
+  <property>
+    <name>ranger.plugin.kafka.ambari.cluster.name</name>
+    <value>{{cluster_name}}</value>
+    <description>Capture cluster name from where Ranger kafka plugin is enabled.</description>
+    <value-attributes>
+      <empty-value-valid>true</empty-value-valid>
+    </value-attributes>
+    <on-ambari-upgrade add="false"/>
+  </property>
+
+</configuration>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/d711d7a1/ambari-server/src/main/resources/stacks/HDP/2.6/services/KNOX/configuration/ranger-knox-audit.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.6/services/KNOX/configuration/ranger-knox-audit.xml b/ambari-server/src/main/resources/stacks/HDP/2.6/services/KNOX/configuration/ranger-knox-audit.xml
new file mode 100644
index 0000000..9dc3ec5
--- /dev/null
+++ b/ambari-server/src/main/resources/stacks/HDP/2.6/services/KNOX/configuration/ranger-knox-audit.xml
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+-->
+<configuration>
+
+  <property>
+    <name>ranger.plugin.knox.ambari.cluster.name</name>
+    <value>{{cluster_name}}</value>
+    <description>Capture cluster name from where Ranger knox plugin is enabled.</description>
+    <value-attributes>
+      <empty-value-valid>true</empty-value-valid>
+    </value-attributes>
+    <on-ambari-upgrade add="false"/>
+  </property>
+
+</configuration>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/d711d7a1/ambari-server/src/main/resources/stacks/HDP/2.6/services/RANGER_KMS/configuration/ranger-kms-audit.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.6/services/RANGER_KMS/configuration/ranger-kms-audit.xml b/ambari-server/src/main/resources/stacks/HDP/2.6/services/RANGER_KMS/configuration/ranger-kms-audit.xml
new file mode 100644
index 0000000..e755770
--- /dev/null
+++ b/ambari-server/src/main/resources/stacks/HDP/2.6/services/RANGER_KMS/configuration/ranger-kms-audit.xml
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+-->
+<configuration>
+
+  <property>
+    <name>ranger.plugin.kms.ambari.cluster.name</name>
+    <value>{{cluster_name}}</value>
+    <description>Capture cluster name from where Ranger kms plugin is enabled.</description>
+    <value-attributes>
+      <empty-value-valid>true</empty-value-valid>
+    </value-attributes>
+    <on-ambari-upgrade add="false"/>
+  </property>
+
+</configuration>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/d711d7a1/ambari-server/src/main/resources/stacks/HDP/2.6/services/STORM/configuration/ranger-storm-audit.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.6/services/STORM/configuration/ranger-storm-audit.xml b/ambari-server/src/main/resources/stacks/HDP/2.6/services/STORM/configuration/ranger-storm-audit.xml
new file mode 100644
index 0000000..9122d92
--- /dev/null
+++ b/ambari-server/src/main/resources/stacks/HDP/2.6/services/STORM/configuration/ranger-storm-audit.xml
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+-->
+<configuration>
+
+  <property>
+    <name>ranger.plugin.storm.ambari.cluster.name</name>
+    <value>{{cluster_name}}</value>
+    <description>Capture cluster name from where Ranger storm plugin is enabled.</description>
+    <value-attributes>
+      <empty-value-valid>true</empty-value-valid>
+    </value-attributes>
+    <on-ambari-upgrade add="false"/>
+  </property>
+
+</configuration>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/d711d7a1/ambari-server/src/main/resources/stacks/HDP/2.6/services/YARN/configuration/ranger-yarn-audit.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.6/services/YARN/configuration/ranger-yarn-audit.xml b/ambari-server/src/main/resources/stacks/HDP/2.6/services/YARN/configuration/ranger-yarn-audit.xml
new file mode 100644
index 0000000..40a2f84
--- /dev/null
+++ b/ambari-server/src/main/resources/stacks/HDP/2.6/services/YARN/configuration/ranger-yarn-audit.xml
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+-->
+<configuration>
+
+  <property>
+    <name>ranger.plugin.yarn.ambari.cluster.name</name>
+    <value>{{cluster_name}}</value>
+    <description>Capture cluster name from where Ranger yarn plugin is enabled.</description>
+    <value-attributes>
+      <empty-value-valid>true</empty-value-valid>
+    </value-attributes>
+    <on-ambari-upgrade add="false"/>
+  </property>
+
+</configuration>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/d711d7a1/ambari-server/src/main/resources/stacks/HDP/2.6/upgrades/config-upgrade.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.6/upgrades/config-upgrade.xml b/ambari-server/src/main/resources/stacks/HDP/2.6/upgrades/config-upgrade.xml
index 0d71244..ceed59b 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.6/upgrades/config-upgrade.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.6/upgrades/config-upgrade.xml
@@ -30,5 +30,113 @@
       </component>
     </service>
 
+    <service name="HDFS">
+      <component name="NAMENODE">
+        <changes>
+          <definition xsi:type="configure" id="hdp_2_6_maint_ranger_hdfs_plugin_cluster_name">
+            <type>ranger-hdfs-audit</type>
+            <set key="ranger.plugin.hdfs.ambari.cluster.name" value="{{cluster_name}}"
+              if-type="ranger-hdfs-plugin-properties" if-key="ranger-hdfs-plugin-enabled" if-key-state="present"/>
+          </definition>
+        </changes>
+      </component>
+    </service>
+
+    <service name="HIVE">
+      <component name="HIVE_SERVER">
+        <changes>
+          <definition xsi:type="configure" id="hdp_2_6_maint_ranger_hive_plugin_cluster_name">
+            <type>ranger-hive-audit</type>
+            <set key="ranger.plugin.hive.ambari.cluster.name" value="{{cluster_name}}"
+              if-type="ranger-hive-audit" if-key="xasecure.audit.destination.solr" if-key-state="present"/>
+          </definition>
+        </changes>
+      </component>
+    </service>
+
+    <service name="HBASE">
+      <component name="HBASE_MASTER">
+        <changes>
+          <definition xsi:type="configure" id="hdp_2_6_maint_ranger_hbase_plugin_cluster_name">
+            <type>ranger-hbase-audit</type>
+            <set key="ranger.plugin.hbase.ambari.cluster.name" value="{{cluster_name}}"
+              if-type="ranger-hbase-plugin-properties" if-key="ranger-hbase-plugin-enabled" if-key-state="present"/>
+          </definition>
+        </changes>
+      </component>
+    </service>
+
+    <service name="KNOX">
+      <component name="KNOX_GATEWAY">
+        <changes>
+          <definition xsi:type="configure" id="hdp_2_6_maint_ranger_knox_plugin_cluster_name">
+            <type>ranger-knox-audit</type>
+            <set key="ranger.plugin.knox.ambari.cluster.name" value="{{cluster_name}}"
+              if-type="ranger-knox-plugin-properties" if-key="ranger-knox-plugin-enabled" if-key-state="present"/>
+          </definition>
+        </changes>
+      </component>
+    </service>
+
+    <service name="STORM">
+      <component name="NIMBUS">
+        <changes>
+          <definition xsi:type="configure" id="hdp_2_6_maint_ranger_storm_plugin_cluster_name">
+            <type>ranger-storm-audit</type>
+            <set key="ranger.plugin.storm.ambari.cluster.name" value="{{cluster_name}}"
+              if-type="ranger-storm-plugin-properties" if-key="ranger-storm-plugin-enabled" if-key-state="present"/>
+          </definition>
+        </changes>
+      </component>
+    </service>
+
+    <service name="YARN">
+      <component name="RESOURCEMANAGER">
+        <changes>
+          <definition xsi:type="configure" id="hdp_2_6_maint_ranger_yarn_plugin_cluster_name">
+            <type>ranger-yarn-audit</type>
+            <set key="ranger.plugin.yarn.ambari.cluster.name" value="{{cluster_name}}"
+              if-type="ranger-yarn-plugin-properties" if-key="ranger-yarn-plugin-enabled" if-key-state="present"/>
+          </definition>
+        </changes>
+      </component>
+    </service>
+
+    <service name="KAFKA">
+      <component name="KAFKA_BROKER">
+        <changes>
+          <definition xsi:type="configure" id="hdp_2_6_maint_ranger_kafka_plugin_cluster_name">
+            <type>ranger-kafka-audit</type>
+            <set key="ranger.plugin.kafka.ambari.cluster.name" value="{{cluster_name}}"
+              if-type="ranger-kafka-plugin-properties" if-key="ranger-kafka-plugin-enabled" if-key-state="present"/>
+          </definition>
+        </changes>
+      </component>
+    </service>
+
+    <service name="ATLAS">
+      <component name="ATLAS_SERVER">
+        <changes>
+          <definition xsi:type="configure" id="hdp_2_6_maint_ranger_atlas_plugin_cluster_name">
+            <type>ranger-atlas-audit</type>
+            <set key="ranger.plugin.atlas.ambari.cluster.name" value="{{cluster_name}}"
+              if-type="ranger-atlas-plugin-properties" if-key="ranger-atlas-plugin-enabled" if-key-state="present"/>
+          </definition>
+        </changes>
+      </component>
+    </service>
+
+    <service name="RANGER_KMS">
+      <component name="RANGER_KMS_SERVER">
+        <changes>
+          <definition xsi:type="configure" id="hdp_2_6_maint_ranger_kms_plugin_cluster_name">
+            <type>ranger-kms-audit</type>
+            <set key="ranger.plugin.kms.ambari.cluster.name" value="{{cluster_name}}"
+              if-type="ranger-kms-audit" if-key="ranger.plugin.kms.ambari.cluster.name" if-key-state="absent"/>
+          </definition>
+        </changes>
+      </component>
+    </service>
+
   </services>
 </upgrade-config-changes>

http://git-wip-us.apache.org/repos/asf/ambari/blob/d711d7a1/ambari-server/src/main/resources/stacks/HDP/2.6/upgrades/nonrolling-upgrade-2.6.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.6/upgrades/nonrolling-upgrade-2.6.xml b/ambari-server/src/main/resources/stacks/HDP/2.6/upgrades/nonrolling-upgrade-2.6.xml
index 68c58c0..ce07f7a 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.6/upgrades/nonrolling-upgrade-2.6.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.6/upgrades/nonrolling-upgrade-2.6.xml
@@ -284,13 +284,58 @@
       </execute-stage>
     </group>
 
-    <!-- ToDo: on config updates, this section need to be uncommented and extended with the changes
+    
     <group xsi:type="cluster" name="Upgrade service configs" title="Upgrade service configs">
-      <direction>UPGRADE</direction>
-      <skippable>true</skippable>
+      <direction>UPGRADE</direction> <!--  prevent config changes on downgrade -->
+      <skippable>true</skippable> <!-- May fix configuration problems manually -->
+
+      <!-- HDFS -->
+      <execute-stage service="HDFS" component="NAMENODE" title="Apply config changes for Ranger Hdfs plugin">
+        <task xsi:type="configure" id="hdp_2_6_maint_ranger_hdfs_plugin_cluster_name"/>
+      </execute-stage>
+
+      <!-- HIVE -->
+      <execute-stage service="HIVE" component="HIVE_SERVER" title="Apply config changes for Ranger Hive plugin">
+        <task xsi:type="configure" id="hdp_2_6_maint_ranger_hive_plugin_cluster_name"/>
+      </execute-stage>
+
+      <!-- HBASE -->
+      <execute-stage service="HBASE" component="HBASE_MASTER" title="Apply config changes for Ranger Hbase plugin">
+        <task xsi:type="configure" id="hdp_2_6_maint_ranger_hbase_plugin_cluster_name"/>
+      </execute-stage>
+
+      <!-- KNOX -->
+      <execute-stage service="KNOX" component="KNOX_GATEWAY" title="Apply config changes for Ranger Knox plugin">
+        <task xsi:type="configure" id="hdp_2_6_maint_ranger_knox_plugin_cluster_name"/>
+      </execute-stage>
+
+      <!-- STORM -->
+      <execute-stage service="STORM" component="NIMBUS" title="Apply config changes for Ranger Storm plugin">
+        <task xsi:type="configure" id="hdp_2_6_maint_ranger_storm_plugin_cluster_name"/>
+      </execute-stage>
+
+      <!-- YARN -->
+      <execute-stage service="YARN" component="RESOURCEMANAGER" title="Apply config changes for Ranger Yarn plugin">
+        <task xsi:type="configure" id="hdp_2_6_maint_ranger_yarn_plugin_cluster_name"/>
+      </execute-stage>
+
+      <!-- KAFKA -->
+      <execute-stage service="KAFKA" component="KAFKA_BROKER" title="Apply config changes for Ranger Kafka plugin">
+        <task xsi:type="configure" id="hdp_2_6_maint_ranger_kafka_plugin_cluster_name"/>
+      </execute-stage>
+
+      <!-- ATLAS -->
+      <execute-stage service="ATLAS" component="ATLAS_SERVER" title="Apply config changes for Ranger Atlas plugin">
+        <task xsi:type="configure" id="hdp_2_6_maint_ranger_atlas_plugin_cluster_name"/>
+      </execute-stage>
+
+      <!-- KMS -->
+      <execute-stage service="RANGER_KMS" component="RANGER_KMS_SERVER" title="Apply config changes for Ranger Kms plugin">
+        <task xsi:type="configure" id="hdp_2_6_maint_ranger_kms_plugin_cluster_name"/>
+      </execute-stage>
 
     </group>
-    -->
+    
 
     <!--
     After processing this group, the user-specified Kerberos descriptor will be updated to work with

http://git-wip-us.apache.org/repos/asf/ambari/blob/d711d7a1/ambari-server/src/main/resources/stacks/HDP/2.6/upgrades/upgrade-2.6.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.6/upgrades/upgrade-2.6.xml b/ambari-server/src/main/resources/stacks/HDP/2.6/upgrades/upgrade-2.6.xml
index 01f11e4..fd72e4d 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.6/upgrades/upgrade-2.6.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.6/upgrades/upgrade-2.6.xml
@@ -569,6 +569,7 @@
     <service name="RANGER_KMS">
       <component name="RANGER_KMS_SERVER">
         <pre-upgrade>
+          <task xsi:type="configure" id="hdp_2_6_maint_ranger_kms_plugin_cluster_name"/>
           <task xsi:type="execute" hosts="any" sequential="true">
             <summary>Upgrading Ranger KMS database schema</summary>
             <script>scripts/kms_server.py</script>
@@ -592,6 +593,10 @@
 
     <service name="KAFKA">
       <component name="KAFKA_BROKER">
+        <pre-upgrade>
+          <task xsi:type="configure" id="hdp_2_6_maint_ranger_kafka_plugin_cluster_name"/>
+        </pre-upgrade>
+        <pre-downgrade/> <!--  no-op to prevent config changes on downgrade -->
         <upgrade>
           <task xsi:type="restart-task" />
         </upgrade>
@@ -600,6 +605,10 @@
 
     <service name="HDFS">
       <component name="NAMENODE">
+        <pre-upgrade>
+          <task xsi:type="configure" id="hdp_2_6_maint_ranger_hdfs_plugin_cluster_name"/>
+        </pre-upgrade>
+        <pre-downgrade/> <!--  no-op to prevent config changes on downgrade -->
         <upgrade>
           <task xsi:type="restart-task" />
         </upgrade>
@@ -674,6 +683,10 @@
       </component>
 
       <component name="RESOURCEMANAGER">
+        <pre-upgrade>
+          <task xsi:type="configure" id="hdp_2_6_maint_ranger_yarn_plugin_cluster_name"/>
+        </pre-upgrade>
+        <pre-downgrade/> <!--  no-op to prevent config changes on downgrade -->
         <upgrade>
           <task xsi:type="restart-task" />
         </upgrade>
@@ -694,6 +707,10 @@
 
     <service name="HBASE">
       <component name="HBASE_MASTER">
+        <pre-upgrade>
+          <task xsi:type="configure" id="hdp_2_6_maint_ranger_hbase_plugin_cluster_name"/>
+        </pre-upgrade>
+        <pre-downgrade/> <!--  no-op to prevent config changes on downgrade -->
         <upgrade>
           <task xsi:type="restart-task" />
         </upgrade>
@@ -766,6 +783,10 @@
       </component>
 
       <component name="HIVE_SERVER">
+        <pre-upgrade>
+          <task xsi:type="configure" id="hdp_2_6_maint_ranger_hive_plugin_cluster_name"/>
+        </pre-upgrade>
+        <pre-downgrade/> <!--  no-op to prevent config changes on downgrade -->
         <upgrade>
           <task xsi:type="restart-task" />
         </upgrade>
@@ -914,6 +935,10 @@
 
     <service name="KNOX">
       <component name="KNOX_GATEWAY">
+        <pre-upgrade>
+          <task xsi:type="configure" id="hdp_2_6_maint_ranger_knox_plugin_cluster_name"/>
+        </pre-upgrade>
+        <pre-downgrade/> <!--  no-op to prevent config changes on downgrade -->
         <upgrade>
           <task xsi:type="restart-task" />
         </upgrade>
@@ -922,6 +947,10 @@
 
     <service name="STORM">
       <component name="NIMBUS">
+        <pre-upgrade>
+          <task xsi:type="configure" id="hdp_2_6_maint_ranger_storm_plugin_cluster_name"/>
+        </pre-upgrade>
+        <pre-downgrade/> <!--  no-op to prevent config changes on downgrade -->
         <upgrade>
           <task xsi:type="restart-task" />
         </upgrade>
@@ -986,6 +1015,10 @@
 
     <service name="ATLAS">
       <component name="ATLAS_SERVER">
+        <pre-upgrade>
+          <task xsi:type="configure" id="hdp_2_6_maint_ranger_atlas_plugin_cluster_name"/>
+        </pre-upgrade>
+        <pre-downgrade/> <!--  no-op to prevent config changes on downgrade -->
         <upgrade>
           <task xsi:type="restart-task"/>
         </upgrade>


[11/50] ambari git commit: AMBARI-20640. Upgrade server-side actions should be performed only one time per group (ncole)

Posted by jo...@apache.org.
AMBARI-20640. Upgrade server-side actions should be performed only one time per group (ncole)


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

Branch: refs/heads/branch-feature-AMBARI-12556
Commit: ad118045afd5381b7d028294faaa1b8fc3c41b8e
Parents: f8827fe
Author: Nate Cole <nc...@hortonworks.com>
Authored: Thu Mar 30 20:53:17 2017 -0400
Committer: Nate Cole <nc...@hortonworks.com>
Committed: Mon Apr 3 10:25:43 2017 -0400

----------------------------------------------------------------------
 .../state/stack/upgrade/ColocatedGrouping.java  |  80 +++++++-
 .../state/stack/upgrade/TaskWrapperBuilder.java |  10 +-
 .../AmbariManagementControllerTest.java         |   2 +-
 .../ambari/server/state/UpgradeHelperTest.java  | 188 ++++++++++++++++++-
 .../upgrades/upgrade_multi_server_tasks.xml     |  88 +++++++++
 5 files changed, 352 insertions(+), 16 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/ad118045/ambari-server/src/main/java/org/apache/ambari/server/state/stack/upgrade/ColocatedGrouping.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/state/stack/upgrade/ColocatedGrouping.java b/ambari-server/src/main/java/org/apache/ambari/server/state/stack/upgrade/ColocatedGrouping.java
index c939320..272264f 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/state/stack/upgrade/ColocatedGrouping.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/state/stack/upgrade/ColocatedGrouping.java
@@ -18,6 +18,7 @@
 package org.apache.ambari.server.state.stack.upgrade;
 
 import java.util.ArrayList;
+import java.util.Collection;
 import java.util.Collections;
 import java.util.HashMap;
 import java.util.HashSet;
@@ -35,10 +36,14 @@ import org.apache.ambari.server.stack.HostsType;
 import org.apache.ambari.server.state.UpgradeContext;
 import org.apache.ambari.server.state.stack.UpgradePack.ProcessingComponent;
 import org.apache.ambari.server.state.stack.upgrade.StageWrapper.Type;
+import org.apache.commons.collections.CollectionUtils;
+import org.apache.commons.lang.ArrayUtils;
 import org.apache.commons.lang.StringUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import com.google.common.base.Predicate;
+import com.google.common.collect.Collections2;
 import com.google.gson.JsonArray;
 import com.google.gson.JsonObject;
 import com.google.gson.JsonPrimitive;
@@ -95,6 +100,7 @@ public class ColocatedGrouping extends Grouping {
 
         Map<String, List<TaskProxy>> targetMap = ((i++) < count) ? initialBatch : finalBatches;
         List<TaskProxy> targetList = targetMap.get(host);
+
         if (null == targetList) {
           targetList = new ArrayList<>();
           targetMap.put(host, targetList);
@@ -160,8 +166,26 @@ public class ColocatedGrouping extends Grouping {
      * {@inheritDoc}
      */
     @Override
-    public List<StageWrapper> build(UpgradeContext upgradeContext,
-        List<StageWrapper> stageWrappers) {
+    public List<StageWrapper> build(UpgradeContext upgradeContext, List<StageWrapper> stageWrappers) {
+
+      final List<Task> visitedServerSideTasks = new ArrayList<>();
+
+      // !!! predicate to ensure server-side tasks are executed once only per grouping
+      Predicate<Task> predicate = new Predicate<Task>() {
+        @Override
+        public boolean apply(Task input) {
+          if (visitedServerSideTasks.contains(input)) {
+            return false;
+          }
+
+          if (input.getType().isServerAction()) {
+            visitedServerSideTasks.add(input);
+          }
+
+          return true;
+        };
+      };
+
       List<StageWrapper> results = new ArrayList<>(stageWrappers);
 
       if (LOG.isDebugEnabled()) {
@@ -169,7 +193,7 @@ public class ColocatedGrouping extends Grouping {
         LOG.debug("RU final: {}", finalBatches);
       }
 
-      List<StageWrapper> befores = fromProxies(upgradeContext.getDirection(), initialBatch);
+      List<StageWrapper> befores = fromProxies(upgradeContext.getDirection(), initialBatch, predicate);
       results.addAll(befores);
 
       if (!befores.isEmpty()) {
@@ -189,13 +213,14 @@ public class ColocatedGrouping extends Grouping {
         results.add(wrapper);
       }
 
-      results.addAll(fromProxies(upgradeContext.getDirection(), finalBatches));
+      results.addAll(fromProxies(upgradeContext.getDirection(), finalBatches, predicate));
 
       return results;
     }
 
     private List<StageWrapper> fromProxies(Direction direction,
-        Map<String, List<TaskProxy>> wrappers) {
+        Map<String, List<TaskProxy>> wrappers, Predicate<Task> predicate) {
+
       List<StageWrapper> results = new ArrayList<>();
 
       Set<String> serviceChecks = new HashSet<>();
@@ -213,10 +238,27 @@ public class ColocatedGrouping extends Grouping {
 
           if (!t.restart) {
             if (null == wrapper) {
-              wrapper = new StageWrapper(t.type, t.message, t.getTasksArray());
+              TaskWrapper[] tasks = t.getTasksArray(predicate);
+
+              if (LOG.isDebugEnabled()) {
+                for (TaskWrapper tw : tasks) {
+                  LOG.debug("{}", tw);
+                }
+              }
+
+              if (ArrayUtils.isNotEmpty(tasks)) {
+                wrapper = new StageWrapper(t.type, t.message, tasks);
+              }
             }
           } else {
-            execwrappers.add(new StageWrapper(StageWrapper.Type.RESTART, t.message, t.getTasksArray()));
+            TaskWrapper[] tasks = t.getTasksArray(null);
+
+            if (LOG.isDebugEnabled()) {
+              for (TaskWrapper tw : tasks) {
+                LOG.debug("{}", tw);
+              }
+            }
+            execwrappers.add(new StageWrapper(StageWrapper.Type.RESTART, t.message, tasks));
           }
         }
 
@@ -345,8 +387,28 @@ public class ColocatedGrouping extends Grouping {
       return s;
     }
 
-    private TaskWrapper[] getTasksArray() {
-      return tasks.toArray(new TaskWrapper[0]);
+    /**
+     * Get the task wrappers for this proxy.  Server-side tasks cannot be executed more than
+     * one time per grouping.
+     * @param predicate the predicate to determine if a server-side task has already been added to a wrapper.
+     * @return the wrappers for a stage
+     */
+    private TaskWrapper[] getTasksArray(Predicate<Task> predicate) {
+      if (null == predicate) {
+        return tasks.toArray(new TaskWrapper[tasks.size()]);
+      }
+
+      List<TaskWrapper> interim = new ArrayList<>();
+
+      for (TaskWrapper wrapper : tasks) {
+        Collection<Task> filtered = Collections2.filter(wrapper.getTasks(), predicate);
+
+        if (CollectionUtils.isNotEmpty(filtered)) {
+          interim.add(wrapper);
+        }
+      }
+
+      return interim.toArray(new TaskWrapper[interim.size()]);
     }
   }
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/ad118045/ambari-server/src/main/java/org/apache/ambari/server/state/stack/upgrade/TaskWrapperBuilder.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/state/stack/upgrade/TaskWrapperBuilder.java b/ambari-server/src/main/java/org/apache/ambari/server/state/stack/upgrade/TaskWrapperBuilder.java
index bd2bf14..a75fe00 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/state/stack/upgrade/TaskWrapperBuilder.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/state/stack/upgrade/TaskWrapperBuilder.java
@@ -27,6 +27,7 @@ import java.util.Set;
 
 import org.apache.ambari.server.stack.HostsType;
 import org.apache.ambari.server.utils.StageUtils;
+import org.apache.commons.collections.CollectionUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -54,11 +55,10 @@ public class TaskWrapperBuilder {
 
     List<TaskWrapper> collection = new ArrayList<>();
     for (Task t : tasks) {
-      if (t.getType().equals(Task.Type.CONFIGURE) || t.getType().equals(Task.Type.MANUAL)) {
-        // only add the CONFIGURE/MANUAL task if there are actual hosts for the service/component
-        if (null != hostsType.hosts && !hostsType.hosts.isEmpty()) {
-          collection.add(new TaskWrapper(service, component, Collections.singleton(ambariServerHostname), params, t));
-        }
+
+      // only add the server-side task if there are actual hosts for the service/component
+      if (t.getType().isServerAction() && CollectionUtils.isNotEmpty(hostsType.hosts)) {
+        collection.add(new TaskWrapper(service, component, Collections.singleton(ambariServerHostname), params, t));
         continue;
       }
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/ad118045/ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariManagementControllerTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariManagementControllerTest.java b/ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariManagementControllerTest.java
index 483880a..554e089 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariManagementControllerTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariManagementControllerTest.java
@@ -7310,7 +7310,7 @@ public class AmbariManagementControllerTest {
     Assert.assertEquals(1, responsesWithParams.size());
     StackVersionResponse resp = responsesWithParams.iterator().next();
     assertNotNull(resp.getUpgradePacks());
-    assertEquals(12, resp.getUpgradePacks().size());
+    assertEquals(13, resp.getUpgradePacks().size());
     assertTrue(resp.getUpgradePacks().contains("upgrade_test"));
   }
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/ad118045/ambari-server/src/test/java/org/apache/ambari/server/state/UpgradeHelperTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/state/UpgradeHelperTest.java b/ambari-server/src/test/java/org/apache/ambari/server/state/UpgradeHelperTest.java
index 8e5ad0a..0dd7f58 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/state/UpgradeHelperTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/state/UpgradeHelperTest.java
@@ -601,7 +601,7 @@ public class UpgradeHelperTest {
     assertEquals(4, groups.get(0).items.size());
     assertEquals(8, groups.get(1).items.size());
     assertEquals(5, groups.get(2).items.size());
-    assertEquals(8, groups.get(3).items.size());
+    assertEquals(7, groups.get(3).items.size());
     assertEquals(8, groups.get(4).items.size());
   }
 
@@ -943,6 +943,7 @@ public class UpgradeHelperTest {
     Map<String, String> hiveConfigs = new HashMap<>();
     hiveConfigs.put("fooKey", "THIS-BETTER-CHANGE");
     hiveConfigs.put("ifFooKey", "ifFooValue");
+
     ConfigurationRequest configurationRequest = new ConfigurationRequest();
     configurationRequest.setClusterName(cluster.getClusterName());
     configurationRequest.setType("hive-site");
@@ -1870,6 +1871,191 @@ public class UpgradeHelperTest {
     assertTrue(groups.isEmpty());
   }
 
+  @Test
+  public void testMultipleServerTasks() throws Exception {
+
+    // !!! make a two node cluster with just ZK
+    Clusters clusters = injector.getInstance(Clusters.class);
+    ServiceFactory serviceFactory = injector.getInstance(ServiceFactory.class);
+
+    String clusterName = "c1";
+
+    StackId stackId = new StackId("HDP-2.1.1");
+    StackId stackId2 = new StackId("HDP-2.2.0");
+
+    clusters.addCluster(clusterName, stackId);
+    Cluster c = clusters.getCluster(clusterName);
+
+    helper.getOrCreateRepositoryVersion(stackId,
+        c.getDesiredStackVersion().getStackVersion());
+
+    helper.getOrCreateRepositoryVersion(stackId2,"2.2.0");
+
+    helper.getOrCreateRepositoryVersion(stackId2, UPGRADE_VERSION);
+
+    c.createClusterVersion(stackId,
+        c.getDesiredStackVersion().getStackVersion(), "admin",
+        RepositoryVersionState.INSTALLING);
+
+    for (int i = 0; i < 2; i++) {
+      String hostName = "h" + (i+1);
+      clusters.addHost(hostName);
+      Host host = clusters.getHost(hostName);
+
+      Map<String, String> hostAttributes = new HashMap<>();
+      hostAttributes.put("os_family", "redhat");
+      hostAttributes.put("os_release_version", "6");
+      host.setHostAttributes(hostAttributes);
+
+      clusters.mapHostToCluster(hostName, clusterName);
+    }
+
+    // !!! add services
+    c.addService(serviceFactory.createNew(c, "ZOOKEEPER"));
+
+    Service s = c.getService("ZOOKEEPER");
+    ServiceComponent sc = s.addServiceComponent("ZOOKEEPER_SERVER");
+    sc.addServiceComponentHost("h1");
+    sc.addServiceComponentHost("h2");
+
+    sc = s.addServiceComponent("ZOOKEEPER_CLIENT");
+    sc.addServiceComponentHost("h1");
+    sc.addServiceComponentHost("h2");
+
+    EasyMock.reset(m_masterHostResolver);
+
+    expect(m_masterHostResolver.getCluster()).andReturn(c).anyTimes();
+
+    HostsType type = new HostsType();
+    type.hosts.addAll(Arrays.asList("h1", "h2"));
+    expect(m_masterHostResolver.getMasterAndHosts("ZOOKEEPER", "ZOOKEEPER_SERVER")).andReturn(type).anyTimes();
+
+    type = new HostsType();
+    type.hosts.addAll(Arrays.asList("h1", "h2"));
+    expect(m_masterHostResolver.getMasterAndHosts("ZOOKEEPER", "ZOOKEEPER_CLIENT")).andReturn(type).anyTimes();
+
+
+    replay(m_masterHostResolver);
+
+    Map<String, UpgradePack> upgrades = ambariMetaInfo.getUpgradePacks("HDP", "2.1.1");
+
+    ServiceInfo si = ambariMetaInfo.getService("HDP", "2.1.1", "ZOOKEEPER");
+    si.setDisplayName("Zk");
+    ComponentInfo ci = si.getComponentByName("ZOOKEEPER_SERVER");
+    ci.setDisplayName("ZooKeeper1 Server2");
+
+    UpgradePack upgrade = upgrades.get("upgrade_multi_server_tasks");
+    assertNotNull(upgrade);
+
+    UpgradeContext context = m_upgradeContextFactory.create(c, UpgradeType.NON_ROLLING,
+        Direction.UPGRADE, "2.2.0", new HashMap<String, Object>());
+    context.setResolver(m_masterHostResolver);
+
+    List<UpgradeGroupHolder> groups = m_upgradeHelper.createSequence(upgrade, context);
+
+    assertEquals(2, groups.size());
+
+
+    // zk server as a colocated grouping first.  XML says to run a manual, 2 configs, and an execute
+    UpgradeGroupHolder group1 = groups.get(0);
+    assertEquals(7, group1.items.size());
+
+    // Stage 1.  manual, 2 configs, execute
+    assertEquals(4, group1.items.get(0).getTasks().size());
+    TaskWrapper taskWrapper = group1.items.get(0).getTasks().get(0);
+    assertEquals(1, taskWrapper.getTasks().size());
+    assertEquals(Task.Type.MANUAL, taskWrapper.getTasks().get(0).getType());
+
+    taskWrapper = group1.items.get(0).getTasks().get(1);
+    assertEquals(1, taskWrapper.getTasks().size());
+    assertEquals(Task.Type.CONFIGURE, taskWrapper.getTasks().get(0).getType());
+
+    taskWrapper = group1.items.get(0).getTasks().get(2);
+    assertEquals(1, taskWrapper.getTasks().size());
+    assertEquals(Task.Type.CONFIGURE, taskWrapper.getTasks().get(0).getType());
+
+    taskWrapper = group1.items.get(0).getTasks().get(3);
+    assertEquals(1, taskWrapper.getTasks().size());
+    assertEquals(Task.Type.EXECUTE, taskWrapper.getTasks().get(0).getType());
+
+    // Stage 2. restart for h1
+    assertEquals(1, group1.items.get(1).getTasks().size());
+    taskWrapper = group1.items.get(1).getTasks().get(0);
+    assertEquals(1, taskWrapper.getTasks().size());
+    assertEquals(Task.Type.RESTART, taskWrapper.getTasks().get(0).getType());
+    assertTrue(taskWrapper.getHosts().contains("h1"));
+
+    // Stage 3. service check
+    assertEquals(1, group1.items.get(2).getTasks().size());
+    taskWrapper = group1.items.get(2).getTasks().get(0);
+    assertEquals(1, taskWrapper.getTasks().size());
+    assertEquals(Task.Type.SERVICE_CHECK, taskWrapper.getTasks().get(0).getType());
+
+    // stage 4. manual step for validation
+    assertEquals(1, group1.items.get(3).getTasks().size());
+    taskWrapper = group1.items.get(3).getTasks().get(0);
+    assertEquals(1, taskWrapper.getTasks().size());
+    assertEquals(Task.Type.MANUAL, taskWrapper.getTasks().get(0).getType());
+
+    // Stage 5. repeat execute as it's not a server-side task.  no configure or manual tasks
+    assertEquals(1, group1.items.get(4).getTasks().size());
+    taskWrapper = group1.items.get(4).getTasks().get(0);
+    assertEquals(1, taskWrapper.getTasks().size());
+    assertEquals(Task.Type.EXECUTE, taskWrapper.getTasks().get(0).getType());
+
+    // Stage 6. restart for h2.
+    assertEquals(1, group1.items.get(5).getTasks().size());
+    taskWrapper = group1.items.get(5).getTasks().get(0);
+    assertEquals(1, taskWrapper.getTasks().size());
+    assertEquals(Task.Type.RESTART, taskWrapper.getTasks().get(0).getType());
+    assertTrue(taskWrapper.getHosts().contains("h2"));
+
+    // Stage 7. service check
+    assertEquals(1, group1.items.get(6).getTasks().size());
+    taskWrapper = group1.items.get(6).getTasks().get(0);
+    assertEquals(1, taskWrapper.getTasks().size());
+    assertEquals(Task.Type.SERVICE_CHECK, taskWrapper.getTasks().get(0).getType());
+
+
+    // zk client
+    UpgradeGroupHolder group2 = groups.get(1);
+    assertEquals(5, group2.items.size());
+
+    // Stage 1. Configure
+    assertEquals(1, group2.items.get(0).getTasks().size());
+    taskWrapper = group2.items.get(0).getTasks().get(0);
+    assertEquals(1, taskWrapper.getTasks().size());
+    assertEquals(Task.Type.CONFIGURE, taskWrapper.getTasks().get(0).getType());
+
+    // Stage 2. Custom class
+    assertEquals(1, group2.items.get(1).getTasks().size());
+    taskWrapper = group2.items.get(1).getTasks().get(0);
+    assertEquals(1, taskWrapper.getTasks().size());
+    assertEquals(Task.Type.SERVER_ACTION, taskWrapper.getTasks().get(0).getType());
+
+    // Stage 3. Restart client on h1
+    assertEquals(1, group2.items.get(2).getTasks().size());
+    taskWrapper = group2.items.get(2).getTasks().get(0);
+    assertEquals(1, taskWrapper.getTasks().size());
+    assertEquals(Task.Type.RESTART, taskWrapper.getTasks().get(0).getType());
+
+    // Stage 4. Restart client on h2 (no configure or custom class)
+    assertEquals(1, group2.items.get(3).getTasks().size());
+    taskWrapper = group2.items.get(3).getTasks().get(0);
+    assertEquals(1, taskWrapper.getTasks().size());
+    assertEquals(Task.Type.RESTART, taskWrapper.getTasks().get(0).getType());
+
+    // Stage 5. service check
+    assertEquals(1, group2.items.get(4).getTasks().size());
+    taskWrapper = group2.items.get(4).getTasks().get(0);
+    assertEquals(1, taskWrapper.getTasks().size());
+    assertEquals(Task.Type.SERVICE_CHECK, taskWrapper.getTasks().get(0).getType());
+
+  }
+
+
+
+
   /**
    * Tests {@link UpgradeType#HOST_ORDERED}, specifically that the orchestration
    * can properly expand the single {@link HostOrderGrouping} and create the

http://git-wip-us.apache.org/repos/asf/ambari/blob/ad118045/ambari-server/src/test/resources/stacks/HDP/2.1.1/upgrades/upgrade_multi_server_tasks.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/resources/stacks/HDP/2.1.1/upgrades/upgrade_multi_server_tasks.xml b/ambari-server/src/test/resources/stacks/HDP/2.1.1/upgrades/upgrade_multi_server_tasks.xml
new file mode 100644
index 0000000..de99d59
--- /dev/null
+++ b/ambari-server/src/test/resources/stacks/HDP/2.1.1/upgrades/upgrade_multi_server_tasks.xml
@@ -0,0 +1,88 @@
+<?xml version="1.0"?>
+<!--
+   Licensed to the Apache Software Foundation (ASF) under one or more
+   contributor license agreements.  See the NOTICE file distributed with
+   this work for additional information regarding copyright ownership.
+   The ASF licenses this file to You under the Apache License, Version 2.0
+   (the "License"); you may not use this file except in compliance with
+   the License.  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+-->
+<upgrade xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="upgrade-pack.xsd">
+  <target>2.2.*.*</target>
+  <target-stack>HDP-2.2.0</target-stack>
+  <type>ROLLING</type>
+  <prerequisite-checks />
+  
+  <order>
+    <group xsi:type="colocated" name="ZOOKEEPER" title="Zookeeper">
+      <skippable>true</skippable>
+      <allow-retry>false</allow-retry>
+      <service name="ZOOKEEPER">
+        <component>ZOOKEEPER_SERVER</component>
+      </service>
+      
+      <batch>
+        <percent>20</percent>
+        <message>Please run additional tests on {{components}}</message>
+      </batch>
+      
+    </group>
+    
+    <group name="CLIENTS" title="Zookeeper Clients">
+      <skippable>true</skippable>
+      <allow-retry>false</allow-retry>
+      <service name="ZOOKEEPER">
+        <component>ZOOKEEPER_CLIENT</component>
+      </service>
+    </group>
+    
+  </order>
+  
+  <processing>
+    <service name="ZOOKEEPER">
+      <component name="ZOOKEEPER_SERVER">
+        <pre-upgrade>
+          <task xsi:type="manual">
+            <message>This is a manual task with a placeholder of {{foo/bar}}</message>
+          </task>
+          
+          <task xsi:type="configure" id="hdp_2_1_1_zookeeper_new_config_type" />
+          <task xsi:type="configure" id="hdp_2_1_1_zookeeper_new_config_type" />
+          
+         
+          <task xsi:type="execute">
+            <script>foo</script>
+            <function>list</function>
+          </task>
+         
+        </pre-upgrade>
+        <pre-downgrade copy-upgrade="true" />
+        <upgrade>
+          <task xsi:type="restart-task" />
+        </upgrade>
+      </component>
+      
+      <component name="ZOOKEEPER_CLIENT">
+        <pre-upgrade>
+          <task xsi:type="configure" id="hdp_2_1_1_zookeeper_new_config_type" />
+          <task xsi:type="server_action" class="org.apache.ambari.server.serveraction.upgrades.FixLzoCodecPath"/>
+        </pre-upgrade>
+        
+        <pre-downgrade />
+        
+        <upgrade>
+          <task xsi:type="restart-task" />
+        </upgrade>
+      </component>
+      
+    </service>
+  </processing>
+</upgrade>


[46/50] ambari git commit: AMBARI-20691. Fix the default service version numbers in HDP-2.6 service metainfo files (dgrinenko via dlysnichenko)

Posted by jo...@apache.org.
AMBARI-20691. Fix the default service version numbers in HDP-2.6 service metainfo files (dgrinenko via dlysnichenko)


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

Branch: refs/heads/branch-feature-AMBARI-12556
Commit: e8c506f2cd137e7eae2745db987675074208681f
Parents: 28238ae
Author: Lisnichenko Dmitro <dl...@hortonworks.com>
Authored: Thu Apr 6 17:57:56 2017 +0300
Committer: Lisnichenko Dmitro <dl...@hortonworks.com>
Committed: Thu Apr 6 17:58:37 2017 +0300

----------------------------------------------------------------------
 .../main/resources/stacks/HDP/2.6/services/ACCUMULO/metainfo.xml   | 2 +-
 .../src/main/resources/stacks/HDP/2.6/services/ATLAS/metainfo.xml  | 2 +-
 .../src/main/resources/stacks/HDP/2.6/services/DRUID/metainfo.xml  | 2 +-
 .../src/main/resources/stacks/HDP/2.6/services/FALCON/metainfo.xml | 2 +-
 .../src/main/resources/stacks/HDP/2.6/services/FLUME/metainfo.xml  | 2 +-
 .../src/main/resources/stacks/HDP/2.6/services/HBASE/metainfo.xml  | 2 +-
 .../src/main/resources/stacks/HDP/2.6/services/HDFS/metainfo.xml   | 2 +-
 .../src/main/resources/stacks/HDP/2.6/services/HIVE/metainfo.xml   | 2 +-
 .../src/main/resources/stacks/HDP/2.6/services/KAFKA/metainfo.xml  | 2 +-
 .../src/main/resources/stacks/HDP/2.6/services/KNOX/metainfo.xml   | 2 +-
 .../src/main/resources/stacks/HDP/2.6/services/MAHOUT/metainfo.xml | 2 +-
 .../src/main/resources/stacks/HDP/2.6/services/OOZIE/metainfo.xml  | 2 +-
 .../src/main/resources/stacks/HDP/2.6/services/PIG/metainfo.xml    | 2 +-
 .../src/main/resources/stacks/HDP/2.6/services/RANGER/metainfo.xml | 2 +-
 .../main/resources/stacks/HDP/2.6/services/RANGER_KMS/metainfo.xml | 2 +-
 .../src/main/resources/stacks/HDP/2.6/services/SLIDER/metainfo.xml | 2 +-
 .../src/main/resources/stacks/HDP/2.6/services/STORM/metainfo.xml  | 2 +-
 .../src/main/resources/stacks/HDP/2.6/services/YARN/metainfo.xml   | 2 +-
 18 files changed, 18 insertions(+), 18 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/e8c506f2/ambari-server/src/main/resources/stacks/HDP/2.6/services/ACCUMULO/metainfo.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.6/services/ACCUMULO/metainfo.xml b/ambari-server/src/main/resources/stacks/HDP/2.6/services/ACCUMULO/metainfo.xml
index 3f619af..15888ba 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.6/services/ACCUMULO/metainfo.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.6/services/ACCUMULO/metainfo.xml
@@ -20,7 +20,7 @@
   <services>
     <service>
       <name>ACCUMULO</name>
-      <version>1.7.0.2.6</version>
+      <version>1.7.0</version>
     </service>
   </services>
 </metainfo>

http://git-wip-us.apache.org/repos/asf/ambari/blob/e8c506f2/ambari-server/src/main/resources/stacks/HDP/2.6/services/ATLAS/metainfo.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.6/services/ATLAS/metainfo.xml b/ambari-server/src/main/resources/stacks/HDP/2.6/services/ATLAS/metainfo.xml
index a652a7b..6e1a52e 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.6/services/ATLAS/metainfo.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.6/services/ATLAS/metainfo.xml
@@ -20,7 +20,7 @@
   <services>
     <service>
       <name>ATLAS</name>
-      <version>0.8.0.2.6</version>
+      <version>0.8.0</version>
 
       <themes>
         <theme>

http://git-wip-us.apache.org/repos/asf/ambari/blob/e8c506f2/ambari-server/src/main/resources/stacks/HDP/2.6/services/DRUID/metainfo.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.6/services/DRUID/metainfo.xml b/ambari-server/src/main/resources/stacks/HDP/2.6/services/DRUID/metainfo.xml
index fe5ba5f..f1f099e 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.6/services/DRUID/metainfo.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.6/services/DRUID/metainfo.xml
@@ -20,7 +20,7 @@
   <services>
     <service>
       <name>DRUID</name>
-      <version>0.9.2.2.6</version>
+      <version>0.9.2</version>
       <extends>common-services/DRUID/0.9.2</extends>
       <selection>TECH_PREVIEW</selection>
     </service>

http://git-wip-us.apache.org/repos/asf/ambari/blob/e8c506f2/ambari-server/src/main/resources/stacks/HDP/2.6/services/FALCON/metainfo.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.6/services/FALCON/metainfo.xml b/ambari-server/src/main/resources/stacks/HDP/2.6/services/FALCON/metainfo.xml
index b449388..fdeca9b 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.6/services/FALCON/metainfo.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.6/services/FALCON/metainfo.xml
@@ -20,7 +20,7 @@
   <services>
     <service>
       <name>FALCON</name>
-      <version>0.10.0.2.6</version>
+      <version>0.10.0</version>
     </service>
   </services>
 </metainfo>

http://git-wip-us.apache.org/repos/asf/ambari/blob/e8c506f2/ambari-server/src/main/resources/stacks/HDP/2.6/services/FLUME/metainfo.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.6/services/FLUME/metainfo.xml b/ambari-server/src/main/resources/stacks/HDP/2.6/services/FLUME/metainfo.xml
index 0d7cd1f..59a04fd 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.6/services/FLUME/metainfo.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.6/services/FLUME/metainfo.xml
@@ -20,7 +20,7 @@
   <services>
     <service>
       <name>FLUME</name>
-      <version>1.5.2.2.6</version>
+      <version>1.5.2</version>
     </service>
   </services>
 </metainfo>

http://git-wip-us.apache.org/repos/asf/ambari/blob/e8c506f2/ambari-server/src/main/resources/stacks/HDP/2.6/services/HBASE/metainfo.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.6/services/HBASE/metainfo.xml b/ambari-server/src/main/resources/stacks/HDP/2.6/services/HBASE/metainfo.xml
index 9bc3ee2..a6c1530 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.6/services/HBASE/metainfo.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.6/services/HBASE/metainfo.xml
@@ -20,7 +20,7 @@
   <services>
     <service>
       <name>HBASE</name>
-      <version>1.1.2.2.6</version>
+      <version>1.1.2</version>
     </service>
   </services>
 </metainfo>

http://git-wip-us.apache.org/repos/asf/ambari/blob/e8c506f2/ambari-server/src/main/resources/stacks/HDP/2.6/services/HDFS/metainfo.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.6/services/HDFS/metainfo.xml b/ambari-server/src/main/resources/stacks/HDP/2.6/services/HDFS/metainfo.xml
index c80b2b4..f91ed8e 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.6/services/HDFS/metainfo.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.6/services/HDFS/metainfo.xml
@@ -20,7 +20,7 @@
   <services>
     <service>
       <name>HDFS</name>
-      <version>2.7.3.2.6</version>
+      <version>2.7.3</version>
       <configuration-dependencies>
         <config-type>hadoop-metrics2.properties</config-type>
       </configuration-dependencies>

http://git-wip-us.apache.org/repos/asf/ambari/blob/e8c506f2/ambari-server/src/main/resources/stacks/HDP/2.6/services/HIVE/metainfo.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.6/services/HIVE/metainfo.xml b/ambari-server/src/main/resources/stacks/HDP/2.6/services/HIVE/metainfo.xml
index d0c8013..d43a535 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.6/services/HIVE/metainfo.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.6/services/HIVE/metainfo.xml
@@ -20,7 +20,7 @@
   <services>
     <service>
       <name>HIVE</name>
-      <version>1.2.1.2.6</version>
+      <version>1.2.1000</version>
     </service>
     <themes>
       <theme>

http://git-wip-us.apache.org/repos/asf/ambari/blob/e8c506f2/ambari-server/src/main/resources/stacks/HDP/2.6/services/KAFKA/metainfo.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.6/services/KAFKA/metainfo.xml b/ambari-server/src/main/resources/stacks/HDP/2.6/services/KAFKA/metainfo.xml
index 047bbd2..fb28136 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.6/services/KAFKA/metainfo.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.6/services/KAFKA/metainfo.xml
@@ -20,7 +20,7 @@
   <services>
     <service>
       <name>KAFKA</name>
-      <version>0.10.0.2.6</version>
+      <version>0.10.1</version>
     </service>
   </services>
 </metainfo>

http://git-wip-us.apache.org/repos/asf/ambari/blob/e8c506f2/ambari-server/src/main/resources/stacks/HDP/2.6/services/KNOX/metainfo.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.6/services/KNOX/metainfo.xml b/ambari-server/src/main/resources/stacks/HDP/2.6/services/KNOX/metainfo.xml
index cd7b92c..d9283e2 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.6/services/KNOX/metainfo.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.6/services/KNOX/metainfo.xml
@@ -20,7 +20,7 @@
   <services>
     <service>
       <name>KNOX</name>
-      <version>0.11.0.2.6</version>
+      <version>0.12.0</version>
     </service>
   </services>
 </metainfo>

http://git-wip-us.apache.org/repos/asf/ambari/blob/e8c506f2/ambari-server/src/main/resources/stacks/HDP/2.6/services/MAHOUT/metainfo.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.6/services/MAHOUT/metainfo.xml b/ambari-server/src/main/resources/stacks/HDP/2.6/services/MAHOUT/metainfo.xml
index 3fe4d57..d5b0149 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.6/services/MAHOUT/metainfo.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.6/services/MAHOUT/metainfo.xml
@@ -20,7 +20,7 @@
   <services>
     <service>
       <name>MAHOUT</name>
-      <version>0.9.0.2.6</version>
+      <version>0.9.0</version>
     </service>
   </services>
 </metainfo>

http://git-wip-us.apache.org/repos/asf/ambari/blob/e8c506f2/ambari-server/src/main/resources/stacks/HDP/2.6/services/OOZIE/metainfo.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.6/services/OOZIE/metainfo.xml b/ambari-server/src/main/resources/stacks/HDP/2.6/services/OOZIE/metainfo.xml
index 19b8bae..c9dfaad 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.6/services/OOZIE/metainfo.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.6/services/OOZIE/metainfo.xml
@@ -20,7 +20,7 @@
   <services>
     <service>
       <name>OOZIE</name>
-      <version>4.2.0.2.6</version>
+      <version>4.2.0</version>
       <configuration-dependencies>
         <config-type>application-properties</config-type>
       </configuration-dependencies>

http://git-wip-us.apache.org/repos/asf/ambari/blob/e8c506f2/ambari-server/src/main/resources/stacks/HDP/2.6/services/PIG/metainfo.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.6/services/PIG/metainfo.xml b/ambari-server/src/main/resources/stacks/HDP/2.6/services/PIG/metainfo.xml
index 266aa5e..ef9e487 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.6/services/PIG/metainfo.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.6/services/PIG/metainfo.xml
@@ -20,7 +20,7 @@
   <services>
     <service>
       <name>PIG</name>
-      <version>0.16.0.2.6</version>
+      <version>0.16.0</version>
     </service>
   </services>
 </metainfo>

http://git-wip-us.apache.org/repos/asf/ambari/blob/e8c506f2/ambari-server/src/main/resources/stacks/HDP/2.6/services/RANGER/metainfo.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.6/services/RANGER/metainfo.xml b/ambari-server/src/main/resources/stacks/HDP/2.6/services/RANGER/metainfo.xml
index 01d1cbf..3516bef 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.6/services/RANGER/metainfo.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.6/services/RANGER/metainfo.xml
@@ -24,7 +24,7 @@
     <service>
       <name>RANGER</name>
       <extends>common-services/RANGER/0.7.0</extends>
-      <version>0.7.0.2.6</version>
+      <version>0.7.0</version>
     </service>
   </services>
 </metainfo>

http://git-wip-us.apache.org/repos/asf/ambari/blob/e8c506f2/ambari-server/src/main/resources/stacks/HDP/2.6/services/RANGER_KMS/metainfo.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.6/services/RANGER_KMS/metainfo.xml b/ambari-server/src/main/resources/stacks/HDP/2.6/services/RANGER_KMS/metainfo.xml
index 1c0a2db..bb5a8c2 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.6/services/RANGER_KMS/metainfo.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.6/services/RANGER_KMS/metainfo.xml
@@ -23,7 +23,7 @@
   <services>
     <service>
       <name>RANGER_KMS</name>
-      <version>0.7.0.2.6</version>
+      <version>0.7.0</version>
     </service>
   </services>
 </metainfo>

http://git-wip-us.apache.org/repos/asf/ambari/blob/e8c506f2/ambari-server/src/main/resources/stacks/HDP/2.6/services/SLIDER/metainfo.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.6/services/SLIDER/metainfo.xml b/ambari-server/src/main/resources/stacks/HDP/2.6/services/SLIDER/metainfo.xml
index 692eb8a..112b6a0 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.6/services/SLIDER/metainfo.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.6/services/SLIDER/metainfo.xml
@@ -20,7 +20,7 @@
   <services>
     <service>
       <name>SLIDER</name>
-      <version>0.91.0</version>
+      <version>0.92.0</version>
     </service>
   </services>
 </metainfo>

http://git-wip-us.apache.org/repos/asf/ambari/blob/e8c506f2/ambari-server/src/main/resources/stacks/HDP/2.6/services/STORM/metainfo.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.6/services/STORM/metainfo.xml b/ambari-server/src/main/resources/stacks/HDP/2.6/services/STORM/metainfo.xml
index 826056f..db5c8b8 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.6/services/STORM/metainfo.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.6/services/STORM/metainfo.xml
@@ -21,7 +21,7 @@
   <services>
     <service>
       <name>STORM</name>
-      <version>1.0.1</version>
+      <version>1.1.0</version>
     </service>
   </services>
 </metainfo>

http://git-wip-us.apache.org/repos/asf/ambari/blob/e8c506f2/ambari-server/src/main/resources/stacks/HDP/2.6/services/YARN/metainfo.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.6/services/YARN/metainfo.xml b/ambari-server/src/main/resources/stacks/HDP/2.6/services/YARN/metainfo.xml
index 801df78..b1a5d45 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.6/services/YARN/metainfo.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.6/services/YARN/metainfo.xml
@@ -25,7 +25,7 @@
     </service>
     <service>
       <name>MAPREDUCE2</name>
-      <version>2.7.3.2.6</version>
+      <version>2.7.3</version>
       <configuration-dir>configuration-mapred</configuration-dir>
     </service>
   </services>


[02/50] ambari git commit: AMBARI-20641. Pig view fails to load when using ambari thru KNOX. (gauravn7)

Posted by jo...@apache.org.
AMBARI-20641. Pig view fails to load when using ambari thru KNOX. (gauravn7)


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

Branch: refs/heads/branch-feature-AMBARI-12556
Commit: b88512e719f894d9ab3d5cb956a29f21e44fc29a
Parents: 1a08c49
Author: Gaurav Nagar <gr...@gmail.com>
Authored: Sat Apr 1 08:59:53 2017 +0530
Committer: Gaurav Nagar <gr...@gmail.com>
Committed: Sat Apr 1 08:59:53 2017 +0530

----------------------------------------------------------------------
 .../pig/src/main/resources/ui/pig-web/app/app.js | 19 +++++++++++--------
 1 file changed, 11 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/b88512e7/contrib/views/pig/src/main/resources/ui/pig-web/app/app.js
----------------------------------------------------------------------
diff --git a/contrib/views/pig/src/main/resources/ui/pig-web/app/app.js b/contrib/views/pig/src/main/resources/ui/pig-web/app/app.js
index c683f72..35cce9d 100644
--- a/contrib/views/pig/src/main/resources/ui/pig-web/app/app.js
+++ b/contrib/views/pig/src/main/resources/ui/pig-web/app/app.js
@@ -25,16 +25,19 @@ module.exports = Em.Application.create({
   errorLog: "",
 
   getNamespaceUrl: function() {
-    var parts = window.location.pathname.match(/\/[^\/]*/g);
-    var view = parts[1];
-    var version = '/versions' + parts[2];
-    var instance = parts[3];
-    if (parts.length == 4) { // version is not present
-      instance = parts[2];
+    var parts = window.location.pathname.split('/').filter(function (i) {
+      return i !== "";
+    });
+    var view = parts[parts.length - 3];
+    var version = '/versions/' + parts[parts.length - 2];
+    var instance = parts[parts.length - 1];
+
+    if (!/^(\d+\.){2,3}\d+$/.test(parts[parts.length - 2])) { // version is not present
+      instance = parts[parts.length - 2];
       version = '';
     }
-    var namespaceUrl = 'api/v1/views' + view + version + '/instances' + instance;
-    return namespaceUrl;
+    var namespaceUrl = 'api/v1/views/' + view + version + '/instances/' + instance;
+    return namespaceUrl.replace(/^\/|\/$/g, ''); //remove starting slash if proxied through knox
   },
 
   Resolver: Ember.DefaultResolver.extend({


[18/50] ambari git commit: AMBARI-20648. Ambari Agent Distro/Conf Select Versions alert is not functioning correctly since missing format index when using Python 2.6 (alejandro)

Posted by jo...@apache.org.
AMBARI-20648. Ambari Agent Distro/Conf Select Versions alert is not functioning correctly since missing format index when using Python 2.6 (alejandro)


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

Branch: refs/heads/branch-feature-AMBARI-12556
Commit: dca1ebd6be1c3843afb074e6d03bdd53508e08a5
Parents: ba63ea3
Author: Alejandro Fernandez <af...@hortonworks.com>
Authored: Fri Mar 31 14:39:30 2017 -0700
Committer: Alejandro Fernandez <af...@hortonworks.com>
Committed: Mon Apr 3 16:19:44 2017 -0700

----------------------------------------------------------------------
 .../main/resources/host_scripts/alert_version_select.py   | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/dca1ebd6/ambari-server/src/main/resources/host_scripts/alert_version_select.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/host_scripts/alert_version_select.py b/ambari-server/src/main/resources/host_scripts/alert_version_select.py
index 118911f..0ce79e7 100644
--- a/ambari-server/src/main/resources/host_scripts/alert_version_select.py
+++ b/ambari-server/src/main/resources/host_scripts/alert_version_select.py
@@ -70,7 +70,7 @@ def execute(configurations={}, parameters={}, host_name=None):
     stack_tools_str = configurations[STACK_TOOLS]
 
     if stack_tools_str is None:
-      return (RESULT_STATE_UNKNOWN, ['{} is a required parameter for the script and the value is null'.format(STACK_TOOLS)])
+      return (RESULT_STATE_UNKNOWN, ['{0} is a required parameter for the script and the value is null'.format(STACK_TOOLS)])
 
     distro_select = "unknown-distro-select"
     try:
@@ -87,18 +87,18 @@ def execute(configurations={}, parameters={}, host_name=None):
       (code, out, versions) = unsafe_get_stack_versions()
 
       if code == 0:
-        msg.append("Ok. {}".format(distro_select))
+        msg.append("Ok. {0}".format(distro_select))
         if versions is not None and type(versions) is list and len(versions) > 0:
-          msg.append("Versions: {}".format(", ".join(versions)))
+          msg.append("Versions: {0}".format(", ".join(versions)))
         return (RESULT_STATE_OK, ["\n".join(msg)])
       else:
-        msg.append("Failed, check dir {} for unexpected contents.".format(stack_root_dir))
+        msg.append("Failed, check dir {0} for unexpected contents.".format(stack_root_dir))
         if out is not None:
           msg.append(out)
 
         return (RESULT_STATE_CRITICAL, ["\n".join(msg)])
     else:
-      msg.append("Ok. No stack root {} to check.".format(stack_root_dir))
+      msg.append("Ok. No stack root {0} to check.".format(stack_root_dir))
       return (RESULT_STATE_OK, ["\n".join(msg)])
   except Exception, e:
     return (RESULT_STATE_CRITICAL, [e.message])


[24/50] ambari git commit: AMBARI-20573. Hive view 2.0 fails on LLAP (Gaurav Nagar via nitirajrathore)

Posted by jo...@apache.org.
AMBARI-20573. Hive view 2.0 fails on LLAP (Gaurav Nagar via nitirajrathore)


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

Branch: refs/heads/branch-feature-AMBARI-12556
Commit: 1022fdbc5a98b6f17d7a2745d2ca55c4b1fdba6d
Parents: a1d58c1
Author: Nitiraj Singh Rathore <ni...@gmail.com>
Authored: Tue Apr 4 12:43:23 2017 +0530
Committer: Nitiraj Singh Rathore <ni...@gmail.com>
Committed: Tue Apr 4 12:43:23 2017 +0530

----------------------------------------------------------------------
 .../apache/ambari/server/view/ViewRegistry.java | 51 ++++++++++++++++++--
 1 file changed, 48 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/1022fdbc/ambari-server/src/main/java/org/apache/ambari/server/view/ViewRegistry.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/view/ViewRegistry.java b/ambari-server/src/main/java/org/apache/ambari/server/view/ViewRegistry.java
index 5b58abc..c7b2f79 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/view/ViewRegistry.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/view/ViewRegistry.java
@@ -85,6 +85,7 @@ import org.apache.ambari.server.orm.entities.ViewEntity;
 import org.apache.ambari.server.orm.entities.ViewEntityEntity;
 import org.apache.ambari.server.orm.entities.ViewInstanceDataEntity;
 import org.apache.ambari.server.orm.entities.ViewInstanceEntity;
+import org.apache.ambari.server.orm.entities.ViewInstancePropertyEntity;
 import org.apache.ambari.server.orm.entities.ViewParameterEntity;
 import org.apache.ambari.server.orm.entities.ViewResourceEntity;
 import org.apache.ambari.server.orm.entities.ViewURLEntity;
@@ -93,6 +94,8 @@ import org.apache.ambari.server.security.authorization.AuthorizationHelper;
 import org.apache.ambari.server.security.authorization.ResourceType;
 import org.apache.ambari.server.security.authorization.RoleAuthorization;
 import org.apache.ambari.server.state.Clusters;
+import org.apache.ambari.server.state.Service;
+import org.apache.ambari.server.state.ServiceComponent;
 import org.apache.ambari.server.state.StackId;
 import org.apache.ambari.server.state.stack.OsFamily;
 import org.apache.ambari.server.utils.Closeables;
@@ -988,7 +991,7 @@ public class ViewRegistry {
 
         try {
           if (checkAutoInstanceConfig(autoConfig, stackId, event.getServiceName(), serviceNames)) {
-            installAutoInstance(clusterId, clusterName, viewEntity, viewName, viewConfig, autoConfig, roles);
+            installAutoInstance(clusterId, clusterName, cluster.getService(event.getServiceName()), viewEntity, viewName, viewConfig, autoConfig, roles);
           }
         } catch (Exception e) {
           LOG.error("Can't auto create instance of view " + viewName + " for cluster " + clusterName +
@@ -1000,9 +1003,10 @@ public class ViewRegistry {
     }
   }
 
-  private void installAutoInstance(Long clusterId, String clusterName, ViewEntity viewEntity, String viewName, ViewConfig viewConfig, AutoInstanceConfig autoConfig, Collection<String> roles) throws SystemException, ValidationException {
+  private void installAutoInstance(Long clusterId, String clusterName, Service service, ViewEntity viewEntity, String viewName, ViewConfig viewConfig, AutoInstanceConfig autoConfig, Collection<String> roles) throws SystemException, ValidationException {
     LOG.info("Auto creating instance of view " + viewName + " for cluster " + clusterName + ".");
     ViewInstanceEntity viewInstanceEntity = createViewInstanceEntity(viewEntity, viewConfig, autoConfig);
+    updateHiveLLAPSettingsIfRequired(viewInstanceEntity, service);
     viewInstanceEntity.setClusterHandle(clusterId);
     installViewInstance(viewInstanceEntity);
     setViewInstanceRoleAccess(viewInstanceEntity, roles);
@@ -1015,6 +1019,47 @@ public class ViewRegistry {
 
   }
 
+  /**
+   * Checks is service is 'HIVE' and INTERACTIVE_SERVICE(LLAP) is enabled. Then, it sets the view instance
+   * parameter 'use.hive.interactive.mode' for the 'AUTO_INSTANCE_VIEW' to be true.
+   * @param viewInstanceEntity
+   * @param service
+   */
+  private void updateHiveLLAPSettingsIfRequired(ViewInstanceEntity viewInstanceEntity, Service service) {
+    String INTERACTIVE_KEY = "use.hive.interactive.mode";
+    String LLAP_COMPONENT_NAME = "HIVE_SERVER_INTERACTIVE";
+    String viewVersion = viewInstanceEntity.getViewDefinition().getVersion();
+    String viewName = viewInstanceEntity.getViewDefinition().getViewName();
+    if(!viewName.equalsIgnoreCase("HIVE") || viewVersion.equalsIgnoreCase("1.0.0")) {
+      return;
+    }
+
+    try {
+      ServiceComponent component = service.getServiceComponent(LLAP_COMPONENT_NAME);
+      if (component.getServiceComponentHosts().size() == 0) {
+        // The LLAP server is not installed in any of the hosts. Hence, return;
+        return;
+      }
+
+      for (Map.Entry<String, String> property : viewInstanceEntity.getPropertyMap().entrySet()) {
+        if (INTERACTIVE_KEY.equals(property.getKey()) && (!"true".equalsIgnoreCase(property.getValue()))) {
+          ViewInstancePropertyEntity propertyEntity = new ViewInstancePropertyEntity();
+          propertyEntity.setViewInstanceName(viewInstanceEntity.getName());
+          propertyEntity.setViewName(viewInstanceEntity.getViewName());
+          propertyEntity.setName(INTERACTIVE_KEY);
+          propertyEntity.setValue("true");
+          propertyEntity.setViewInstanceEntity(viewInstanceEntity);
+          viewInstanceEntity.getProperties().add(propertyEntity);
+        }
+      }
+
+    } catch (AmbariException e) {
+      LOG.error("Failed to update '{}' parameter for viewName: {}, version: {}. Exception: {}",
+          INTERACTIVE_KEY, viewName, viewVersion, e);
+    }
+
+  }
+
   private String getUrlName(ViewInstanceEntity viewInstanceEntity) {
     return viewInstanceEntity.getViewEntity().getCommonName().toLowerCase() + "_" + viewInstanceEntity.getInstanceName().toLowerCase();
   }
@@ -1920,7 +1965,7 @@ public class ViewRegistry {
         try {
 
           if (checkAutoInstanceConfig(autoInstanceConfig, stackId, service, serviceNames)) {
-            installAutoInstance(clusterId, clusterName, viewEntity, viewName, viewConfig, autoInstanceConfig, roles);
+            installAutoInstance(clusterId, clusterName, cluster.getService(service), viewEntity, viewName, viewConfig, autoInstanceConfig, roles);
           }
         } catch (Exception e) {
           LOG.error("Can't auto create instance of view " + viewName + " for cluster " + clusterName +


[10/50] ambari git commit: AMBARI-20632. With multi-process StatusCommandsExecutor, Status commands are taking too long to report back (echekanskiy)

Posted by jo...@apache.org.
AMBARI-20632. With multi-process StatusCommandsExecutor, Status commands are taking too long to report back (echekanskiy)


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

Branch: refs/heads/branch-feature-AMBARI-12556
Commit: f8827fea405482289a8849ebe2a7dcf2fee11294
Parents: f389293
Author: Eugene Chekanskiy <ec...@hortonworks.com>
Authored: Mon Apr 3 16:46:27 2017 +0300
Committer: Eugene Chekanskiy <ec...@hortonworks.com>
Committed: Mon Apr 3 16:46:27 2017 +0300

----------------------------------------------------------------------
 .../ambari_agent/StatusCommandsExecutor.py      | 209 +++++++++----------
 .../src/main/python/ambari_agent/main.py        |   5 +-
 2 files changed, 98 insertions(+), 116 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/f8827fea/ambari-agent/src/main/python/ambari_agent/StatusCommandsExecutor.py
----------------------------------------------------------------------
diff --git a/ambari-agent/src/main/python/ambari_agent/StatusCommandsExecutor.py b/ambari-agent/src/main/python/ambari_agent/StatusCommandsExecutor.py
index 04a3e85..142e7ca 100644
--- a/ambari-agent/src/main/python/ambari_agent/StatusCommandsExecutor.py
+++ b/ambari-agent/src/main/python/ambari_agent/StatusCommandsExecutor.py
@@ -49,7 +49,7 @@ class SingleProcessStatusCommandsExecutor(StatusCommandsExecutor):
     self.config = config
     self.actionQueue = actionQueue
     self.statusCommandQueue = Queue.Queue()
-    self.need_relaunch = False
+    self.need_relaunch = (False, None) #  tuple (bool, str|None) with flag to relaunch and reason of relaunch
 
   def put_commands(self, commands):
     with self.statusCommandQueue.mutex:
@@ -88,12 +88,13 @@ class MultiProcessStatusCommandsExecutor(StatusCommandsExecutor):
     self.config = config
     self.actionQueue = actionQueue
 
-    self._can_relaunch_lock = threading.RLock()
-    self._can_relaunch = True
+    self.can_relaunch = True
 
     # used to prevent queues from been used during creation of new one to prevent threads messing up with combination of
     # old and new queues
     self.usage_lock = threading.RLock()
+    # protects against simultaneous killing/creating from different threads.
+    self.kill_lock = threading.RLock()
 
     self.status_command_timeout = int(self.config.get('agent', 'status_command_timeout', 5))
     self.customServiceOrchestrator = self.actionQueue.customServiceOrchestrator
@@ -107,42 +108,32 @@ class MultiProcessStatusCommandsExecutor(StatusCommandsExecutor):
     self.mp_result_logs = multiprocessing.Queue()
     self.mp_task_queue = multiprocessing.Queue()
 
-  @property
-  def can_relaunch(self):
-    with self._can_relaunch_lock:
-      return self._can_relaunch
-
-  @can_relaunch.setter
-  def can_relaunch(self, value):
-    with self._can_relaunch_lock:
-      self._can_relaunch = value
-
-  def _log_message(self, level, message, exception=None):
-    """
-    Put log message to logging queue. Must be used only for logging from child process(in _worker_process_target).
-
-    :param level:
-    :param message:
-    :param exception:
-    :return:
+  def _drain_queue(self, target_queue, max_time=5, max_empty_count=15, read_break=.001):
     """
-    result_message = "StatusCommandExecutor reporting at {0}: ".format(time.time()) + message
-    self.mp_result_logs.put((level, result_message, exception))
-
-  def _get_log_messages(self):
-    """
-    Returns list of (level, message, exception) log messages.
-
-    :return: list of (level, message, exception)
+    Read everything that available in queue. Using not reliable multiprocessing.Queue methods(qsize, empty), so contains
+    extremely dumb protection against blocking too much at this method: will try to get all possible items for not more
+    than ``max_time`` seconds; will return after ``max_empty_count`` calls of ``target_queue.get(False)`` that raised
+    ``Queue.Empty`` exception. Notice ``read_break`` argument, with default values this method will be able to read
+    ~4500 ``range(1,10000)`` objects for 5 seconds. So don't fill queue too fast.
+
+    :param target_queue: queue to read from
+    :param max_time: maximum time to spend in this method call
+    :param max_empty_count: maximum allowed ``Queue.Empty`` in a row
+    :param read_break: time to wait before next read cycle iteration
+    :return: list of resulting objects
     """
     results = []
+    _empty = 0
+    _start = time.time()
     with self.usage_lock:
       try:
-        while not self.mp_result_logs.empty():
+        while (not target_queue.empty() or target_queue.qsize() > 0) and time.time() - _start < max_time and _empty < max_empty_count:
           try:
-            results.append(self.mp_result_logs.get(False))
+            results.append(target_queue.get(False))
+            _empty = 0
+            time.sleep(read_break) # sleep a little to get more accurate empty and qsize results
           except Queue.Empty:
-            pass
+            _empty += 1
           except IOError:
             pass
           except UnicodeDecodeError:
@@ -151,11 +142,23 @@ class MultiProcessStatusCommandsExecutor(StatusCommandsExecutor):
         pass
     return results
 
+  def _log_message(self, level, message, exception=None):
+    """
+    Put log message to logging queue. Must be used only for logging from child process(in _worker_process_target).
+
+    :param level:
+    :param message:
+    :param exception:
+    :return:
+    """
+    result_message = "StatusCommandExecutor reporting at {0}: ".format(time.time()) + message
+    self.mp_result_logs.put((level, result_message, exception))
+
   def _process_logs(self):
     """
     Get all available at this moment logs and prints them to logger.
     """
-    for level, message, exception in self._get_log_messages():
+    for level, message, exception in self._drain_queue(self.mp_result_logs):
       if level == logging.ERROR:
         logger.debug(message, exc_info=exception)
       if level == logging.WARN:
@@ -256,16 +259,6 @@ class MultiProcessStatusCommandsExecutor(StatusCommandsExecutor):
     :return:
     """
     with self.usage_lock:
-      if not self.mp_task_queue.empty():
-        status_command_queue_size = 0
-        try:
-          while not self.mp_task_queue.empty():
-            self.mp_task_queue.get(False)
-            status_command_queue_size += 1
-        except Queue.Empty:
-          pass
-
-        logger.info("Number of status commands removed from queue : " + str(status_command_queue_size))
       for command in commands:
         logger.info("Adding " + command['commandType'] + " for component " + \
                     command['componentName'] + " of service " + \
@@ -276,43 +269,29 @@ class MultiProcessStatusCommandsExecutor(StatusCommandsExecutor):
 
   def process_results(self):
     """
-    Process all the results from the internal worker
+    Process all the results from the SCE worker process.
     """
     self._process_logs()
-    for result in self._get_results():
+    results = self._drain_queue(self.mp_result_queue)
+    logger.debug("Drained %s status commands results, ~%s remains in queue", len(results), self.mp_result_queue.qsize())
+    for result in results:
       try:
         self.actionQueue.process_status_command_result(result)
       except UnicodeDecodeError:
         pass
 
-  def _get_results(self):
-    """
-    Get all available results for status commands.
-
-    :return: list of results
-    """
-    results = []
-    with self.usage_lock:
-      try:
-        while not self.mp_result_queue.empty():
-          try:
-            results.append(self.mp_result_queue.get(False))
-          except Queue.Empty:
-            pass
-          except IOError:
-            pass
-          except UnicodeDecodeError:
-            pass
-      except IOError:
-        pass
-    return results
-
   @property
   def need_relaunch(self):
     """
     Indicates if process need to be relaunched due to timeout or it is dead or even was not created.
+
+    :return: tuple (bool, str|None) with flag to relaunch and reason of relaunch
     """
-    return self.timedOutEvent.is_set() or not self.worker_process or not self.worker_process.is_alive()
+    if not self.worker_process or not self.worker_process.is_alive():
+      return True, "WORKER_DEAD"
+    elif self.timedOutEvent.is_set():
+      return True, "COMMAND_TIMEOUT"
+    return False, None
 
   def relaunch(self, reason=None):
     """
@@ -321,13 +300,15 @@ class MultiProcessStatusCommandsExecutor(StatusCommandsExecutor):
     :param reason: reason of restart
     :return:
     """
-    if self.can_relaunch:
-      self.kill(reason)
-      self.worker_process = multiprocessing.Process(target=self._worker_process_target)
-      self.worker_process.start()
-      logger.info("Started process with pid {0}".format(self.worker_process.pid))
-    else:
-      logger.debug("Relaunch does not allowed, can not relaunch")
+    with self.kill_lock:
+      logger.info("Relaunching child process reason:" + str(reason))
+      if self.can_relaunch:
+        self.kill(reason)
+        self.worker_process = multiprocessing.Process(target=self._worker_process_target)
+        self.worker_process.start()
+        logger.info("Started process with pid {0}".format(self.worker_process.pid))
+      else:
+        logger.debug("Relaunch does not allowed, can not relaunch")
 
   def kill(self, reason=None, can_relaunch=True):
     """
@@ -339,43 +320,43 @@ class MultiProcessStatusCommandsExecutor(StatusCommandsExecutor):
     :param reason: reason of killing
     :return:
     """
-    logger.info("Killing child process reason:" + str(reason))
-    self.can_relaunch = can_relaunch
-
-    if not self.can_relaunch:
-      logger.info("Killing without possibility to relaunch...")
-
-    # try graceful stop, otherwise hard-kill
-    if self.worker_process and self.worker_process.is_alive():
-      self.mustDieEvent.set()
-      self.worker_process.join(timeout=3)
-      if self.worker_process.is_alive():
-        os.kill(self.worker_process.pid, signal.SIGKILL)
-        logger.info("Child process killed by -9")
+    with self.kill_lock:
+      self.can_relaunch = can_relaunch
+
+      if not self.can_relaunch:
+        logger.info("Killing without possibility to relaunch...")
+
+      # try graceful stop, otherwise hard-kill
+      if self.worker_process and self.worker_process.is_alive():
+        self.mustDieEvent.set()
+        self.worker_process.join(timeout=3)
+        if self.worker_process.is_alive():
+          os.kill(self.worker_process.pid, signal.SIGKILL)
+          logger.info("Child process killed by -9")
+        else:
+          # get log messages only if we died gracefully, otherwise we will have chance to block here forever, in most cases
+          # this call will do nothing, as all logs will be processed in ActionQueue loop
+          self._process_logs()
+          logger.info("Child process died gracefully")
       else:
-        # get log messages only if we died gracefully, otherwise we will have chance to block here forever, in most cases
-        # this call will do nothing, as all logs will be processed in ActionQueue loop
-        self._process_logs()
-        logger.info("Child process died gracefully")
-    else:
-      logger.info("Child process already dead")
-
-    # close queues and acquire usage lock
-    # closing both sides of pipes here, we need this hack in case of blocking on recv() call
-    self.mp_result_queue.close()
-    self.mp_result_queue._writer.close()
-    self.mp_result_logs.close()
-    self.mp_result_logs._writer.close()
-    self.mp_task_queue.close()
-    self.mp_task_queue._writer.close()
-
-    with self.usage_lock:
-      self.mp_result_queue.join_thread()
-      self.mp_result_queue = multiprocessing.Queue()
-      self.mp_task_queue.join_thread()
-      self.mp_task_queue = multiprocessing.Queue()
-      self.mp_result_logs.join_thread()
-      self.mp_result_logs = multiprocessing.Queue()
-      self.customServiceOrchestrator = self.actionQueue.customServiceOrchestrator
-      self.mustDieEvent.clear()
-      self.timedOutEvent.clear()
+        logger.info("Child process already dead")
+
+      # close queues and acquire usage lock
+      # closing both sides of pipes here, we need this hack in case of blocking on recv() call
+      self.mp_result_queue.close()
+      self.mp_result_queue._writer.close()
+      self.mp_result_logs.close()
+      self.mp_result_logs._writer.close()
+      self.mp_task_queue.close()
+      self.mp_task_queue._writer.close()
+
+      with self.usage_lock:
+        self.mp_result_queue.join_thread()
+        self.mp_result_queue = multiprocessing.Queue()
+        self.mp_task_queue.join_thread()
+        self.mp_task_queue = multiprocessing.Queue()
+        self.mp_result_logs.join_thread()
+        self.mp_result_logs = multiprocessing.Queue()
+        self.customServiceOrchestrator = self.actionQueue.customServiceOrchestrator
+        self.mustDieEvent.clear()
+        self.timedOutEvent.clear()

http://git-wip-us.apache.org/repos/asf/ambari/blob/f8827fea/ambari-agent/src/main/python/ambari_agent/main.py
----------------------------------------------------------------------
diff --git a/ambari-agent/src/main/python/ambari_agent/main.py b/ambari-agent/src/main/python/ambari_agent/main.py
index 923c570..19c92b0 100644
--- a/ambari-agent/src/main/python/ambari_agent/main.py
+++ b/ambari-agent/src/main/python/ambari_agent/main.py
@@ -352,8 +352,9 @@ def run_threads(server_hostname, heartbeat_stop_callback):
   while controller.is_alive():
     time.sleep(0.1)
 
-    if controller.get_status_commands_executor().need_relaunch:
-      controller.get_status_commands_executor().relaunch("COMMAND_TIMEOUT_OR_KILLED")
+    need_relaunch, reason = controller.get_status_commands_executor().need_relaunch
+    if need_relaunch:
+      controller.get_status_commands_executor().relaunch(reason)
 
   controller.get_status_commands_executor().kill("AGENT_STOPPED", can_relaunch=False)
 


[16/50] ambari git commit: AMBARI-20663. During finalize of HDP upgrade, Ambari should provide a message regarding HBase snapshots (dlysnichenko)

Posted by jo...@apache.org.
AMBARI-20663. During finalize of HDP upgrade, Ambari should provide a message regarding HBase snapshots (dlysnichenko)


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

Branch: refs/heads/branch-feature-AMBARI-12556
Commit: 48af3ee8dbe221872abd8ac4fc736acfa30f78ba
Parents: 8f95262
Author: Lisnichenko Dmitro <dl...@hortonworks.com>
Authored: Mon Apr 3 21:36:20 2017 +0300
Committer: Lisnichenko Dmitro <dl...@hortonworks.com>
Committed: Mon Apr 3 21:36:20 2017 +0300

----------------------------------------------------------------------
 .../stacks/HDP/2.3/upgrades/nonrolling-upgrade-2.3.xml    | 10 ++++++++++
 .../stacks/HDP/2.3/upgrades/nonrolling-upgrade-2.4.xml    | 10 ++++++++++
 .../stacks/HDP/2.3/upgrades/nonrolling-upgrade-2.5.xml    | 10 ++++++++++
 .../stacks/HDP/2.3/upgrades/nonrolling-upgrade-2.6.xml    | 10 ++++++++++
 .../resources/stacks/HDP/2.3/upgrades/upgrade-2.3.xml     | 10 ++++++++++
 .../resources/stacks/HDP/2.3/upgrades/upgrade-2.4.xml     | 10 ++++++++++
 .../resources/stacks/HDP/2.3/upgrades/upgrade-2.5.xml     | 10 ++++++++++
 .../resources/stacks/HDP/2.3/upgrades/upgrade-2.6.xml     | 10 ++++++++++
 .../stacks/HDP/2.4/upgrades/nonrolling-upgrade-2.4.xml    | 10 ++++++++++
 .../stacks/HDP/2.4/upgrades/nonrolling-upgrade-2.5.xml    | 10 ++++++++++
 .../stacks/HDP/2.4/upgrades/nonrolling-upgrade-2.6.xml    | 10 ++++++++++
 .../resources/stacks/HDP/2.4/upgrades/upgrade-2.4.xml     | 10 ++++++++++
 .../resources/stacks/HDP/2.4/upgrades/upgrade-2.5.xml     | 10 ++++++++++
 .../resources/stacks/HDP/2.4/upgrades/upgrade-2.6.xml     | 10 ++++++++++
 .../stacks/HDP/2.5/upgrades/nonrolling-upgrade-2.5.xml    | 10 ++++++++++
 .../stacks/HDP/2.5/upgrades/nonrolling-upgrade-2.6.xml    | 10 ++++++++++
 .../resources/stacks/HDP/2.5/upgrades/upgrade-2.5.xml     | 10 ++++++++++
 .../resources/stacks/HDP/2.5/upgrades/upgrade-2.6.xml     | 10 ++++++++++
 .../stacks/HDP/2.6/upgrades/nonrolling-upgrade-2.6.xml    | 10 ++++++++++
 .../resources/stacks/HDP/2.6/upgrades/upgrade-2.6.xml     | 10 ++++++++++
 .../stacks/PERF/1.0/upgrades/nonrolling-upgrade-2.0.xml   | 10 ++++++++++
 .../resources/stacks/PERF/1.0/upgrades/upgrade-2.0.xml    | 10 ++++++++++
 22 files changed, 220 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/48af3ee8/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/nonrolling-upgrade-2.3.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/nonrolling-upgrade-2.3.xml b/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/nonrolling-upgrade-2.3.xml
index 28ca939..3d8041e 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/nonrolling-upgrade-2.3.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/nonrolling-upgrade-2.3.xml
@@ -661,6 +661,16 @@
         </task>
       </execute-stage>
 
+      <execute-stage service="HBASE" component="HBASE_MASTER" title="Delete HBase snapshots">
+        <direction>UPGRADE</direction>
+        <task xsi:type="manual">
+          <message>You can now remove any HBase snapshots which were created at the beginning of the upgrade. To see existing snapshots, use the following HBase shell command:</message>
+          <message>hbase> list_snapshots</message>
+          <message>Once you have found an existing snapshot which you would like to remove, you can use the following command:</message>
+          <message>hbase> delete_snapshot 'snapshotName'</message>
+        </task>
+      </execute-stage>
+
       <execute-stage service="HDFS" component="NAMENODE" title="Execute HDFS Finalize">
         <task xsi:type="execute" hosts="master">
           <script>scripts/namenode.py</script>

http://git-wip-us.apache.org/repos/asf/ambari/blob/48af3ee8/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/nonrolling-upgrade-2.4.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/nonrolling-upgrade-2.4.xml b/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/nonrolling-upgrade-2.4.xml
index 9aff1a9..fa06291 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/nonrolling-upgrade-2.4.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/nonrolling-upgrade-2.4.xml
@@ -806,6 +806,16 @@
         </task>
       </execute-stage>
 
+      <execute-stage service="HBASE" component="HBASE_MASTER" title="Delete HBase snapshots">
+        <direction>UPGRADE</direction>
+        <task xsi:type="manual">
+          <message>You can now remove any HBase snapshots which were created at the beginning of the upgrade. To see existing snapshots, use the following HBase shell command:</message>
+          <message>hbase> list_snapshots</message>
+          <message>Once you have found an existing snapshot which you would like to remove, you can use the following command:</message>
+          <message>hbase> delete_snapshot 'snapshotName'</message>
+        </task>
+      </execute-stage>
+
       <execute-stage service="HDFS" component="NAMENODE" title="Execute HDFS Finalize">
         <task xsi:type="execute" hosts="master">
           <script>scripts/namenode.py</script>

http://git-wip-us.apache.org/repos/asf/ambari/blob/48af3ee8/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/nonrolling-upgrade-2.5.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/nonrolling-upgrade-2.5.xml b/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/nonrolling-upgrade-2.5.xml
index 73a4f5e..8b8b9a6 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/nonrolling-upgrade-2.5.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/nonrolling-upgrade-2.5.xml
@@ -958,6 +958,16 @@
         </task>
       </execute-stage>
 
+      <execute-stage service="HBASE" component="HBASE_MASTER" title="Delete HBase snapshots">
+        <direction>UPGRADE</direction>
+        <task xsi:type="manual">
+          <message>You can now remove any HBase snapshots which were created at the beginning of the upgrade. To see existing snapshots, use the following HBase shell command:</message>
+          <message>hbase> list_snapshots</message>
+          <message>Once you have found an existing snapshot which you would like to remove, you can use the following command:</message>
+          <message>hbase> delete_snapshot 'snapshotName'</message>
+        </task>
+      </execute-stage>
+
       <execute-stage service="HDFS" component="NAMENODE" title="Execute HDFS Finalize">
         <task xsi:type="execute" hosts="master">
           <script>scripts/namenode.py</script>

http://git-wip-us.apache.org/repos/asf/ambari/blob/48af3ee8/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/nonrolling-upgrade-2.6.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/nonrolling-upgrade-2.6.xml b/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/nonrolling-upgrade-2.6.xml
index 3a7df7d..2bf6e23 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/nonrolling-upgrade-2.6.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/nonrolling-upgrade-2.6.xml
@@ -1056,6 +1056,16 @@
         </task>
       </execute-stage>
 
+      <execute-stage service="HBASE" component="HBASE_MASTER" title="Delete HBase snapshots">
+        <direction>UPGRADE</direction>
+        <task xsi:type="manual">
+          <message>You can now remove any HBase snapshots which were created at the beginning of the upgrade. To see existing snapshots, use the following HBase shell command:</message>
+          <message>hbase> list_snapshots</message>
+          <message>Once you have found an existing snapshot which you would like to remove, you can use the following command:</message>
+          <message>hbase> delete_snapshot 'snapshotName'</message>
+        </task>
+      </execute-stage>
+
       <execute-stage service="HDFS" component="NAMENODE" title="Execute HDFS Finalize">
         <task xsi:type="execute" hosts="master">
           <script>scripts/namenode.py</script>

http://git-wip-us.apache.org/repos/asf/ambari/blob/48af3ee8/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/upgrade-2.3.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/upgrade-2.3.xml b/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/upgrade-2.3.xml
index 89b5126..1340b22 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/upgrade-2.3.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/upgrade-2.3.xml
@@ -410,6 +410,16 @@
         </task>
       </execute-stage>
 
+      <execute-stage service="HBASE" component="HBASE_MASTER" title="Delete HBase snapshots">
+        <direction>UPGRADE</direction>
+        <task xsi:type="manual">
+          <message>You can now remove any HBase snapshots which were created at the beginning of the upgrade. To see existing snapshots, use the following HBase shell command:</message>
+          <message>hbase> list_snapshots</message>
+          <message>Once you have found an existing snapshot which you would like to remove, you can use the following command:</message>
+          <message>hbase> delete_snapshot 'snapshotName'</message>
+        </task>
+      </execute-stage>
+
       <execute-stage service="HDFS" component="NAMENODE" title="Execute HDFS Finalize">
         <task xsi:type="execute" hosts="master">
           <script>scripts/namenode.py</script>

http://git-wip-us.apache.org/repos/asf/ambari/blob/48af3ee8/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/upgrade-2.4.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/upgrade-2.4.xml b/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/upgrade-2.4.xml
index 4e897a0..40afc4f 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/upgrade-2.4.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/upgrade-2.4.xml
@@ -454,6 +454,16 @@
         </task>
       </execute-stage>
 
+      <execute-stage service="HBASE" component="HBASE_MASTER" title="Delete HBase snapshots">
+        <direction>UPGRADE</direction>
+        <task xsi:type="manual">
+          <message>You can now remove any HBase snapshots which were created at the beginning of the upgrade. To see existing snapshots, use the following HBase shell command:</message>
+          <message>hbase> list_snapshots</message>
+          <message>Once you have found an existing snapshot which you would like to remove, you can use the following command:</message>
+          <message>hbase> delete_snapshot 'snapshotName'</message>
+        </task>
+      </execute-stage>
+
       <execute-stage service="HDFS" component="NAMENODE" title="Execute HDFS Finalize">
         <task xsi:type="execute" hosts="master">
           <script>scripts/namenode.py</script>

http://git-wip-us.apache.org/repos/asf/ambari/blob/48af3ee8/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/upgrade-2.5.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/upgrade-2.5.xml b/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/upgrade-2.5.xml
index ca612b8..e0882d8 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/upgrade-2.5.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/upgrade-2.5.xml
@@ -540,6 +540,16 @@
         </task>
       </execute-stage>
 
+      <execute-stage service="HBASE" component="HBASE_MASTER" title="Delete HBase snapshots">
+        <direction>UPGRADE</direction>
+        <task xsi:type="manual">
+          <message>You can now remove any HBase snapshots which were created at the beginning of the upgrade. To see existing snapshots, use the following HBase shell command:</message>
+          <message>hbase> list_snapshots</message>
+          <message>Once you have found an existing snapshot which you would like to remove, you can use the following command:</message>
+          <message>hbase> delete_snapshot 'snapshotName'</message>
+        </task>
+      </execute-stage>
+
       <execute-stage service="HDFS" component="NAMENODE" title="Execute HDFS Finalize">
         <task xsi:type="execute" hosts="master">
           <script>scripts/namenode.py</script>

http://git-wip-us.apache.org/repos/asf/ambari/blob/48af3ee8/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/upgrade-2.6.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/upgrade-2.6.xml b/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/upgrade-2.6.xml
index 1fbf81e..0f4efdc 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/upgrade-2.6.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/upgrade-2.6.xml
@@ -542,6 +542,16 @@
         </task>
       </execute-stage>
 
+      <execute-stage service="HBASE" component="HBASE_MASTER" title="Delete HBase snapshots">
+        <direction>UPGRADE</direction>
+        <task xsi:type="manual">
+          <message>You can now remove any HBase snapshots which were created at the beginning of the upgrade. To see existing snapshots, use the following HBase shell command:</message>
+          <message>hbase> list_snapshots</message>
+          <message>Once you have found an existing snapshot which you would like to remove, you can use the following command:</message>
+          <message>hbase> delete_snapshot 'snapshotName'</message>
+        </task>
+      </execute-stage>
+
       <execute-stage service="HDFS" component="NAMENODE" title="Execute HDFS Finalize">
         <task xsi:type="execute" hosts="master">
           <script>scripts/namenode.py</script>

http://git-wip-us.apache.org/repos/asf/ambari/blob/48af3ee8/ambari-server/src/main/resources/stacks/HDP/2.4/upgrades/nonrolling-upgrade-2.4.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.4/upgrades/nonrolling-upgrade-2.4.xml b/ambari-server/src/main/resources/stacks/HDP/2.4/upgrades/nonrolling-upgrade-2.4.xml
index 3c0104b..13f44fb 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.4/upgrades/nonrolling-upgrade-2.4.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.4/upgrades/nonrolling-upgrade-2.4.xml
@@ -652,6 +652,16 @@
         </task>
       </execute-stage>
 
+      <execute-stage service="HBASE" component="HBASE_MASTER" title="Delete HBase snapshots">
+        <direction>UPGRADE</direction>
+        <task xsi:type="manual">
+          <message>You can now remove any HBase snapshots which were created at the beginning of the upgrade. To see existing snapshots, use the following HBase shell command:</message>
+          <message>hbase> list_snapshots</message>
+          <message>Once you have found an existing snapshot which you would like to remove, you can use the following command:</message>
+          <message>hbase> delete_snapshot 'snapshotName'</message>
+        </task>
+      </execute-stage>
+
       <execute-stage service="HDFS" component="NAMENODE" title="Execute HDFS Finalize">
         <task xsi:type="execute" hosts="master">
           <script>scripts/namenode.py</script>

http://git-wip-us.apache.org/repos/asf/ambari/blob/48af3ee8/ambari-server/src/main/resources/stacks/HDP/2.4/upgrades/nonrolling-upgrade-2.5.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.4/upgrades/nonrolling-upgrade-2.5.xml b/ambari-server/src/main/resources/stacks/HDP/2.4/upgrades/nonrolling-upgrade-2.5.xml
index bb6506e..ea261b9 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.4/upgrades/nonrolling-upgrade-2.5.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.4/upgrades/nonrolling-upgrade-2.5.xml
@@ -919,6 +919,16 @@
         </task>
       </execute-stage>
 
+      <execute-stage service="HBASE" component="HBASE_MASTER" title="Delete HBase snapshots">
+        <direction>UPGRADE</direction>
+        <task xsi:type="manual">
+          <message>You can now remove any HBase snapshots which were created at the beginning of the upgrade. To see existing snapshots, use the following HBase shell command:</message>
+          <message>hbase> list_snapshots</message>
+          <message>Once you have found an existing snapshot which you would like to remove, you can use the following command:</message>
+          <message>hbase> delete_snapshot 'snapshotName'</message>
+        </task>
+      </execute-stage>
+
       <execute-stage service="HDFS" component="NAMENODE" title="Execute HDFS Finalize">
         <task xsi:type="execute" hosts="master">
           <script>scripts/namenode.py</script>

http://git-wip-us.apache.org/repos/asf/ambari/blob/48af3ee8/ambari-server/src/main/resources/stacks/HDP/2.4/upgrades/nonrolling-upgrade-2.6.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.4/upgrades/nonrolling-upgrade-2.6.xml b/ambari-server/src/main/resources/stacks/HDP/2.4/upgrades/nonrolling-upgrade-2.6.xml
index c6c3a0d..de6b8ef 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.4/upgrades/nonrolling-upgrade-2.6.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.4/upgrades/nonrolling-upgrade-2.6.xml
@@ -1014,6 +1014,16 @@
         </task>
       </execute-stage>
 
+      <execute-stage service="HBASE" component="HBASE_MASTER" title="Delete HBase snapshots">
+        <direction>UPGRADE</direction>
+        <task xsi:type="manual">
+          <message>You can now remove any HBase snapshots which were created at the beginning of the upgrade. To see existing snapshots, use the following HBase shell command:</message>
+          <message>hbase> list_snapshots</message>
+          <message>Once you have found an existing snapshot which you would like to remove, you can use the following command:</message>
+          <message>hbase> delete_snapshot 'snapshotName'</message>
+        </task>
+      </execute-stage>
+
       <execute-stage service="HDFS" component="NAMENODE" title="Execute HDFS Finalize">
         <task xsi:type="execute" hosts="master">
           <script>scripts/namenode.py</script>

http://git-wip-us.apache.org/repos/asf/ambari/blob/48af3ee8/ambari-server/src/main/resources/stacks/HDP/2.4/upgrades/upgrade-2.4.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.4/upgrades/upgrade-2.4.xml b/ambari-server/src/main/resources/stacks/HDP/2.4/upgrades/upgrade-2.4.xml
index 10f07f9..d5e9a5b 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.4/upgrades/upgrade-2.4.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.4/upgrades/upgrade-2.4.xml
@@ -406,6 +406,16 @@
         </task>
       </execute-stage>
 
+      <execute-stage service="HBASE" component="HBASE_MASTER" title="Delete HBase snapshots">
+        <direction>UPGRADE</direction>
+        <task xsi:type="manual">
+          <message>You can now remove any HBase snapshots which were created at the beginning of the upgrade. To see existing snapshots, use the following HBase shell command:</message>
+          <message>hbase> list_snapshots</message>
+          <message>Once you have found an existing snapshot which you would like to remove, you can use the following command:</message>
+          <message>hbase> delete_snapshot 'snapshotName'</message>
+        </task>
+      </execute-stage>
+
       <execute-stage service="HDFS" component="NAMENODE" title="Execute HDFS Finalize">
         <task xsi:type="execute" hosts="master">
           <script>scripts/namenode.py</script>

http://git-wip-us.apache.org/repos/asf/ambari/blob/48af3ee8/ambari-server/src/main/resources/stacks/HDP/2.4/upgrades/upgrade-2.5.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.4/upgrades/upgrade-2.5.xml b/ambari-server/src/main/resources/stacks/HDP/2.4/upgrades/upgrade-2.5.xml
index 4654ac8..350395c 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.4/upgrades/upgrade-2.5.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.4/upgrades/upgrade-2.5.xml
@@ -525,6 +525,16 @@
         </task>
       </execute-stage>
 
+      <execute-stage service="HBASE" component="HBASE_MASTER" title="Delete HBase snapshots">
+        <direction>UPGRADE</direction>
+        <task xsi:type="manual">
+          <message>You can now remove any HBase snapshots which were created at the beginning of the upgrade. To see existing snapshots, use the following HBase shell command:</message>
+          <message>hbase> list_snapshots</message>
+          <message>Once you have found an existing snapshot which you would like to remove, you can use the following command:</message>
+          <message>hbase> delete_snapshot 'snapshotName'</message>
+        </task>
+      </execute-stage>
+
       <execute-stage service="HDFS" component="NAMENODE" title="Execute HDFS Finalize">
         <task xsi:type="execute" hosts="master">
           <script>scripts/namenode.py</script>

http://git-wip-us.apache.org/repos/asf/ambari/blob/48af3ee8/ambari-server/src/main/resources/stacks/HDP/2.4/upgrades/upgrade-2.6.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.4/upgrades/upgrade-2.6.xml b/ambari-server/src/main/resources/stacks/HDP/2.4/upgrades/upgrade-2.6.xml
index ec7d8b8..9ac3d52 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.4/upgrades/upgrade-2.6.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.4/upgrades/upgrade-2.6.xml
@@ -531,6 +531,16 @@
         </task>
       </execute-stage>
 
+      <execute-stage service="HBASE" component="HBASE_MASTER" title="Delete HBase snapshots">
+        <direction>UPGRADE</direction>
+        <task xsi:type="manual">
+          <message>You can now remove any HBase snapshots which were created at the beginning of the upgrade. To see existing snapshots, use the following HBase shell command:</message>
+          <message>hbase> list_snapshots</message>
+          <message>Once you have found an existing snapshot which you would like to remove, you can use the following command:</message>
+          <message>hbase> delete_snapshot 'snapshotName'</message>
+        </task>
+      </execute-stage>
+
       <execute-stage service="HDFS" component="NAMENODE" title="Execute HDFS Finalize">
         <task xsi:type="execute" hosts="master">
           <script>scripts/namenode.py</script>

http://git-wip-us.apache.org/repos/asf/ambari/blob/48af3ee8/ambari-server/src/main/resources/stacks/HDP/2.5/upgrades/nonrolling-upgrade-2.5.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.5/upgrades/nonrolling-upgrade-2.5.xml b/ambari-server/src/main/resources/stacks/HDP/2.5/upgrades/nonrolling-upgrade-2.5.xml
index 95ca3a2..0f05089 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.5/upgrades/nonrolling-upgrade-2.5.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.5/upgrades/nonrolling-upgrade-2.5.xml
@@ -741,6 +741,16 @@
         </task>
       </execute-stage>
 
+      <execute-stage service="HBASE" component="HBASE_MASTER" title="Delete HBase snapshots">
+        <direction>UPGRADE</direction>
+        <task xsi:type="manual">
+          <message>You can now remove any HBase snapshots which were created at the beginning of the upgrade. To see existing snapshots, use the following HBase shell command:</message>
+          <message>hbase> list_snapshots</message>
+          <message>Once you have found an existing snapshot which you would like to remove, you can use the following command:</message>
+          <message>hbase> delete_snapshot 'snapshotName'</message>
+        </task>
+      </execute-stage>
+
       <execute-stage service="HDFS" component="NAMENODE" title="Execute HDFS Finalize">
         <task xsi:type="execute" hosts="master">
           <script>scripts/namenode.py</script>

http://git-wip-us.apache.org/repos/asf/ambari/blob/48af3ee8/ambari-server/src/main/resources/stacks/HDP/2.5/upgrades/nonrolling-upgrade-2.6.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.5/upgrades/nonrolling-upgrade-2.6.xml b/ambari-server/src/main/resources/stacks/HDP/2.5/upgrades/nonrolling-upgrade-2.6.xml
index 05ecb2c..a6bc4fc 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.5/upgrades/nonrolling-upgrade-2.6.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.5/upgrades/nonrolling-upgrade-2.6.xml
@@ -1047,6 +1047,16 @@
         </task>
       </execute-stage>
 
+      <execute-stage service="HBASE" component="HBASE_MASTER" title="Delete HBase snapshots">
+        <direction>UPGRADE</direction>
+        <task xsi:type="manual">
+          <message>You can now remove any HBase snapshots which were created at the beginning of the upgrade. To see existing snapshots, use the following HBase shell command:</message>
+          <message>hbase> list_snapshots</message>
+          <message>Once you have found an existing snapshot which you would like to remove, you can use the following command:</message>
+          <message>hbase> delete_snapshot 'snapshotName'</message>
+        </task>
+      </execute-stage>
+
       <execute-stage service="HDFS" component="NAMENODE" title="Execute HDFS Finalize">
         <task xsi:type="execute" hosts="master">
           <script>scripts/namenode.py</script>

http://git-wip-us.apache.org/repos/asf/ambari/blob/48af3ee8/ambari-server/src/main/resources/stacks/HDP/2.5/upgrades/upgrade-2.5.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.5/upgrades/upgrade-2.5.xml b/ambari-server/src/main/resources/stacks/HDP/2.5/upgrades/upgrade-2.5.xml
index 37f92fd..04a06e8 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.5/upgrades/upgrade-2.5.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.5/upgrades/upgrade-2.5.xml
@@ -450,6 +450,16 @@
         </task>
       </execute-stage>
 
+      <execute-stage service="HBASE" component="HBASE_MASTER" title="Delete HBase snapshots">
+        <direction>UPGRADE</direction>
+        <task xsi:type="manual">
+          <message>You can now remove any HBase snapshots which were created at the beginning of the upgrade. To see existing snapshots, use the following HBase shell command:</message>
+          <message>hbase> list_snapshots</message>
+          <message>Once you have found an existing snapshot which you would like to remove, you can use the following command:</message>
+          <message>hbase> delete_snapshot 'snapshotName'</message>
+        </task>
+      </execute-stage>
+
       <execute-stage service="HDFS" component="NAMENODE" title="Execute HDFS Finalize">
         <task xsi:type="execute" hosts="master">
           <script>scripts/namenode.py</script>

http://git-wip-us.apache.org/repos/asf/ambari/blob/48af3ee8/ambari-server/src/main/resources/stacks/HDP/2.5/upgrades/upgrade-2.6.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.5/upgrades/upgrade-2.6.xml b/ambari-server/src/main/resources/stacks/HDP/2.5/upgrades/upgrade-2.6.xml
index 0dab6f4..879fe0f 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.5/upgrades/upgrade-2.6.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.5/upgrades/upgrade-2.6.xml
@@ -461,6 +461,16 @@
         </task>
       </execute-stage>
 
+      <execute-stage service="HBASE" component="HBASE_MASTER" title="Delete HBase snapshots">
+        <direction>UPGRADE</direction>
+        <task xsi:type="manual">
+          <message>You can now remove any HBase snapshots which were created at the beginning of the upgrade. To see existing snapshots, use the following HBase shell command:</message>
+          <message>hbase> list_snapshots</message>
+          <message>Once you have found an existing snapshot which you would like to remove, you can use the following command:</message>
+          <message>hbase> delete_snapshot 'snapshotName'</message>
+        </task>
+      </execute-stage>
+
       <execute-stage service="HDFS" component="NAMENODE" title="Execute HDFS Finalize">
         <task xsi:type="execute" hosts="master">
           <script>scripts/namenode.py</script>

http://git-wip-us.apache.org/repos/asf/ambari/blob/48af3ee8/ambari-server/src/main/resources/stacks/HDP/2.6/upgrades/nonrolling-upgrade-2.6.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.6/upgrades/nonrolling-upgrade-2.6.xml b/ambari-server/src/main/resources/stacks/HDP/2.6/upgrades/nonrolling-upgrade-2.6.xml
index 4a641ec..68c58c0 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.6/upgrades/nonrolling-upgrade-2.6.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.6/upgrades/nonrolling-upgrade-2.6.xml
@@ -743,6 +743,16 @@
         </task>
       </execute-stage>
 
+      <execute-stage service="HBASE" component="HBASE_MASTER" title="Delete HBase snapshots">
+        <direction>UPGRADE</direction>
+        <task xsi:type="manual">
+          <message>You can now remove any HBase snapshots which were created at the beginning of the upgrade. To see existing snapshots, use the following HBase shell command:</message>
+          <message>hbase> list_snapshots</message>
+          <message>Once you have found an existing snapshot which you would like to remove, you can use the following command:</message>
+          <message>hbase> delete_snapshot 'snapshotName'</message>
+        </task>
+      </execute-stage>
+
       <execute-stage service="HDFS" component="NAMENODE" title="Execute HDFS Finalize">
         <task xsi:type="execute" hosts="master">
           <script>scripts/namenode.py</script>

http://git-wip-us.apache.org/repos/asf/ambari/blob/48af3ee8/ambari-server/src/main/resources/stacks/HDP/2.6/upgrades/upgrade-2.6.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.6/upgrades/upgrade-2.6.xml b/ambari-server/src/main/resources/stacks/HDP/2.6/upgrades/upgrade-2.6.xml
index 0587741..01f11e4 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.6/upgrades/upgrade-2.6.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.6/upgrades/upgrade-2.6.xml
@@ -477,6 +477,16 @@
         </task>
       </execute-stage>
 
+      <execute-stage service="HBASE" component="HBASE_MASTER" title="Delete HBase snapshots">
+        <direction>UPGRADE</direction>
+        <task xsi:type="manual">
+          <message>You can now remove any HBase snapshots which were created at the beginning of the upgrade. To see existing snapshots, use the following HBase shell command:</message>
+          <message>hbase> list_snapshots</message>
+          <message>Once you have found an existing snapshot which you would like to remove, you can use the following command:</message>
+          <message>hbase> delete_snapshot 'snapshotName'</message>
+        </task>
+      </execute-stage>
+
       <execute-stage service="HDFS" component="NAMENODE" title="Execute HDFS Finalize">
         <task xsi:type="execute" hosts="master">
           <script>scripts/namenode.py</script>

http://git-wip-us.apache.org/repos/asf/ambari/blob/48af3ee8/ambari-server/src/main/resources/stacks/PERF/1.0/upgrades/nonrolling-upgrade-2.0.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/PERF/1.0/upgrades/nonrolling-upgrade-2.0.xml b/ambari-server/src/main/resources/stacks/PERF/1.0/upgrades/nonrolling-upgrade-2.0.xml
index 2626bc3..7078a6e 100644
--- a/ambari-server/src/main/resources/stacks/PERF/1.0/upgrades/nonrolling-upgrade-2.0.xml
+++ b/ambari-server/src/main/resources/stacks/PERF/1.0/upgrades/nonrolling-upgrade-2.0.xml
@@ -286,6 +286,16 @@
         </task>
       </execute-stage>
 
+      <execute-stage service="FAKEHBASE" component="FAKEHBASE_MASTER" title="Delete FAKEHBase snapshots">
+        <direction>UPGRADE</direction>
+        <task xsi:type="manual">
+          <message>You can now remove any FAKEHBASE snapshots which were created at the beginning of the upgrade. To see existing snapshots, use the following FAKEHBASE shell command:</message>
+          <message>hbase> list_snapshots</message>
+          <message>Once you have found an existing snapshot which you would like to remove, you can use the following command:</message>
+          <message>hbase> delete_snapshot 'snapshotName'</message>
+        </task>
+      </execute-stage>
+
       <execute-stage service="FAKEHDFS" component="FAKENAMENODE" title="Execute FAKEHDFS Finalize">
         <task xsi:type="execute" hosts="master">
           <script>scripts/namenode.py</script>

http://git-wip-us.apache.org/repos/asf/ambari/blob/48af3ee8/ambari-server/src/main/resources/stacks/PERF/1.0/upgrades/upgrade-2.0.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/PERF/1.0/upgrades/upgrade-2.0.xml b/ambari-server/src/main/resources/stacks/PERF/1.0/upgrades/upgrade-2.0.xml
index 99746d6..9c9cebb 100644
--- a/ambari-server/src/main/resources/stacks/PERF/1.0/upgrades/upgrade-2.0.xml
+++ b/ambari-server/src/main/resources/stacks/PERF/1.0/upgrades/upgrade-2.0.xml
@@ -172,6 +172,16 @@
         </task>
       </execute-stage>
 
+      <execute-stage service="FAKEHBASE" component="FAKEHBASE_MASTER" title="Delete FAKEHBase snapshots">
+        <direction>UPGRADE</direction>
+        <task xsi:type="manual">
+          <message>You can now remove any FAKEHBASE snapshots which were created at the beginning of the upgrade. To see existing snapshots, use the following FAKEHBASE shell command:</message>
+          <message>hbase> list_snapshots</message>
+          <message>Once you have found an existing snapshot which you would like to remove, you can use the following command:</message>
+          <message>hbase> delete_snapshot 'snapshotName'</message>
+        </task>
+      </execute-stage>
+
       <execute-stage service="FAKEHDFS" component="FAKENAMENODE" title="Execute FAKEHDFS Finalize">
         <task xsi:type="execute" hosts="master">
           <script>scripts/namenode.py</script>


[17/50] ambari git commit: AMBARI-19149. Code cleanup: String concatenation in StringBuilder.append()

Posted by jo...@apache.org.
AMBARI-19149. Code cleanup: String concatenation in StringBuilder.append()


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

Branch: refs/heads/branch-feature-AMBARI-12556
Commit: ba63ea303870b3091d2a512883bb0105c46dbc75
Parents: 48af3ee
Author: Attila Doroszlai <ad...@hortonworks.com>
Authored: Mon Apr 3 15:25:41 2017 +0200
Committer: Attila Doroszlai <ad...@hortonworks.com>
Committed: Mon Apr 3 23:04:05 2017 +0200

----------------------------------------------------------------------
 .../ambari/server/actionmanager/Stage.java      | 22 ++++++++++----------
 .../server/configuration/Configuration.java     |  2 +-
 .../ambari/server/controller/ActionRequest.java | 19 +++++++++--------
 .../server/controller/ClusterResponse.java      | 17 +++++++--------
 .../server/controller/ExecuteActionRequest.java | 16 +++++++-------
 .../server/controller/ServiceRequest.java       | 10 ++++-----
 .../server/controller/ShortTaskStatus.java      | 19 ++++++++---------
 .../ambari/server/controller/UserRequest.java   |  2 +-
 .../customactions/ActionDefinitionManager.java  |  4 ++--
 .../server/orm/helpers/dbms/PostgresHelper.java |  2 +-
 .../server/stageplanner/RoleGraphNode.java      |  2 +-
 .../apache/ambari/server/state/HostConfig.java  |  4 ++--
 .../server/state/ServiceComponentImpl.java      | 13 +++++++-----
 .../apache/ambari/server/state/ServiceImpl.java | 10 +++++----
 .../server/topology/BlueprintValidatorImpl.java |  2 +-
 .../ganglia/GangliaPropertyProviderTest.java    |  6 +++---
 .../RangerWebAlertConfigActionTest.java         |  2 +-
 17 files changed, 77 insertions(+), 75 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/ba63ea30/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/Stage.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/Stage.java b/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/Stage.java
index cca279b..a46e6a2 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/Stage.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/Stage.java
@@ -930,19 +930,19 @@ public class Stage {
   public synchronized String toString() {
     StringBuilder builder = new StringBuilder();
     builder.append("STAGE DESCRIPTION BEGIN\n");
-    builder.append("requestId="+requestId+"\n");
-    builder.append("stageId="+stageId+"\n");
-    builder.append("clusterName="+clusterName+"\n");
-    builder.append("logDir=" + logDir+"\n");
-    builder.append("requestContext="+requestContext+"\n");
-    builder.append("clusterHostInfo="+clusterHostInfo+"\n");
-    builder.append("commandParamsStage="+commandParamsStage+"\n");
-    builder.append("hostParamsStage="+hostParamsStage+"\n");
-    builder.append("status="+status+"\n");
-    builder.append("displayStatus="+displayStatus+"\n");
+    builder.append("requestId=").append(requestId).append("\n");
+    builder.append("stageId=").append(stageId).append("\n");
+    builder.append("clusterName=").append(clusterName).append("\n");
+    builder.append("logDir=").append(logDir).append("\n");
+    builder.append("requestContext=").append(requestContext).append("\n");
+    builder.append("clusterHostInfo=").append(clusterHostInfo).append("\n");
+    builder.append("commandParamsStage=").append(commandParamsStage).append("\n");
+    builder.append("hostParamsStage=").append(hostParamsStage).append("\n");
+    builder.append("status=").append(status).append("\n");
+    builder.append("displayStatus=").append(displayStatus).append("\n");
     builder.append("Success Factors:\n");
     for (Role r : successFactors.keySet()) {
-      builder.append("  role: "+r+", factor: "+successFactors.get(r)+"\n");
+      builder.append("  role: ").append(r).append(", factor: ").append(successFactors.get(r)).append("\n");
     }
     for (HostRoleCommand hostRoleCommand : getOrderedHostRoleCommands()) {
       builder.append("HOST: ").append(hostRoleCommand.getHostName()).append(" :\n");

http://git-wip-us.apache.org/repos/asf/ambari/blob/ba63ea30/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 537b993..a8bfbf0 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
@@ -5673,7 +5673,7 @@ public class Configuration {
     // now write out specific groupings
     StringBuilder baselineBuffer = new StringBuilder(1024);
     for( ConfigurationGrouping grouping : ConfigurationGrouping.values() ){
-      baselineBuffer.append("#### " + grouping);
+      baselineBuffer.append("#### ").append(grouping);
       baselineBuffer.append(System.lineSeparator());
       baselineBuffer.append("| Property Name | ");
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/ba63ea30/ambari-server/src/main/java/org/apache/ambari/server/controller/ActionRequest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/ActionRequest.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/ActionRequest.java
index 6fdac2f..7a4fd36 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/ActionRequest.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/ActionRequest.java
@@ -121,14 +121,15 @@ public class ActionRequest {
 
   @Override
   public String toString() {
-    return (new StringBuilder()).
-        append("actionName :" + actionName).
-        append(", actionType :" + actionType).
-        append(", inputs :" + inputs).
-        append(", targetService :" + targetService).
-        append(", targetComponent :" + targetComponent).
-        append(", description :" + description).
-        append(", targetType :" + targetType).
-        append(", defaultTimeout :" + defaultTimeout).toString();
+    return new StringBuilder()
+      .append("actionName :").append(actionName)
+      .append(", actionType :").append(actionType)
+      .append(", inputs :").append(inputs)
+      .append(", targetService :").append(targetService)
+      .append(", targetComponent :").append(targetComponent)
+      .append(", description :").append(description)
+      .append(", targetType :").append(targetType)
+      .append(", defaultTimeout :").append(defaultTimeout)
+      .toString();
   }
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/ba63ea30/ambari-server/src/main/java/org/apache/ambari/server/controller/ClusterResponse.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/ClusterResponse.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/ClusterResponse.java
index b3a2def..b89bd45 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/ClusterResponse.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/ClusterResponse.java
@@ -135,13 +135,12 @@ public class ClusterResponse {
   @Override
   public String toString() {
     StringBuilder sb = new StringBuilder();
-    sb.append("{"
-        + " clusterName=" + clusterName
-        + ", clusterId=" + clusterId
-        + ", provisioningState=" + provisioningState
-        + ", desiredStackVersion=" + desiredStackVersion
-        + ", totalHosts=" + totalHosts
-        + ", hosts=[");
+    sb.append("{ clusterName=").append(clusterName)
+      .append(", clusterId=").append(clusterId)
+      .append(", provisioningState=").append(provisioningState)
+      .append(", desiredStackVersion=").append(desiredStackVersion)
+      .append(", totalHosts=").append(totalHosts)
+      .append(", hosts=[");
 
     if (hostNames != null) {
       int i = 0;
@@ -153,9 +152,7 @@ public class ClusterResponse {
         sb.append(hostName);
       }
     }
-    sb.append("]"
-        + ", clusterHealthReport= " + clusterHealthReport
-        + "}");
+    sb.append("], clusterHealthReport= ").append(clusterHealthReport).append("}");
     return sb.toString();
   }
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/ba63ea30/ambari-server/src/main/java/org/apache/ambari/server/controller/ExecuteActionRequest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/ExecuteActionRequest.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/ExecuteActionRequest.java
index 351974a..a659f96 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/ExecuteActionRequest.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/ExecuteActionRequest.java
@@ -107,13 +107,13 @@ public class ExecuteActionRequest {
 
   @Override
   public synchronized String toString() {
-    return (new StringBuilder()).
-        append("isCommand :" + isCommand().toString()).
-        append(", action :" + actionName).
-        append(", command :" + commandName).
-        append(", inputs :" + parameters.toString()).
-        append(", resourceFilters: " + resourceFilters).
-        append(", exclusive: " + exclusive).
-        append(", clusterName :" + clusterName).toString();
+    return new StringBuilder()
+      .append("isCommand :").append(isCommand())
+      .append(", action :").append(actionName)
+      .append(", command :").append(commandName)
+      .append(", inputs :").append(parameters)
+      .append(", resourceFilters: ").append(resourceFilters)
+      .append(", exclusive: ").append(exclusive)
+      .append(", clusterName :").append(clusterName).toString();
   }
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/ba63ea30/ambari-server/src/main/java/org/apache/ambari/server/controller/ServiceRequest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/ServiceRequest.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/ServiceRequest.java
index a8e6315..6c0d4ea 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/ServiceRequest.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/ServiceRequest.java
@@ -132,11 +132,11 @@ public class ServiceRequest {
 
   public String toString() {
     StringBuilder sb = new StringBuilder();
-    sb.append("clusterName=" + clusterName
-        + ", serviceName=" + serviceName
-        + ", desiredState=" + desiredState
-        + ", credentialStoreEnabled=" + credentialStoreEnabled
-        + ", credentialStoreSupported=" + credentialStoreSupported);
+    sb.append("clusterName=").append(clusterName)
+      .append(", serviceName=").append(serviceName)
+      .append(", desiredState=").append(desiredState)
+      .append(", credentialStoreEnabled=").append(credentialStoreEnabled)
+      .append(", credentialStoreSupported=").append(credentialStoreSupported);
     return sb.toString();
   }
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/ba63ea30/ambari-server/src/main/java/org/apache/ambari/server/controller/ShortTaskStatus.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/ShortTaskStatus.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/ShortTaskStatus.java
index 975476f..df40aa8 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/ShortTaskStatus.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/ShortTaskStatus.java
@@ -144,16 +144,15 @@ public class ShortTaskStatus {
 
   public String toString() {
     StringBuilder sb = new StringBuilder();
-    sb.append("ShortTaskStatusDump "
-        + ", stageId=" + stageId
-        + ", taskId=" + taskId
-        + ", hostname=" + hostName
-        + ", role=" + role
-        + ", command=" + command
-        + ", status=" + status
-        + ", outputLog=" + outputLog
-        + ", errorLog=" + errorLog
-    );
+    sb.append("ShortTaskStatusDump ")
+      .append(", stageId=").append(stageId)
+      .append(", taskId=").append(taskId)
+      .append(", hostname=").append(hostName)
+      .append(", role=").append(role)
+      .append(", command=").append(command)
+      .append(", status=").append(status)
+      .append(", outputLog=").append(outputLog)
+      .append(", errorLog=").append(errorLog);
     return sb.toString();
   }
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/ba63ea30/ambari-server/src/main/java/org/apache/ambari/server/controller/UserRequest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/UserRequest.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/UserRequest.java
index 282131a..c25fffe 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/UserRequest.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/UserRequest.java
@@ -70,7 +70,7 @@ public class UserRequest {
   @Override
   public String toString() {
     StringBuilder sb = new StringBuilder();
-    sb.append("User, username=" + userName);
+    sb.append("User, username=").append(userName);
     return sb.toString();
   }
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/ba63ea30/ambari-server/src/main/java/org/apache/ambari/server/customactions/ActionDefinitionManager.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/customactions/ActionDefinitionManager.java b/ambari-server/src/main/java/org/apache/ambari/server/customactions/ActionDefinitionManager.java
index 7a2738b..05af097 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/customactions/ActionDefinitionManager.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/customactions/ActionDefinitionManager.java
@@ -79,7 +79,7 @@ public class ActionDefinitionManager {
     try {
       return Enum.valueOf(enumm, s);
     } catch (IllegalArgumentException iaex) {
-      reason.append("Invalid value provided for " + enumm.getName());
+      reason.append("Invalid value provided for ").append(enumm.getName());
       return null;
     }
   }
@@ -147,7 +147,7 @@ public class ActionDefinitionManager {
       }
 
       if (actionType == null || actionType == ActionType.SYSTEM_DISABLED) {
-        reason.append("Action type cannot be " + actionType);
+        reason.append("Action type cannot be ").append(actionType);
         return false;
       }
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/ba63ea30/ambari-server/src/main/java/org/apache/ambari/server/orm/helpers/dbms/PostgresHelper.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/orm/helpers/dbms/PostgresHelper.java b/ambari-server/src/main/java/org/apache/ambari/server/orm/helpers/dbms/PostgresHelper.java
index ad18428..2237f86 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/orm/helpers/dbms/PostgresHelper.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/orm/helpers/dbms/PostgresHelper.java
@@ -75,6 +75,6 @@ public class PostgresHelper extends GenericDbmsHelper {
 
   @Override
   public  StringBuilder writeDropPrimaryKeyStatement(StringBuilder builder, String constraintName, boolean cascade){
-      return builder.append("DROP CONSTRAINT ").append(constraintName + (cascade ? " CASCADE" : ""));
+      return builder.append("DROP CONSTRAINT ").append(constraintName).append(cascade ? " CASCADE" : "");
   }
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/ba63ea30/ambari-server/src/main/java/org/apache/ambari/server/stageplanner/RoleGraphNode.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/stageplanner/RoleGraphNode.java b/ambari-server/src/main/java/org/apache/ambari/server/stageplanner/RoleGraphNode.java
index d2aac3c..4e305bd 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/stageplanner/RoleGraphNode.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/stageplanner/RoleGraphNode.java
@@ -72,7 +72,7 @@ public class RoleGraphNode {
   @Override
   public String toString() {
     StringBuilder builder = new StringBuilder();
-    builder.append("("+role+", "+command +", "+inDegree+")");
+    builder.append("(").append(role).append(", ").append(command).append(", ").append(inDegree).append(")");
     return builder.toString();
   }
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/ba63ea30/ambari-server/src/main/java/org/apache/ambari/server/state/HostConfig.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/state/HostConfig.java b/ambari-server/src/main/java/org/apache/ambari/server/state/HostConfig.java
index f95d843..5395f4c 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/state/HostConfig.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/state/HostConfig.java
@@ -62,7 +62,7 @@ public class HostConfig {
     StringBuilder sb = new StringBuilder();
     sb.append("{");
     if (defaultVersionTag != null) {
-      sb.append("default = " + defaultVersionTag);
+      sb.append("default = ").append(defaultVersionTag);
     }
     if (!configGroupOverrides.isEmpty()) {
       sb.append(", overrides = [ ");
@@ -71,7 +71,7 @@ public class HostConfig {
         if (i++ != 0) {
           sb.append(", ");
         }
-        sb.append(entry.getKey().toString() + " : " + entry.getValue());
+        sb.append(entry.getKey()).append(" : ").append(entry.getValue());
       }
       sb.append("]");
     }

http://git-wip-us.apache.org/repos/asf/ambari/blob/ba63ea30/ambari-server/src/main/java/org/apache/ambari/server/state/ServiceComponentImpl.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/state/ServiceComponentImpl.java b/ambari-server/src/main/java/org/apache/ambari/server/state/ServiceComponentImpl.java
index 515cc63..f6ddc6d 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/state/ServiceComponentImpl.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/state/ServiceComponentImpl.java
@@ -439,11 +439,14 @@ public class ServiceComponentImpl implements ServiceComponent {
 
   @Override
   public void debugDump(StringBuilder sb) {
-    sb.append("ServiceComponent={ serviceComponentName=" + getName() + ", recoveryEnabled="
-        + isRecoveryEnabled() + ", clusterName=" + service.getCluster().getClusterName()
-        + ", clusterId=" + service.getCluster().getClusterId() + ", serviceName="
-        + service.getName() + ", desiredStackVersion=" + getDesiredStackVersion()
-        + ", desiredState=" + getDesiredState().toString() + ", hostcomponents=[ ");
+    sb.append("ServiceComponent={ serviceComponentName=").append(getName())
+      .append(", recoveryEnabled=").append(isRecoveryEnabled())
+      .append(", clusterName=").append(service.getCluster().getClusterName())
+      .append(", clusterId=").append(service.getCluster().getClusterId())
+      .append(", serviceName=").append(service.getName())
+      .append(", desiredStackVersion=").append(getDesiredStackVersion())
+      .append(", desiredState=").append(getDesiredState())
+      .append(", hostcomponents=[ ");
     boolean first = true;
     for (ServiceComponentHost sch : hostComponents.values()) {
       if (!first) {

http://git-wip-us.apache.org/repos/asf/ambari/blob/ba63ea30/ambari-server/src/main/java/org/apache/ambari/server/state/ServiceImpl.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/state/ServiceImpl.java b/ambari-server/src/main/java/org/apache/ambari/server/state/ServiceImpl.java
index 9caff6a..a0c0db1 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/state/ServiceImpl.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/state/ServiceImpl.java
@@ -423,10 +423,12 @@ public class ServiceImpl implements Service {
 
   @Override
   public void debugDump(StringBuilder sb) {
-    sb.append("Service={ serviceName=" + getName() + ", clusterName=" + cluster.getClusterName()
-        + ", clusterId=" + cluster.getClusterId() + ", desiredStackVersion="
-        + getDesiredStackVersion() + ", desiredState=" + getDesiredState().toString()
-        + ", components=[ ");
+    sb.append("Service={ serviceName=").append(getName())
+      .append(", clusterName=").append(cluster.getClusterName())
+      .append(", clusterId=").append(cluster.getClusterId())
+      .append(", desiredStackVersion=").append(getDesiredStackVersion())
+      .append(", desiredState=").append(getDesiredState())
+      .append(", components=[ ");
     boolean first = true;
     for (ServiceComponent sc : components.values()) {
       if (!first) {

http://git-wip-us.apache.org/repos/asf/ambari/blob/ba63ea30/ambari-server/src/main/java/org/apache/ambari/server/topology/BlueprintValidatorImpl.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/topology/BlueprintValidatorImpl.java b/ambari-server/src/main/java/org/apache/ambari/server/topology/BlueprintValidatorImpl.java
index f994457..9688c60 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/topology/BlueprintValidatorImpl.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/topology/BlueprintValidatorImpl.java
@@ -104,7 +104,7 @@ public class BlueprintValidatorImpl implements BlueprintValidator {
             String propertyValue = propertyEntry.getValue();
             if (propertyValue != null) {
               if (SecretReference.isSecret(propertyValue)) {
-                errorMessage.append("  Config:" + configType + " Property:" + propertyName+"\n");
+                errorMessage.append("  Config:").append(configType).append(" Property:").append(propertyName).append("\n");
                 containsSecretReferences = true;
               }
             }

http://git-wip-us.apache.org/repos/asf/ambari/blob/ba63ea30/ambari-server/src/test/java/org/apache/ambari/server/controller/metrics/ganglia/GangliaPropertyProviderTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/controller/metrics/ganglia/GangliaPropertyProviderTest.java b/ambari-server/src/test/java/org/apache/ambari/server/controller/metrics/ganglia/GangliaPropertyProviderTest.java
index 5ef7117..62b7d8a 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/controller/metrics/ganglia/GangliaPropertyProviderTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/controller/metrics/ganglia/GangliaPropertyProviderTest.java
@@ -474,9 +474,9 @@ public class GangliaPropertyProviderTest {
       resources.add(resource);
       
       if (hostsList.length() != 0)
-        hostsList.append("," + "host" + i );
+        hostsList.append(",host").append(i);
       else
-        hostsList.append("host" + i); 
+        hostsList.append("host").append(i);
     }
 
     // only ask for one property
@@ -945,7 +945,7 @@ public class GangliaPropertyProviderTest {
       for (String metricRegex: metricsRegexes)
       {
         if (entry.getKey().startsWith(metricRegex)) {
-          metricsBuilder.append(entry.getValue().getPropertyId() + ",");
+          metricsBuilder.append(entry.getValue().getPropertyId()).append(",");
         }
       }
     }

http://git-wip-us.apache.org/repos/asf/ambari/blob/ba63ea30/ambari-server/src/test/java/org/apache/ambari/server/serveraction/upgrades/RangerWebAlertConfigActionTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/serveraction/upgrades/RangerWebAlertConfigActionTest.java b/ambari-server/src/test/java/org/apache/ambari/server/serveraction/upgrades/RangerWebAlertConfigActionTest.java
index 5d2e605..b4edb41 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/serveraction/upgrades/RangerWebAlertConfigActionTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/serveraction/upgrades/RangerWebAlertConfigActionTest.java
@@ -117,7 +117,7 @@ public class RangerWebAlertConfigActionTest {
 
       try {
         while (scanner.hasNextLine()) {
-          rangerAlertsConfigFile.append(scanner.nextLine() + lineSeparator);
+          rangerAlertsConfigFile.append(scanner.nextLine()).append(lineSeparator);
         }
         Mockito.when(alertDefinitionEntity.getSource()).thenReturn(rangerAlertsConfigFile.toString());
       } finally {


[13/50] ambari git commit: AMBARI-20652. Test fix.HDP 3.0 TP - add Pig client: configs, metainfo, descriptors, service advisor and etc.(vbrodetskyi)

Posted by jo...@apache.org.
AMBARI-20652. Test fix.HDP 3.0 TP - add Pig client: configs, metainfo, descriptors, service advisor and etc.(vbrodetskyi)


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

Branch: refs/heads/branch-feature-AMBARI-12556
Commit: a1cbf83ea9923d1ad7c98111a4382ef87feb4bae
Parents: d5249c6
Author: Vitaly Brodetskyi <vb...@hortonworks.com>
Authored: Mon Apr 3 19:28:26 2017 +0300
Committer: Vitaly Brodetskyi <vb...@hortonworks.com>
Committed: Mon Apr 3 19:28:26 2017 +0300

----------------------------------------------------------------------
 .../common-services/PIG/0.16.1.3.0/configuration/pig-env.xml       | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/a1cbf83e/ambari-server/src/main/resources/common-services/PIG/0.16.1.3.0/configuration/pig-env.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/PIG/0.16.1.3.0/configuration/pig-env.xml b/ambari-server/src/main/resources/common-services/PIG/0.16.1.3.0/configuration/pig-env.xml
index 11afa11..5eafd9e 100644
--- a/ambari-server/src/main/resources/common-services/PIG/0.16.1.3.0/configuration/pig-env.xml
+++ b/ambari-server/src/main/resources/common-services/PIG/0.16.1.3.0/configuration/pig-env.xml
@@ -36,6 +36,6 @@ fi
     <value-attributes>
       <type>content</type>
     </value-attributes>
-    <on-ambari-upgrade add="fallse"/>
+    <on-ambari-upgrade add="false"/>
   </property>
 </configuration>


[19/50] ambari git commit: AMBARI-20655.Need to improve the grouping of the nodes available in transition section of WFM(M Madhan Mohan Reddy via padmapriyanitt)

Posted by jo...@apache.org.
AMBARI-20655.Need to improve the grouping of the nodes available in transition section of WFM(M Madhan Mohan Reddy via padmapriyanitt)


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

Branch: refs/heads/branch-feature-AMBARI-12556
Commit: e945bb1869dd8abb71cfd1285b6a23a0df5e39f0
Parents: dca1ebd
Author: padmapriyanitt <pa...@gmail.com>
Authored: Tue Apr 4 11:47:45 2017 +0530
Committer: padmapriyanitt <pa...@gmail.com>
Committed: Tue Apr 4 11:47:45 2017 +0530

----------------------------------------------------------------------
 .../templates/components/transition-config.hbs  | 34 +++++++++++---------
 1 file changed, 19 insertions(+), 15 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/e945bb18/contrib/views/wfmanager/src/main/resources/ui/app/templates/components/transition-config.hbs
----------------------------------------------------------------------
diff --git a/contrib/views/wfmanager/src/main/resources/ui/app/templates/components/transition-config.hbs b/contrib/views/wfmanager/src/main/resources/ui/app/templates/components/transition-config.hbs
index 83fe96c..7618481 100644
--- a/contrib/views/wfmanager/src/main/resources/ui/app/templates/components/transition-config.hbs
+++ b/contrib/views/wfmanager/src/main/resources/ui/app/templates/components/transition-config.hbs
@@ -19,14 +19,16 @@
   <label class="control-label col-xs-2">Error To<span class="requiredField">&nbsp;*</span></label>
   <div class=" col-xs-7">
     <select onchange={{action "errorToHandler" value="target.value"}} name="select-node" class="form-control" data-show-icon="true">
-      <optgroup label="Kill Nodes"></optgroup>
-      {{#each killNodes as |node index|}}
-      <option value={{node.name}} selected={{eq node.name transition.errorNode.name}}>{{node.name}}</option>
-      {{/each}}
-      <optgroup label="Other Nodes"></optgroup>
-      {{#each descendantNodes as |node index|}}
-      <option value={{node.name}} selected={{eq node.name transition.errorNode.name}}>{{node.name}}</option>
-      {{/each}}
+      <optgroup label="Kill Nodes">
+        {{#each killNodes as |node index|}}
+        <option value={{node.name}} selected={{eq node.name transition.errorNode.name}}>{{node.name}}</option>
+        {{/each}}
+      </optgroup>
+      <optgroup label="Other Nodes">
+        {{#each descendantNodes as |node index|}}
+        <option value={{node.name}} selected={{eq node.name transition.errorNode.name}}>{{node.name}}</option>
+        {{/each}}
+      </optgroup>
     </select>
     {{#if (eq transition.errorNode.type 'kill')}}
       <span class="kill-message">{{transition.errorNode.killMessage}}</span>
@@ -37,14 +39,16 @@
   <label class="control-label col-xs-2">Ok To<span class="requiredField">&nbsp;*</span></label>
   <div class=" col-xs-7">
     <select onchange={{action "okToHandler" value="target.value"}} name="select-node" class="form-control" data-show-icon="true">
-      <optgroup label="Kill Nodes"></optgroup>
-      {{#each killNodes as |node index|}}
-      <option value={{node.name}} selected={{eq node.name transition.okToNode.name}}>{{node.name}}</option>
-      {{/each}}
-      <optgroup label="Other Nodes"></optgroup>
-      {{#each currentNode.validOkToNodes as |node index|}}
+      <optgroup label="Kill Nodes">
+        {{#each killNodes as |node index|}}
         <option value={{node.name}} selected={{eq node.name transition.okToNode.name}}>{{node.name}}</option>
-      {{/each}}
+        {{/each}}
+      </optgroup>
+      <optgroup label="Other Nodes">
+        {{#each currentNode.validOkToNodes as |node index|}}
+          <option value={{node.name}} selected={{eq node.name transition.okToNode.name}}>{{node.name}}</option>
+        {{/each}}
+      </optgroup>
     </select>
     {{#if showWarning}}
       <span class="ok-to-warning">


[34/50] ambari git commit: AMBARI-20672 - Cluster Merge At End Of Upgrade Creation Cascades Unnecessarily (jonathanhurley)

Posted by jo...@apache.org.
AMBARI-20672 - Cluster Merge At End Of Upgrade Creation Cascades Unnecessarily (jonathanhurley)


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

Branch: refs/heads/branch-feature-AMBARI-12556
Commit: fe0aa448bd16a225ccb0bab8315fd2b8b34fba75
Parents: 3ca41f2
Author: Jonathan Hurley <jh...@hortonworks.com>
Authored: Tue Apr 4 12:57:33 2017 -0400
Committer: Jonathan Hurley <jh...@hortonworks.com>
Committed: Tue Apr 4 16:52:10 2017 -0400

----------------------------------------------------------------------
 .../internal/UpgradeResourceProvider.java       | 86 ++++++++++----------
 .../alerts/AlertStateChangedListener.java       |  2 +-
 .../listeners/upgrade/StackVersionListener.java |  2 +-
 .../ambari/server/orm/dao/UpgradeDAO.java       |  5 --
 .../server/orm/entities/ClusterEntity.java      | 13 ++-
 .../server/orm/entities/UpgradeEntity.java      | 27 ++++--
 .../org/apache/ambari/server/state/Cluster.java | 30 +++----
 .../server/state/cluster/ClusterImpl.java       | 48 ++---------
 .../services/RetryUpgradeActionService.java     |  2 +-
 .../internal/UpgradeResourceProviderTest.java   |  4 +-
 .../UpgradeSummaryResourceProviderTest.java     | 16 ++--
 .../upgrade/StackVersionListenerTest.java       |  2 +-
 .../ambari/server/orm/dao/UpgradeDAOTest.java   | 21 +++--
 .../upgrades/UpgradeActionTest.java             |  2 +-
 .../server/state/ServiceComponentTest.java      | 15 +++-
 .../alerts/AlertStateChangedEventTest.java      |  6 +-
 .../services/RetryUpgradeActionServiceTest.java |  2 +-
 17 files changed, 141 insertions(+), 142 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/fe0aa448/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/UpgradeResourceProvider.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/UpgradeResourceProvider.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/UpgradeResourceProvider.java
index ca9ce07..709ca93 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/UpgradeResourceProvider.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/UpgradeResourceProvider.java
@@ -335,7 +335,7 @@ public class UpgradeResourceProvider extends AbstractControllerResourceProvider
     final Cluster cluster;
 
     try {
-      cluster = getManagementController().getClusters().getCluster(clusterName);
+      cluster = clusters.get().getCluster(clusterName);
     } catch (AmbariException e) {
       throw new NoSuchParentResourceException(
           String.format("Cluster %s could not be loaded", clusterName));
@@ -421,7 +421,7 @@ public class UpgradeResourceProvider extends AbstractControllerResourceProvider
 
       Cluster cluster;
       try {
-        cluster = getManagementController().getClusters().getCluster(clusterName);
+        cluster = clusters.get().getCluster(clusterName);
       } catch (AmbariException e) {
         throw new NoSuchResourceException(
             String.format("Cluster %s could not be loaded", clusterName));
@@ -484,7 +484,7 @@ public class UpgradeResourceProvider extends AbstractControllerResourceProvider
     final Cluster cluster;
 
     try {
-      cluster = getManagementController().getClusters().getCluster(clusterName);
+      cluster = clusters.get().getCluster(clusterName);
     } catch (AmbariException e) {
       throw new NoSuchParentResourceException(
           String.format("Cluster %s could not be loaded", clusterName));
@@ -496,14 +496,11 @@ public class UpgradeResourceProvider extends AbstractControllerResourceProvider
           "manage upgrade and downgrade");
     }
 
-
-
     String requestIdProperty = (String) propertyMap.get(UPGRADE_REQUEST_ID);
     if (null == requestIdProperty) {
       throw new IllegalArgumentException(String.format("%s is required", UPGRADE_REQUEST_ID));
     }
 
-    long clusterId = cluster.getClusterId();
     long requestId = Long.parseLong(requestIdProperty);
     UpgradeEntity upgradeEntity = s_upgradeDAO.findUpgradeByRequestId(requestId);
     if( null == upgradeEntity){
@@ -544,11 +541,11 @@ public class UpgradeResourceProvider extends AbstractControllerResourceProvider
         suspended = Boolean.valueOf((String) propertyMap.get(UPGRADE_SUSPENDED));
       }
 
-      setUpgradeRequestStatus(clusterId, requestId, status, propertyMap);
-
-      // When the status of the upgrade's request is changing, we also update the suspended flag.
-      upgradeEntity.setSuspended(suspended);
-      s_upgradeDAO.merge(upgradeEntity);
+      try {
+        setUpgradeRequestStatus(cluster, requestId, status, suspended, propertyMap);
+      } catch (AmbariException ambariException) {
+        throw new SystemException(ambariException.getMessage(), ambariException);
+      }
     }
 
     // if either of the skip failure settings are in the request, then we need
@@ -948,11 +945,12 @@ public class UpgradeResourceProvider extends AbstractControllerResourceProvider
       RequestStageContainer request,
       UpgradeEntity upgradeEntity) throws AmbariException {
 
-    upgradeEntity.setRequestId(request.getId());
-
     request.persist();
+    RequestEntity requestEntity = s_requestDAO.findByPK(request.getId());
 
+    upgradeEntity.setRequestEntity(requestEntity);
     s_upgradeDAO.create(upgradeEntity);
+
     cluster.setUpgradeEntity(upgradeEntity);
 
     return upgradeEntity;
@@ -1670,19 +1668,28 @@ public class UpgradeResourceProvider extends AbstractControllerResourceProvider
    * <li>{@link HostRoleStatus#ABORTED}</li>
    * <li>{@link HostRoleStatus#PENDING}</li>
    * </ul>
+   * This method will also adjust the cluster->upgrade association correctly
+   * based on the new status being supplied.
    *
-   * @param clusterId
-   *          the ID of the cluster
+   * @param cluster
+   *          the cluster
    * @param requestId
    *          the request to change the status for.
    * @param status
    *          the status to set on the associated request.
+   * @param suspended
+   *          if the value of the specified status is
+   *          {@link HostRoleStatus#ABORTED}, then this boolean will control
+   *          whether the upgrade is suspended (still associated with the
+   *          cluster) or aborted (no longer associated with the cluster).
    * @param propertyMap
    *          the map of request properties (needed for things like abort reason
    *          if present)
    */
-  private void setUpgradeRequestStatus(long clusterId, long requestId, HostRoleStatus status,
-      Map<String, Object> propertyMap) {
+  @Transactional
+  void setUpgradeRequestStatus(Cluster cluster, long requestId, HostRoleStatus status,
+      boolean suspended, Map<String, Object> propertyMap) throws AmbariException {
+    // these are the only two states we allow
     if (status != HostRoleStatus.ABORTED && status != HostRoleStatus.PENDING) {
       throw new IllegalArgumentException(String.format("Cannot set status %s, only %s is allowed",
           status, EnumSet.of(HostRoleStatus.ABORTED, HostRoleStatus.PENDING)));
@@ -1710,23 +1717,23 @@ public class UpgradeResourceProvider extends AbstractControllerResourceProvider
 
     ActionManager actionManager = getManagementController().getActionManager();
 
-    if (HostRoleStatus.ABORTED == status) {
-      if (!internalStatus.isCompletedState()) {
-        actionManager.cancelRequest(requestId, reason);
-        // Remove relevant upgrade entity
-        try {
-          Cluster cluster = clusters.get().getClusterById(clusterId);
-          UpgradeEntity upgradeEntity = s_upgradeDAO.findUpgradeByRequestId(requestId);
-          upgradeEntity.setSuspended(true);
-          s_upgradeDAO.merge(upgradeEntity);
-
-          cluster.setUpgradeEntity(null);
-        } catch (AmbariException e) {
-          LOG.warn("Could not clear upgrade entity for cluster with id {}", clusterId, e);
-        }
+    if (HostRoleStatus.ABORTED == status && !internalStatus.isCompletedState()) {
+      // cancel the request
+      actionManager.cancelRequest(requestId, reason);
+
+      // either suspend the upgrade or abort it outright
+      UpgradeEntity upgradeEntity = s_upgradeDAO.findUpgradeByRequestId(requestId);
+      if (suspended) {
+        // set the upgrade to suspended
+        upgradeEntity.setSuspended(suspended);
+        s_upgradeDAO.merge(upgradeEntity);
+      } else {
+        // otherwise remove the association with the cluster since it's being
+        // full aborted
+        cluster.setUpgradeEntity(null);
       }
-    } else {
-      // Status must be PENDING.
+
+    } else if (status == HostRoleStatus.PENDING) {
       List<Long> taskIds = new ArrayList<>();
       List<HostRoleCommandEntity> hrcEntities = s_hostRoleCommandDAO.findByRequestIdAndStatuses(
           requestId, Sets.newHashSet(HostRoleStatus.ABORTED, HostRoleStatus.TIMEDOUT));
@@ -1737,16 +1744,9 @@ public class UpgradeResourceProvider extends AbstractControllerResourceProvider
 
       actionManager.resubmitTasks(taskIds);
 
-      try {
-        Cluster cluster = clusters.get().getClusterById(clusterId);
-        UpgradeEntity lastUpgradeItemForCluster = s_upgradeDAO.findLastUpgradeOrDowngradeForCluster(cluster.getClusterId());
-        lastUpgradeItemForCluster.setSuspended(false);
-        s_upgradeDAO.merge(lastUpgradeItemForCluster);
-
-        cluster.setUpgradeEntity(lastUpgradeItemForCluster);
-      } catch (AmbariException e) {
-        LOG.warn("Could not clear upgrade entity for cluster with id {}", clusterId, e);
-      }
+      UpgradeEntity lastUpgradeItemForCluster = s_upgradeDAO.findLastUpgradeOrDowngradeForCluster(cluster.getClusterId());
+      lastUpgradeItemForCluster.setSuspended(false);
+      s_upgradeDAO.merge(lastUpgradeItemForCluster);
     }
   }
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/fe0aa448/ambari-server/src/main/java/org/apache/ambari/server/events/listeners/alerts/AlertStateChangedListener.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/events/listeners/alerts/AlertStateChangedListener.java b/ambari-server/src/main/java/org/apache/ambari/server/events/listeners/alerts/AlertStateChangedListener.java
index ce55203..a02a5d8 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/events/listeners/alerts/AlertStateChangedListener.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/events/listeners/alerts/AlertStateChangedListener.java
@@ -227,7 +227,7 @@ public class AlertStateChangedListener {
     Long clusterId = history.getClusterId();
     try {
       Cluster cluster = m_clusters.get().getClusterById(clusterId);
-      if (null != cluster.getUpgradeEntity() || cluster.isUpgradeSuspended()) {
+      if (null != cluster.getUpgradeInProgress()) {
         // only send AMBARI alerts if in an upgrade
         String serviceName = definition.getServiceName();
         if (!StringUtils.equals(serviceName, Services.AMBARI.name())) {

http://git-wip-us.apache.org/repos/asf/ambari/blob/fe0aa448/ambari-server/src/main/java/org/apache/ambari/server/events/listeners/upgrade/StackVersionListener.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/events/listeners/upgrade/StackVersionListener.java b/ambari-server/src/main/java/org/apache/ambari/server/events/listeners/upgrade/StackVersionListener.java
index bd7eb00..22d7f2e 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/events/listeners/upgrade/StackVersionListener.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/events/listeners/upgrade/StackVersionListener.java
@@ -223,7 +223,7 @@ public class StackVersionListener {
         sch.setUpgradeState(UpgradeState.VERSION_MISMATCH);
       }
     } else if (upgradeState == UpgradeState.VERSION_MISMATCH && desiredVersion.equals(newVersion)) {
-      if (cluster.getUpgradeEntity() != null) {
+      if (cluster.getUpgradeInProgress() != null) {
         sch.setUpgradeState(UpgradeState.COMPLETE);
       } else {
         sch.setUpgradeState(UpgradeState.NONE);

http://git-wip-us.apache.org/repos/asf/ambari/blob/fe0aa448/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/UpgradeDAO.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/UpgradeDAO.java b/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/UpgradeDAO.java
index bf9c650..4666edf 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/UpgradeDAO.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/UpgradeDAO.java
@@ -105,11 +105,6 @@ public class UpgradeDAO {
   @Transactional
   public void create(UpgradeEntity entity) {
     EntityManager entityManager = entityManagerProvider.get();
-    // This is required because since none of the entities
-    // for the request are actually persisted yet,
-    // JPA ordering could allow foreign key entities
-    // to be created after this statement.
-    entityManager.flush();
     entityManager.persist(entity);
   }
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/fe0aa448/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/ClusterEntity.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/ClusterEntity.java b/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/ClusterEntity.java
index 89b0646..527fd7a 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/ClusterEntity.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/ClusterEntity.java
@@ -142,8 +142,17 @@ public class ClusterEntity {
   })
   private ResourceEntity resource;
 
-  @OneToOne(cascade = CascadeType.ALL)
-  @JoinColumn(name = "upgrade_id", referencedColumnName = "upgrade_id")
+  @Basic
+  @Column(name = "upgrade_id", nullable = true, insertable = false, updatable = false)
+  private Long upgradeId;
+
+  @OneToOne(cascade = CascadeType.REMOVE)
+  @JoinColumn(
+      name = "upgrade_id",
+      referencedColumnName = "upgrade_id",
+      nullable = true,
+      insertable = false,
+      updatable = true)
   /**
    * {@code null} when there is no upgrade/downgrade in progress.
    */

http://git-wip-us.apache.org/repos/asf/ambari/blob/fe0aa448/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/UpgradeEntity.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/UpgradeEntity.java b/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/UpgradeEntity.java
index 7421ca1..89574bc 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/UpgradeEntity.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/UpgradeEntity.java
@@ -24,12 +24,15 @@ import javax.persistence.Column;
 import javax.persistence.Entity;
 import javax.persistence.EnumType;
 import javax.persistence.Enumerated;
+import javax.persistence.FetchType;
 import javax.persistence.GeneratedValue;
 import javax.persistence.GenerationType;
 import javax.persistence.Id;
+import javax.persistence.JoinColumn;
 import javax.persistence.NamedQueries;
 import javax.persistence.NamedQuery;
 import javax.persistence.OneToMany;
+import javax.persistence.OneToOne;
 import javax.persistence.Table;
 import javax.persistence.TableGenerator;
 
@@ -42,8 +45,11 @@ import org.apache.ambari.server.state.stack.upgrade.UpgradeType;
  */
 @Entity
 @Table(name = "upgrade")
-@TableGenerator(name = "upgrade_id_generator",
-    table = "ambari_sequences", pkColumnName = "sequence_name", valueColumnName = "sequence_value",
+@TableGenerator(
+    name = "upgrade_id_generator",
+    table = "ambari_sequences",
+    pkColumnName = "sequence_name",
+    valueColumnName = "sequence_value",
     pkColumnValue = "upgrade_id_seq",
     initialValue = 0)
 @NamedQueries({
@@ -68,9 +74,19 @@ public class UpgradeEntity {
   @Column(name = "cluster_id", nullable = false, insertable = true, updatable = false)
   private Long clusterId;
 
-  @Column(name="request_id", nullable = false)
+  @Column(name = "request_id", nullable = false, insertable = false, updatable = false)
   private Long requestId;
 
+  /**
+   * The request entity associated with this upgrade. This relationship allows
+   * JPA to correctly order non-flushed commits during the transaction which
+   * creates the upgrade. Without it, JPA would not know the correct order and
+   * may try to create the upgrade before the request.
+   */
+  @OneToOne(optional = false, fetch = FetchType.LAZY)
+  @JoinColumn(name = "request_id", nullable = false, insertable = true, updatable = false)
+  private RequestEntity requestEntity = null;
+
   @Column(name="from_version", nullable = false)
   private String fromVersion = null;
 
@@ -161,8 +177,9 @@ public class UpgradeEntity {
   /**
    * @param id the request id
    */
-  public void setRequestId(Long id) {
-    requestId = id;
+  public void setRequestEntity(RequestEntity requestEntity) {
+    this.requestEntity = requestEntity;
+    requestId = requestEntity.getRequestId();
   }
 
   /**

http://git-wip-us.apache.org/repos/asf/ambari/blob/fe0aa448/ambari-server/src/main/java/org/apache/ambari/server/state/Cluster.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/state/Cluster.java b/ambari-server/src/main/java/org/apache/ambari/server/state/Cluster.java
index 8074b31..9594803 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/state/Cluster.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/state/Cluster.java
@@ -672,15 +672,21 @@ public interface Cluster {
   boolean isBluePrintDeployed();
 
   /**
-   * @return upgrade that is in progress for a cluster. If no upgrade is going
-   * on, a null is returned.
+   * Gets an {@link UpgradeEntity} if there is an upgrade in progress or an
+   * upgrade that has been suspended. This will return the associated
+   * {@link UpgradeEntity} if it exists.
+   * 
+   * @return an upgrade which will either be in progress or suspended, or
+   *         {@code null} if none.
+   * 
    */
-  UpgradeEntity getUpgradeEntity();
+  UpgradeEntity getUpgradeInProgress();
 
   /**
-   * The value is explicitly set on the ClusterEntity when Creating,
-   * Aborting (switching to downgrade), Resuming, or Finalizing an upgrade.
-   * @param upgradeEntity the upgrade entity to set for cluster
+   * Sets or clears the associated upgrade with the cluster.
+   *
+   * @param upgradeEntity
+   *          the upgrade entity to set for cluster, or {@code null} for none.
    * @throws AmbariException
    */
   void setUpgradeEntity(UpgradeEntity upgradeEntity) throws AmbariException;
@@ -695,18 +701,6 @@ public interface Cluster {
   boolean isUpgradeSuspended();
 
   /**
-   * Gets an {@link UpgradeEntity} if there is an upgrade in progress or an
-   * upgrade that has been suspended. This will first check
-   * {@link #getUpgradeEntity()} and return that if it is not {@code null}.
-   * Otherwise, this will perform a search for the most recent upgrade/downgrade
-   * which has not been completed.
-   *
-   * @return an upgrade which will either be in progress or suspended, or
-   *         {@code null} if none.
-   */
-  UpgradeEntity getUpgradeInProgress();
-
-  /**
    * Returns the name of the service that the passed config type belongs to.
    *
    * @param configType

http://git-wip-us.apache.org/repos/asf/ambari/blob/fe0aa448/ambari-server/src/main/java/org/apache/ambari/server/state/cluster/ClusterImpl.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/state/cluster/ClusterImpl.java b/ambari-server/src/main/java/org/apache/ambari/server/state/cluster/ClusterImpl.java
index 739fe23..b7cc4cd 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/state/cluster/ClusterImpl.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/state/cluster/ClusterImpl.java
@@ -1020,39 +1020,6 @@ public class ClusterImpl implements Cluster {
    * {@inheritDoc}
    */
   @Override
-  public UpgradeEntity getUpgradeInProgress() {
-    // first check for an upgrade that's actively running
-    UpgradeEntity upgradeInProgress = getUpgradeEntity();
-    if (null != upgradeInProgress) {
-      return upgradeInProgress;
-    }
-
-    // perform a search for any upgrade which should also return upgrades which
-    // are suspended
-    UpgradeEntity mostRecentUpgrade = upgradeDAO.findLastUpgradeOrDowngradeForCluster(getClusterId());
-    if (mostRecentUpgrade != null) {
-      if (mostRecentUpgrade.isSuspended()) {
-        return mostRecentUpgrade;
-      }
-
-      // look for any item from the prior upgrade which is still in progress
-      // (not failed, completed, or aborted)
-      List<HostRoleCommandEntity> commands = hostRoleCommandDAO.findByRequestIdAndStatuses(
-          mostRecentUpgrade.getRequestId(), HostRoleStatus.IN_PROGRESS_STATUSES);
-
-      if (!commands.isEmpty()) {
-        return mostRecentUpgrade;
-      }
-    }
-
-    return null;
-  }
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
   public ClusterVersionEntity getEffectiveClusterVersion() throws AmbariException {
     UpgradeEntity upgradeEntity = getUpgradeInProgress();
     if (upgradeEntity == null) {
@@ -3334,7 +3301,7 @@ public class ClusterImpl implements Cluster {
    * {@inheritDoc}
    */
   @Override
-  public UpgradeEntity getUpgradeEntity() {
+  public UpgradeEntity getUpgradeInProgress() {
     ClusterEntity clusterEntity = getClusterEntity();
     return clusterEntity.getUpgradeEntity();
   }
@@ -3350,10 +3317,7 @@ public class ClusterImpl implements Cluster {
       clusterEntity.setUpgradeEntity(upgradeEntity);
       clusterDAO.merge(clusterEntity);
     } catch (RollbackException e) {
-      String msg = "Unable to set upgrade entiry " + upgradeEntity + " for cluster "
-        + getClusterName();
-      LOG.warn(msg);
-      throw new AmbariException(msg, e);
+      throw new AmbariException("Unable to update the associated upgrade with the cluster", e);
     }
   }
 
@@ -3362,11 +3326,9 @@ public class ClusterImpl implements Cluster {
    */
   @Override
   public boolean isUpgradeSuspended() {
-    UpgradeEntity lastUpgradeItemForCluster = upgradeDAO.findLastUpgradeForCluster(clusterId,
-        Direction.UPGRADE);
-
-    if (null != lastUpgradeItemForCluster) {
-      return lastUpgradeItemForCluster.isSuspended();
+    UpgradeEntity upgrade = getUpgradeInProgress();
+    if (null != upgrade) {
+      return upgrade.isSuspended();
     }
 
     return false;

http://git-wip-us.apache.org/repos/asf/ambari/blob/fe0aa448/ambari-server/src/main/java/org/apache/ambari/server/state/services/RetryUpgradeActionService.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/state/services/RetryUpgradeActionService.java b/ambari-server/src/main/java/org/apache/ambari/server/state/services/RetryUpgradeActionService.java
index 6d960c3..584ce98 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/state/services/RetryUpgradeActionService.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/state/services/RetryUpgradeActionService.java
@@ -173,7 +173,7 @@ public class RetryUpgradeActionService extends AbstractScheduledService {
     }
 
     // May be null, and either upgrade or downgrade
-    UpgradeEntity currentUpgrade = cluster.getUpgradeEntity();
+    UpgradeEntity currentUpgrade = cluster.getUpgradeInProgress();
     if (currentUpgrade == null) {
       LOG.debug("There is no active stack upgrade in progress. Skip retrying failed tasks.");
       return null;

http://git-wip-us.apache.org/repos/asf/ambari/blob/fe0aa448/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/UpgradeResourceProviderTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/UpgradeResourceProviderTest.java b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/UpgradeResourceProviderTest.java
index 3e70989..999b7a7 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/UpgradeResourceProviderTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/UpgradeResourceProviderTest.java
@@ -618,7 +618,7 @@ public class UpgradeResourceProviderTest {
     upgradeEntity.setToVersion("2.2.2.2");
     upgradeEntity.setUpgradePackage("upgrade_test");
     upgradeEntity.setUpgradeType(UpgradeType.ROLLING);
-    upgradeEntity.setRequestId(2L);
+    upgradeEntity.setRequestEntity(requestEntity);
 
     upgradeDao.create(upgradeEntity);
     upgrades = upgradeDao.findUpgrades(cluster.getClusterId());
@@ -1608,7 +1608,7 @@ public class UpgradeResourceProviderTest {
     Request request = PropertyHelper.getCreateRequest(Collections.singleton(requestProps), null);
     upgradeResourceProvider.createResources(request);
 
-    List<StageEntity> stages = stageDao.findByRequestId(cluster.getUpgradeEntity().getRequestId());
+    List<StageEntity> stages = stageDao.findByRequestId(cluster.getUpgradeInProgress().getRequestId());
     Assert.assertEquals(3, stages.size());
 
     long expectedStageId = 1L;

http://git-wip-us.apache.org/repos/asf/ambari/blob/fe0aa448/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/UpgradeSummaryResourceProviderTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/UpgradeSummaryResourceProviderTest.java b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/UpgradeSummaryResourceProviderTest.java
index 19dbb44..bee8983 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/UpgradeSummaryResourceProviderTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/UpgradeSummaryResourceProviderTest.java
@@ -202,10 +202,7 @@ public class UpgradeSummaryResourceProviderTest {
     ServiceComponentHostEvent event = new ServiceComponentHostOpInProgressEvent("ZOOKEEPER_SERVER", "h1", 1L);
     ServiceComponentHostEventWrapper eventWrapper = new ServiceComponentHostEventWrapper(event);
 
-    RequestEntity requestEntity = new RequestEntity();
-    requestEntity.setRequestId(upgradeRequestId);
-    requestEntity.setClusterId(cluster.getClusterId());
-    requestDAO.create(requestEntity);
+    RequestEntity requestEntity = requestDAO.findByPK(upgradeRequestId);
 
     // Create the stage and add it to the request
     StageEntity stageEntity = new StageEntity();
@@ -269,8 +266,15 @@ public class UpgradeSummaryResourceProviderTest {
     Set<Resource> resources = upgradeSummaryResourceProvider.getResources(requestResource, p1And2);
     assertEquals(0, resources.size());
 
+    RequestEntity requestEntity = new RequestEntity();
+    requestEntity.setRequestId(1L);
+    requestEntity.setClusterId(cluster.getClusterId());
+    requestEntity.setStatus(HostRoleStatus.PENDING);
+    requestEntity.setStages(new ArrayList<StageEntity>());
+    requestDAO.create(requestEntity);
+
     UpgradeEntity upgrade = new UpgradeEntity();
-    upgrade.setRequestId(upgradeRequestId);
+    upgrade.setRequestEntity(requestEntity);
     upgrade.setClusterId(cluster.getClusterId());
     upgrade.setId(1L);
     upgrade.setUpgradePackage("some-name");
@@ -298,7 +302,7 @@ public class UpgradeSummaryResourceProviderTest {
     Assert.assertNull(r.getPropertyValue(UpgradeSummaryResourceProvider.UPGRADE_SUMMARY_FAIL_REASON));
 
     // Case 4: Append a failed task to the Upgrade. Resource should have a failed reason.
-    RequestEntity requestEntity = requestDAO.findByPK(upgradeRequestId);
+    requestEntity = requestDAO.findByPK(upgradeRequestId);
     HostEntity h1 = hostDAO.findByName("h1");
 
     StageEntity nextStage = new StageEntity();

http://git-wip-us.apache.org/repos/asf/ambari/blob/fe0aa448/ambari-server/src/test/java/org/apache/ambari/server/events/listeners/upgrade/StackVersionListenerTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/events/listeners/upgrade/StackVersionListenerTest.java b/ambari-server/src/test/java/org/apache/ambari/server/events/listeners/upgrade/StackVersionListenerTest.java
index bd9a340..7b8b68a 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/events/listeners/upgrade/StackVersionListenerTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/events/listeners/upgrade/StackVersionListenerTest.java
@@ -248,7 +248,7 @@ public class StackVersionListenerTest extends EasyMockSupport {
   public void testSetUpgradeStateToCompleteWhenHostHasVersionMismatchAndNewVersionIsEqualToComponentDesiredVersionAndClusterUpgradeIsInProgress() {
     expect(sch.getVersion()).andReturn(VALID_PREVIOUS_VERSION);
     expect(sch.getUpgradeState()).andReturn(UpgradeState.VERSION_MISMATCH);
-    expect(cluster.getUpgradeEntity()).andReturn(DUMMY_UPGRADE_ENTITY);
+    expect(cluster.getUpgradeInProgress()).andReturn(DUMMY_UPGRADE_ENTITY);
     expect(serviceComponent.getDesiredVersion()).andStubReturn(VALID_NEW_VERSION);
     expect(serviceComponent.isVersionAdvertised()).andReturn(Boolean.TRUE);
     sch.setUpgradeState(UpgradeState.COMPLETE);

http://git-wip-us.apache.org/repos/asf/ambari/blob/fe0aa448/ambari-server/src/test/java/org/apache/ambari/server/orm/dao/UpgradeDAOTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/orm/dao/UpgradeDAOTest.java b/ambari-server/src/test/java/org/apache/ambari/server/orm/dao/UpgradeDAOTest.java
index 636108e..9e47e4d 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/orm/dao/UpgradeDAOTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/orm/dao/UpgradeDAOTest.java
@@ -33,7 +33,6 @@ import org.apache.ambari.server.actionmanager.HostRoleStatus;
 import org.apache.ambari.server.orm.GuiceJpaInitializer;
 import org.apache.ambari.server.orm.InMemoryDefaultTestModule;
 import org.apache.ambari.server.orm.OrmTestHelper;
-import org.apache.ambari.server.orm.entities.AlertDefinitionEntity;
 import org.apache.ambari.server.orm.entities.RequestEntity;
 import org.apache.ambari.server.orm.entities.StageEntity;
 import org.apache.ambari.server.orm.entities.UpgradeEntity;
@@ -51,8 +50,7 @@ import com.google.inject.Guice;
 import com.google.inject.Injector;
 
 /**
- * Tests {@link AlertDefinitionDAO} for interacting with
- * {@link AlertDefinitionEntity}.
+ * Tests {@link UpgradeDAO} for interacting with {@link UpgradeEntity}.
  */
 public class UpgradeDAOTest {
 
@@ -78,10 +76,17 @@ public class UpgradeDAOTest {
     helper = injector.getInstance(OrmTestHelper.class);
     clusterId = helper.createCluster();
 
+    RequestEntity requestEntity = new RequestEntity();
+    requestEntity.setRequestId(99L);
+    requestEntity.setClusterId(clusterId.longValue());
+    requestEntity.setStatus(HostRoleStatus.PENDING);
+    requestEntity.setStages(new ArrayList<StageEntity>());
+    requestDAO.create(requestEntity);
+
     // create upgrade entities
     UpgradeEntity entity = new UpgradeEntity();
     entity.setClusterId(clusterId.longValue());
-    entity.setRequestId(Long.valueOf(1));
+    entity.setRequestEntity(requestEntity);
     entity.setFromVersion("");
     entity.setToVersion("");
     entity.setUpgradeType(UpgradeType.ROLLING);
@@ -159,7 +164,7 @@ public class UpgradeDAOTest {
     entity1.setId(11L);
     entity1.setClusterId(clusterId.longValue());
     entity1.setDirection(Direction.UPGRADE);
-    entity1.setRequestId(1L);
+    entity1.setRequestEntity(requestEntity);
     entity1.setFromVersion("2.2.0.0-1234");
     entity1.setToVersion("2.3.0.0-4567");
     entity1.setUpgradeType(UpgradeType.ROLLING);
@@ -170,7 +175,7 @@ public class UpgradeDAOTest {
     entity2.setId(22L);
     entity2.setClusterId(clusterId.longValue());
     entity2.setDirection(Direction.DOWNGRADE);
-    entity2.setRequestId(1L);
+    entity2.setRequestEntity(requestEntity);
     entity2.setFromVersion("2.3.0.0-4567");
     entity2.setToVersion("2.2.0.0-1234");
     entity2.setUpgradeType(UpgradeType.ROLLING);
@@ -181,7 +186,7 @@ public class UpgradeDAOTest {
     entity3.setId(33L);
     entity3.setClusterId(clusterId.longValue());
     entity3.setDirection(Direction.UPGRADE);
-    entity3.setRequestId(1L);
+    entity3.setRequestEntity(requestEntity);
     entity3.setFromVersion("2.2.0.0-1234");
     entity3.setToVersion("2.3.1.1-4567");
     entity3.setUpgradeType(UpgradeType.ROLLING);
@@ -211,7 +216,7 @@ public class UpgradeDAOTest {
     upgradeEntity.setId(11L);
     upgradeEntity.setClusterId(clusterId.longValue());
     upgradeEntity.setDirection(Direction.UPGRADE);
-    upgradeEntity.setRequestId(1L);
+    upgradeEntity.setRequestEntity(requestEntity);
     upgradeEntity.setFromVersion("2.2.0.0-1234");
     upgradeEntity.setToVersion("2.3.0.0-4567");
     upgradeEntity.setUpgradeType(UpgradeType.ROLLING);

http://git-wip-us.apache.org/repos/asf/ambari/blob/fe0aa448/ambari-server/src/test/java/org/apache/ambari/server/serveraction/upgrades/UpgradeActionTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/serveraction/upgrades/UpgradeActionTest.java b/ambari-server/src/test/java/org/apache/ambari/server/serveraction/upgrades/UpgradeActionTest.java
index a17c40d..c6ee875 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/serveraction/upgrades/UpgradeActionTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/serveraction/upgrades/UpgradeActionTest.java
@@ -980,7 +980,7 @@ public class UpgradeActionTest {
     UpgradeEntity upgradeEntity = new UpgradeEntity();
     upgradeEntity.setId(1L);
     upgradeEntity.setClusterId(cluster.getClusterId());
-    upgradeEntity.setRequestId(requestEntity.getRequestId());
+    upgradeEntity.setRequestEntity(requestEntity);
     upgradeEntity.setUpgradePackage("");
     upgradeEntity.setFromVersion(sourceRepo);
     upgradeEntity.setToVersion(targetRepo);

http://git-wip-us.apache.org/repos/asf/ambari/blob/fe0aa448/ambari-server/src/test/java/org/apache/ambari/server/state/ServiceComponentTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/state/ServiceComponentTest.java b/ambari-server/src/test/java/org/apache/ambari/server/state/ServiceComponentTest.java
index 5383113..8e8bed3 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/state/ServiceComponentTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/state/ServiceComponentTest.java
@@ -23,12 +23,14 @@ import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.fail;
 
 import java.sql.SQLException;
+import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 
 import org.apache.ambari.server.AmbariException;
 import org.apache.ambari.server.H2DatabaseCleaner;
+import org.apache.ambari.server.actionmanager.HostRoleStatus;
 import org.apache.ambari.server.api.services.AmbariMetaInfo;
 import org.apache.ambari.server.controller.ServiceComponentResponse;
 import org.apache.ambari.server.orm.GuiceJpaInitializer;
@@ -38,15 +40,18 @@ import org.apache.ambari.server.orm.dao.HostComponentDesiredStateDAO;
 import org.apache.ambari.server.orm.dao.HostComponentStateDAO;
 import org.apache.ambari.server.orm.dao.HostDAO;
 import org.apache.ambari.server.orm.dao.RepositoryVersionDAO;
+import org.apache.ambari.server.orm.dao.RequestDAO;
 import org.apache.ambari.server.orm.dao.ServiceComponentDesiredStateDAO;
 import org.apache.ambari.server.orm.dao.UpgradeDAO;
 import org.apache.ambari.server.orm.entities.HostComponentDesiredStateEntity;
 import org.apache.ambari.server.orm.entities.HostComponentStateEntity;
 import org.apache.ambari.server.orm.entities.HostEntity;
 import org.apache.ambari.server.orm.entities.RepositoryVersionEntity;
+import org.apache.ambari.server.orm.entities.RequestEntity;
 import org.apache.ambari.server.orm.entities.ServiceComponentDesiredStateEntity;
 import org.apache.ambari.server.orm.entities.ServiceComponentHistoryEntity;
 import org.apache.ambari.server.orm.entities.ServiceComponentVersionEntity;
+import org.apache.ambari.server.orm.entities.StageEntity;
 import org.apache.ambari.server.orm.entities.UpgradeEntity;
 import org.apache.ambari.server.state.stack.upgrade.Direction;
 import org.apache.ambari.server.state.stack.upgrade.UpgradeType;
@@ -643,6 +648,14 @@ public class ServiceComponentTest {
    * @return
    */
   private UpgradeEntity createUpgradeEntity(String fromVersion, String toVersion) {
+    RequestDAO requestDAO = injector.getInstance(RequestDAO.class);
+    RequestEntity requestEntity = new RequestEntity();
+    requestEntity.setRequestId(99L);
+    requestEntity.setClusterId(cluster.getClusterId());
+    requestEntity.setStatus(HostRoleStatus.PENDING);
+    requestEntity.setStages(new ArrayList<StageEntity>());
+    requestDAO.create(requestEntity);
+
     UpgradeDAO upgradeDao = injector.getInstance(UpgradeDAO.class);
     UpgradeEntity upgradeEntity = new UpgradeEntity();
     upgradeEntity.setClusterId(cluster.getClusterId());
@@ -651,7 +664,7 @@ public class ServiceComponentTest {
     upgradeEntity.setToVersion(toVersion);
     upgradeEntity.setUpgradePackage("upgrade_test");
     upgradeEntity.setUpgradeType(UpgradeType.ROLLING);
-    upgradeEntity.setRequestId(1L);
+    upgradeEntity.setRequestEntity(requestEntity);
 
     upgradeDao.create(upgradeEntity);
     List<UpgradeEntity> upgrades = upgradeDao.findUpgrades(cluster.getClusterId());

http://git-wip-us.apache.org/repos/asf/ambari/blob/fe0aa448/ambari-server/src/test/java/org/apache/ambari/server/state/alerts/AlertStateChangedEventTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/state/alerts/AlertStateChangedEventTest.java b/ambari-server/src/test/java/org/apache/ambari/server/state/alerts/AlertStateChangedEventTest.java
index 222f2b0..d4dbdc8 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/state/alerts/AlertStateChangedEventTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/state/alerts/AlertStateChangedEventTest.java
@@ -540,7 +540,7 @@ public class AlertStateChangedEventTest extends EasyMockSupport {
     Cluster cluster = createMock(Cluster.class);
 
     EasyMock.expect(clusters.getClusterById(EasyMock.anyLong())).andReturn(cluster).atLeastOnce();
-    EasyMock.expect(cluster.getUpgradeEntity()).andReturn(null).anyTimes();
+    EasyMock.expect(cluster.getUpgradeInProgress()).andReturn(null).anyTimes();
     EasyMock.expect(cluster.isUpgradeSuspended()).andReturn(false).anyTimes();
   }
 
@@ -556,7 +556,7 @@ public class AlertStateChangedEventTest extends EasyMockSupport {
     EasyMock.reset(clusters);
 
     EasyMock.expect(clusters.getClusterById(EasyMock.anyLong())).andReturn(cluster).atLeastOnce();
-    EasyMock.expect(cluster.getUpgradeEntity()).andReturn(new UpgradeEntity()).anyTimes();
+    EasyMock.expect(cluster.getUpgradeInProgress()).andReturn(new UpgradeEntity()).anyTimes();
     EasyMock.expect(cluster.isUpgradeSuspended()).andReturn(false).anyTimes();
   }
 
@@ -572,7 +572,7 @@ public class AlertStateChangedEventTest extends EasyMockSupport {
     EasyMock.reset(clusters);
 
     EasyMock.expect(clusters.getClusterById(EasyMock.anyLong())).andReturn(cluster).atLeastOnce();
-    EasyMock.expect(cluster.getUpgradeEntity()).andReturn(null).anyTimes();
+    EasyMock.expect(cluster.getUpgradeInProgress()).andReturn(null).anyTimes();
     EasyMock.expect(cluster.isUpgradeSuspended()).andReturn(true).anyTimes();
   }
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/fe0aa448/ambari-server/src/test/java/org/apache/ambari/server/state/services/RetryUpgradeActionServiceTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/state/services/RetryUpgradeActionServiceTest.java b/ambari-server/src/test/java/org/apache/ambari/server/state/services/RetryUpgradeActionServiceTest.java
index 2c0b507..f52f007 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/state/services/RetryUpgradeActionServiceTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/state/services/RetryUpgradeActionServiceTest.java
@@ -285,7 +285,7 @@ public class RetryUpgradeActionServiceTest {
 
     UpgradeEntity upgrade = new UpgradeEntity();
     upgrade.setId(1L);
-    upgrade.setRequestId(upgradeRequestId);
+    upgrade.setRequestEntity(requestEntity);
     upgrade.setClusterId(cluster.getClusterId());
     upgrade.setUpgradePackage("some-name");
     upgrade.setUpgradeType(UpgradeType.ROLLING);


[23/50] ambari git commit: AMBARI-20558. HiveView does not work on WASB ACLs cluster (Gaurav Nagar via nitirajrathore)

Posted by jo...@apache.org.
AMBARI-20558. HiveView does not work on WASB ACLs cluster (Gaurav Nagar via nitirajrathore)


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

Branch: refs/heads/branch-feature-AMBARI-12556
Commit: a1d58c1652920a7ab0cd7cee15c7aea79d2febb1
Parents: 40a2065
Author: Nitiraj Singh Rathore <ni...@gmail.com>
Authored: Tue Apr 4 12:39:08 2017 +0530
Committer: Nitiraj Singh Rathore <ni...@gmail.com>
Committed: Tue Apr 4 12:39:08 2017 +0530

----------------------------------------------------------------------
 .../src/main/java/org/apache/ambari/view/utils/hdfs/HdfsApi.java    | 1 +
 1 file changed, 1 insertion(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/a1d58c16/contrib/views/utils/src/main/java/org/apache/ambari/view/utils/hdfs/HdfsApi.java
----------------------------------------------------------------------
diff --git a/contrib/views/utils/src/main/java/org/apache/ambari/view/utils/hdfs/HdfsApi.java b/contrib/views/utils/src/main/java/org/apache/ambari/view/utils/hdfs/HdfsApi.java
index 66679e8..90fa483 100644
--- a/contrib/views/utils/src/main/java/org/apache/ambari/view/utils/hdfs/HdfsApi.java
+++ b/contrib/views/utils/src/main/java/org/apache/ambari/view/utils/hdfs/HdfsApi.java
@@ -66,6 +66,7 @@ public class HdfsApi {
       InterruptedException, HdfsApiException {
     this.authParams = configurationBuilder.buildAuthenticationConfig();
     conf = configurationBuilder.buildConfig();
+    UserGroupInformation.setConfiguration(conf);
     ugi = UserGroupInformation.createProxyUser(username, getProxyUser());
 
     fs = execute(new PrivilegedExceptionAction<FileSystem>() {


[49/50] ambari git commit: AMBARI-20692. Add Ability to Pause An Upgrade In Progress (alexantonenko)

Posted by jo...@apache.org.
AMBARI-20692. Add Ability to Pause An Upgrade In Progress (alexantonenko)


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

Branch: refs/heads/branch-feature-AMBARI-12556
Commit: 01e372770fb19ed50324846ce0e9ae080ae8fc01
Parents: 65d2f3f
Author: Alex Antonenko <hi...@gmail.com>
Authored: Thu Apr 6 19:07:15 2017 +0300
Committer: Alex Antonenko <hi...@gmail.com>
Committed: Thu Apr 6 20:59:54 2017 +0300

----------------------------------------------------------------------
 ambari-web/app/routes/stack_upgrade_routes.js   |  2 +-
 .../stack_upgrade/stack_upgrade_wizard.hbs      | 47 ++++++++------------
 ambari-web/test/views/main/service/menu_test.js | 10 ++---
 .../test/views/main/service/service_test.js     |  2 -
 4 files changed, 22 insertions(+), 39 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/01e37277/ambari-web/app/routes/stack_upgrade_routes.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/routes/stack_upgrade_routes.js b/ambari-web/app/routes/stack_upgrade_routes.js
index ea40a1b..42dc4dd 100644
--- a/ambari-web/app/routes/stack_upgrade_routes.js
+++ b/ambari-web/app/routes/stack_upgrade_routes.js
@@ -22,7 +22,7 @@ module.exports = App.WizardRoute.extend({
   route: 'stack/upgrade',
 
   breadcrumbs: {
-    label: 'App.router.mainAdminStackAndUpgradeController.wizardModalTitle'
+    labelBindingPath: 'App.router.mainAdminStackAndUpgradeController.wizardModalTitle'
   },
 
   enter: function (router) {

http://git-wip-us.apache.org/repos/asf/ambari/blob/01e37277/ambari-web/app/templates/main/admin/stack_upgrade/stack_upgrade_wizard.hbs
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates/main/admin/stack_upgrade/stack_upgrade_wizard.hbs b/ambari-web/app/templates/main/admin/stack_upgrade/stack_upgrade_wizard.hbs
index f82cca4..f6be5d1 100644
--- a/ambari-web/app/templates/main/admin/stack_upgrade/stack_upgrade_wizard.hbs
+++ b/ambari-web/app/templates/main/admin/stack_upgrade/stack_upgrade_wizard.hbs
@@ -38,6 +38,15 @@
   <div class="task-list scrollable-block task-list-main-wrap">
     {{#if view.isLoaded}}
       <div>
+        <div class="row">
+          {{#if isDowngrade}}
+            <button
+              class="btn btn-default" {{action confirmPauseDowngrade target="view"}}>{{t admin.stackUpgrade.pauseDowngrade}}</button>
+          {{else}}
+            <button
+              class="btn btn-default" {{action confirmPauseUpgrade target="view"}}>{{t admin.stackUpgrade.pauseUpgrade}}</button>
+          {{/if}}
+        </div>
         {{#if view.runningItem}}
           <div class="panel panel-default details-box row">
             <div class="row col-md-12">
@@ -80,11 +89,6 @@
                   {{#if view.isDowngradeAvailable}}
                     <button class="btn btn-danger" {{bindAttr disabled="controller.requestInProgress"}} {{action confirmDowngrade view.failedItem target="controller"}}>{{t common.downgrade}}</button>
                   {{/if}}
-                  {{#if isDowngrade}}
-                    <button class="btn btn-default" {{action confirmPauseDowngrade target="view"}}>{{t admin.stackUpgrade.pauseDowngrade}}</button>
-                  {{else}}
-                    <button class="btn btn-default" {{action confirmPauseUpgrade target="view"}}>{{t admin.stackUpgrade.pauseUpgrade}}</button>
-                  {{/if}}
                   {{#if view.failedItem.skippable}}
                     <button class="btn btn-warning" {{bindAttr disabled="controller.requestInProgress"}} {{action continue view.failedItem target="view"}}>{{t admin.stackUpgrade.dialog.continue}}</button>
                   {{/if}}
@@ -107,14 +111,9 @@
               {{#if view.isDowngradeAvailable}}
                 <button class="btn btn-danger" {{bindAttr disabled="controller.requestInProgress"}} {{action confirmDowngrade view.manualItem target="controller"}}>{{t common.downgrade}}</button>
               {{/if}}
-              {{#if isDowngrade}}
-                <button class="btn btn-default" {{action confirmPauseDowngrade target="view"}}>{{t admin.stackUpgrade.pauseDowngrade}}</button>
-              {{else}}
-                <button class="btn btn-default" {{action confirmPauseUpgrade target="view"}}>{{t admin.stackUpgrade.pauseUpgrade}}</button>
-              {{/if}}
-                <button class="btn btn-success" {{bindAttr disabled="view.isManualProceedDisabled"}} {{action complete view.manualItem target="view"}}>
-                  {{t common.proceed}}
-                </button>
+              <button class="btn btn-success" {{bindAttr disabled="view.isManualProceedDisabled"}} {{action complete view.manualItem target="view"}}>
+                {{t common.proceed}}
+              </button>
             </div>
           </div>
         {{/if}}
@@ -187,17 +186,12 @@
               {{#if view.isDowngradeAvailable}}
                 <button class="btn btn-danger" {{bindAttr disabled="controller.requestInProgress"}} {{action confirmDowngrade view.manualItem target="controller"}}>{{t common.downgrade}}</button>
               {{/if}}
-              {{#if isDowngrade}}
-                <button class="btn btn-default" {{action confirmPauseDowngrade target="view"}}>{{t admin.stackUpgrade.pauseDowngrade}}</button>
-              {{else}}
-                <button class="btn btn-default" {{action confirmPauseUpgrade target="view"}}>{{t admin.stackUpgrade.pauseUpgrade}}</button>
-              {{/if}}
               {{#if view.isHoldingState}}
                 <button class="btn btn-default" {{bindAttr disabled="controller.requestInProgress"}} {{action retry view.failedItem target="view"}}>{{t common.retry}}</button>
               {{else}}
-                <button class="btn btn-success" {{bindAttr disabled="view.isManualProceedDisabled"}} {{action complete view.manualItem target="view"}}>
-                  {{t common.proceed}}
-                </button>
+              <button class="btn btn-success" {{bindAttr disabled="view.isManualProceedDisabled"}} {{action complete view.manualItem target="view"}}>
+                {{t common.proceed}}
+              </button>
               {{/if}}
             </div>
           </div>
@@ -249,14 +243,9 @@
               {{#if view.isDowngradeAvailable}}
                   <button class="btn btn-danger" {{bindAttr disabled="controller.requestInProgress"}} {{action confirmDowngrade view.manualItem target="controller"}}>{{t common.downgrade}}</button>
               {{/if}}
-              {{#if isDowngrade}}
-                <button class="btn btn-default" {{action confirmPauseDowngrade target="view"}}>{{t admin.stackUpgrade.pauseDowngrade}}</button>
-              {{else}}
-                <button class="btn btn-default" {{action confirmPauseUpgrade target="view"}}>{{t admin.stackUpgrade.pauseUpgrade}}</button>
-              {{/if}}
-                <button class="btn btn-success" {{bindAttr disabled="view.isManualProceedDisabled"}} {{action complete view.manualItem target="view"}}>
-                  {{t common.proceed}}
-                </button>
+              <button class="btn btn-success" {{bindAttr disabled="view.isManualProceedDisabled"}} {{action complete view.manualItem target="view"}}>
+                {{t common.proceed}}
+              </button>
             </div>
           </div>
         {{/if}}

http://git-wip-us.apache.org/repos/asf/ambari/blob/01e37277/ambari-web/test/views/main/service/menu_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/views/main/service/menu_test.js b/ambari-web/test/views/main/service/menu_test.js
index f925f2c..6295b63 100644
--- a/ambari-web/test/views/main/service/menu_test.js
+++ b/ambari-web/test/views/main/service/menu_test.js
@@ -19,10 +19,6 @@
 var App = require('app');
 require('views/main/service/menu');
 
-function getView() {
-  return App.MainServiceMenuView.create();
-}
-
 function getItemViewClass() {
   return App.MainServiceMenuView.create().get('itemViewClass').create({
     content: Em.Object.create(),
@@ -112,7 +108,7 @@ describe('App.MainServiceMenuView', function () {
         itemView.set('parentView.activeServiceId', 'S1');
         expect(itemView.get('active')).to.be.equal('active');
       });
-      it('should return "active" ', function() {
+      it('should not return "active" ', function() {
         itemView.set('content.id', 'S1');
         itemView.set('parentView.activeServiceId', 'S2');
         expect(itemView.get('active')).to.be.empty;
@@ -168,13 +164,13 @@ describe('App.MainServiceMenuView', function () {
         App.router.transitionTo.restore();
       });
 
-      it('App.router.set should be called', function() {
+      it('App.router.set should be called (routeToConfigs true)', function() {
         expect(App.router.set.calledWith('mainServiceItemController.routeToConfigs', true)).to.be.true;
       });
       it('App.router.transitionTo should be called', function() {
         expect(App.router.transitionTo.calledWith('services.service.configs', Em.Object.create())).to.be.true;
       });
-      it('App.router.set should be called', function() {
+      it('App.router.set should be called (routeToConfigs false)', function() {
         expect(App.router.set.calledWith('mainServiceItemController.routeToConfigs', false)).to.be.true;
       });
     });

http://git-wip-us.apache.org/repos/asf/ambari/blob/01e37277/ambari-web/test/views/main/service/service_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/views/main/service/service_test.js b/ambari-web/test/views/main/service/service_test.js
index 72c2f3e..fec2540 100644
--- a/ambari-web/test/views/main/service/service_test.js
+++ b/ambari-web/test/views/main/service/service_test.js
@@ -18,8 +18,6 @@
 
 var App = require('app');
 require('views/main/service/service');
-var testHelpers = require('test/helpers');
-
 
 describe('App.MainDashboardServiceHealthView', function () {
   var view;


[40/50] ambari git commit: AMBARI-20683 Reduce size of persisted configurations in wizards. (atkach)

Posted by jo...@apache.org.
AMBARI-20683 Reduce size of persisted configurations in wizards. (atkach)


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

Branch: refs/heads/branch-feature-AMBARI-12556
Commit: 7d0baec7d7ddad29a6955f3af2ff6f020136abcd
Parents: 6c0b38e
Author: Andrii Tkach <at...@apache.org>
Authored: Wed Apr 5 16:25:23 2017 +0300
Committer: Andrii Tkach <at...@apache.org>
Committed: Wed Apr 5 16:25:23 2017 +0300

----------------------------------------------------------------------
 ambari-web/app/controllers/installer.js         | 15 +++--
 .../main/admin/kerberos/wizard_controller.js    | 18 +++---
 .../controllers/main/service/add_controller.js  | 43 +++++---------
 ambari-web/app/controllers/wizard.js            | 61 +++++++++++++++-----
 ambari-web/app/routes/add_kerberos_routes.js    | 22 ++++---
 ambari-web/app/routes/add_service_routes.js     | 16 +++--
 ambari-web/app/routes/installer.js              | 25 ++++----
 ambari-web/test/controllers/installer_test.js   | 17 ------
 ambari-web/test/controllers/wizard_test.js      | 47 ++++++++++++++-
 ambari-web/test/init_test.js                    | 25 ++++++++
 10 files changed, 176 insertions(+), 113 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/7d0baec7/ambari-web/app/controllers/installer.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/installer.js b/ambari-web/app/controllers/installer.js
index 0946ed8..369e163 100644
--- a/ambari-web/app/controllers/installer.js
+++ b/ambari-web/app/controllers/installer.js
@@ -1022,14 +1022,13 @@ App.InstallerController = App.WizardController.extend(App.Persist, {
         callback: function () {
           var dfd = $.Deferred();
           var self = this;
-          this.loadServiceConfigProperties().always(function() {
-            self.loadServiceConfigGroups();
-            self.loadCurrentHostGroups();
-            self.loadRecommendationsConfigs();
-            self.loadComponentsFromConfigs();
-            self.loadConfigThemes().then(function() {
-              dfd.resolve();
-            });
+          this.loadServiceConfigGroups();
+          this.loadCurrentHostGroups();
+          this.loadRecommendationsConfigs();
+          this.loadComponentsFromConfigs();
+          this.loadConfigThemes().then(function() {
+            self.loadServiceConfigProperties();
+            dfd.resolve();
           });
           return dfd.promise();
         }

http://git-wip-us.apache.org/repos/asf/ambari/blob/7d0baec7/ambari-web/app/controllers/main/admin/kerberos/wizard_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/admin/kerberos/wizard_controller.js b/ambari-web/app/controllers/main/admin/kerberos/wizard_controller.js
index 93ffcaa..64b2065 100644
--- a/ambari-web/app/controllers/main/admin/kerberos/wizard_controller.js
+++ b/ambari-web/app/controllers/main/admin/kerberos/wizard_controller.js
@@ -280,19 +280,15 @@ App.KerberosWizardController = App.WizardController.extend(App.InstallComponent,
     ],
     '2': [
       {
-        type: 'async',
+        type: 'sync',
         callback: function () {
           var self = this;
-          var dfd = $.Deferred();
-          this.loadServiceConfigProperties().always(function() {
-            if (!self.get('stackConfigsLoaded')) {
-              App.config.loadConfigsFromStack(['KERBEROS']).complete(function() {
-                self.set('stackConfigsLoaded', true);
-              }, self);
-            }
-            dfd.resolve();
-          });
-          return dfd.promise();
+          this.loadServiceConfigProperties();
+          if (!self.get('stackConfigsLoaded')) {
+            App.config.loadConfigsFromStack(['KERBEROS']).complete(function() {
+              self.set('stackConfigsLoaded', true);
+            }, self);
+          }
         }
       }
     ],

http://git-wip-us.apache.org/repos/asf/ambari/blob/7d0baec7/ambari-web/app/controllers/main/service/add_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/service/add_controller.js b/ambari-web/app/controllers/main/service/add_controller.js
index dc8f76c..ee7719c 100644
--- a/ambari-web/app/controllers/main/service/add_controller.js
+++ b/ambari-web/app/controllers/main/service/add_controller.js
@@ -126,10 +126,9 @@ App.AddServiceController = App.WizardController.extend(App.AddSecurityConfigs, {
           this.loadKerberosDescriptorConfigs().done(function() {
             self.loadServiceConfigGroups();
             self.loadConfigThemes().then(function() {
-              self.loadServiceConfigProperties().always(function() {
-                self.loadCurrentHostGroups();
-                dfd.resolve();
-              });
+              self.loadServiceConfigProperties();
+              self.loadCurrentHostGroups();
+              dfd.resolve();
             });
           });
           return dfd.promise();
@@ -291,19 +290,14 @@ App.AddServiceController = App.WizardController.extend(App.AddSecurityConfigs, {
   },
 
   loadServiceConfigProperties: function () {
-    var self = this;
-    var dfd = $.Deferred();
-    this._super().always(function() {
-      if (!self.get('content.services')) {
-        self.loadServices();
-      }
-      if (self.get('currentStep') > 1 && self.get('currentStep') < 6) {
-        self.set('content.skipConfigStep', self.skipConfigStep());
-        self.get('isStepDisabled').findProperty('step', 4).set('value', self.get('content.skipConfigStep'));
-      }
-      dfd.resolve();
-    });
-    return dfd.promise();
+    this._super();
+    if (!this.get('content.services')) {
+      this.loadServices();
+    }
+    if (this.get('currentStep') > 1 && this.get('currentStep') < 6) {
+      this.set('content.skipConfigStep', this.skipConfigStep());
+      this.get('isStepDisabled').findProperty('step', 4).set('value', this.get('content.skipConfigStep'));
+    }
   },
 
   /**
@@ -331,16 +325,11 @@ App.AddServiceController = App.WizardController.extend(App.AddSecurityConfigs, {
   },
 
   saveServiceConfigProperties: function (stepController) {
-    var dfd = $.Deferred();
-    var self = this;
-    this._super(stepController).always(function() {
-      if (self.get('currentStep') > 1 && self.get('currentStep') < 6) {
-        self.set('content.skipConfigStep', self.skipConfigStep());
-        self.get('isStepDisabled').findProperty('step', 4).set('value', self.get('content.skipConfigStep'));
-      }
-      dfd.resolve();
-    });
-    return dfd.promise();
+    this._super(stepController);
+    if (this.get('currentStep') > 1 && this.get('currentStep') < 6) {
+      this.set('content.skipConfigStep', this.skipConfigStep());
+      this.get('isStepDisabled').findProperty('step', 4).set('value', this.get('content.skipConfigStep'));
+    }
   },
 
   /**

http://git-wip-us.apache.org/repos/asf/ambari/blob/7d0baec7/ambari-web/app/controllers/wizard.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/wizard.js b/ambari-web/app/controllers/wizard.js
index 49bdac6..c3a54cf 100644
--- a/ambari-web/app/controllers/wizard.js
+++ b/ambari-web/app/controllers/wizard.js
@@ -21,7 +21,7 @@ var App = require('app');
 
 require('models/host');
 
-App.WizardController = Em.Controller.extend(App.LocalStorage, App.ThemesMappingMixin, App.Persist, {
+App.WizardController = Em.Controller.extend(App.LocalStorage, App.ThemesMappingMixin, {
 
   isStepDisabled: null,
 
@@ -908,26 +908,45 @@ App.WizardController = Em.Controller.extend(App.LocalStorage, App.ThemesMappingM
   },
 
   /**
-   * Load serviceConfigProperties from persist
-   * @return {$.Deferred}
+   * Load serviceConfigProperties from localStorage
    */
   loadServiceConfigProperties: function () {
-    var dfd = $.Deferred();
-    var self = this;
-    this.getDecompressedData('serviceConfigProperties').always(function(data) {
-      if (data && !data.error) {
-        self.set('content.serviceConfigProperties', data);
-      }
-      dfd.resolve();
-    });
-    return dfd.promise();
+    var stackConfigs = App.configsCollection.getAll();
+    var serviceConfigProperties = this.getDBProperty('serviceConfigProperties');
+    this.set('content.serviceConfigProperties', this.applyStoredConfigs(stackConfigs, serviceConfigProperties));
+  },
+
+  /**
+   *
+   * @param {array} configs
+   * @param {?array} storedConfigs
+   * @returns {?array}
+   */
+  applyStoredConfigs: function(configs, storedConfigs) {
+    if (storedConfigs && storedConfigs.length) {
+      let result = [];
+      let configsMap = configs.toMapByProperty('id');
+      storedConfigs.forEach(function(stored) {
+        var config = configsMap[stored.id];
+        if (config) {
+          result.push(Object.assign({}, config, stored, {savedValue: null}));
+        } else if (stored.isUserProperty) {
+          result.push(Object.assign({}, stored));
+        }
+      });
+      return result;
+    }
+    return storedConfigs;
   },
+
   /**
    * Save config properties
    * @param stepController Step7WizardController
    */
   saveServiceConfigProperties: function (stepController) {
     var serviceConfigProperties = [];
+    // properties in db should contain only mutable info to avoid localStorage overflow
+    var dbConfigProperties = [];
     var fileNamesToUpdate = this.getDBProperty('fileNamesToUpdate') || [];
     var installedServiceNames = stepController.get('installedServiceNames') || [];
     var installedServiceNamesMap = installedServiceNames.toWickMap();
@@ -948,9 +967,19 @@ App.WizardController = Em.Controller.extend(App.LocalStorage, App.ThemesMappingM
         );
         configProperty = App.config.mergeStaticProperties(configProperty, _configProperties, [], ['name', 'filename', 'isUserProperty', 'value']);
 
+        var dbConfigProperty = {
+          id: _configProperties.get('id'),
+          value: _configProperties.get('value'),
+          isFinal: _configProperties.get('isFinal')
+        };
+        if (_configProperties.get('isUserProperty') || _configProperties.get('filename') === 'capacity-scheduler.xml') {
+          dbConfigProperty = configProperty;
+        }
         if (this.isExcludedConfig(configProperty)) {
           configProperty.value = '';
+          dbConfigProperty.value = '';
         }
+        dbConfigProperties.push(dbConfigProperty);
         serviceConfigProperties.push(configProperty);
       }, this);
       // check for configs that need to update for installed services
@@ -969,8 +998,10 @@ App.WizardController = Em.Controller.extend(App.LocalStorage, App.ThemesMappingM
       }
     }, this);
     this.set('content.serviceConfigProperties', serviceConfigProperties);
-    this.setDBProperty('fileNamesToUpdate', fileNamesToUpdate);
-    return this.postCompressedData('serviceConfigProperties', serviceConfigProperties);
+    this.setDBProperties({
+      fileNamesToUpdate: fileNamesToUpdate,
+      serviceConfigProperties: dbConfigProperties
+    });
   },
 
   isExcludedConfig: function (configProperty) {
@@ -1435,7 +1466,7 @@ App.WizardController = Em.Controller.extend(App.LocalStorage, App.ThemesMappingM
 
   clearServiceConfigProperties: function() {
     this.get('content.serviceConfigProperties', null);
-    return this.postCompressedData('serviceConfigProperties', '');
+    return this.setDBProperty('serviceConfigProperties', null);
   },
 
   saveTasksStatuses: function (tasksStatuses) {

http://git-wip-us.apache.org/repos/asf/ambari/blob/7d0baec7/ambari-web/app/routes/add_kerberos_routes.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/routes/add_kerberos_routes.js b/ambari-web/app/routes/add_kerberos_routes.js
index 3dbf050..50d5595 100644
--- a/ambari-web/app/routes/add_kerberos_routes.js
+++ b/ambari-web/app/routes/add_kerberos_routes.js
@@ -134,9 +134,8 @@ module.exports = App.WizardRoute.extend({
       var kerberosStep1controller = router.get('kerberosWizardStep1Controller');
 
       kerberosWizardController.saveKerberosOption(kerberosStep1controller);
-      kerberosWizardController.clearServiceConfigProperties().always(function() {
-        router.transitionTo('step2');
-      });
+      kerberosWizardController.clearServiceConfigProperties();
+      router.transitionTo('step2');
     }
   }),
 
@@ -174,15 +173,14 @@ module.exports = App.WizardRoute.extend({
         kerberosWizardStep2Controller.get('stepConfigs')[0].get('configs').findProperty('name', 'manage_krb5_conf').set('value', 'false');
       }
 
-      kerberosWizardController.saveServiceConfigProperties(kerberosWizardStep2Controller, true).always(function() {
-        kerberosWizardController.clearTasksData();
-        if (kerberosWizardController.get('skipClientInstall')) {
-          kerberosWizardController.setDBProperty('kerberosDescriptorConfigs', null);
-          router.transitionTo('step4');
-        } else {
-          router.transitionTo('step3');
-        }
-      });
+      kerberosWizardController.saveServiceConfigProperties(kerberosWizardStep2Controller, true);
+      kerberosWizardController.clearTasksData();
+      if (kerberosWizardController.get('skipClientInstall')) {
+        kerberosWizardController.setDBProperty('kerberosDescriptorConfigs', null);
+        router.transitionTo('step4');
+      } else {
+        router.transitionTo('step3');
+      }
     }
   }),
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/7d0baec7/ambari-web/app/routes/add_service_routes.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/routes/add_service_routes.js b/ambari-web/app/routes/add_service_routes.js
index 773042b..89a4a36 100644
--- a/ambari-web/app/routes/add_service_routes.js
+++ b/ambari-web/app/routes/add_service_routes.js
@@ -231,12 +231,11 @@ module.exports = App.WizardRoute.extend({
           router.get('wizardStep7Controller').clearAllRecommendations();
           addServiceController.setDBProperty('serviceConfigGroups', undefined);
           App.ServiceConfigGroup.find().clear();
-          addServiceController.clearServiceConfigProperties().always(function() {
-            if (App.get('isKerberosEnabled')) {
-              addServiceController.setDBProperty('kerberosDescriptorConfigs', null);
-            }
-            router.transitionTo('step4');
-          });
+          addServiceController.clearServiceConfigProperties();
+          if (App.get('isKerberosEnabled')) {
+            addServiceController.setDBProperty('kerberosDescriptorConfigs', null);
+          }
+          router.transitionTo('step4');
         });
       });
     }
@@ -290,9 +289,8 @@ module.exports = App.WizardRoute.extend({
           }
         }
         addServiceController.saveServiceConfigGroups(wizardStep7Controller, true);
-        addServiceController.saveServiceConfigProperties(wizardStep7Controller).always(function() {
-          router.transitionTo('step5');
-        });
+        addServiceController.saveServiceConfigProperties(wizardStep7Controller);
+        router.transitionTo('step5');
       });
     }
   }),

http://git-wip-us.apache.org/repos/asf/ambari/blob/7d0baec7/ambari-web/app/routes/installer.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/routes/installer.js b/ambari-web/app/routes/installer.js
index 1048e8e..daefa48 100644
--- a/ambari-web/app/routes/installer.js
+++ b/ambari-web/app/routes/installer.js
@@ -379,10 +379,9 @@ module.exports = Em.Route.extend(App.RouterRedirections, {
               recommendationsConfigs: null,
               componentsFromConfigs: []
             });
-            controller.clearServiceConfigProperties().then(function() {
-              router.transitionTo('step7');
-              console.timeEnd('step6 next');
-            });
+            controller.clearServiceConfigProperties();
+            router.transitionTo('step7');
+            console.timeEnd('step6 next');
           }
         });
       }
@@ -435,15 +434,17 @@ module.exports = Em.Route.extend(App.RouterRedirections, {
         App.set('router.nextBtnClickInProgress', true);
         var controller = router.get('installerController');
         var wizardStep7Controller = router.get('wizardStep7Controller');
-        controller.saveServiceConfigProperties(wizardStep7Controller).always(function() {
-          controller.saveServiceConfigGroups(wizardStep7Controller);
-          controller.setDBProperty('recommendationsConfigs', wizardStep7Controller.get('recommendationsConfigs'));
-          controller.saveComponentsFromConfigs(controller.get('content.componentsFromConfigs'));
-          controller.setDBProperty('recommendationsHostGroup', wizardStep7Controller.get('content.recommendationsHostGroup'));
-          controller.setDBProperty('masterComponentHosts', wizardStep7Controller.get('content.masterComponentHosts'));
-          router.transitionTo('step8');
-          console.timeEnd('step7 next');
+        controller.saveServiceConfigProperties(wizardStep7Controller);
+        controller.saveServiceConfigGroups(wizardStep7Controller);
+        controller.setDBProperty('recommendationsConfigs', wizardStep7Controller.get('recommendationsConfigs'));
+        controller.saveComponentsFromConfigs(controller.get('content.componentsFromConfigs'));
+        controller.setDBProperty('recommendationsHostGroup', wizardStep7Controller.get('content.recommendationsHostGroup'));
+        controller.setDBProperty('masterComponentHosts', wizardStep7Controller.get('content.masterComponentHosts'));
+        App.clusterStatus.setClusterStatus({
+          localdb: App.db.data
         });
+        router.transitionTo('step8');
+        console.timeEnd('step7 next');
       }
     }
   }),

http://git-wip-us.apache.org/repos/asf/ambari/blob/7d0baec7/ambari-web/test/controllers/installer_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/installer_test.js b/ambari-web/test/controllers/installer_test.js
index d936ffc..94af88e 100644
--- a/ambari-web/test/controllers/installer_test.js
+++ b/ambari-web/test/controllers/installer_test.js
@@ -785,23 +785,6 @@ describe('App.InstallerController', function () {
     });
   });
 
-  describe('#loadServiceConfigProperties', function() {
-    beforeEach(function () {
-      sinon.stub(installerController, 'getDecompressedData').returns($.Deferred().resolve({
-        value: 2
-      }).promise());
-    });
-    afterEach(function () {
-      installerController.getDecompressedData.restore();
-    });
-    it ('Should load service config property', function() {
-      installerController.loadServiceConfigProperties();
-      expect(installerController.get('content.serviceConfigProperties')).to.eql({
-        "value": 2
-      });
-    });
-  });
-
   describe('#saveServices', function() {
     it ('Should return correct names', function() {
       var stepController = Em.A([

http://git-wip-us.apache.org/repos/asf/ambari/blob/7d0baec7/ambari-web/test/controllers/wizard_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/wizard_test.js b/ambari-web/test/controllers/wizard_test.js
index 1a00f24..078f8ae 100644
--- a/ambari-web/test/controllers/wizard_test.js
+++ b/ambari-web/test/controllers/wizard_test.js
@@ -1055,7 +1055,6 @@ describe('App.WizardController', function () {
       sinon.stub(c, 'setDBProperty', Em.K);
       sinon.stub(c, 'setDBProperties', Em.K);
       sinon.stub(c, 'getDBProperty').withArgs('fileNamesToUpdate').returns([]);
-      sinon.stub(c, 'postCompressedData', Em.K);
       sinon.stub(App.config, 'shouldSupportFinal').returns(true);
     });
 
@@ -1063,7 +1062,6 @@ describe('App.WizardController', function () {
       c.setDBProperty.restore();
       c.setDBProperties.restore();
       c.getDBProperty.restore();
-      c.postCompressedData.restore();
       App.config.shouldSupportFinal.restore();
     });
 
@@ -1743,4 +1741,49 @@ describe('App.WizardController', function () {
     });
   });
 
+  describe('#applyStoredConfigs', function() {
+
+    it('should return null when storedConfigs null', function() {
+      expect(c.applyStoredConfigs([], null)).to.be.null;
+    });
+
+    it('should merged configs when storedConfigs has items', function() {
+      var storedConfigs = [
+        {
+          id: 1,
+          value: 'foo',
+          isFinal: false
+        },
+        {
+          id: 2,
+          value: 'foo2',
+          isFinal: true,
+          isUserProperty: true
+        }
+      ];
+      var configs = [
+        {
+          id: 1,
+          value: '',
+          isFinal: true
+        }
+      ];
+      expect(c.applyStoredConfigs(configs, storedConfigs)).to.be.eql([
+        {
+          id: 1,
+          value: 'foo',
+          isFinal: false,
+          savedValue: null
+        },
+        {
+          id: 2,
+          value: 'foo2',
+          isFinal: true,
+          isUserProperty: true
+        }
+      ]);
+    });
+  });
+
+
 });

http://git-wip-us.apache.org/repos/asf/ambari/blob/7d0baec7/ambari-web/test/init_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/init_test.js b/ambari-web/test/init_test.js
index 02188ff..db72744 100644
--- a/ambari-web/test/init_test.js
+++ b/ambari-web/test/init_test.js
@@ -91,6 +91,31 @@ if (!Array.prototype.includes) {
   });
 }
 
+if (typeof Object.assign != 'function') {
+  Object.assign = function(target, varArgs) { // .length of function is 2
+    'use strict';
+    if (target == null) { // TypeError if undefined or null
+      throw new TypeError('Cannot convert undefined or null to object');
+    }
+
+    var to = Object(target);
+
+    for (var index = 1; index < arguments.length; index++) {
+      var nextSource = arguments[index];
+
+      if (nextSource != null) { // Skip over if undefined or null
+        for (var nextKey in nextSource) {
+          // Avoid bugs when hasOwnProperty is shadowed
+          if (Object.prototype.hasOwnProperty.call(nextSource, nextKey)) {
+            to[nextKey] = nextSource[nextKey];
+          }
+        }
+      }
+    }
+    return to;
+  };
+}
+
 Number.isFinite = Number.isFinite || function(value) {
   return typeof value === 'number' && isFinite(value);
 };


[30/50] ambari git commit: AMBARI-20668 Component identities is not updated in Add Service Wizard (akovalenko)

Posted by jo...@apache.org.
AMBARI-20668 Component identities is not updated in Add Service Wizard (akovalenko)


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

Branch: refs/heads/branch-feature-AMBARI-12556
Commit: dd2c2d0f0a64d8c64c74d370b4b7b0524d0f78d1
Parents: d711d7a
Author: Aleksandr Kovalenko <ak...@hortonworks.com>
Authored: Tue Apr 4 14:50:40 2017 +0300
Committer: Aleksandr Kovalenko <ak...@hortonworks.com>
Committed: Tue Apr 4 17:27:31 2017 +0300

----------------------------------------------------------------------
 ambari-web/app/mixins/wizard/addSecurityConfigs.js | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/dd2c2d0f/ambari-web/app/mixins/wizard/addSecurityConfigs.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/mixins/wizard/addSecurityConfigs.js b/ambari-web/app/mixins/wizard/addSecurityConfigs.js
index 2e6d3bc..e8da47f 100644
--- a/ambari-web/app/mixins/wizard/addSecurityConfigs.js
+++ b/ambari-web/app/mixins/wizard/addSecurityConfigs.js
@@ -390,7 +390,7 @@ App.AddSecurityConfigs = Em.Mixin.create({
         var prop = identity[item];
 
         // compare ui rendered config against identity with `configuration attribute` (Most of the identities have `configuration attribute`)
-        var isIdentityWithConfig =  (prop.configuration && prop.configuration.split('/')[0] === config.filename && prop.configuration.split('/')[1] === config.name);
+        var isIdentityWithConfig = (prop.configuration && prop.configuration.split('/')[0] === App.config.getConfigTagFromFileName(config.filename) && prop.configuration.split('/')[1] === config.name);
 
         // compare ui rendered config against identity without `configuration attribute` (For example spnego principal and keytab)
         var isIdentityWithoutConfig = (!prop.configuration && identity.name === config.name.split('_')[0] && item === config.name.split('_')[1]);


[14/50] ambari git commit: AMBARI-20665 Merge duplicated logic of Persist. (atkach)

Posted by jo...@apache.org.
AMBARI-20665 Merge duplicated logic of Persist. (atkach)


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

Branch: refs/heads/branch-feature-AMBARI-12556
Commit: c5e5999ee7adf765b043911c574884fc016364ad
Parents: a1cbf83
Author: Andrii Tkach <at...@apache.org>
Authored: Mon Apr 3 19:32:31 2017 +0300
Committer: Andrii Tkach <at...@apache.org>
Committed: Mon Apr 3 21:17:07 2017 +0300

----------------------------------------------------------------------
 ambari-web/app/assets/test/tests.js             |   1 +
 ambari-web/app/controllers/application.js       |   2 +-
 ambari-web/app/controllers/experimental.js      |   2 +-
 .../global/errors_handler_controller.js         |   2 +-
 .../global/user_settings_controller.js          |   2 +-
 .../global/wizard_watcher_controller.js         |   2 +-
 ambari-web/app/controllers/installer.js         |   2 +-
 ambari-web/app/controllers/wizard.js            |   7 +-
 ambari-web/app/mixins.js                        |   3 +-
 ambari-web/app/mixins/common/persist.js         | 166 +++++++++++++++++++
 ambari-web/app/mixins/common/persist_mixin.js   |  45 -----
 ambari-web/app/mixins/common/userPref.js        | 126 --------------
 ambari-web/app/models/cluster_states.js         |   3 +-
 ambari-web/app/utils/ajax/ajax.js               |  24 +--
 ambari-web/app/utils/persist.js                 | 101 -----------
 .../configs/service_configs_by_category_view.js |   2 +-
 ambari-web/app/views/common/table_view.js       |   2 +-
 ambari-web/app/views/main/dashboard/widgets.js  |   2 +-
 .../app/views/main/service/info/summary.js      |   2 +-
 ambari-web/test/controllers/installer_test.js   |   4 +-
 .../test/controllers/main/service/item_test.js  |   2 +-
 ambari-web/test/controllers/wizard_test.js      |   4 +-
 ambari-web/test/mixins/common/persist_test.js   | 125 ++++++++++++++
 ambari-web/test/views/common/table_view_test.js |  14 +-
 .../test/views/main/dashboard/widgets_test.js   |   2 +-
 25 files changed, 328 insertions(+), 319 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/c5e5999e/ambari-web/app/assets/test/tests.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/assets/test/tests.js b/ambari-web/app/assets/test/tests.js
index 8859a29..ef8d0bc 100644
--- a/ambari-web/app/assets/test/tests.js
+++ b/ambari-web/app/assets/test/tests.js
@@ -186,6 +186,7 @@ var files = [
   'test/mixins/common/serverValidator_test',
   'test/mixins/common/table_server_view_mixin_test',
   'test/mixins/common/widget_mixin_test',
+  'test/mixins/common/persist_test',
   'test/mixins/main/host/details/host_components/decommissionable_test',
   'test/mixins/main/host/details/host_components/install_component_test',
   'test/mixins/main/service/configs/widget_popover_support_test',

http://git-wip-us.apache.org/repos/asf/ambari/blob/c5e5999e/ambari-web/app/controllers/application.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/application.js b/ambari-web/app/controllers/application.js
index df0a8e8..580f337 100644
--- a/ambari-web/app/controllers/application.js
+++ b/ambari-web/app/controllers/application.js
@@ -19,7 +19,7 @@
 
 var App = require('app');
 
-App.ApplicationController = Em.Controller.extend(App.UserPref, {
+App.ApplicationController = Em.Controller.extend(App.Persist, {
 
   name: 'applicationController',
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/c5e5999e/ambari-web/app/controllers/experimental.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/experimental.js b/ambari-web/app/controllers/experimental.js
index bf5c529..f4e22ea 100644
--- a/ambari-web/app/controllers/experimental.js
+++ b/ambari-web/app/controllers/experimental.js
@@ -17,7 +17,7 @@
 
 var App = require('app');
 
-App.ExperimentalController = Em.Controller.extend(App.UserPref, {
+App.ExperimentalController = Em.Controller.extend(App.Persist, {
   name: 'experimentalController',
   supports: function () {
     return Em.keys(App.get('supports')).map(function (sup) {

http://git-wip-us.apache.org/repos/asf/ambari/blob/c5e5999e/ambari-web/app/controllers/global/errors_handler_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/global/errors_handler_controller.js b/ambari-web/app/controllers/global/errors_handler_controller.js
index c5b1067..966fcab 100644
--- a/ambari-web/app/controllers/global/errors_handler_controller.js
+++ b/ambari-web/app/controllers/global/errors_handler_controller.js
@@ -18,7 +18,7 @@
 
 var App = require('app');
 
-App.ErrorsHandlerController = Em.Controller.extend(App.UserPref, {
+App.ErrorsHandlerController = Em.Controller.extend(App.Persist, {
 
   name: 'errorsHandlerController',
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/c5e5999e/ambari-web/app/controllers/global/user_settings_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/global/user_settings_controller.js b/ambari-web/app/controllers/global/user_settings_controller.js
index e971cba..68d7e65 100644
--- a/ambari-web/app/controllers/global/user_settings_controller.js
+++ b/ambari-web/app/controllers/global/user_settings_controller.js
@@ -26,7 +26,7 @@ var timezoneUtils = require('utils/date/timezone');
  *
  * @class UserSettingsController
  */
-App.UserSettingsController = Em.Controller.extend(App.UserPref, {
+App.UserSettingsController = Em.Controller.extend(App.Persist, {
 
   name: 'userSettingsController',
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/c5e5999e/ambari-web/app/controllers/global/wizard_watcher_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/global/wizard_watcher_controller.js b/ambari-web/app/controllers/global/wizard_watcher_controller.js
index e2770fa..1562d7c 100644
--- a/ambari-web/app/controllers/global/wizard_watcher_controller.js
+++ b/ambari-web/app/controllers/global/wizard_watcher_controller.js
@@ -18,7 +18,7 @@
 
 var App = require('app');
 
-App.WizardWatcherController = Em.Controller.extend(App.UserPref, {
+App.WizardWatcherController = Em.Controller.extend(App.Persist, {
   name: 'wizardWatcherController',
 
   /**

http://git-wip-us.apache.org/repos/asf/ambari/blob/c5e5999e/ambari-web/app/controllers/installer.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/installer.js b/ambari-web/app/controllers/installer.js
index 553ec43..0946ed8 100644
--- a/ambari-web/app/controllers/installer.js
+++ b/ambari-web/app/controllers/installer.js
@@ -21,7 +21,7 @@ var App = require('app');
 var stringUtils = require('utils/string_utils');
 var validator = require('utils/validator');
 
-App.InstallerController = App.WizardController.extend(App.UserPref, {
+App.InstallerController = App.WizardController.extend(App.Persist, {
 
   name: 'installerController',
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/c5e5999e/ambari-web/app/controllers/wizard.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/wizard.js b/ambari-web/app/controllers/wizard.js
index d9d05bc..49bdac6 100644
--- a/ambari-web/app/controllers/wizard.js
+++ b/ambari-web/app/controllers/wizard.js
@@ -18,7 +18,6 @@
 
 
 var App = require('app');
-var persistUtils = require('utils/persist');
 
 require('models/host');
 
@@ -915,7 +914,7 @@ App.WizardController = Em.Controller.extend(App.LocalStorage, App.ThemesMappingM
   loadServiceConfigProperties: function () {
     var dfd = $.Deferred();
     var self = this;
-    this.getPersistentProperty('serviceConfigProperties').always(function(data) {
+    this.getDecompressedData('serviceConfigProperties').always(function(data) {
       if (data && !data.error) {
         self.set('content.serviceConfigProperties', data);
       }
@@ -971,7 +970,7 @@ App.WizardController = Em.Controller.extend(App.LocalStorage, App.ThemesMappingM
     }, this);
     this.set('content.serviceConfigProperties', serviceConfigProperties);
     this.setDBProperty('fileNamesToUpdate', fileNamesToUpdate);
-    return this.setPersistentProperty('serviceConfigProperties', serviceConfigProperties);
+    return this.postCompressedData('serviceConfigProperties', serviceConfigProperties);
   },
 
   isExcludedConfig: function (configProperty) {
@@ -1436,7 +1435,7 @@ App.WizardController = Em.Controller.extend(App.LocalStorage, App.ThemesMappingM
 
   clearServiceConfigProperties: function() {
     this.get('content.serviceConfigProperties', null);
-    return this.removePersistentProperty('serviceConfigProperties');
+    return this.postCompressedData('serviceConfigProperties', '');
   },
 
   saveTasksStatuses: function (tasksStatuses) {

http://git-wip-us.apache.org/repos/asf/ambari/blob/c5e5999e/ambari-web/app/mixins.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/mixins.js b/ambari-web/app/mixins.js
index 4fdfa54..06c69f7 100644
--- a/ambari-web/app/mixins.js
+++ b/ambari-web/app/mixins.js
@@ -23,8 +23,7 @@ require('mixins/common/blueprint');
 require('mixins/common/kdc_credentials_controller_mixin');
 require('mixins/common/localStorage');
 require('mixins/common/infinite_scroll_mixin');
-require('mixins/common/persist_mixin');
-require('mixins/common/userPref');
+require('mixins/common/persist');
 require('mixins/common/reload_popup');
 require('mixins/common/serverValidator');
 require('mixins/common/table_server_view_mixin');

http://git-wip-us.apache.org/repos/asf/ambari/blob/c5e5999e/ambari-web/app/mixins/common/persist.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/mixins/common/persist.js b/ambari-web/app/mixins/common/persist.js
new file mode 100644
index 0000000..4475112
--- /dev/null
+++ b/ambari-web/app/mixins/common/persist.js
@@ -0,0 +1,166 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+var App = require('app');
+var LZString = require('utils/lz-string');
+
+/**
+ * Small mixin for processing user preferences
+ * Provide methods to save/load some values in <code>persist</code> storage
+ * Save available only for admin users!
+ * When using this mixin you should redeclare methods:
+ * <ul>
+ *   <li>getUserPrefSuccessCallback</li>
+ *   <li>getUserPrefErrorCallback</li>
+ *   <li>postUserPrefSuccessCallback</li>
+ *   <li>postUserPrefErrorCallback</li>
+ * </ul>
+ * @type {Em.Mixin}
+ */
+App.Persist = Em.Mixin.create({
+
+  /**
+   * Additional to request data
+   * @type {object}
+   */
+  additionalData: {},
+
+  /**
+   * Get persist value from server with persistKey
+   * @param {String} key
+   */
+  getUserPref: function(key) {
+    return App.ajax.send({
+      name: 'persist.get',
+      sender: this,
+      data: {
+        key: key,
+        data: this.get('additionalData')
+      },
+      success: 'getUserPrefSuccessCallback',
+      error: 'getUserPrefErrorCallback'
+    });
+  },
+
+  /**
+   *
+   * @param {string} key
+   * @returns {$.Deferred}
+   */
+  getDecompressedData: function(key) {
+    var dfd = $.Deferred();
+    App.ajax.send({
+      name: 'persist.get.text',
+      sender: this,
+      data: {
+        key: key
+      }
+    }).always(function(data, textStatus, error) {
+      if (data && typeof data === 'string') {
+        dfd.resolve(JSON.parse(LZString.decompressFromBase64(data)));
+      } else {
+        dfd.reject({error: error});
+      }
+    });
+    return dfd.promise();
+  },
+
+  /**
+   * Should be redefined in objects that use this mixin
+   * @param {*} response
+   * @param {Object} request
+   * @param {Object} data
+   * @returns {*}
+   */
+  getUserPrefSuccessCallback: function (response, request, data) {},
+
+  /**
+   * Should be redefined in objects that use this mixin
+   * @param {Object} request
+   * @param {Object} ajaxOptions
+   * @param {String} error
+   */
+  getUserPrefErrorCallback: function (request, ajaxOptions, error) {},
+
+  /**
+   * Post persist key/value to server, value is object
+   * Only for admin users!
+   * @param {String} key
+   * @param {Object} value
+   */
+  postUserPref: function (key, value) {
+    if (!App.isAuthorized('CLUSTER.MANAGE_USER_PERSISTED_DATA')) {
+      return $.Deferred().reject().promise();
+    }
+    var keyValuePair = {};
+    keyValuePair[key] = JSON.stringify(value);
+    return this.post(keyValuePair);
+  },
+
+  /**
+   *
+   * @param {string} key
+   * @param {Object} value
+   * @returns {$.ajax}
+   */
+  postCompressedData: function (key, value) {
+    var keyValuePair = {};
+    keyValuePair[key] = !Em.isEmpty(value) ? LZString.compressToBase64(JSON.stringify(value)) : '';
+    return this.post(keyValuePair);
+  },
+
+  post: function(keyValuePair) {
+    return App.ajax.send({
+      'name': 'persist.post',
+      'sender': this,
+      'beforeSend': 'postUserPrefBeforeSend',
+      'data': {
+        'keyValuePair': keyValuePair
+      },
+      'success': 'postUserPrefSuccessCallback',
+      'error': 'postUserPrefErrorCallback'
+    });
+  },
+
+  /**
+   * Should be redefined in objects that use this mixin
+   * @param {*} response
+   * @param {Object} request
+   * @param {Object} data
+   * @returns {*}
+   */
+  postUserPrefSuccessCallback: function (response, request, data) {},
+
+  /**
+   * Should be redefined in objects that use this mixin
+   * @param {Object} request
+   * @param {Object} ajaxOptions
+   * @param {String} error
+   */
+  postUserPrefErrorCallback: function(request, ajaxOptions, error) {},
+
+  /**
+   * Little log before post request
+   * @param {Object} request
+   * @param {Object} ajaxOptions
+   * @param {Object} data
+   */
+  postUserPrefBeforeSend: function(request, ajaxOptions, data){
+  }
+
+});

http://git-wip-us.apache.org/repos/asf/ambari/blob/c5e5999e/ambari-web/app/mixins/common/persist_mixin.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/mixins/common/persist_mixin.js b/ambari-web/app/mixins/common/persist_mixin.js
deleted file mode 100644
index 0b81364..0000000
--- a/ambari-web/app/mixins/common/persist_mixin.js
+++ /dev/null
@@ -1,45 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-var App = require('app');
-var persistUtils = require('utils/persist');
-
-App.Persist = Em.Mixin.create({
-
-  persistNamespace: function() {
-    var name = this.get('name');
-    if (Em.isNone(name)) {
-      name = this.get('controller.name');
-    }
-    return name.capitalize().replace('Controller', '');
-  }.property('name'),
-
-  getPersistentProperty: function(key) {
-    return persistUtils.get(this.get('persistNamespace') + '__' + key);
-  },
-
-  setPersistentProperty: function(key, value) {
-    return persistUtils.put(this.get('persistNamespace') + '__' + key, value);
-  },
-
-  removePersistentProperty: function(key) {
-    return persistUtils.remove(this.get('persistNamespace') + '__' + key);
-  }
-
-
-});

http://git-wip-us.apache.org/repos/asf/ambari/blob/c5e5999e/ambari-web/app/mixins/common/userPref.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/mixins/common/userPref.js b/ambari-web/app/mixins/common/userPref.js
deleted file mode 100644
index 54afe4a..0000000
--- a/ambari-web/app/mixins/common/userPref.js
+++ /dev/null
@@ -1,126 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-var App = require('app');
-
-/**
- * Small mixin for processing user preferences
- * Provide methods to save/load some values in <code>persist</code> storage
- * Save available only for admin users!
- * When using this mixin you should redeclare methods:
- * <ul>
- *   <li>getUserPrefSuccessCallback</li>
- *   <li>getUserPrefErrorCallback</li>
- *   <li>postUserPrefSuccessCallback</li>
- *   <li>postUserPrefErrorCallback</li>
- * </ul>
- * @type {Em.Mixin}
- */
-App.UserPref = Em.Mixin.create({
-
-  /**
-   * Additional to request data
-   * @type {object}
-   */
-  additionalData: {},
-
-  /**
-   * Get persist value from server with persistKey
-   * @param {String} key
-   */
-  getUserPref: function(key) {
-    return App.ajax.send({
-      name: 'settings.get.user_pref',
-      sender: this,
-      data: {
-        key: key,
-        data: this.get('additionalData')
-      },
-      success: 'getUserPrefSuccessCallback',
-      error: 'getUserPrefErrorCallback'
-    });
-  },
-
-  /**
-   * Should be redeclared in objects that use this mixin
-   * @param {*} response
-   * @param {Object} request
-   * @param {Object} data
-   * @returns {*}
-   */
-  getUserPrefSuccessCallback: function (response, request, data) {},
-
-  /**
-   * Should be redeclared in objects that use this mixin
-   * @param {Object} request
-   * @param {Object} ajaxOptions
-   * @param {String} error
-   */
-  getUserPrefErrorCallback: function (request, ajaxOptions, error) {},
-
-  /**
-   * Post persist key/value to server, value is object
-   * Only for admin users!
-   * @param {String} key
-   * @param {Object} value
-   */
-  postUserPref: function (key, value) {
-    if (!App.isAuthorized('CLUSTER.MANAGE_USER_PERSISTED_DATA')) {
-      return $.Deferred().reject().promise();
-    }
-    var keyValuePair = {};
-    keyValuePair[key] = JSON.stringify(value);
-    return App.ajax.send({
-      'name': 'settings.post.user_pref',
-      'sender': this,
-      'beforeSend': 'postUserPrefBeforeSend',
-      'data': {
-        'keyValuePair': keyValuePair
-      },
-      'success': 'postUserPrefSuccessCallback',
-      'error': 'postUserPrefErrorCallback'
-    });
-  },
-
-  /**
-   * Should be redeclared in objects that use this mixin
-   * @param {*} response
-   * @param {Object} request
-   * @param {Object} data
-   * @returns {*}
-   */
-  postUserPrefSuccessCallback: function (response, request, data) {},
-
-  /**
-   * Should be redeclared in objects that use this mixin
-   * @param {Object} request
-   * @param {Object} ajaxOptions
-   * @param {String} error
-   */
-  postUserPrefErrorCallback: function(request, ajaxOptions, error) {},
-
-  /**
-   * Little log before post request
-   * @param {Object} request
-   * @param {Object} ajaxOptions
-   * @param {Object} data
-   */
-  postUserPrefBeforeSend: function(request, ajaxOptions, data){
-  }
-
-});

http://git-wip-us.apache.org/repos/asf/ambari/blob/c5e5999e/ambari-web/app/models/cluster_states.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/models/cluster_states.js b/ambari-web/app/models/cluster_states.js
index cbc134d..f111c3a 100644
--- a/ambari-web/app/models/cluster_states.js
+++ b/ambari-web/app/models/cluster_states.js
@@ -16,9 +16,8 @@
  * limitations under the License.
  */
 var App = require('app');
-require('mixins/common/userPref');
 var LZString = require('utils/lz-string');
-App.clusterStatus = Em.Object.create(App.UserPref, {
+App.clusterStatus = Em.Object.create(App.Persist, {
 
   /**
    * Cluster name

http://git-wip-us.apache.org/repos/asf/ambari/blob/c5e5999e/ambari-web/app/utils/ajax/ajax.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/utils/ajax/ajax.js b/ambari-web/app/utils/ajax/ajax.js
index e8be31c..2d157fe 100644
--- a/ambari-web/app/utils/ajax/ajax.js
+++ b/ambari-web/app/utils/ajax/ajax.js
@@ -1350,20 +1350,6 @@ var urls = {
       };
     }
   },
-  'settings.get.user_pref': {
-    'real': '/persist/{key}',
-    'mock': '/data/user_settings/{key}.json'
-  },
-  'settings.post.user_pref': {
-    'real': '/persist',
-    'mock': '',
-    'type': 'POST',
-    'format': function (data) {
-      return {
-        data: JSON.stringify(data.keyValuePair)
-      }
-    }
-  },
   'cluster.load_cluster_name': {
     'real': '/clusters?fields=Clusters/security_type',
     'mock': '/data/clusters/info.json'
@@ -2200,7 +2186,7 @@ var urls = {
     'mock': '/data/requests/host_check/1.json'
   },
 
-  'persist.get': {
+  'persist.get.text': {
     'real': '/persist/{key}',
     'mock': '',
     'type': 'GET',
@@ -2210,7 +2196,13 @@ var urls = {
       }
     }
   },
-  'persist.put': {
+
+  'persist.get': {
+    'real': '/persist/{key}',
+    'mock': '',
+    'type': 'GET'
+  },
+  'persist.post': {
     'real': '/persist',
     'mock': '',
     'type': 'POST',

http://git-wip-us.apache.org/repos/asf/ambari/blob/c5e5999e/ambari-web/app/utils/persist.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/utils/persist.js b/ambari-web/app/utils/persist.js
deleted file mode 100644
index 3d3164f..0000000
--- a/ambari-web/app/utils/persist.js
+++ /dev/null
@@ -1,101 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-var LZString = require('utils/lz-string');
-/**
- * Persist storage managing utils. It helps to put and get values from persisted storage
- * by api (/api/v1/persist).
- * @type {Object}
- */
-module.exports = {
-  /**
-   * Get item from persist storage by key and optional path.
-   *
-   * @param  {String} key persist key to get e.g 'CLUSTER_STATUS', will fetch data from
-   * /api/v1/persist/CLUSTER_STATUS
-   * @param  {String} [path=null] Em.get compatible attributes path
-   * @return {$.Deferred}
-   */
-  get: function(key, path) {
-    var dfd = $.Deferred();
-    App.ajax.send({
-      name: 'persist.get',
-      sender: this,
-      data: {
-        deferred: dfd,
-        key: key || '',
-        path: path
-      },
-      success: 'getSuccessCallback',
-      error: 'getErrorCallback'
-    });
-    return dfd.promise();
-  },
-
-  getSuccessCallback: function(data, xhr, params) {
-    var extracted, response = data;
-    try {
-      response = JSON.parse(response);
-    } catch(e) { }
-    if (Em.isEmpty(data)) {
-      params.deferred.resolve(null);
-      return;
-    }
-    if (typeof response === 'string') {
-      extracted = JSON.parse(LZString.decompressFromBase64(response));
-      params.deferred.resolve(params.path ? Em.get(extracted, params.path) : extracted);
-    } else {
-      params.deferred.resolve(response);
-    }
-  },
-
-  getErrorCallback: function(request, ajaxOptions, error, opt, params) {
-    params.deferred.reject({
-      request: request,
-      error: error
-    });
-  },
-
-  /**
-   * Update key value.
-   *
-   * @param  {String} key
-   * @param  {Object} value value to save
-   * @return {$.Deferred}
-   */
-  put: function(key, value) {
-    var kv = {};
-    kv[key] = !Em.isEmpty(value) ? LZString.compressToBase64(JSON.stringify(value)) : '';
-    return App.ajax.send({
-      name: 'persist.put',
-      sender: this,
-      data: {
-        keyValuePair: kv
-      },
-      success: 'putSuccessCallback',
-      error: 'putErrorCallback'
-    });
-  },
-
-  putSuccessCallback: function() {},
-  putErrorCallback: function() {},
-
-  remove: function(key) {
-    return this.put(key, '');
-  }
-}

http://git-wip-us.apache.org/repos/asf/ambari/blob/c5e5999e/ambari-web/app/views/common/configs/service_configs_by_category_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/common/configs/service_configs_by_category_view.js b/ambari-web/app/views/common/configs/service_configs_by_category_view.js
index 16c828c..4058020 100644
--- a/ambari-web/app/views/common/configs/service_configs_by_category_view.js
+++ b/ambari-web/app/views/common/configs/service_configs_by_category_view.js
@@ -21,7 +21,7 @@ var App = require('app');
 var validator = require('utils/validator');
 require('utils/configs/modification_handlers/modification_handler');
 
-App.ServiceConfigsByCategoryView = Em.View.extend(App.UserPref, App.ConfigOverridable, {
+App.ServiceConfigsByCategoryView = Em.View.extend(App.Persist, App.ConfigOverridable, {
 
   templateName: require('templates/common/configs/service_config_category'),
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/c5e5999e/ambari-web/app/views/common/table_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/common/table_view.js b/ambari-web/app/views/common/table_view.js
index c394d47..e14d283 100644
--- a/ambari-web/app/views/common/table_view.js
+++ b/ambari-web/app/views/common/table_view.js
@@ -19,7 +19,7 @@
 var App = require('app');
 var filters = require('views/common/filter_view');
 
-App.TableView = Em.View.extend(App.UserPref, {
+App.TableView = Em.View.extend(App.Persist, {
 
   init: function() {
     this.set('filterConditions', []);

http://git-wip-us.apache.org/repos/asf/ambari/blob/c5e5999e/ambari-web/app/views/main/dashboard/widgets.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/dashboard/widgets.js b/ambari-web/app/views/main/dashboard/widgets.js
index 16840a5..2850200 100644
--- a/ambari-web/app/views/main/dashboard/widgets.js
+++ b/ambari-web/app/views/main/dashboard/widgets.js
@@ -28,7 +28,7 @@ const WidgetObject = Em.Object.extend({
   isVisible: true
 });
 
-App.MainDashboardWidgetsView = Em.View.extend(App.UserPref, App.LocalStorage, App.TimeRangeMixin, {
+App.MainDashboardWidgetsView = Em.View.extend(App.Persist, App.LocalStorage, App.TimeRangeMixin, {
   name: 'mainDashboardWidgetsView',
   templateName: require('templates/main/dashboard/widgets'),
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/c5e5999e/ambari-web/app/views/main/service/info/summary.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/service/info/summary.js b/ambari-web/app/views/main/service/info/summary.js
index 378a8b3..551a3fd 100644
--- a/ambari-web/app/views/main/service/info/summary.js
+++ b/ambari-web/app/views/main/service/info/summary.js
@@ -21,7 +21,7 @@ var misc = require('utils/misc');
 require('views/main/service/service');
 require('data/service_graph_config');
 
-App.MainServiceInfoSummaryView = Em.View.extend(App.UserPref, App.TimeRangeMixin, {
+App.MainServiceInfoSummaryView = Em.View.extend(App.Persist, App.TimeRangeMixin, {
   templateName: require('templates/main/service/info/summary'),
   /**
    * @property {Number} chunkSize - number of columns in Metrics section

http://git-wip-us.apache.org/repos/asf/ambari/blob/c5e5999e/ambari-web/test/controllers/installer_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/installer_test.js b/ambari-web/test/controllers/installer_test.js
index 74556e8..d936ffc 100644
--- a/ambari-web/test/controllers/installer_test.js
+++ b/ambari-web/test/controllers/installer_test.js
@@ -787,12 +787,12 @@ describe('App.InstallerController', function () {
 
   describe('#loadServiceConfigProperties', function() {
     beforeEach(function () {
-      sinon.stub(installerController, 'getPersistentProperty').returns($.Deferred().resolve({
+      sinon.stub(installerController, 'getDecompressedData').returns($.Deferred().resolve({
         value: 2
       }).promise());
     });
     afterEach(function () {
-      installerController.getPersistentProperty.restore();
+      installerController.getDecompressedData.restore();
     });
     it ('Should load service config property', function() {
       installerController.loadServiceConfigProperties();

http://git-wip-us.apache.org/repos/asf/ambari/blob/c5e5999e/ambari-web/test/controllers/main/service/item_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/main/service/item_test.js b/ambari-web/test/controllers/main/service/item_test.js
index 69a02de..7f50620 100644
--- a/ambari-web/test/controllers/main/service/item_test.js
+++ b/ambari-web/test/controllers/main/service/item_test.js
@@ -20,7 +20,7 @@ App = require('app');
 require('ember');
 require('models/host_component');
 require('views/common/modal_popup');
-require('mixins/common/userPref');
+require('mixins/common/persist');
 require('controllers/application');
 require('controllers/global/background_operations_controller');
 require('controllers/global/cluster_controller');

http://git-wip-us.apache.org/repos/asf/ambari/blob/c5e5999e/ambari-web/test/controllers/wizard_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/wizard_test.js b/ambari-web/test/controllers/wizard_test.js
index 922cc90..1a00f24 100644
--- a/ambari-web/test/controllers/wizard_test.js
+++ b/ambari-web/test/controllers/wizard_test.js
@@ -1055,7 +1055,7 @@ describe('App.WizardController', function () {
       sinon.stub(c, 'setDBProperty', Em.K);
       sinon.stub(c, 'setDBProperties', Em.K);
       sinon.stub(c, 'getDBProperty').withArgs('fileNamesToUpdate').returns([]);
-      sinon.stub(c, 'setPersistentProperty', Em.K);
+      sinon.stub(c, 'postCompressedData', Em.K);
       sinon.stub(App.config, 'shouldSupportFinal').returns(true);
     });
 
@@ -1063,7 +1063,7 @@ describe('App.WizardController', function () {
       c.setDBProperty.restore();
       c.setDBProperties.restore();
       c.getDBProperty.restore();
-      c.setPersistentProperty.restore();
+      c.postCompressedData.restore();
       App.config.shouldSupportFinal.restore();
     });
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/c5e5999e/ambari-web/test/mixins/common/persist_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/mixins/common/persist_test.js b/ambari-web/test/mixins/common/persist_test.js
new file mode 100644
index 0000000..592d9b7
--- /dev/null
+++ b/ambari-web/test/mixins/common/persist_test.js
@@ -0,0 +1,125 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+var App = require('app');
+var testHelpers = require('test/helpers');
+var LZString = require('utils/lz-string');
+
+describe('App.Persist', function () {
+  var mixin;
+
+  beforeEach(function () {
+    mixin = Em.Object.create(App.Persist, {
+      additionalData: {}
+    });
+  });
+
+  describe('#getUserPref', function() {
+
+    it('App.ajax.send should be called', function() {
+      mixin.getUserPref('foo');
+      var args = testHelpers.findAjaxRequest('name', 'persist.get');
+      expect(args[0]).to.be.eql({
+        name: 'persist.get',
+        sender: mixin,
+        data: {
+          key: 'foo',
+          data: {}
+        },
+        success: 'getUserPrefSuccessCallback',
+        error: 'getUserPrefErrorCallback'
+      });
+    });
+  });
+
+  describe('#getDecompressedData', function() {
+
+    it('App.ajax.send should be called', function() {
+      mixin.getDecompressedData('foo');
+      var args = testHelpers.findAjaxRequest('name', 'persist.get.text');
+      expect(args[0]).to.be.eql({
+        name: 'persist.get.text',
+        sender: mixin,
+        data: {
+          key: 'foo'
+        }
+      });
+    });
+  });
+
+  describe('#post', function() {
+
+    it('App.ajax.send should be called', function() {
+      mixin.post({"foo": "bar"});
+      var args = testHelpers.findAjaxRequest('name', 'persist.post');
+      expect(args[0]).to.be.eql({
+        'name': 'persist.post',
+        'sender': mixin,
+        'beforeSend': 'postUserPrefBeforeSend',
+        'data': {
+          'keyValuePair': {"foo": "bar"}
+        },
+        'success': 'postUserPrefSuccessCallback',
+        'error': 'postUserPrefErrorCallback'
+      });
+    });
+  });
+
+  describe('#postUserPref', function() {
+    beforeEach(function() {
+      sinon.stub(mixin, 'post');
+      this.mockAuthorize = sinon.stub(App, 'isAuthorized');
+    });
+    afterEach(function() {
+      mixin.post.restore();
+      this.mockAuthorize.restore();
+    });
+
+    it('post should be called when authorized', function() {
+      this.mockAuthorize.withArgs('CLUSTER.MANAGE_USER_PERSISTED_DATA').returns(true);
+      mixin.postUserPref('foo', {"foo": "bar"});
+      expect(mixin.post.calledWith({'foo': '{"foo":"bar"}'})).to.be.true;
+    });
+
+    it('post should not be called when authorized', function() {
+      this.mockAuthorize.withArgs('CLUSTER.MANAGE_USER_PERSISTED_DATA').returns(false);
+      mixin.postUserPref('foo', {"foo": "bar"});
+      expect(mixin.post.called).to.be.false;
+    });
+  });
+
+  describe('#postCompressedData', function() {
+    beforeEach(function() {
+      sinon.stub(mixin, 'post');
+      sinon.stub(LZString, 'compressToBase64', function(args) {return args;})
+    });
+    afterEach(function() {
+      mixin.post.restore();
+      LZString.compressToBase64.restore();
+    });
+
+    it('post should be called with object value', function() {
+      mixin.postCompressedData('foo', {"foo": "bar"});
+      expect(mixin.post.calledWith({'foo': '{"foo":"bar"}'})).to.be.true;
+    });
+    it('post should be called with empty value', function() {
+      mixin.postCompressedData('foo', null);
+      expect(mixin.post.calledWith({'foo': ''})).to.be.true;
+    });
+  });
+});

http://git-wip-us.apache.org/repos/asf/ambari/blob/c5e5999e/ambari-web/test/views/common/table_view_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/views/common/table_view_test.js b/ambari-web/test/views/common/table_view_test.js
index 3d11e30..439fac4 100644
--- a/ambari-web/test/views/common/table_view_test.js
+++ b/ambari-web/test/views/common/table_view_test.js
@@ -21,7 +21,7 @@ require('utils/db');
 require('views/common/filter_view');
 require('views/common/sort_view');
 require('mixins');
-require('mixins/common/userPref');
+require('mixins/common/persist');
 require('views/common/table_view');
 
 function getView() {
@@ -60,7 +60,7 @@ describe('App.TableView', function () {
   describe('#updatePaging', function() {
 
     beforeEach(function() {
-      view = App.TableView.create(App.UserPref, {
+      view = App.TableView.create(App.Persist, {
         controller: Em.Object.create({}),
         displayLength: 10,
         startIndex: 1,
@@ -88,7 +88,7 @@ describe('App.TableView', function () {
   describe('#endIndex', function() {
 
     beforeEach(function() {
-      view = App.TableView.create(App.UserPref, {
+      view = App.TableView.create(App.Persist, {
         controller: Em.Object.create({}),
         displayLength: 10,
         startIndex: 1,
@@ -130,7 +130,7 @@ describe('App.TableView', function () {
   describe('#pageContent', function() {
 
     beforeEach(function() {
-      view = App.TableView.create(App.UserPref, {
+      view = App.TableView.create(App.Persist, {
         controller: Em.Object.create({}),
         displayLength: 10,
         startIndex: 1,
@@ -175,7 +175,7 @@ describe('App.TableView', function () {
   describe('#filtersUsedCalc', function() {
 
     beforeEach(function() {
-      view = App.TableView.create(App.UserPref, {
+      view = App.TableView.create(App.Persist, {
         controller: Em.Object.create({}),
         displayLength: 10,
         startIndex: 1,
@@ -209,7 +209,7 @@ describe('App.TableView', function () {
   describe('#nextPage', function() {
 
     beforeEach(function() {
-      view = App.TableView.create(App.UserPref, {
+      view = App.TableView.create(App.Persist, {
         controller: Em.Object.create({}),
         displayLength: 10,
         startIndex: 1,
@@ -249,7 +249,7 @@ describe('App.TableView', function () {
   describe('#previousPage', function() {
 
     beforeEach(function() {
-      view = App.TableView.create(App.UserPref, {
+      view = App.TableView.create(App.Persist, {
         controller: Em.Object.create({}),
         displayLength: 10,
         startIndex: 50,

http://git-wip-us.apache.org/repos/asf/ambari/blob/c5e5999e/ambari-web/test/views/main/dashboard/widgets_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/views/main/dashboard/widgets_test.js b/ambari-web/test/views/main/dashboard/widgets_test.js
index 4700ac8..6e8a6eb 100644
--- a/ambari-web/test/views/main/dashboard/widgets_test.js
+++ b/ambari-web/test/views/main/dashboard/widgets_test.js
@@ -19,7 +19,7 @@
 
 var App = require('app');
 require('messages');
-require('mixins/common/userPref');
+require('mixins/common/persist');
 require('mixins/common/localStorage');
 require('views/main/dashboard/widgets');
 


[05/50] ambari git commit: AMBARI-20596. Cleanup temporary files needed for downloading client configurations response -- fix checkstyle error (Attila Magyar via adoroszlai)

Posted by jo...@apache.org.
AMBARI-20596. Cleanup temporary files needed for downloading client configurations response -- fix checkstyle error (Attila Magyar via adoroszlai)


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

Branch: refs/heads/branch-feature-AMBARI-12556
Commit: 0ffb42b5e52176cd55f14f7303e34483c608cbfa
Parents: fc36391
Author: Attila Magyar <am...@hortonworks.com>
Authored: Mon Apr 3 14:05:05 2017 +0200
Committer: Attila Doroszlai <ad...@hortonworks.com>
Committed: Mon Apr 3 14:05:05 2017 +0200

----------------------------------------------------------------------
 .../controller/internal/ClientConfigResourceProviderTest.java       | 1 -
 1 file changed, 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/0ffb42b5/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/ClientConfigResourceProviderTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/ClientConfigResourceProviderTest.java b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/ClientConfigResourceProviderTest.java
index c2ee4d6..e7c1588 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/ClientConfigResourceProviderTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/ClientConfigResourceProviderTest.java
@@ -76,7 +76,6 @@ import org.apache.ambari.server.state.StackId;
 import org.apache.ambari.server.state.UserGroupInfo;
 import org.apache.ambari.server.state.ValueAttributesInfo;
 import org.apache.ambari.server.utils.StageUtils;
-import org.apache.commons.io.FileUtils;
 import org.easymock.EasyMock;
 import org.junit.Assert;
 import org.junit.Test;


[35/50] ambari git commit: AMBARI-20672 - Cluster Merge At End Of Upgrade Creation Cascades Unnecessarily (part2) (jonathanhurley)

Posted by jo...@apache.org.
AMBARI-20672 - Cluster Merge At End Of Upgrade Creation Cascades Unnecessarily (part2) (jonathanhurley)


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

Branch: refs/heads/branch-feature-AMBARI-12556
Commit: 8c2ff91c7c632d01c35dec160b0debdab730ca82
Parents: fe0aa44
Author: Jonathan Hurley <jh...@hortonworks.com>
Authored: Tue Apr 4 17:14:33 2017 -0400
Committer: Jonathan Hurley <jh...@hortonworks.com>
Committed: Tue Apr 4 17:14:33 2017 -0400

----------------------------------------------------------------------
 .../ambari/server/state/alerts/AlertStateChangedEventTest.java     | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/8c2ff91c/ambari-server/src/test/java/org/apache/ambari/server/state/alerts/AlertStateChangedEventTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/state/alerts/AlertStateChangedEventTest.java b/ambari-server/src/test/java/org/apache/ambari/server/state/alerts/AlertStateChangedEventTest.java
index d4dbdc8..f507cab 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/state/alerts/AlertStateChangedEventTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/state/alerts/AlertStateChangedEventTest.java
@@ -572,7 +572,7 @@ public class AlertStateChangedEventTest extends EasyMockSupport {
     EasyMock.reset(clusters);
 
     EasyMock.expect(clusters.getClusterById(EasyMock.anyLong())).andReturn(cluster).atLeastOnce();
-    EasyMock.expect(cluster.getUpgradeInProgress()).andReturn(null).anyTimes();
+    EasyMock.expect(cluster.getUpgradeInProgress()).andReturn(EasyMock.createMock(UpgradeEntity.class)).anyTimes();
     EasyMock.expect(cluster.isUpgradeSuspended()).andReturn(true).anyTimes();
   }
 


[50/50] ambari git commit: Merge branch 'trunk' into branch-feature-AMBARI-12556

Posted by jo...@apache.org.
Merge branch 'trunk' into branch-feature-AMBARI-12556


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

Branch: refs/heads/branch-feature-AMBARI-12556
Commit: f650e351ce50ab2ed7852cf764b6a5074d7873ac
Parents: 70c23bc 01e3727
Author: Jonathan Hurley <jh...@hortonworks.com>
Authored: Thu Apr 6 14:57:29 2017 -0400
Committer: Jonathan Hurley <jh...@hortonworks.com>
Committed: Thu Apr 6 14:57:29 2017 -0400

----------------------------------------------------------------------
 .../main/resources/ui/admin-web/app/index.html  |   4 +-
 ambari-agent/pom.xml                            |  10 +-
 .../ambari_agent/StatusCommandsExecutor.py      | 209 ++++++-------
 .../src/main/python/ambari_agent/main.py        |   5 +-
 .../python/resource_management/TestUtils.py     |  39 +++
 .../python/resource_management/core/sudo.py     |  58 +++-
 .../python/resource_management/core/utils.py    |  56 +++-
 .../libraries/functions/copy_tarball.py         |  24 +-
 .../functions/setup_ranger_plugin_xml.py        |  16 +-
 .../libraries/script/script.py                  |   8 +-
 .../FieldAuditLogRequestQueryConverter.java     |   1 -
 .../TopFieldAuditLogRequestQueryConverter.java  |  54 ++++
 .../logsearch/manager/AuditLogsManager.java     |   3 +-
 .../request/impl/FieldAuditLogRequest.java      |  17 +-
 .../request/impl/TopFieldAuditLogRequest.java   |  40 +++
 .../logsearch/rest/AuditLogsResource.java       |   4 +-
 .../logsearch/rest/UserConfigResource.java      |   2 +-
 .../FieldAuditLogRequestQueryConverterTest.java |   3 +-
 ...pFieldAuditLogRequestQueryConverterTest.java |  61 ++++
 .../ambari-logsearch-web/package.json           |  17 +-
 .../main/webapp/scripts/views/common/Header.js  |   6 +-
 .../server/actionmanager/ActionDBAccessor.java  |  16 +-
 .../actionmanager/ActionDBAccessorImpl.java     |  13 +-
 .../server/actionmanager/ActionScheduler.java   |   2 +-
 .../ambari/server/actionmanager/Stage.java      |  22 +-
 .../server/api/services/AmbariMetaInfo.java     |   6 +
 .../StackAdvisorBlueprintProcessor.java         |   8 +-
 .../ambari/server/checks/CheckDescription.java  |   5 +-
 .../checks/ServiceCheckValidityCheck.java       |  13 +-
 .../server/checks/ServicePresenceCheck.java     |  52 ++-
 .../server/configuration/Configuration.java     |   2 +-
 .../ambari/server/controller/ActionRequest.java |  19 +-
 .../server/controller/ClusterResponse.java      |  17 +-
 .../server/controller/ExecuteActionRequest.java |  16 +-
 .../server/controller/ServiceRequest.java       |  10 +-
 .../server/controller/ShortTaskStatus.java      |  19 +-
 .../ambari/server/controller/UserRequest.java   |   2 +-
 .../BlueprintConfigurationProcessor.java        |   1 +
 .../internal/ClientConfigResourceProvider.java  |  35 ++-
 .../internal/StageResourceProvider.java         |   4 +-
 .../internal/UpgradeItemResourceProvider.java   |  61 ++--
 .../internal/UpgradeResourceProvider.java       |  86 ++---
 .../customactions/ActionDefinitionManager.java  |   4 +-
 .../ambari/server/events/HostsRemovedEvent.java |   2 +-
 .../alerts/AlertStateChangedListener.java       |   2 +-
 .../listeners/upgrade/StackVersionListener.java |   2 +-
 .../apache/ambari/server/orm/dao/StageDAO.java  |  68 ++--
 .../ambari/server/orm/dao/UpgradeDAO.java       |   5 -
 .../server/orm/entities/ClusterEntity.java      |  13 +-
 .../ambari/server/orm/entities/StageEntity.java |  28 +-
 .../server/orm/entities/StageEntityPK.java      |  35 +--
 .../server/orm/entities/UpgradeEntity.java      |  27 +-
 .../server/orm/helpers/dbms/PostgresHelper.java |   2 +-
 .../security/encryption/CredentialProvider.java |   2 +-
 .../serveraction/ServerActionExecutor.java      | 114 +++----
 .../ambari/server/stack/ServiceModule.java      |  18 +-
 .../apache/ambari/server/stack/StackModule.java |   9 +
 .../server/stageplanner/RoleGraphNode.java      |   2 +-
 .../org/apache/ambari/server/state/Cluster.java |  30 +-
 .../apache/ambari/server/state/HostConfig.java  |   4 +-
 .../server/state/ServiceComponentImpl.java      |  13 +-
 .../apache/ambari/server/state/ServiceImpl.java |  10 +-
 .../apache/ambari/server/state/StackInfo.java   |  13 +
 .../ambari/server/state/UpgradeHelper.java      |  48 ---
 .../server/state/cluster/ClusterImpl.java       |  48 +--
 .../AbstractKerberosDescriptorContainer.java    |  27 +-
 .../kerberos/KerberosIdentityDescriptor.java    |  18 ++
 .../state/services/MetricsRetrievalService.java |  29 +-
 .../services/RetryUpgradeActionService.java     |   2 +-
 .../state/stack/StackRoleCommandOrder.java      |   2 +-
 .../state/stack/upgrade/ColocatedGrouping.java  |  80 ++++-
 .../state/stack/upgrade/TaskWrapperBuilder.java |  10 +-
 .../server/topology/BlueprintValidatorImpl.java |   2 +-
 .../apache/ambari/server/view/ViewRegistry.java |  51 ++-
 ambari-server/src/main/python/ambari-server.py  |   4 +-
 .../1.6.1.2.2.0/role_command_order.json         |  14 +
 .../HDP/grafana-llapdaemon-daemons.json         | 313 ++++++++++++++-----
 .../0.1.0/role_command_order.json               |   9 +
 .../ATLAS/0.1.0.2.3/package/scripts/params.py   |   5 +
 .../DRUID/0.9.2/package/scripts/superset.py     |   2 +-
 .../FALCON/0.5.0.2.1/role_command_order.json    |   7 +
 .../0.96.0.2.0/package/scripts/params_linux.py  |   9 +-
 .../HBASE/0.96.0.2.0/role_command_order.json    |  10 +
 .../HDFS/2.1.0.2.0/configuration/hadoop-env.xml |   2 +-
 .../2.1.0.2.0/package/scripts/params_linux.py   |  11 +-
 .../HDFS/2.1.0.2.0/role_command_order.json      |  22 ++
 .../configuration/ranger-hdfs-audit.xml         |   9 +
 .../3.0.0.3.0/package/scripts/params_linux.py   |   9 +-
 .../HDFS/3.0.0.3.0/service_advisor.py           |  27 +-
 .../0.12.0.2.0/package/scripts/params_linux.py  |   6 +-
 .../HIVE/0.12.0.2.0/role_command_order.json     |  14 +
 .../configuration/ranger-hive-audit.xml         |   9 +
 .../2.1.0.3.0/package/scripts/params_linux.py   |   6 +-
 .../HIVE/2.1.0.3.0/service_advisor.py           |  25 +-
 .../KAFKA/0.8.1/package/scripts/params.py       |   9 +-
 .../KAFKA/0.8.1/role_command_order.json         |   7 +
 .../KAFKA/0.9.0/role_command_order.json         |   6 +
 .../1.10.3-10/configuration/kerberos-env.xml    |  15 +
 .../1.10.3-10/configuration/krb5-conf.xml       |  43 +--
 .../package/scripts/kerberos_common.py          |   5 +-
 .../1.10.3-10/package/scripts/params.py         |   2 +
 .../1.10.3-10/package/templates/krb5_conf.j2    |  54 ----
 .../KERBEROS/1.10.3-10/properties/krb5_conf.j2  |  60 ++++
 .../0.5.0.2.2/package/scripts/params_linux.py   |  11 +-
 .../KNOX/0.5.0.2.2/role_command_order.json      |   7 +
 .../MAHOUT/1.0.0.2.3/role_command_order.json    |   6 +
 .../OOZIE/4.0.0.2.0/role_command_order.json     |   9 +
 .../PIG/0.12.0.2.0/role_command_order.json      |   6 +
 .../PIG/0.16.1.3.0/configuration/pig-env.xml    |  41 +++
 .../PIG/0.16.1.3.0/configuration/pig-log4j.xml  |  65 ++++
 .../0.16.1.3.0/configuration/pig-properties.xml |  93 ++++++
 .../PIG/0.16.1.3.0/kerberos.json                |  17 +
 .../common-services/PIG/0.16.1.3.0/metainfo.xml | 101 ++++++
 .../PIG/0.16.1.3.0/package/files/pigSmoke.sh    |  18 ++
 .../PIG/0.16.1.3.0/package/scripts/params.py    |  31 ++
 .../0.16.1.3.0/package/scripts/params_linux.py  | 104 ++++++
 .../package/scripts/params_windows.py           |  45 +++
 .../PIG/0.16.1.3.0/package/scripts/pig.py       |  80 +++++
 .../0.16.1.3.0/package/scripts/pig_client.py    |  71 +++++
 .../0.16.1.3.0/package/scripts/service_check.py | 142 +++++++++
 .../PIG/0.16.1.3.0/service_advisor.py           | 171 ++++++++++
 .../RANGER/0.4.0/role_command_order.json        |   8 +
 .../RANGER/0.5.0/role_command_order.json        |   6 +
 .../RANGER/0.6.0/role_command_order.json        |   6 +
 .../0.5.0.2.3/package/scripts/params.py         |  10 +-
 .../0.5.0.2.3/role_command_order.json           |   7 +
 .../SLIDER/0.91.0.3.0/service_advisor.py        |   7 +-
 .../SPARK/1.2.1/role_command_order.json         |   6 +
 .../SPARK/1.5.2/role_command_order.json         |   6 +
 .../SPARK/1.6.0/role_command_order.json         |   8 +
 .../SPARK/2.2.0/service_advisor.py              |   7 +-
 .../SPARK2/2.0.0/role_command_order.json        |   6 +
 .../SQOOP/1.4.4.2.0/role_command_order.json     |   6 +
 .../STORM/0.10.0/role_command_order.json        |   8 +
 .../STORM/0.9.1/package/scripts/params_linux.py |   6 +-
 .../STORM/0.9.1/role_command_order.json         |  13 +
 .../STORM/0.9.3/role_command_order.json         |   7 +
 .../TEZ/0.4.0.2.1/configuration/tez-site.xml    |   2 +-
 .../0.4.0.2.1/package/scripts/params_linux.py   |   2 +
 .../TEZ/0.4.0.2.1/role_command_order.json       |   6 +
 .../TEZ/0.9.0.3.0/service_advisor.py            |   9 +-
 .../configuration-mapred/mapred-site.xml        |   2 +-
 .../2.1.0.2.0/package/scripts/params_linux.py   |  10 +-
 .../YARN/2.1.0.2.0/package/scripts/yarn.py      |  16 +-
 .../YARN/2.1.0.2.0/role_command_order.json      |  21 ++
 .../configuration/ranger-yarn-audit.xml         |   9 +
 .../3.0.0.3.0/package/scripts/params_linux.py   |   9 +-
 .../YARN/3.0.0.3.0/package/scripts/yarn.py      |  14 +-
 .../YARN/3.0.0.3.0/service_advisor.py           | 259 +++++++--------
 .../0.6.0.2.5/package/scripts/master.py         |  10 +-
 .../ZOOKEEPER/3.4.5/role_command_order.json     |   9 +
 .../ZOOKEEPER/3.4.9/service_advisor.py          |  13 +-
 .../host_scripts/alert_version_select.py        |  10 +-
 .../stacks/BIGTOP/0.8/services/stack_advisor.py |   3 +-
 .../2.0.6/hooks/before-ANY/scripts/params.py    |   1 +
 .../stacks/HDP/2.0.6/services/stack_advisor.py  |   7 +-
 .../stacks/HDP/2.1/services/stack_advisor.py    |   3 +-
 .../services/HDFS/configuration/hadoop-env.xml  |   2 +-
 .../stacks/HDP/2.2/services/stack_advisor.py    |   3 +-
 .../services/HDFS/configuration/hadoop-env.xml  |   2 +-
 .../stacks/HDP/2.3/services/stack_advisor.py    |   3 +-
 .../stacks/HDP/2.3/upgrades/config-upgrade.xml  |   6 +
 .../HDP/2.3/upgrades/nonrolling-upgrade-2.3.xml |  10 +
 .../HDP/2.3/upgrades/nonrolling-upgrade-2.4.xml |  10 +
 .../HDP/2.3/upgrades/nonrolling-upgrade-2.5.xml |  16 +
 .../HDP/2.3/upgrades/nonrolling-upgrade-2.6.xml |  16 +
 .../stacks/HDP/2.3/upgrades/upgrade-2.3.xml     |  10 +
 .../stacks/HDP/2.3/upgrades/upgrade-2.4.xml     |  10 +
 .../stacks/HDP/2.3/upgrades/upgrade-2.5.xml     |  11 +
 .../stacks/HDP/2.3/upgrades/upgrade-2.6.xml     |  11 +
 .../services/HDFS/configuration/hadoop-env.xml  |   2 +-
 .../stacks/HDP/2.4/upgrades/config-upgrade.xml  |   5 +
 .../HDP/2.4/upgrades/nonrolling-upgrade-2.4.xml |  10 +
 .../HDP/2.4/upgrades/nonrolling-upgrade-2.5.xml |  16 +
 .../HDP/2.4/upgrades/nonrolling-upgrade-2.6.xml |  16 +
 .../stacks/HDP/2.4/upgrades/upgrade-2.4.xml     |  10 +
 .../stacks/HDP/2.4/upgrades/upgrade-2.5.xml     |  11 +
 .../stacks/HDP/2.4/upgrades/upgrade-2.6.xml     |  11 +
 .../stacks/HDP/2.5/services/stack_advisor.py    | 277 ++++++++--------
 .../stacks/HDP/2.5/upgrades/config-upgrade.xml  |   6 +
 .../HDP/2.5/upgrades/nonrolling-upgrade-2.5.xml |  16 +
 .../HDP/2.5/upgrades/nonrolling-upgrade-2.6.xml |  16 +
 .../stacks/HDP/2.5/upgrades/upgrade-2.5.xml     |  16 +
 .../stacks/HDP/2.5/upgrades/upgrade-2.6.xml     |  11 +
 .../resources/stacks/HDP/2.6/repos/repoinfo.xml |  16 +-
 .../HDP/2.6/services/ACCUMULO/metainfo.xml      |   2 +-
 .../ATLAS/configuration/ranger-atlas-audit.xml  |  33 ++
 .../stacks/HDP/2.6/services/ATLAS/metainfo.xml  |   2 +-
 .../stacks/HDP/2.6/services/DRUID/metainfo.xml  |   2 +-
 .../stacks/HDP/2.6/services/FALCON/metainfo.xml |   2 +-
 .../stacks/HDP/2.6/services/FLUME/metainfo.xml  |   2 +-
 .../HBASE/configuration/ranger-hbase-audit.xml  |  33 ++
 .../stacks/HDP/2.6/services/HBASE/metainfo.xml  |   2 +-
 .../services/HDFS/configuration/hadoop-env.xml  |   2 +-
 .../HDFS/configuration/ranger-hdfs-audit.xml    |  33 ++
 .../stacks/HDP/2.6/services/HDFS/metainfo.xml   |   2 +-
 .../HIVE/configuration/ranger-hive-audit.xml    |  33 ++
 .../stacks/HDP/2.6/services/HIVE/metainfo.xml   |   2 +-
 .../KAFKA/configuration/ranger-kafka-audit.xml  |  33 ++
 .../stacks/HDP/2.6/services/KAFKA/metainfo.xml  |   2 +-
 .../KNOX/configuration/ranger-knox-audit.xml    |  33 ++
 .../stacks/HDP/2.6/services/KNOX/metainfo.xml   |   2 +-
 .../stacks/HDP/2.6/services/MAHOUT/metainfo.xml |   2 +-
 .../stacks/HDP/2.6/services/OOZIE/metainfo.xml  |   2 +-
 .../stacks/HDP/2.6/services/PIG/metainfo.xml    |   2 +-
 .../stacks/HDP/2.6/services/RANGER/metainfo.xml |   2 +-
 .../configuration/ranger-kms-audit.xml          |  33 ++
 .../HDP/2.6/services/RANGER_KMS/metainfo.xml    |   2 +-
 .../stacks/HDP/2.6/services/SLIDER/metainfo.xml |   2 +-
 .../STORM/configuration/ranger-storm-audit.xml  |  33 ++
 .../stacks/HDP/2.6/services/STORM/metainfo.xml  |   2 +-
 .../YARN/configuration/ranger-yarn-audit.xml    |  33 ++
 .../stacks/HDP/2.6/services/YARN/metainfo.xml   |   2 +-
 .../stacks/HDP/2.6/services/stack_advisor.py    |  27 +-
 .../stacks/HDP/2.6/upgrades/config-upgrade.xml  | 108 +++++++
 .../HDP/2.6/upgrades/nonrolling-upgrade-2.6.xml |  63 +++-
 .../stacks/HDP/2.6/upgrades/upgrade-2.6.xml     |  43 +++
 .../stacks/HDP/3.0/services/PIG/metainfo.xml    |  27 ++
 .../stacks/HDPWIN/2.1/services/stack_advisor.py |   9 +-
 .../stacks/HDPWIN/2.2/services/stack_advisor.py |   3 +-
 .../KERBEROS/configuration/kerberos-env.xml     |  15 +
 .../KERBEROS/configuration/krb5-conf.xml        |  43 +--
 .../KERBEROS/package/scripts/kerberos_common.py |   5 +-
 .../services/KERBEROS/package/scripts/params.py |   2 +
 .../KERBEROS/package/templates/krb5_conf.j2     |  54 ----
 .../services/KERBEROS/properties/krb5_conf.j2   |  60 ++++
 .../stacks/PERF/1.0/services/stack_advisor.py   |   3 +-
 .../1.0/upgrades/nonrolling-upgrade-2.0.xml     |  10 +
 .../stacks/PERF/1.0/upgrades/upgrade-2.0.xml    |  10 +
 .../src/main/resources/stacks/stack_advisor.py  |  88 +++---
 .../actionmanager/TestActionDBAccessorImpl.java |  27 +-
 .../actionmanager/TestActionScheduler.java      | 139 ++++----
 .../server/api/services/AmbariMetaInfoTest.java |   7 +
 .../StackAdvisorBlueprintProcessorTest.java     |   4 +-
 .../checks/ServiceCheckValidityCheckTest.java   |  20 +-
 .../server/checks/ServicePresenceCheckTest.java |  41 ++-
 .../AmbariManagementControllerTest.java         |   2 +-
 .../BlueprintConfigurationProcessorTest.java    |   5 +-
 .../ClientConfigResourceProviderTest.java       |  12 +-
 .../internal/UpgradeResourceProviderTest.java   |   4 +-
 .../UpgradeSummaryResourceProviderTest.java     |  16 +-
 .../ganglia/GangliaPropertyProviderTest.java    |   6 +-
 .../upgrade/StackVersionListenerTest.java       |   2 +-
 .../ambari/server/orm/dao/RequestDAOTest.java   |  21 +-
 .../ambari/server/orm/dao/UpgradeDAOTest.java   |  21 +-
 .../serveraction/ServerActionExecutorTest.java  |   2 +-
 .../RangerWebAlertConfigActionTest.java         |   2 +-
 .../upgrades/UpgradeActionTest.java             |   2 +-
 .../ambari/server/stack/StackManagerTest.java   |  20 +-
 .../ambari/server/stack/StackModuleTest.java    |  11 +
 .../server/state/ServiceComponentTest.java      |  15 +-
 .../ambari/server/state/UpgradeHelperTest.java  | 188 ++++++++++-
 .../alerts/AlertStateChangedEventTest.java      |   6 +-
 .../state/kerberos/KerberosDescriptorTest.java  |  19 ++
 .../services/MetricsRetrievalServiceTest.java   |  63 ++++
 .../services/RetryUpgradeActionServiceTest.java |  14 +-
 .../stacks/2.0.6/HDFS/test_hdfs_client.py       |  11 +-
 .../python/stacks/2.0.6/configs/default.json    |  24 ++
 .../stacks/2.2/KERBEROS/test_kerberos_client.py |   4 +-
 .../python/stacks/2.2/KERBEROS/use_cases.py     |   5 +-
 .../test_filtering_identity_descriptor.json     |  74 +++++
 .../HDP/2.0.7/services/SYSTEMML/metainfo.xml    |  39 +++
 .../stacks/HDP/2.0.8/services/HIVE/metainfo.xml | 174 +++++++++++
 .../HDP/2.0.8/services/SYSTEMML/metainfo.xml    |  39 +++
 .../upgrades/upgrade_multi_server_tasks.xml     |  88 ++++++
 ambari-web/app/assets/test/tests.js             |   5 +
 ambari-web/app/controllers/application.js       |  10 +-
 ambari-web/app/controllers/experimental.js      |   2 +-
 .../global/errors_handler_controller.js         |   2 +-
 .../global/user_settings_controller.js          |   2 +-
 .../global/wizard_watcher_controller.js         |   2 +-
 ambari-web/app/controllers/installer.js         |  23 +-
 .../main/admin/kerberos/wizard_controller.js    |  18 +-
 .../controllers/main/service/add_controller.js  |  43 +--
 ambari-web/app/controllers/wizard.js            |  62 +++-
 .../app/controllers/wizard/step1_controller.js  |   6 +-
 .../app/controllers/wizard/step3_controller.js  |   5 +-
 .../app/controllers/wizard/step4_controller.js  |   2 +
 .../app/controllers/wizard/step9_controller.js  |   3 +-
 .../wizards/kerberos_descriptor_properties.js   |   5 +
 ambari-web/app/messages.js                      |   8 +-
 ambari-web/app/mixins.js                        |   3 +-
 ambari-web/app/mixins/common/persist.js         | 166 ++++++++++
 ambari-web/app/mixins/common/persist_mixin.js   |  45 ---
 ambari-web/app/mixins/common/userPref.js        | 126 --------
 .../main/host/details/actions/check_host.js     |  86 ++---
 .../app/mixins/wizard/addSecurityConfigs.js     |   4 +-
 ambari-web/app/models/cluster_states.js         |   3 +-
 ambari-web/app/models/repository.js             |  15 +-
 ambari-web/app/routes/add_kerberos_routes.js    |  22 +-
 ambari-web/app/routes/add_service_routes.js     |  16 +-
 ambari-web/app/routes/installer.js              |  25 +-
 ambari-web/app/routes/stack_upgrade_routes.js   |   2 +-
 .../app/styles/theme/bootstrap-ambari.css       |   6 +-
 ambari-web/app/styles/widgets.less              |   1 +
 ambari-web/app/templates/application.hbs        |   6 +-
 .../common/configs/overriddenProperty.hbs       |   4 +-
 .../common/configs/service_config_category.hbs  |  16 +-
 .../common/configs/services_config.hbs          |   6 +-
 ambari-web/app/templates/common/modal_popup.hbs |   8 +-
 ambari-web/app/templates/common/pagination.hbs  |   2 +-
 ambari-web/app/templates/login.hbs              |  12 +-
 ambari-web/app/templates/main.hbs               |   2 +-
 .../stack_upgrade/stack_upgrade_wizard.hbs      |  47 ++-
 ambari-web/app/templates/wizard/step0.hbs       |   9 +-
 ambari-web/app/templates/wizard/step1.hbs       |  70 +++--
 ambari-web/app/templates/wizard/step10.hbs      |   2 +-
 ambari-web/app/templates/wizard/step2.hbs       | 246 ++++++++-------
 ambari-web/app/templates/wizard/step3.hbs       |  63 ++--
 .../step3/step3_host_warning_popup_footer.hbs   |   5 +-
 .../wizard/step3/step3_host_warnings_popup.hbs  |  35 +--
 .../step3/step3_registered_hosts_popup.hbs      |   2 +-
 ambari-web/app/templates/wizard/step4.hbs       |  20 +-
 .../step4/step4_ranger_requirements_popup.hbs   |   2 +-
 ambari-web/app/templates/wizard/step7.hbs       |   4 +-
 ambari-web/app/templates/wizard/step8.hbs       |   8 +-
 ambari-web/app/templates/wizard/step9.hbs       |  46 ++-
 .../wizard/step9/step9HostTasksLogPopup.hbs     |   2 +-
 ambari-web/app/utils/ajax/ajax.js               |  24 +-
 ambari-web/app/utils/helper.js                  |  57 +++-
 ambari-web/app/utils/persist.js                 | 101 ------
 ambari-web/app/views/common/checkbox_view.js    |   3 +-
 .../configs/service_configs_by_category_view.js |   8 +-
 ambari-web/app/views/common/controls_view.js    |   5 +-
 ambari-web/app/views/common/table_view.js       |   2 +-
 ambari-web/app/views/login.js                   |   6 +-
 ambari-web/app/views/main/dashboard/widgets.js  |   2 +-
 .../app/views/main/service/info/summary.js      |   2 +-
 .../main/service/manage_config_groups_view.js   |   2 +-
 ambari-web/app/views/main/service/menu.js       |  40 +--
 .../app/views/main/service/reconfigure.js       |   8 +-
 ambari-web/app/views/main/service/service.js    |  23 +-
 ambari-web/app/views/wizard/step1_view.js       |  13 +-
 ambari-web/app/views/wizard/step2_view.js       |   4 +-
 .../wizard/step3/hostWarningPopupBody_view.js   |   3 +-
 ambari-web/app/views/wizard/step9_view.js       |   1 +
 ambari-web/test/controllers/installer_test.js   |  23 +-
 .../test/controllers/main/service/item_test.js  |   2 +-
 .../test/controllers/wizard/step3_test.js       |  34 --
 ambari-web/test/controllers/wizard_test.js      |  47 ++-
 ambari-web/test/init_test.js                    |  25 ++
 ambari-web/test/mixins/common/persist_test.js   | 125 ++++++++
 ambari-web/test/views/common/table_view_test.js |  14 +-
 .../test/views/main/dashboard/widgets_test.js   |   2 +-
 ambari-web/test/views/main/service/item_test.js | 163 +++++++++-
 .../service/manage_config_groups_view_test.js   | 125 ++++++++
 ambari-web/test/views/main/service/menu_test.js | 210 ++++++++++---
 .../views/main/service/reassign_view_test.js    | 128 ++++++++
 .../test/views/main/service/reconfigure_test.js | 126 ++++++++
 .../test/views/main/service/service_test.js     | 264 ++++++++++++++++
 ambari-web/test/views/wizard/step1_view_test.js |  16 +-
 .../vendor/scripts/theme/bootstrap-ambari.js    |  29 +-
 .../stacks/ODPi/2.0/services/stack_advisor.py   |  21 +-
 .../uploads/parsers/xml/XMLParser.java          |   2 +
 .../uploads/parsers/xml/XMLParser.java          |   2 +
 .../main/resources/ui/app/routes/queries/new.js |   5 +-
 .../src/main/resources/ui/app/styles/app.scss   |  41 ++-
 .../ui/app/styles/bootstrap-overrides.scss      |  25 +-
 .../resources/ui/app/templates/application.hbs  |   2 +-
 .../app/templates/components/alert-message.hbs  |   6 +-
 .../components/top-application-bar.hbs          |   2 +-
 .../src/main/resources/ui/pig-web/app/app.js    |  19 +-
 .../apache/ambari/view/utils/hdfs/HdfsApi.java  |   1 +
 .../ui/app/components/bundle-config.js          |   1 +
 .../resources/ui/app/components/coord-config.js |   1 +
 .../ui/app/components/designer-workspace.js     |   1 +
 .../ui/app/components/flow-designer.js          |   4 +
 .../resources/ui/app/components/job-config.js   |  32 +-
 .../ui/app/components/workflow-credentials.js   |   2 +-
 .../ui/app/domain/cytoscape-flow-renderer.js    |  18 +-
 .../src/main/resources/ui/app/routes/index.js   |   5 +-
 .../ui/app/services/workflow-manager-configs.js |  27 ++
 .../src/main/resources/ui/app/styles/app.less   |   3 -
 .../app/templates/components/bundle-config.hbs  |   2 +-
 .../app/templates/components/coord-config.hbs   |   2 +-
 .../templates/components/credentials-config.hbs |   2 +-
 .../app/templates/components/flow-designer.hbs  |   2 +-
 .../templates/components/transition-config.hbs  |  34 +-
 .../components/workflow-credentials.hbs         |  13 +-
 .../services/workflow-manager-configs-test.js   |  28 ++
 dev-support/test-patch.sh                       |  88 ++----
 docs/pom.xml                                    |   3 +-
 docs/src/site/apt/index.apt                     |   2 +-
 docs/src/site/apt/whats-new.apt                 |  24 +-
 docs/src/site/site.xml                          |   2 +
 385 files changed, 7316 insertions(+), 2689 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/f650e351/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/UpgradeResourceProvider.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/ambari/blob/f650e351/ambari-server/src/main/java/org/apache/ambari/server/events/listeners/upgrade/StackVersionListener.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/ambari/blob/f650e351/ambari-server/src/main/java/org/apache/ambari/server/state/ServiceComponentImpl.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/ambari/blob/f650e351/ambari-server/src/test/java/org/apache/ambari/server/state/ServiceComponentTest.java
----------------------------------------------------------------------
diff --cc ambari-server/src/test/java/org/apache/ambari/server/state/ServiceComponentTest.java
index 740ecea,8e8bed3..2d589ed
--- a/ambari-server/src/test/java/org/apache/ambari/server/state/ServiceComponentTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/state/ServiceComponentTest.java
@@@ -29,9 -30,9 +30,10 @@@ import java.util.Map
  
  import org.apache.ambari.server.AmbariException;
  import org.apache.ambari.server.H2DatabaseCleaner;
+ import org.apache.ambari.server.actionmanager.HostRoleStatus;
  import org.apache.ambari.server.api.services.AmbariMetaInfo;
  import org.apache.ambari.server.controller.ServiceComponentResponse;
 +import org.apache.ambari.server.events.listeners.upgrade.StackVersionListener;
  import org.apache.ambari.server.orm.GuiceJpaInitializer;
  import org.apache.ambari.server.orm.InMemoryDefaultTestModule;
  import org.apache.ambari.server.orm.OrmTestHelper;

http://git-wip-us.apache.org/repos/asf/ambari/blob/f650e351/ambari-server/src/test/java/org/apache/ambari/server/state/UpgradeHelperTest.java
----------------------------------------------------------------------


[45/50] ambari git commit: AMBARI-20670 Node manager start extremely slow when YARN NM local dirs are very large (dgrinenko via dsen)

Posted by jo...@apache.org.
AMBARI-20670 Node manager start extremely slow when YARN NM local dirs are very large (dgrinenko via dsen)


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

Branch: refs/heads/branch-feature-AMBARI-12556
Commit: 28238ae84e24aa72613e59b6af341f1c2452a0aa
Parents: c11d004
Author: Dmytro Sen <ds...@apache.org>
Authored: Thu Apr 6 15:22:10 2017 +0300
Committer: Dmytro Sen <ds...@apache.org>
Committed: Thu Apr 6 15:22:10 2017 +0300

----------------------------------------------------------------------
 .../python/resource_management/TestUtils.py     | 39 +++++++++++++
 .../python/resource_management/core/sudo.py     | 58 +++++++++++++++-----
 .../python/resource_management/core/utils.py    | 56 ++++++++++++++++++-
 .../YARN/2.1.0.2.0/package/scripts/yarn.py      | 16 ++++--
 .../YARN/3.0.0.3.0/package/scripts/yarn.py      | 14 +++--
 5 files changed, 159 insertions(+), 24 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/28238ae8/ambari-agent/src/test/python/resource_management/TestUtils.py
----------------------------------------------------------------------
diff --git a/ambari-agent/src/test/python/resource_management/TestUtils.py b/ambari-agent/src/test/python/resource_management/TestUtils.py
new file mode 100644
index 0000000..0fbae3e
--- /dev/null
+++ b/ambari-agent/src/test/python/resource_management/TestUtils.py
@@ -0,0 +1,39 @@
+"""
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+"""
+
+import stat
+from unittest import TestCase
+from resource_management.core.utils import attr_to_bitmask
+
+
+class TestUtils(TestCase):
+
+  def test_attr_to_bitmask(self):
+    test_set = [
+      ["+r", stat.S_IRUSR | stat.S_IRGRP | stat.S_IROTH, 0],
+      ["u+w", stat.S_IWUSR, 0],
+      ["uo+x", stat.S_IXUSR | stat.S_IXOTH, 0],
+      ["-x", stat.S_IRUSR, stat.S_IXUSR | stat.S_IXOTH | stat.S_IRUSR],
+      ["=x", stat.S_IXUSR | stat.S_IXOTH | stat.S_IXGRP, stat.S_IRUSR | stat.S_IRGRP]
+    ]
+
+    for test in test_set:
+      test_pattern, expected, initial_val = test
+      bitmask = attr_to_bitmask(test_pattern, initial_bitmask= initial_val)
+      self.assertEquals(expected, bitmask, "Test set \"{0}\" failed, expected: {1} but got {2}".format(
+        test_pattern, expected, bitmask))

http://git-wip-us.apache.org/repos/asf/ambari/blob/28238ae8/ambari-common/src/main/python/resource_management/core/sudo.py
----------------------------------------------------------------------
diff --git a/ambari-common/src/main/python/resource_management/core/sudo.py b/ambari-common/src/main/python/resource_management/core/sudo.py
index d6fd71f..c350161 100644
--- a/ambari-common/src/main/python/resource_management/core/sudo.py
+++ b/ambari-common/src/main/python/resource_management/core/sudo.py
@@ -30,6 +30,7 @@ from resource_management.core import shell
 from resource_management.core.exceptions import Fail
 import subprocess
 
+from resource_management.core.utils import attr_to_bitmask
 
 if os.geteuid() == 0:
   def chown(path, owner, group):
@@ -54,16 +55,45 @@ if os.geteuid() == 0:
             
   
   def chmod(path, mode):
+    """
+    Wrapper around python function
+    
+    :type path str
+    :type mode int
+    """
     return os.chmod(path, mode)
   
-  mode_to_stat = {"a+x": stat.S_IXUSR | stat.S_IXGRP | stat.S_IXOTH, "a+rx": stat.S_IXUSR | stat.S_IXGRP | stat.S_IXOTH | stat.S_IRUSR | stat.S_IRGRP | stat.S_IROTH, "u+x": stat.S_IXUSR, "g+x": stat.S_IXGRP,  "o+x": stat.S_IXOTH}
+
   def chmod_extended(path, mode):
-    if mode in mode_to_stat:
-      st = os.stat(path)
-      os.chmod(path, st.st_mode | mode_to_stat[mode])
-    else:
-      shell.checked_call(["chmod", mode, path])
-      
+    """
+    :type path str
+    :type mode str
+    """
+    st = os.stat(path)
+    os.chmod(path, attr_to_bitmask(mode, initial_bitmask=st.st_mode))
+
+  def chmod_recursive(path, recursive_mode_flags, recursion_follow_links=False):
+    """
+    Change recursively permissions on directories or files
+    
+    :type path str
+    :type recursive_mode_flags
+    :type recursion_follow_links bool
+    """
+    dir_attrib = recursive_mode_flags["d"] if "d" in recursive_mode_flags else None
+    files_attrib = recursive_mode_flags["f"] if "d" in recursive_mode_flags else None
+
+    for root, dirs, files in os.walk(path, followlinks=recursion_follow_links):
+      if dir_attrib is not None:
+        for dir_name in dirs:
+          full_dir_path = os.path.join(root, dir_name)
+          chmod(full_dir_path, attr_to_bitmask(dir_attrib, initial_bitmask=os.stat(full_dir_path).st_mode))
+
+      if files_attrib is not None:
+        for file_name in files:
+          full_file_path = os.path.join(root, file_name)
+          chmod(full_file_path, attr_to_bitmask(files_attrib, initial_bitmask=os.stat(full_file_path).st_mode))
+
   def copy(src, dst):
     shutil.copy(src, dst)
     
@@ -278,10 +308,10 @@ else:
     return files
 
 
-def chmod_recursive(path, recursive_mode_flags, recursion_follow_links):
-  find_flags = []
-  if recursion_follow_links:
-    find_flags.append('-L')
-    
-  for key, flags in recursive_mode_flags.iteritems():
-    shell.checked_call(["find"] + find_flags + [path, "-type", key, "-exec" , "chmod", flags ,"{}" ,";"])
+  def chmod_recursive(path, recursive_mode_flags, recursion_follow_links):
+    find_flags = []
+    if recursion_follow_links:
+      find_flags.append('-L')
+
+    for key, flags in recursive_mode_flags.iteritems():
+      shell.checked_call(["find"] + find_flags + [path, "-type", key, "-exec" , "chmod", flags ,"{}" ,";"])

http://git-wip-us.apache.org/repos/asf/ambari/blob/28238ae8/ambari-common/src/main/python/resource_management/core/utils.py
----------------------------------------------------------------------
diff --git a/ambari-common/src/main/python/resource_management/core/utils.py b/ambari-common/src/main/python/resource_management/core/utils.py
index 265b2f2..53f6b8b 100644
--- a/ambari-common/src/main/python/resource_management/core/utils.py
+++ b/ambari-common/src/main/python/resource_management/core/utils.py
@@ -27,10 +27,16 @@ import sys
 import signal
 import cStringIO
 from functools import wraps
+
+import re
+
 from resource_management.core.exceptions import Fail
 from itertools import chain, repeat, islice
 
 PASSWORDS_HIDE_STRING = "[PROTECTED]"
+PERM_STRING_REGEXP = re.compile("(?P<scope>[ugoa]*)(?P<direction>[-+=])(?P<attr>[rwx]*)")
+PERM_REGISTER = {"u": 0o100, "g": 0o010, "o": 0o001}
+PERM_BITS = {"r": 0o004, "w": 0o002, "x": 0o001}
 
 class AttributeDictionary(object):
   def __init__(self, *args, **kwargs):
@@ -157,4 +163,52 @@ def pad_infinite(iterable, padding=None):
   return chain(iterable, repeat(padding))
 
 def pad(iterable, size, padding=None):
-  return islice(pad_infinite(iterable, padding), size)
\ No newline at end of file
+  return islice(pad_infinite(iterable, padding), size)
+
+
+def attr_to_bitmask(attr, initial_bitmask=0o0):
+  """
+  Function able to generate permission bits from passed named permission string (chmod like style)
+   
+  Supports:
+   - scope modifications: u,g,o or a 
+   - setting mode: +,-,-
+   - attributes: r,x,w
+   
+  Samples:
+    uo+rw, a+x, u-w, o=r
+  
+  :type attr str 
+  :type initial_bitmask int
+  """
+  attr_dict = {"scope": "", "direction": "", "attr": ""}
+  re_match_result = PERM_STRING_REGEXP.match(attr)
+
+  if re_match_result:
+    attr_dict = re_match_result.groupdict(default=attr_dict)
+
+  if attr_dict["scope"] == "":
+    attr_dict["scope"] = "a"
+
+  if "a" in attr_dict["scope"]:
+    attr_dict["scope"] = "ugo"
+
+  attr_dict["scope"] = list(attr_dict["scope"])
+  attr_dict["attr"] = list(attr_dict["attr"])
+
+  if attr_dict["direction"] == "=":
+    clear_mask = 0o0
+    for scope in attr_dict["scope"]:
+      clear_mask = clear_mask | 0o007 * PERM_REGISTER[scope]
+
+    initial_bitmask = initial_bitmask ^ (initial_bitmask & clear_mask)
+    attr_dict["direction"] = "+"
+
+  for scope in attr_dict["scope"]:
+    for attr in attr_dict["attr"]:
+      if attr_dict["direction"] == "-" and (initial_bitmask & (PERM_BITS[attr] * PERM_REGISTER[scope])) > 0:
+        initial_bitmask = initial_bitmask ^ (PERM_BITS[attr] * PERM_REGISTER[scope])
+      elif attr_dict["direction"] == "+":
+        initial_bitmask = initial_bitmask | (PERM_BITS[attr] * PERM_REGISTER[scope])
+
+  return initial_bitmask

http://git-wip-us.apache.org/repos/asf/ambari/blob/28238ae8/ambari-server/src/main/resources/common-services/YARN/2.1.0.2.0/package/scripts/yarn.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/YARN/2.1.0.2.0/package/scripts/yarn.py b/ambari-server/src/main/resources/common-services/YARN/2.1.0.2.0/package/scripts/yarn.py
index 204ab56..52338df 100644
--- a/ambari-server/src/main/resources/common-services/YARN/2.1.0.2.0/package/scripts/yarn.py
+++ b/ambari-server/src/main/resources/common-services/YARN/2.1.0.2.0/package/scripts/yarn.py
@@ -347,7 +347,6 @@ def setup_nodemanager():
     elif not params.security_enabled:
       File(params.nm_security_marker, action="delete")
 
-
   if not params.security_enabled or params.toggle_nm_security:
     # handle_mounted_dirs ensures that we don't create dirs which are temporary unavailable (unmounted), and intended to reside on a different mount.
     nm_log_dir_to_mount_file_content = handle_mounted_dirs(create_log_dir, params.nm_log_dirs, params.nm_log_dir_to_mount_file, params)
@@ -459,17 +458,24 @@ def create_log_dir(dir_name):
             ignore_failures=True,
   )
 
+
 def create_local_dir(dir_name):
   import params
+
+  directory_args = {}
+
+  if params.toggle_nm_security:
+    directory_args["recursive_mode_flags"] = {'f': 'a+rw', 'd': 'a+rwx'}
+
   Directory(dir_name,
-            create_parents = True,
+            create_parents=True,
             cd_access="a",
             mode=0755,
             owner=params.yarn_user,
             group=params.user_group,
             ignore_failures=True,
-            recursive_mode_flags = {'f': 'a+rw', 'd': 'a+rwx'},
-  )
+            **directory_args
+            )
 
 @OsFamilyFuncImpl(os_family=OSConst.WINSRV_FAMILY)
 def yarn(name = None):
@@ -500,4 +506,4 @@ def yarn(name = None):
     ServiceConfig(service_name,
                   action="change_user",
                   username = params.yarn_user,
-                  password = Script.get_password(params.yarn_user))
\ No newline at end of file
+                  password = Script.get_password(params.yarn_user))

http://git-wip-us.apache.org/repos/asf/ambari/blob/28238ae8/ambari-server/src/main/resources/common-services/YARN/3.0.0.3.0/package/scripts/yarn.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/YARN/3.0.0.3.0/package/scripts/yarn.py b/ambari-server/src/main/resources/common-services/YARN/3.0.0.3.0/package/scripts/yarn.py
index ae1b425..d601f8f 100644
--- a/ambari-server/src/main/resources/common-services/YARN/3.0.0.3.0/package/scripts/yarn.py
+++ b/ambari-server/src/main/resources/common-services/YARN/3.0.0.3.0/package/scripts/yarn.py
@@ -347,7 +347,6 @@ def setup_nodemanager():
     elif not params.security_enabled:
       File(params.nm_security_marker, action="delete")
 
-
   if not params.security_enabled or params.toggle_nm_security:
     # handle_mounted_dirs ensures that we don't create dirs which are temporary unavailable (unmounted), and intended to reside on a different mount.
     nm_log_dir_to_mount_file_content = handle_mounted_dirs(create_log_dir, params.nm_log_dirs, params.nm_log_dir_to_mount_file, params)
@@ -459,16 +458,23 @@ def create_log_dir(dir_name):
             ignore_failures=True,
   )
 
+
 def create_local_dir(dir_name):
   import params
+
+  directory_args = {}
+
+  if params.toggle_nm_security:
+    directory_args["recursive_mode_flags"] = {'f': 'a+rw', 'd': 'a+rwx'}
+
   Directory(dir_name,
-            create_parents = True,
+            create_parents=True,
             cd_access="a",
             mode=0755,
             owner=params.yarn_user,
             group=params.user_group,
             ignore_failures=True,
-            recursive_mode_flags = {'f': 'a+rw', 'd': 'a+rwx'},
+            **directory_args
   )
 
 @OsFamilyFuncImpl(os_family=OSConst.WINSRV_FAMILY)
@@ -500,4 +506,4 @@ def yarn(name = None):
     ServiceConfig(service_name,
                   action="change_user",
                   username = params.yarn_user,
-                  password = Script.get_password(params.yarn_user))
\ No newline at end of file
+                  password = Script.get_password(params.yarn_user))


[36/50] ambari git commit: AMBARI-20651 - When in Upgrade paused state, links should be disabled for less privileged user (rzang)

Posted by jo...@apache.org.
AMBARI-20651 - When in Upgrade paused state, links should be disabled for less privileged user (rzang)

Change-Id: I4f6460680f420a5664923136756aaa1e9cb9af09


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

Branch: refs/heads/branch-feature-AMBARI-12556
Commit: b491509ab65353494d8660e2954c87c3a6f1abf4
Parents: 8c2ff91
Author: Richard Zang <rz...@apache.org>
Authored: Tue Apr 4 15:19:12 2017 -0700
Committer: Richard Zang <rz...@apache.org>
Committed: Tue Apr 4 15:19:12 2017 -0700

----------------------------------------------------------------------
 ambari-web/app/controllers/application.js | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/b491509a/ambari-web/app/controllers/application.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/application.js b/ambari-web/app/controllers/application.js
index 580f337..d813d89 100644
--- a/ambari-web/app/controllers/application.js
+++ b/ambari-web/app/controllers/application.js
@@ -83,24 +83,24 @@ App.ApplicationController = Em.Controller.extend(App.Persist, {
     var upgradeSuspended = App.get('upgradeSuspended');
     var isDowngrade = App.router.get('mainAdminStackAndUpgradeController.isDowngrade');
     var typeSuffix = isDowngrade ? 'downgrade' : 'upgrade';
-
+    var hasUpgradePrivilege = App.isAuthorized('CLUSTER.UPGRADE_DOWNGRADE_STACK');
     if (upgradeInProgress) {
       return {
-        cls: 'upgrade-in-progress',
+        cls: hasUpgradePrivilege? 'upgrade-in-progress' : 'upgrade-in-progress not-allowed-cursor',
         icon: 'glyphicon-cog',
         msg: Em.I18n.t('admin.stackVersions.version.' + typeSuffix + '.running')
       }
     }
     if (upgradeHolding) {
       return {
-        cls: 'upgrade-holding',
+        cls: hasUpgradePrivilege? 'upgrade-holding' : 'upgrade-holding not-allowed-cursor',
         icon: 'glyphicon-pause',
         msg: Em.I18n.t('admin.stackVersions.version.' + typeSuffix + '.pause')
       }
     }
     if (upgradeSuspended) {
       return {
-        cls: 'upgrade-aborted',
+        cls: hasUpgradePrivilege? 'upgrade-aborted' : 'upgrade-aborted not-allowed-cursor',
         icon: 'glyphicon-pause',
         msg: Em.I18n.t('admin.stackVersions.version.' + typeSuffix + '.suspended')
       }


[38/50] ambari git commit: AMBARI-20660. HiveView2.0 scrolling in query tab does not work properly for a longer query (pallavkul)

Posted by jo...@apache.org.
AMBARI-20660. HiveView2.0 scrolling in query tab does not work properly for a longer query (pallavkul)


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

Branch: refs/heads/branch-feature-AMBARI-12556
Commit: 3b25533430a181b6b83f4f1cf665c8f9aceafd4e
Parents: b4fc47f
Author: pallavkul <pa...@gmail.com>
Authored: Wed Apr 5 11:33:30 2017 +0530
Committer: pallavkul <pa...@gmail.com>
Committed: Wed Apr 5 11:33:30 2017 +0530

----------------------------------------------------------------------
 contrib/views/hive20/src/main/resources/ui/app/styles/app.scss | 4 ++++
 1 file changed, 4 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/3b255334/contrib/views/hive20/src/main/resources/ui/app/styles/app.scss
----------------------------------------------------------------------
diff --git a/contrib/views/hive20/src/main/resources/ui/app/styles/app.scss b/contrib/views/hive20/src/main/resources/ui/app/styles/app.scss
index c06e65e..f4b63c5 100644
--- a/contrib/views/hive20/src/main/resources/ui/app/styles/app.scss
+++ b/contrib/views/hive20/src/main/resources/ui/app/styles/app.scss
@@ -973,3 +973,7 @@ rect.operator__box {
   bottom:10px;
   right:-15px;
 }
+
+.CodeMirror-scroll {
+  padding-bottom: 20px;
+}


[48/50] ambari git commit: AMBARI-20693. Principal suffix field should be a non mandatory field in configure identities page of Enable kerberos wizard (akovalenko)

Posted by jo...@apache.org.
AMBARI-20693. Principal suffix field should be a non mandatory field in configure identities page of Enable kerberos wizard (akovalenko)


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

Branch: refs/heads/branch-feature-AMBARI-12556
Commit: 65d2f3f6d29f05213b2e6469f360f8fc3ff3f397
Parents: 9289481
Author: Aleksandr Kovalenko <ak...@hortonworks.com>
Authored: Thu Apr 6 20:17:55 2017 +0300
Committer: Aleksandr Kovalenko <ak...@hortonworks.com>
Committed: Thu Apr 6 20:17:55 2017 +0300

----------------------------------------------------------------------
 .../app/data/configs/wizards/kerberos_descriptor_properties.js  | 5 +++++
 ambari-web/app/mixins/wizard/addSecurityConfigs.js              | 2 +-
 2 files changed, 6 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/65d2f3f6/ambari-web/app/data/configs/wizards/kerberos_descriptor_properties.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/data/configs/wizards/kerberos_descriptor_properties.js b/ambari-web/app/data/configs/wizards/kerberos_descriptor_properties.js
index f6e4239..a6ecf20 100644
--- a/ambari-web/app/data/configs/wizards/kerberos_descriptor_properties.js
+++ b/ambari-web/app/data/configs/wizards/kerberos_descriptor_properties.js
@@ -29,6 +29,11 @@ var properties = [
     "name": "additional_realms",
     "index": 5,
     "placeholderText": "(" + Em.I18n.t("common.optional") + ")"
+  },
+  {
+    "name": "principal_suffix",
+    "index": 6,
+    "placeholderText": "(" + Em.I18n.t("common.optional") + ")"
   }
 ];
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/65d2f3f6/ambari-web/app/mixins/wizard/addSecurityConfigs.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/mixins/wizard/addSecurityConfigs.js b/ambari-web/app/mixins/wizard/addSecurityConfigs.js
index e8da47f..89d3cf7 100644
--- a/ambari-web/app/mixins/wizard/addSecurityConfigs.js
+++ b/ambari-web/app/mixins/wizard/addSecurityConfigs.js
@@ -204,7 +204,7 @@ App.AddSecurityConfigs = Em.Mixin.create({
     for (var propertyName in kerberosProperties) {
       var predefinedProperty = this.get('kerberosDescriptorProperties').findProperty('name', propertyName);
       var value = kerberosProperties[propertyName];
-      var isRequired = propertyName == 'additional_realms' ? false : value !== "";
+      var isRequired = ['additional_realms', 'principal_suffix'].contains(propertyName) ? false : value !== "";
       var propertyObject = {
         name: propertyName,
         value: value,


[37/50] ambari git commit: AMBARI-20657. Usability: screen jumps when you scroll down (pallavkul)

Posted by jo...@apache.org.
AMBARI-20657. Usability: screen jumps when you scroll down (pallavkul)


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

Branch: refs/heads/branch-feature-AMBARI-12556
Commit: b4fc47f5ea849a5e8fafea0842397fbb1d73272c
Parents: b491509
Author: pallavkul <pa...@gmail.com>
Authored: Wed Apr 5 11:17:27 2017 +0530
Committer: pallavkul <pa...@gmail.com>
Committed: Wed Apr 5 11:17:27 2017 +0530

----------------------------------------------------------------------
 .../src/main/resources/ui/app/styles/app.scss   | 23 ++++++++++--------
 .../ui/app/styles/bootstrap-overrides.scss      | 25 ++++++++++----------
 .../resources/ui/app/templates/application.hbs  |  2 +-
 3 files changed, 27 insertions(+), 23 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/b4fc47f5/contrib/views/hive20/src/main/resources/ui/app/styles/app.scss
----------------------------------------------------------------------
diff --git a/contrib/views/hive20/src/main/resources/ui/app/styles/app.scss b/contrib/views/hive20/src/main/resources/ui/app/styles/app.scss
index 650c1d6..c06e65e 100644
--- a/contrib/views/hive20/src/main/resources/ui/app/styles/app.scss
+++ b/contrib/views/hive20/src/main/resources/ui/app/styles/app.scss
@@ -38,7 +38,10 @@
 .main-wrapper {
   padding: 5px 0;
   background-color: #fff;
-  min-height: 100vh;
+}
+
+.top-application-header{
+  background-color: #e1e1e0;
 }
 
 .fa-1-5{
@@ -49,7 +52,7 @@
   font-size: 2em;
 }
 
-$database-search-background: lighten($body-bg, 10%);
+$database-search-background: lighten($base-bg, 10%);
 $database-search-text-color: $gray;
 .database-search, .multiple-database-search {
   color:  $database-search-text-color;
@@ -128,7 +131,7 @@ $database-search-text-color: $gray;
   }
 }
 
-$list-filter-header-background: lighten($body-bg, 10%);
+$list-filter-header-background: lighten($base-bg, 10%);
 $list-filter-text-color: $gray;
 
 .list-filter {
@@ -152,7 +155,7 @@ $list-filter-text-color: $gray;
 
 .table-list {
   .list-group-item {
-    background-color: lighten($body-bg, 10%);
+    background-color: lighten($base-bg, 10%);
   }
 }
 
@@ -174,10 +177,10 @@ $list-filter-text-color: $gray;
   }
 }
 
-$table-info-background: lighten($body-bg, 10%);
+$table-info-background: lighten($base-bg, 10%);
 .table-info {
 
-  background-color: $body-bg;
+  background-color: $base-bg;
   .table-header {
     border: 1px solid darken($table-info-background, 15%);
     p {
@@ -218,7 +221,7 @@ pre {
 }
 
 .scroll-fix {
-  background-color: lighten($body-bg, 5%);
+  background-color: lighten($base-bg, 5%);
   height: calc(100vh - 180px);
   overflow-y: scroll;
 }
@@ -718,8 +721,8 @@ pre {
 }
 
 .jobs-status {
-  border-top: 1px solid darken($body-bg, 10%);
-  border-bottom: 1px solid darken($body-bg, 10%);
+  border-top: 1px solid darken($base-bg, 10%);
+  border-bottom: 1px solid darken($base-bg, 10%);
   .strip {
     margin-top: 20px;
   }
@@ -969,4 +972,4 @@ rect.operator__box {
   position:relative;
   bottom:10px;
   right:-15px;
-}
\ No newline at end of file
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/b4fc47f5/contrib/views/hive20/src/main/resources/ui/app/styles/bootstrap-overrides.scss
----------------------------------------------------------------------
diff --git a/contrib/views/hive20/src/main/resources/ui/app/styles/bootstrap-overrides.scss b/contrib/views/hive20/src/main/resources/ui/app/styles/bootstrap-overrides.scss
index 4b7bec4..d3cf36e 100644
--- a/contrib/views/hive20/src/main/resources/ui/app/styles/bootstrap-overrides.scss
+++ b/contrib/views/hive20/src/main/resources/ui/app/styles/bootstrap-overrides.scss
@@ -18,7 +18,8 @@
 
 $font-family-sans-serif: 'Roboto', "Helvetica Neue", Helvetica, Arial, sans-serif;
 
-$body-bg: #e1e1e0;
+$body-bg: #FFF;
+$base-bg: #e1e1e0;
 $border-radius-base:        3px;
 $border-radius-large:       4px;
 $border-radius-small:       2px;
@@ -26,10 +27,10 @@ $border-radius-small:       2px;
 
 // nav-tabs
 $nav-link-padding:                          10px 20px !default;
-$nav-tabs-border-color:                     darken($body-bg, 15%);
-$nav-tabs-link-hover-border-color:          darken($body-bg, 15%);
+$nav-tabs-border-color:                     darken($base-bg, 15%);
+$nav-tabs-link-hover-border-color:          darken($base-bg, 15%);
 $nav-tabs-active-link-hover-bg:             #fff;
-$nav-tabs-active-link-hover-border-color:   darken($body-bg, 15%);
+$nav-tabs-active-link-hover-border-color:   darken($base-bg, 15%);
 
 @import 'bootstrap';
 
@@ -40,18 +41,18 @@ $nav-tabs-active-link-hover-border-color:   darken($body-bg, 15%);
          &.active {
            background-color: $gray-dark;
            color: #fff;
-           border: 1px solid darken($body-bg, 15%);
+           border: 1px solid darken($base-bg, 15%);
            border-bottom: none;
            &.ember-transitioning-out {
-             background-color: $body-bg;
-             color: darken($body-bg, 50%);
+             background-color: $base-bg;
+             color: darken($base-bg, 50%);
              border: none;
            }
          }
          &.ember-transitioning-in {
            background-color: $gray-dark;
            color: #fff;
-           border: 1px solid darken($body-bg, 15%);
+           border: 1px solid darken($base-bg, 15%);
            border-bottom: none;
          }
        }
@@ -60,19 +61,19 @@ $nav-tabs-active-link-hover-border-color:   darken($body-bg, 15%);
   li {
     a {
       font-weight: bold;
-      color: darken($body-bg, 50%);
+      color: darken($base-bg, 50%);
       &.active {
         background-color: #fff;
-        border: 1px solid darken($body-bg, 15%);
+        border: 1px solid darken($base-bg, 15%);
         border-bottom: none;
         &.ember-transitioning-out {
-          background-color: $body-bg;
+          background-color: $base-bg;
           border: none;
         }
       }
       &.ember-transitioning-in {
         background-color: #fff;
-        border: 1px solid darken($body-bg, 15%);
+        border: 1px solid darken($base-bg, 15%);
         border-bottom: none;
       }
     }

http://git-wip-us.apache.org/repos/asf/ambari/blob/b4fc47f5/contrib/views/hive20/src/main/resources/ui/app/templates/application.hbs
----------------------------------------------------------------------
diff --git a/contrib/views/hive20/src/main/resources/ui/app/templates/application.hbs b/contrib/views/hive20/src/main/resources/ui/app/templates/application.hbs
index 53b2192..86c23a4 100644
--- a/contrib/views/hive20/src/main/resources/ui/app/templates/application.hbs
+++ b/contrib/views/hive20/src/main/resources/ui/app/templates/application.hbs
@@ -22,7 +22,7 @@
       {{alert-message flash=flash}}
     {{/each}}
   </div>
-  <div class="row">
+  <div class="row  top-application-header">
     <div class="col-md-12">
       {{#if serviceCheckCompleted}}
         {{top-application-bar}}