You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by nc...@apache.org on 2016/02/05 22:56:16 UTC

[01/40] ambari git commit: AMBARI-14904. Disable base URL inputs for all OS except one that the cluster is running (akovalenko)

Repository: ambari
Updated Branches:
  refs/heads/branch-dev-patch-upgrade 0f2c3375d -> c11a41138


AMBARI-14904. Disable base URL inputs for all OS except one that the cluster is running (akovalenko)


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

Branch: refs/heads/branch-dev-patch-upgrade
Commit: 5833aabd811f726d328d5b2ddd565e45cbd48a15
Parents: 424cca6
Author: Aleksandr Kovalenko <ak...@hortonworks.com>
Authored: Wed Feb 3 20:13:51 2016 +0200
Committer: Aleksandr Kovalenko <ak...@hortonworks.com>
Committed: Wed Feb 3 22:13:43 2016 +0200

----------------------------------------------------------------------
 .../stackVersions/StackVersionsCreateCtrl.js      | 18 +++++++++++++++---
 .../stackVersions/StackVersionsEditCtrl.js        | 16 ++++++++++++++--
 .../ui/admin-web/app/scripts/services/Cluster.js  | 15 ++++++++++++++-
 .../ui/admin-web/app/scripts/services/Stack.js    |  2 +-
 .../app/views/stackVersions/stackVersionPage.html |  4 ++--
 5 files changed, 46 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/5833aabd/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/stackVersions/StackVersionsCreateCtrl.js
----------------------------------------------------------------------
diff --git a/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/stackVersions/StackVersionsCreateCtrl.js b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/stackVersions/StackVersionsCreateCtrl.js
index a817d88..fc4bee9 100644
--- a/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/stackVersions/StackVersionsCreateCtrl.js
+++ b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/stackVersions/StackVersionsCreateCtrl.js
@@ -18,7 +18,7 @@
 'use strict';
 
 angular.module('ambariAdminConsole')
-.controller('StackVersionsCreateCtrl', ['$scope', 'Stack', '$routeParams', '$location', 'Alert', '$translate', function($scope, Stack, $routeParams, $location, Alert, $translate) {
+.controller('StackVersionsCreateCtrl', ['$scope', 'Stack', '$routeParams', '$location', 'Alert', '$translate', 'Cluster', function($scope, Stack, $routeParams, $location, Alert, $translate, Cluster) {
   var $t = $translate.instant;
   $scope.createController = true;
   $scope.osList = [];
@@ -43,7 +43,9 @@ angular.module('ambariAdminConsole')
       });
       $scope.upgradeStack.options = versions;
       $scope.upgradeStack.selected = versions[versions.length - 1];
-      $scope.afterStackVersionChange();
+      $scope.afterStackVersionChange().then(function(){
+        $scope.disableUnusedOS();
+      });
     })
     .catch(function (data) {
       Alert.error($t('versions.alerts.filterListError'), data.message);
@@ -71,7 +73,7 @@ angular.module('ambariAdminConsole')
   };
 
   $scope.afterStackVersionChange = function () {
-    Stack.getSupportedOSList($scope.upgradeStack.selected.stack_name, $scope.upgradeStack.selected.stack_version)
+    return Stack.getSupportedOSList($scope.upgradeStack.selected.stack_name, $scope.upgradeStack.selected.stack_version)
     .then(function (data) {
       var operatingSystems = data.operating_systems;
         $scope.osList = operatingSystems.map(function (os) {
@@ -87,6 +89,16 @@ angular.module('ambariAdminConsole')
     });
   };
 
+  $scope.disableUnusedOS = function() {
+    Cluster.getClusterOS().then(function(usedOS){
+      angular.forEach($scope.osList, function (os) {
+        if (os.OperatingSystems.os_type !== usedOS) {
+          os.disabled = true;
+        }
+      });
+    });
+  };
+
   $scope.updateCurrentVersionInput = function () {
     $scope.currentVersionInput = $scope.upgradeStack.selected.displayName + '.' + angular.element('[name="version"]')[0].value;
   };

http://git-wip-us.apache.org/repos/asf/ambari/blob/5833aabd/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/stackVersions/StackVersionsEditCtrl.js
----------------------------------------------------------------------
diff --git a/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/stackVersions/StackVersionsEditCtrl.js b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/stackVersions/StackVersionsEditCtrl.js
index 0763726..39a6700 100644
--- a/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/stackVersions/StackVersionsEditCtrl.js
+++ b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/stackVersions/StackVersionsEditCtrl.js
@@ -63,7 +63,9 @@ angular.module('ambariAdminConsole')
       } else {
         $scope.deleteEnabled = $scope.isDeletable();
       }
-      $scope.addMissingOSList();
+      $scope.addMissingOSList().then(function(){
+        $scope.disableUnusedOS();
+      });
     });
   };
 
@@ -72,7 +74,7 @@ angular.module('ambariAdminConsole')
   };
 
   $scope.addMissingOSList = function() {
-    Stack.getSupportedOSList($scope.stackName, $scope.stackVersion)
+    return Stack.getSupportedOSList($scope.stackName, $scope.stackVersion)
     .then(function (data) {
       var existingOSHash = {};
       angular.forEach($scope.osList, function (os) {
@@ -109,6 +111,16 @@ angular.module('ambariAdminConsole')
     });
   };
 
+  $scope.disableUnusedOS = function() {
+    Cluster.getClusterOS().then(function(usedOS){
+      angular.forEach($scope.osList, function (os) {
+        if (os.OperatingSystems.os_type !== usedOS) {
+          os.disabled = true;
+        }
+      });
+    });
+  };
+
   $scope.defaulfOSRepos = {};
 
   $scope.save = function () {

http://git-wip-us.apache.org/repos/asf/ambari/blob/5833aabd/ambari-admin/src/main/resources/ui/admin-web/app/scripts/services/Cluster.js
----------------------------------------------------------------------
diff --git a/ambari-admin/src/main/resources/ui/admin-web/app/scripts/services/Cluster.js b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/services/Cluster.js
index a758c88..af77596 100644
--- a/ambari-admin/src/main/resources/ui/admin-web/app/scripts/services/Cluster.js
+++ b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/services/Cluster.js
@@ -60,9 +60,22 @@ angular.module('ambariAdminConsole')
 
       return deferred.promise;
     },
+    getClusterOS: function() {
+      var deferred = $q.defer();
+
+      $http.get(Settings.baseUrl + '/services/AMBARI/components/AMBARI_SERVER?fields=RootServiceComponents/properties/server.os_family&minimal_response=true', {mock: 'redhat6'})
+      .then(function(data) {
+        deferred.resolve(data.data.RootServiceComponents.properties['server.os_family']);
+      })
+      .catch(function(data) {
+        deferred.reject(data);
+      });
+
+      return deferred.promise;
+    },
     getAmbariTimeout: function() {
       var deferred = $q.defer();
-      var url = '/services/AMBARI/components/AMBARI_SERVER?fields=RootServiceComponents/properties/user.inactivity.timeout.default'
+      var url = '/services/AMBARI/components/AMBARI_SERVER?fields=RootServiceComponents/properties/user.inactivity.timeout.default';
       $http.get(Settings.baseUrl + url)
       .then(function(data) {
         var properties = data.data.RootServiceComponents.properties;

http://git-wip-us.apache.org/repos/asf/ambari/blob/5833aabd/ambari-admin/src/main/resources/ui/admin-web/app/scripts/services/Stack.js
----------------------------------------------------------------------
diff --git a/ambari-admin/src/main/resources/ui/admin-web/app/scripts/services/Stack.js b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/services/Stack.js
index ffed3cc..4c55967 100644
--- a/ambari-admin/src/main/resources/ui/admin-web/app/scripts/services/Stack.js
+++ b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/services/Stack.js
@@ -222,7 +222,7 @@ angular.module('ambariAdminConsole')
         deferred.resolve(invalidUrls);
       } else {
         osList.forEach(function (os) {
-          if (os.selected) {
+          if (os.selected && !os.disabled) {
             os.repositories.forEach(function (repo) {
               totalCalls++;
               $http.post(url + '/operating_systems/' + os.OperatingSystems.os_type + '/repositories/' + repo.Repositories.repo_id + '?validate_only=true',

http://git-wip-us.apache.org/repos/asf/ambari/blob/5833aabd/ambari-admin/src/main/resources/ui/admin-web/app/views/stackVersions/stackVersionPage.html
----------------------------------------------------------------------
diff --git a/ambari-admin/src/main/resources/ui/admin-web/app/views/stackVersions/stackVersionPage.html b/ambari-admin/src/main/resources/ui/admin-web/app/views/stackVersions/stackVersionPage.html
index 9b7e032..449d743 100644
--- a/ambari-admin/src/main/resources/ui/admin-web/app/views/stackVersions/stackVersionPage.html
+++ b/ambari-admin/src/main/resources/ui/admin-web/app/views/stackVersions/stackVersionPage.html
@@ -71,7 +71,7 @@
         <div class="col-sm-2 os-checkbox">
           <div class="checkbox">
             <label>
-              <input type="checkbox" ng-model="os.selected" ng-change="toggleOSSelect()"> {{os.OperatingSystems.os_type}}
+              <input type="checkbox" ng-model="os.selected" ng-change="toggleOSSelect()" ng-disabled="os.disabled"> {{os.OperatingSystems.os_type}}
             </label>
           </div>
         </div>
@@ -79,7 +79,7 @@
           <div class="form-group {{repository.Repositories.repo_name}}" ng-class="{'has-error': repository.hasError }" ng-repeat="repository in os.repositories">
             <div class="col-sm-3"><label class="control-label">{{repository.Repositories.repo_name}}</label></div>
             <div class="col-sm-9"><input type="text" class="form-control" ng-model="repository.Repositories.base_url"
-                                         ng-change="clearError()" ng-disabled="!os.selected"></div>
+                                         ng-change="clearError()" ng-disabled="os.disabled"></div>
           </div>
         </div>
       </div>


[13/40] ambari git commit: AMBARI-14907 : Metrics not displayed for 'Last 1 year' period. (avijayan)

Posted by nc...@apache.org.
AMBARI-14907 : Metrics not displayed for 'Last 1 year' period. (avijayan)


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

Branch: refs/heads/branch-dev-patch-upgrade
Commit: d0bec5cb3c0298d83413342d55baf36133632ab8
Parents: 8c6c13d
Author: Aravindan Vijayan <av...@hortonworks.com>
Authored: Thu Feb 4 10:48:38 2016 -0800
Committer: Aravindan Vijayan <av...@hortonworks.com>
Committed: Thu Feb 4 10:48:38 2016 -0800

----------------------------------------------------------------------
 .../server/upgrade/UpgradeCatalog222.java       | 46 ++++++++++++
 .../0.1.0/configuration/ams-site.xml            |  4 +-
 .../server/upgrade/UpgradeCatalog222Test.java   | 79 ++++++++++++++++++++
 3 files changed, 127 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/d0bec5cb/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog222.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog222.java b/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog222.java
index 22f6a39..7e2683d 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog222.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog222.java
@@ -27,6 +27,7 @@ import org.apache.ambari.server.orm.dao.DaoUtils;
 import org.apache.ambari.server.orm.entities.AlertDefinitionEntity;
 import org.apache.ambari.server.state.Cluster;
 import org.apache.ambari.server.state.Clusters;
+import org.apache.ambari.server.state.Config;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -46,6 +47,11 @@ public class UpgradeCatalog222 extends AbstractUpgradeCatalog {
    * Logger.
    */
   private static final Logger LOG = LoggerFactory.getLogger(UpgradeCatalog222.class);
+  private static final String AMS_SITE = "ams-site";
+  private static final String HOST_AGGREGATOR_DAILY_CHECKPOINTCUTOFFMULTIPIER =
+    "timeline.metrics.host.aggregator.daily.checkpointCutOffMultiplier";
+  private static final String CLUSTER_AGGREGATOR_DAILY_CHECKPOINTCUTOFFMULTIPIER =
+    "timeline.metrics.cluster.aggregator.daily.checkpointCutOffMultiplier";
 
 
 
@@ -99,6 +105,7 @@ public class UpgradeCatalog222 extends AbstractUpgradeCatalog {
     addNewConfigurationsFromXml();
     updateAlerts();
     updateStormConfigs();
+    updateAMSConfigs();
   }
 
   protected void updateStormConfigs() throws  AmbariException {
@@ -137,4 +144,43 @@ public class UpgradeCatalog222 extends AbstractUpgradeCatalog {
 
   }
 
+  protected void updateAMSConfigs() throws AmbariException {
+    AmbariManagementController ambariManagementController = injector.getInstance(AmbariManagementController.class);
+    Clusters clusters = ambariManagementController.getClusters();
+
+    if (clusters != null) {
+      Map<String, Cluster> clusterMap = clusters.getClusters();
+
+      if (clusterMap != null && !clusterMap.isEmpty()) {
+        for (final Cluster cluster : clusterMap.values()) {
+
+          Config amsSite = cluster.getDesiredConfigByType(AMS_SITE);
+          if (amsSite != null) {
+            Map<String, String> amsSiteProperties = amsSite.getProperties();
+            Map<String, String> newProperties = new HashMap<>();
+
+            if (amsSiteProperties.containsKey(HOST_AGGREGATOR_DAILY_CHECKPOINTCUTOFFMULTIPIER) &&
+              amsSiteProperties.get(HOST_AGGREGATOR_DAILY_CHECKPOINTCUTOFFMULTIPIER).equals("1")) {
+
+              LOG.info("Setting value of " + HOST_AGGREGATOR_DAILY_CHECKPOINTCUTOFFMULTIPIER + " : 2");
+              newProperties.put(HOST_AGGREGATOR_DAILY_CHECKPOINTCUTOFFMULTIPIER, String.valueOf(2));
+
+            }
+
+            if (amsSiteProperties.containsKey(CLUSTER_AGGREGATOR_DAILY_CHECKPOINTCUTOFFMULTIPIER) &&
+              amsSiteProperties.get(CLUSTER_AGGREGATOR_DAILY_CHECKPOINTCUTOFFMULTIPIER).equals("1")) {
+
+              LOG.info("Setting value of " + CLUSTER_AGGREGATOR_DAILY_CHECKPOINTCUTOFFMULTIPIER + " : 2");
+              newProperties.put(CLUSTER_AGGREGATOR_DAILY_CHECKPOINTCUTOFFMULTIPIER, String.valueOf(2));
+
+            }
+
+            updateConfigurationPropertiesForCluster(cluster, AMS_SITE, newProperties, true, true);
+          }
+
+        }
+      }
+    }
+  }
+
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/d0bec5cb/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/configuration/ams-site.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/configuration/ams-site.xml b/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/configuration/ams-site.xml
index 4d19786..a3f0028 100644
--- a/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/configuration/ams-site.xml
+++ b/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/configuration/ams-site.xml
@@ -135,7 +135,7 @@
   </property>
   <property>
     <name>timeline.metrics.host.aggregator.daily.checkpointCutOffMultiplier</name>
-    <value>1</value>
+    <value>2</value>
     <description>
       Multiplier value * interval = Max allowed checkpoint lag. Effectively
       if aggregator checkpoint is greater than max allowed checkpoint delay,
@@ -209,7 +209,7 @@
   </property>
   <property>
     <name>timeline.metrics.cluster.aggregator.daily.checkpointCutOffMultiplier</name>
-    <value>1</value>
+    <value>2</value>
     <description>
       Multiplier value * interval = Max allowed checkpoint lag. Effectively
       if aggregator checkpoint is greater than max allowed checkpoint delay,

http://git-wip-us.apache.org/repos/asf/ambari/blob/d0bec5cb/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog222Test.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog222Test.java b/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog222Test.java
index d6d51a9..b701d78 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog222Test.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog222Test.java
@@ -19,22 +19,42 @@
 package org.apache.ambari.server.upgrade;
 
 
+import com.google.common.collect.Maps;
+import com.google.gson.Gson;
 import com.google.inject.Guice;
 import com.google.inject.Injector;
 import com.google.inject.Provider;
 import com.google.inject.persist.PersistService;
+import org.apache.ambari.server.actionmanager.ActionManager;
 import org.apache.ambari.server.api.services.AmbariMetaInfo;
+import org.apache.ambari.server.controller.AmbariManagementController;
+import org.apache.ambari.server.controller.AmbariManagementControllerImpl;
+import org.apache.ambari.server.controller.ConfigurationRequest;
+import org.apache.ambari.server.controller.ConfigurationResponse;
+import org.apache.ambari.server.controller.KerberosHelper;
+import org.apache.ambari.server.controller.MaintenanceStateHelper;
 import org.apache.ambari.server.orm.GuiceJpaInitializer;
 import org.apache.ambari.server.orm.InMemoryDefaultTestModule;
 import org.apache.ambari.server.orm.dao.StackDAO;
 import org.apache.ambari.server.orm.entities.StackEntity;
+import org.apache.ambari.server.state.Cluster;
+import org.apache.ambari.server.state.Clusters;
+import org.apache.ambari.server.state.Config;
+import org.easymock.Capture;
+import org.easymock.EasyMock;
+import org.easymock.EasyMockSupport;
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
 
 import javax.persistence.EntityManager;
 import java.lang.reflect.Method;
+import java.util.HashMap;
+import java.util.Map;
 
+import static org.easymock.EasyMock.anyObject;
+import static org.easymock.EasyMock.anyString;
+import static org.easymock.EasyMock.capture;
 import static org.easymock.EasyMock.createMockBuilder;
 import static org.easymock.EasyMock.createNiceMock;
 import static org.easymock.EasyMock.createStrictMock;
@@ -43,6 +63,7 @@ import static org.easymock.EasyMock.expectLastCall;
 import static org.easymock.EasyMock.replay;
 import static org.easymock.EasyMock.reset;
 import static org.easymock.EasyMock.verify;
+import static org.junit.Assert.assertTrue;
 
 public class UpgradeCatalog222Test {
   private Injector injector;
@@ -93,6 +114,8 @@ public class UpgradeCatalog222Test {
     expectLastCall().once();
     upgradeCatalog222.updateStormConfigs();
     expectLastCall().once();
+    upgradeCatalog222.updateAMSConfigs();
+    expectLastCall().once();
 
     replay(upgradeCatalog222);
 
@@ -101,6 +124,62 @@ public class UpgradeCatalog222Test {
     verify(upgradeCatalog222);
   }
 
+  @Test
+  public void testAmsSiteUpdateConfigs() throws Exception{
+
+    Map<String, String> oldPropertiesAmsSite = new HashMap<String, String>() {
+      {
+        put("timeline.metrics.host.aggregator.daily.checkpointCutOffMultiplier", String.valueOf(1));
+        put("timeline.metrics.cluster.aggregator.daily.checkpointCutOffMultiplier", String.valueOf(1));
+      }
+    };
+    Map<String, String> newPropertiesAmsSite = new HashMap<String, String>() {
+      {
+        put("timeline.metrics.host.aggregator.daily.checkpointCutOffMultiplier", String.valueOf(2));
+        put("timeline.metrics.cluster.aggregator.daily.checkpointCutOffMultiplier", String.valueOf(2));
+      }
+    };
+    EasyMockSupport easyMockSupport = new EasyMockSupport();
+
+    Clusters clusters = easyMockSupport.createNiceMock(Clusters.class);
+    final Cluster cluster = easyMockSupport.createNiceMock(Cluster.class);
+    Config mockAmsSite = easyMockSupport.createNiceMock(Config.class);
+
+    expect(clusters.getClusters()).andReturn(new HashMap<String, Cluster>() {{
+      put("normal", cluster);
+    }}).once();
+    expect(cluster.getDesiredConfigByType("ams-site")).andReturn(mockAmsSite).atLeastOnce();
+    expect(mockAmsSite.getProperties()).andReturn(oldPropertiesAmsSite).times(2);
+
+    Injector injector = easyMockSupport.createNiceMock(Injector.class);
+    expect(injector.getInstance(Gson.class)).andReturn(null).anyTimes();
+    expect(injector.getInstance(MaintenanceStateHelper.class)).andReturn(null).anyTimes();
+    expect(injector.getInstance(KerberosHelper.class)).andReturn(createNiceMock(KerberosHelper.class)).anyTimes();
+
+    replay(injector, clusters, mockAmsSite, cluster);
+
+    AmbariManagementControllerImpl controller = createMockBuilder(AmbariManagementControllerImpl.class)
+      .addMockedMethod("createConfiguration")
+      .addMockedMethod("getClusters", new Class[] { })
+      .addMockedMethod("createConfig")
+      .withConstructor(createNiceMock(ActionManager.class), clusters, injector)
+      .createNiceMock();
+
+    Injector injector2 = easyMockSupport.createNiceMock(Injector.class);
+    Capture<Map> propertiesCapture = EasyMock.newCapture();
+
+    expect(injector2.getInstance(AmbariManagementController.class)).andReturn(controller).anyTimes();
+    expect(controller.getClusters()).andReturn(clusters).anyTimes();
+    expect(controller.createConfig(anyObject(Cluster.class), anyString(), capture(propertiesCapture), anyString(),
+      anyObject(Map.class))).andReturn(createNiceMock(Config.class)).once();
+
+    replay(controller, injector2);
+    new UpgradeCatalog222(injector2).updateAMSConfigs();
+    easyMockSupport.verifyAll();
+
+    Map<String, String> updatedProperties = propertiesCapture.getValue();
+    assertTrue(Maps.difference(newPropertiesAmsSite, updatedProperties).areEqual());
 
+  }
 
 }


[31/40] ambari git commit: AMBARI-14892 : Add Grafana as a component to AMS (avijayan)

Posted by nc...@apache.org.
AMBARI-14892 : Add Grafana as a component to AMS (avijayan)


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

Branch: refs/heads/branch-dev-patch-upgrade
Commit: 1eb846c153b156f87a7e55b65decb1f2118f90dc
Parents: b02150a
Author: Aravindan Vijayan <av...@hortonworks.com>
Authored: Thu Feb 4 22:44:17 2016 -0800
Committer: Aravindan Vijayan <av...@hortonworks.com>
Committed: Fri Feb 5 07:58:48 2016 -0800

----------------------------------------------------------------------
 .../conf/unix/ambari-metrics-grafana            |  79 +++---
 .../conf/unix/ams-grafana-env.sh                |   9 -
 .../conf/unix/ams-grafana.ini                   |  10 +-
 .../metrics/timeline/PhoenixHBaseAccessor.java  |   2 +-
 .../timeline/AbstractMiniHBaseClusterTest.java  |   1 +
 .../0.1.0/configuration/ams-grafana-env.xml     |  59 ++++
 .../0.1.0/configuration/ams-grafana-ini.xml     | 282 +++++++++++++++++++
 .../AMBARI_METRICS/0.1.0/metainfo.xml           |  18 ++
 .../AMBARI_METRICS/0.1.0/package/scripts/ams.py |  30 ++
 .../0.1.0/package/scripts/metrics_collector.py  |   2 +-
 .../0.1.0/package/scripts/metrics_grafana.py    |  65 +++++
 .../0.1.0/package/scripts/metrics_monitor.py    |   2 +-
 .../0.1.0/package/scripts/params.py             |   9 +
 .../0.1.0/package/scripts/status.py             |   4 +
 .../0.1.0/package/scripts/status_params.py      |   1 +
 .../stacks/HDP/2.0.6/role_command_order.json    |   4 +-
 .../AMBARI_METRICS/test_metrics_grafana.py      |  75 +++++
 .../python/stacks/2.0.6/configs/default.json    |   9 +
 18 files changed, 608 insertions(+), 53 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/1eb846c1/ambari-metrics/ambari-metrics-grafana/conf/unix/ambari-metrics-grafana
----------------------------------------------------------------------
diff --git a/ambari-metrics/ambari-metrics-grafana/conf/unix/ambari-metrics-grafana b/ambari-metrics/ambari-metrics-grafana/conf/unix/ambari-metrics-grafana
index 1de5401..29851d2 100644
--- a/ambari-metrics/ambari-metrics-grafana/conf/unix/ambari-metrics-grafana
+++ b/ambari-metrics/ambari-metrics-grafana/conf/unix/ambari-metrics-grafana
@@ -18,7 +18,7 @@
 # description: Grafana web server & backend
 # processname: grafana
 # config: /etc/grafana/ams-grafana.ini
-# pidfile: /var/run/grafana.pid
+# pidfile: /var/run/ambari-metrics-grafana.pid
 
 ### BEGIN INIT INFO
 # Provides:          grafana
@@ -35,16 +35,18 @@
 
 PATH=/bin:/usr/bin:/sbin:/usr/sbin
 NAME=grafana-server
-DESC="Grafana Server"
-
-if [ -f "/etc/ambari-metrics-grafana/conf/ams-grafana-env.sh" ]; then
-  . "/etc/ambari-metrics-grafana/conf/ams-grafana-env.sh"
+DESC="Ambari Metrics Grafana"
+CONF_DIR=/etc/ambari-metrics-grafana/conf
+
+# execute ams-grafana-env.sh
+if [[ -f "${CONF_DIR}/ams-grafana-env.sh" ]]; then
+. "${CONF_DIR}/ams-grafana-env.sh"
+else
+echo "ERROR: Cannot execute ${CONF_DIR}/ams-grafana-env.sh." 2>&1
+exit 1
 fi
 
-GRAFANA_USER=${AMS_USER}
-GRAFANA_GROUP=${AMS_USER_GROUP}
 GRAFANA_HOME=${AMS_GRAFANA_HOME_DIR}
-CONF_DIR=${AMS_GRAFANA_CONF_DIR}
 WORK_DIR=$GRAFANA_HOME
 DATA_DIR=${AMS_GRAFANA_DATA_DIR}
 LOG_DIR=${AMS_GRAFANA_LOG_DIR}
@@ -52,11 +54,13 @@ CONF_FILE=$CONF_DIR/ams-grafana.ini
 MAX_OPEN_FILES=10000
 PID_FILE=${AMS_GRAFANA_PID_DIR}/$NAME.pid
 DAEMON=$GRAFANA_HOME/bin/$NAME
+OUT_FILE=${AMS_GRAFANA_LOG_DIR}/grafana.out
+STOP_TIMEOUT=5
 
-if [ `id -u` -ne 0 ]; then
-  echo "You need root privileges to run this script"
-  exit 4
-fi
+#if [ `id -u` -ne 0 ]; then
+#  echo "You need root privileges to run this script"
+#  exit 4
+#fi
 
 if [ ! -x $DAEMON ]; then
   echo "Program not installed or not executable"
@@ -66,20 +70,20 @@ fi
 #
 # init.d / servicectl compatibility (openSUSE)
 #
-if [ -f /etc/rc.status ]; then
-    . /etc/rc.status
-    rc_reset
-fi
+# if [ -f /etc/rc.status ]; then
+#    . /etc/rc.status
+#    rc_reset
+# fi
 
 #
 # Source function library.
 #
-if [ -f /etc/rc.d/init.d/functions ]; then
-    . /etc/rc.d/init.d/functions
-fi
+# if [ -f /etc/rc.d/init.d/functions ]; then
+#    . /etc/rc.d/init.d/functions
+# fi
 
 # overwrite settings from default file
-[ -e /etc/sysconfig/$NAME ] && . /etc/sysconfig/$NAME
+# [ -e /etc/sysconfig/$NAME ] && . /etc/sysconfig/$NAME
 
 DAEMON_OPTS="--pidfile=${PID_FILE} --config=${CONF_FILE} cfg:default.paths.data=${DATA_DIR} cfg:default.paths.logs=${LOG_DIR}"
 
@@ -98,16 +102,16 @@ case "$1" in
     fi
 
     # Prepare environment
-    mkdir -p "$LOG_DIR" "$DATA_DIR" && chown "$GRAFANA_USER":"$GRAFANA_GROUP" "$LOG_DIR" "$DATA_DIR"
-    touch "$PID_FILE" && chown "$GRAFANA_USER":"$GRAFANA_GROUP" "$PID_FILE"
+    # mkdir -p "$LOG_DIR" "$DATA_DIR" && chown "$GRAFANA_USER":"$GRAFANA_GROUP" "$LOG_DIR" "$DATA_DIR"
+    # touch "$PID_FILE" && chown "$GRAFANA_USER":"$GRAFANA_GROUP" "$PID_FILE"
 
-    if [ -n "$MAX_OPEN_FILES" ]; then
-      ulimit -n $MAX_OPEN_FILES
-    fi
+    # if [ -n "$MAX_OPEN_FILES" ]; then
+    #   ulimit -n $MAX_OPEN_FILES
+    # fi
 
     # Start Daemon
     cd $GRAFANA_HOME
-    su -s /bin/sh -c "nohup ${DAEMON} ${DAEMON_OPTS} >> /dev/null 3>&1 &" $GRAFANA_USER 2> /dev/null
+    nohup ${DAEMON} ${DAEMON_OPTS} > $OUT_FILE 2>&1 &
     return=$?
     if [ $return -eq 0 ]
     then
@@ -138,17 +142,22 @@ case "$1" in
     echo -n "Stopping $DESC ..."
 
     if [ -f "$PID_FILE" ]; then
-      killproc -p $PID_FILE -d 20 $NAME
-      if [ $? -eq 1 ]; then
-        echo -n "$DESC is not running but pid file exists, cleaning up"
-      elif [ $? -eq 3 ]; then
-        PID="`cat $PID_FILE`"
-        echo -n "Failed to stop $DESC (pid $PID)"
-        exit 1
+      pid=$(cat "$PID_FILE")
+
+      kill "${pid}" >/dev/null 2>&1
+      sleep "${STOP_TIMEOUT}"
+
+      if kill -0 "${pid}" > /dev/null 2>&1; then
+        echo "WARNING: $DESC did not stop gracefully after ${STOP_TIMEOUT} seconds: Trying to kill with kill -9"
+        kill -9 "${pid}" >/dev/null 2>&1
+      fi
+
+      if ps -p "${pid}" > /dev/null 2>&1; then
+        echo "ERROR: Unable to kill ${pid}"
+      else
+        rm -f "${pidfile}" >/dev/null 2>&1
       fi
-      rm -f "$PID_FILE"
       echo "OK"
-      exit 0
     else
       echo -n "(not running)"
     fi

http://git-wip-us.apache.org/repos/asf/ambari/blob/1eb846c1/ambari-metrics/ambari-metrics-grafana/conf/unix/ams-grafana-env.sh
----------------------------------------------------------------------
diff --git a/ambari-metrics/ambari-metrics-grafana/conf/unix/ams-grafana-env.sh b/ambari-metrics/ambari-metrics-grafana/conf/unix/ams-grafana-env.sh
index 20986cb..601e930 100644
--- a/ambari-metrics/ambari-metrics-grafana/conf/unix/ams-grafana-env.sh
+++ b/ambari-metrics/ambari-metrics-grafana/conf/unix/ams-grafana-env.sh
@@ -16,18 +16,9 @@
 
 # Set environment variables here.
 
-# AMS user
-export AMS_USER=ams
-
-# AMS user group
-export AMS_USER_GROUP=hadoop
-
 # AMS Grafana Home Dir
 export AMS_GRAFANA_HOME_DIR=/usr/lib/ambari-metrics-grafana
 
-# AMS Grafana Conf Dir
-export AMS_GRAFANA_CONF_DIR=/etc/ambari-metrics-grafana/conf
-
 # AMS Grafana Data Dir
 export AMS_GRAFANA_DATA_DIR=/var/lib/ambari-metrics-grafana
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/1eb846c1/ambari-metrics/ambari-metrics-grafana/conf/unix/ams-grafana.ini
----------------------------------------------------------------------
diff --git a/ambari-metrics/ambari-metrics-grafana/conf/unix/ams-grafana.ini b/ambari-metrics/ambari-metrics-grafana/conf/unix/ams-grafana.ini
index e42a92f..c0ccf1a 100644
--- a/ambari-metrics/ambari-metrics-grafana/conf/unix/ams-grafana.ini
+++ b/ambari-metrics/ambari-metrics-grafana/conf/unix/ams-grafana.ini
@@ -51,7 +51,7 @@ static_root_path = /usr/lib/ambari-metrics-grafana/public
 # enable gzip
 ;enable_gzip = false
 
-# https certs & key file
+# https certs &amp; key file
 ;cert_file =
 ;cert_key =
 
@@ -145,13 +145,13 @@ static_root_path = /usr/lib/ambari-metrics-grafana/public
 #################################### Anonymous Auth ##########################
 [auth.anonymous]
 # enable anonymous access
-;enabled = false
+enabled = true
 
 # specify organization name that should be used for unauthenticated users
-;org_name = Main Org.
+org_name = Main Org.
 
 # specify role for unauthenticated users
-;org_role = Viewer
+org_role = Admin
 
 #################################### Github Auth ##########################
 [auth.github]
@@ -233,7 +233,7 @@ static_root_path = /usr/lib/ambari-metrics-grafana/public
 # Max line number of single file, default is 1000000
 ;max_lines = 1000000
 
-# Max size shift of single file, default is 28 means 1 << 28, 256MB
+# Max size shift of single file, default is 28 means 1 &lt;&lt; 28, 256MB
 ;max_lines_shift = 28
 
 # Segment log daily, default is true

http://git-wip-us.apache.org/repos/asf/ambari/blob/1eb846c1/ambari-metrics/ambari-metrics-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/metrics/timeline/PhoenixHBaseAccessor.java
----------------------------------------------------------------------
diff --git a/ambari-metrics/ambari-metrics-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/metrics/timeline/PhoenixHBaseAccessor.java b/ambari-metrics/ambari-metrics-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/metrics/timeline/PhoenixHBaseAccessor.java
index 4149e8d..29662f3 100644
--- a/ambari-metrics/ambari-metrics-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/metrics/timeline/PhoenixHBaseAccessor.java
+++ b/ambari-metrics/ambari-metrics-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/metrics/timeline/PhoenixHBaseAccessor.java
@@ -550,7 +550,7 @@ public class PhoenixHBaseAccessor {
     List<Function> functions = metricFunctions.get(metricName);
 
     // Apply aggregation function if present
-    if (functions != null && !functions.isEmpty()) {
+    if ((functions != null && !functions.isEmpty())) {
       if (functions.size() > 1) {
         throw new IllegalArgumentException("Multiple aggregate functions not supported.");
       }

http://git-wip-us.apache.org/repos/asf/ambari/blob/1eb846c1/ambari-metrics/ambari-metrics-timelineservice/src/test/java/org/apache/hadoop/yarn/server/applicationhistoryservice/metrics/timeline/AbstractMiniHBaseClusterTest.java
----------------------------------------------------------------------
diff --git a/ambari-metrics/ambari-metrics-timelineservice/src/test/java/org/apache/hadoop/yarn/server/applicationhistoryservice/metrics/timeline/AbstractMiniHBaseClusterTest.java b/ambari-metrics/ambari-metrics-timelineservice/src/test/java/org/apache/hadoop/yarn/server/applicationhistoryservice/metrics/timeline/AbstractMiniHBaseClusterTest.java
index 8cbc56b..df4fc89 100644
--- a/ambari-metrics/ambari-metrics-timelineservice/src/test/java/org/apache/hadoop/yarn/server/applicationhistoryservice/metrics/timeline/AbstractMiniHBaseClusterTest.java
+++ b/ambari-metrics/ambari-metrics-timelineservice/src/test/java/org/apache/hadoop/yarn/server/applicationhistoryservice/metrics/timeline/AbstractMiniHBaseClusterTest.java
@@ -78,6 +78,7 @@ public abstract class AbstractMiniHBaseClusterTest extends BaseTest {
   @AfterClass
   public static void doTeardown() throws Exception {
     dropNonSystemTables();
+    tearDownMiniCluster();
   }
 
   @Before

http://git-wip-us.apache.org/repos/asf/ambari/blob/1eb846c1/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/configuration/ams-grafana-env.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/configuration/ams-grafana-env.xml b/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/configuration/ams-grafana-env.xml
new file mode 100644
index 0000000..de32ead
--- /dev/null
+++ b/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/configuration/ams-grafana-env.xml
@@ -0,0 +1,59 @@
+<?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>
+  <property>
+    <name>metrics_grafana_log_dir</name>
+    <value>/var/log/ambari-metrics-grafana</value>
+    <display-name>Metrics Grafana log dir</display-name>
+    <description>Metrics Grafana log directory.</description>
+  </property>
+  <property>
+    <name>metrics_grafana_pid_dir</name>
+    <value>/var/run/ambari-metrics-grafana</value>
+    <display-name>Metrics Grafana pid dir</display-name>
+    <description>Metrics Grafana pid directory.</description>
+  </property>
+  <property>
+    <name>metrics_grafana_data_dir</name>
+    <value>/var/lib/ambari-metrics-grafana</value>
+    <display-name>Metrics Grafana data dir</display-name>
+    <description>Metrics Grafana data directory.</description>
+  </property>
+  <property>
+    <name>content</name>
+    <value>
+# Set environment variables here.
+
+# AMS UI Server Home Dir
+export AMS_GRAFANA_HOME_DIR={{ams_grafana_home_dir}}
+
+# AMS UI Server Data Dir
+export AMS_GRAFANA_DATA_DIR={{ams_grafana_data_dir}}
+
+# AMS UI Server Log Dir
+export AMS_GRAFANA_LOG_DIR={{ams_grafana_log_dir}}
+
+# AMS UI Server PID Dir
+export AMS_GRAFANA_PID_DIR={{ams_grafana_pid_dir}}
+    </value>
+  </property>
+
+</configuration>

http://git-wip-us.apache.org/repos/asf/ambari/blob/1eb846c1/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/configuration/ams-grafana-ini.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/configuration/ams-grafana-ini.xml b/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/configuration/ams-grafana-ini.xml
new file mode 100644
index 0000000..ac1f7fc
--- /dev/null
+++ b/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/configuration/ams-grafana-ini.xml
@@ -0,0 +1,282 @@
+<?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>
+    <property>
+        <name>content</name>
+        <value>
+            ##################### Grafana Configuration Example #####################
+            #
+            # Everything has defaults so you only need to uncomment things you want to
+            # change
+
+            # possible values : production, development
+            ; app_mode = production
+
+            #################################### Paths ####################################
+            [paths]
+            # Path to where grafana can store temp files, sessions, and the sqlite3 db (if that is used)
+            #
+            ;data = /var/lib/grafana
+            data = /var/lib/ambari-metrics-grafana
+            #
+            # Directory where grafana can store logs
+            #
+            ;logs = /var/log/grafana
+            logs = /var/log/ambari-metrics-grafana
+
+
+            #################################### Server ####################################
+            [server]
+            # Protocol (http or https)
+            ;protocol = http
+
+            # The ip address to bind to, empty will bind to all interfaces
+            ;http_addr =
+
+            # The http port  to use
+            ;http_port = 3000
+
+            # The public facing domain name used to access grafana from a browser
+            ;domain = localhost
+
+            # Redirect to correct domain if host header does not match domain
+            # Prevents DNS rebinding attacks
+            ;enforce_domain = false
+
+            # The full public facing url
+            ;root_url = %(protocol)s://%(domain)s:%(http_port)s/
+
+            # Log web requests
+            ;router_logging = false
+
+            # the path relative working path
+            ;static_root_path = public
+            static_root_path = /usr/lib/ambari-metrics-grafana/public
+
+            # enable gzip
+            ;enable_gzip = false
+
+            # https certs &amp; key file
+            ;cert_file =
+            ;cert_key =
+
+            #################################### Database ####################################
+            [database]
+            # Either "mysql", "postgres" or "sqlite3", it's your choice
+            ;type = sqlite3
+            ;host = 127.0.0.1:3306
+            ;name = grafana
+            ;user = root
+            ;password =
+
+            # For "postgres" only, either "disable", "require" or "verify-full"
+            ;ssl_mode = disable
+
+            # For "sqlite3" only, path relative to data_path setting
+            ;path = grafana.db
+
+            #################################### Session ####################################
+            [session]
+            # Either "memory", "file", "redis", "mysql", "postgres", default is "file"
+            ;provider = file
+
+            # Provider config options
+            # memory: not have any config yet
+            # file: session dir path, is relative to grafana data_path
+            # redis: config like redis server e.g. `addr=127.0.0.1:6379,pool_size=100,db=grafana`
+            # mysql: go-sql-driver/mysql dsn config string, e.g. `user:password@tcp(127.0.0.1:3306)/database_name`
+            # postgres: user=a password=b host=localhost port=5432 dbname=c sslmode=disable
+            ;provider_config = sessions
+
+            # Session cookie name
+            ;cookie_name = grafana_sess
+
+            # If you use session in https only, default is false
+            ;cookie_secure = false
+
+            # Session life time, default is 86400
+            ;session_life_time = 86400
+
+            #################################### Analytics ####################################
+            [analytics]
+            # Server reporting, sends usage counters to stats.grafana.org every 24 hours.
+            # No ip addresses are being tracked, only simple counters to track
+            # running instances, dashboard and error counts. It is very helpful to us.
+            # Change this option to false to disable reporting.
+            ;reporting_enabled = true
+
+            # Google Analytics universal tracking code, only enabled if you specify an id here
+            ;google_analytics_ua_id =
+
+            #################################### Security ####################################
+            [security]
+            # default admin user, created on startup
+            ;admin_user = admin
+
+            # default admin password, can be changed before first start of grafana,  or in profile settings
+            ;admin_password = admin
+
+            # used for signing
+            ;secret_key = SW2YcwTIb9zpOOhoPsMm
+
+            # Auto-login remember days
+            ;login_remember_days = 7
+            ;cookie_username = grafana_user
+            ;cookie_remember_name = grafana_remember
+
+            # disable gravatar profile images
+            ;disable_gravatar = false
+
+            # data source proxy whitelist (ip_or_domain:port seperated by spaces)
+            ;data_source_proxy_whitelist =
+
+            #################################### Users ####################################
+            [users]
+            # disable user signup / registration
+            ;allow_sign_up = true
+
+            # Allow non admin users to create organizations
+            ;allow_org_create = true
+
+            # Set to true to automatically assign new users to the default organization (id 1)
+            ;auto_assign_org = true
+
+            # Default role new users will be automatically assigned (if disabled above is set to true)
+            ;auto_assign_org_role = Viewer
+
+            # Background text for the user field on the login page
+            ;login_hint = email or username
+
+            #################################### Anonymous Auth ##########################
+            [auth.anonymous]
+            # enable anonymous access
+            enabled = true
+
+            # specify organization name that should be used for unauthenticated users
+            org_name = Main Org.
+
+            # specify role for unauthenticated users
+            org_role = Admin
+
+            #################################### Github Auth ##########################
+            [auth.github]
+            ;enabled = false
+            ;allow_sign_up = false
+            ;client_id = some_id
+            ;client_secret = some_secret
+            ;scopes = user:email,read:org
+            ;auth_url = https://github.com/login/oauth/authorize
+            ;token_url = https://github.com/login/oauth/access_token
+            ;api_url = https://api.github.com/user
+            ;team_ids =
+            ;allowed_organizations =
+
+            #################################### Google Auth ##########################
+            [auth.google]
+            ;enabled = false
+            ;allow_sign_up = false
+            ;client_id = some_client_id
+            ;client_secret = some_client_secret
+            ;scopes = https://www.googleapis.com/auth/userinfo.profile https://www.googleapis.com/auth/userinfo.email
+            ;auth_url = https://accounts.google.com/o/oauth2/auth
+            ;token_url = https://accounts.google.com/o/oauth2/token
+            ;api_url = https://www.googleapis.com/oauth2/v1/userinfo
+            ;allowed_domains =
+
+            #################################### Auth Proxy ##########################
+            [auth.proxy]
+            ;enabled = false
+            ;header_name = X-WEBAUTH-USER
+            ;header_property = username
+            ;auto_sign_up = true
+
+            #################################### Basic Auth ##########################
+            [auth.basic]
+            ;enabled = true
+
+            #################################### Auth LDAP ##########################
+            [auth.ldap]
+            ;enabled = false
+            ;config_file = /etc/grafana/ldap.toml
+
+            #################################### SMTP / Emailing ##########################
+            [smtp]
+            ;enabled = false
+            ;host = localhost:25
+            ;user =
+            ;password =
+            ;cert_file =
+            ;key_file =
+            ;skip_verify = false
+            ;from_address = admin@grafana.localhost
+
+            [emails]
+            ;welcome_email_on_sign_up = false
+
+            #################################### Logging ##########################
+            [log]
+            # Either "console", "file", default is "console"
+            # Use comma to separate multiple modes, e.g. "console, file"
+            ;mode = console, file
+
+            # Buffer length of channel, keep it as it is if you don't know what it is.
+            ;buffer_len = 10000
+
+            # Either "Trace", "Debug", "Info", "Warn", "Error", "Critical", default is "Trace"
+            ;level = Info
+
+            # For "console" mode only
+            [log.console]
+            ;level =
+
+            # For "file" mode only
+            [log.file]
+            ;level =
+            # This enables automated log rotate(switch of following options), default is true
+            ;log_rotate = true
+
+            # Max line number of single file, default is 1000000
+            ;max_lines = 1000000
+
+            # Max size shift of single file, default is 28 means 1 &lt;&lt; 28, 256MB
+            ;max_lines_shift = 28
+
+            # Segment log daily, default is true
+            ;daily_rotate = true
+
+            # Expired days of log file(delete after max days), default is 7
+            ;max_days = 7
+
+            #################################### AMPQ Event Publisher ##########################
+            [event_publisher]
+            ;enabled = false
+            ;rabbitmq_url = amqp://localhost/
+            ;exchange = grafana_events
+
+            ;#################################### Dashboard JSON files ##########################
+            [dashboards.json]
+            ;enabled = false
+            ;path = /var/lib/grafana/dashboards
+            path = /usr/lib/ambari-metrics-grafana/public/dashboards
+        </value>
+    </property>
+
+</configuration>

http://git-wip-us.apache.org/repos/asf/ambari/blob/1eb846c1/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/metainfo.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/metainfo.xml b/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/metainfo.xml
index 48469df..6ea4ca5 100644
--- a/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/metainfo.xml
+++ b/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/metainfo.xml
@@ -62,6 +62,18 @@
             <timeout>1200</timeout>
           </commandScript>
         </component>
+        <component>
+          <name>METRICS_GRAFANA</name>
+          <displayName>Grafana</displayName>
+          <category>MASTER</category>
+          <cardinality>0-1</cardinality>
+          <versionAdvertised>false</versionAdvertised>
+          <commandScript>
+            <script>scripts/metrics_grafana.py</script>
+            <scriptType>PYTHON</scriptType>
+            <timeout>1200</timeout>
+          </commandScript>
+        </component>
       </components>
 
       <osSpecifics>
@@ -81,6 +93,10 @@
               <skipUpgrade>true</skipUpgrade>
             </package>
             <package>
+              <name>ambari-metrics-grafana</name>
+              <skipUpgrade>true</skipUpgrade>
+            </package>
+            <package>
               <name>gcc</name>
             </package>
           </packages>
@@ -135,6 +151,8 @@
         <config-type>ams-hbase-security-site</config-type>
         <config-type>ams-hbase-env</config-type>
         <config-type>ams-hbase-log4j</config-type>
+        <config-type>ams-grafana-env</config-type>
+        <config-type>ams-grafana-ini</config-type>
       </configuration-dependencies>
 
       <excluded-config-types>

http://git-wip-us.apache.org/repos/asf/ambari/blob/1eb846c1/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/package/scripts/ams.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/package/scripts/ams.py b/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/package/scripts/ams.py
index 94b9fc9..40188c2 100644
--- a/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/package/scripts/ams.py
+++ b/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/package/scripts/ams.py
@@ -378,5 +378,35 @@ def ams(name=None):
 
     # TODO
     pass
+  elif name == 'grafana':
+
+    ams_grafana_directories = [
+                              params.ams_grafana_conf_dir,
+                              params.ams_grafana_log_dir,
+                              params.ams_grafana_data_dir,
+                              params.ams_grafana_pid_dir
+                              ]
+
+    for ams_grafana_directory in ams_grafana_directories:
+      Directory(ams_grafana_directory,
+                owner=params.ams_user,
+                group=params.user_group,
+                mode=0755,
+                recursive_ownership = True
+                )
+
+    File(format("{ams_grafana_conf_dir}/ams-grafana-env.sh"),
+         owner=params.ams_user,
+         group=params.user_group,
+         content=InlineTemplate(params.ams_grafana_env_sh_template)
+         )
+
+    File(format("{ams_grafana_conf_dir}/ams-grafana.ini"),
+         owner=params.ams_user,
+         group=params.user_group,
+         content=InlineTemplate(params.ams_grafana_ini_template)
+         )
+
+    pass
 
   pass

http://git-wip-us.apache.org/repos/asf/ambari/blob/1eb846c1/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/package/scripts/metrics_collector.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/package/scripts/metrics_collector.py b/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/package/scripts/metrics_collector.py
index cf498ec..ddefed7 100644
--- a/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/package/scripts/metrics_collector.py
+++ b/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/package/scripts/metrics_collector.py
@@ -31,7 +31,7 @@ from ambari_commons.os_family_impl import OsFamilyImpl
 
 class AmsCollector(Script):
   def install(self, env):
-    self.install_packages(env)
+    self.install_packages(env, exclude_packages = ['ambari-metrics-grafana'])
 
   def configure(self, env, action = None):
     import params

http://git-wip-us.apache.org/repos/asf/ambari/blob/1eb846c1/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/package/scripts/metrics_grafana.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/package/scripts/metrics_grafana.py b/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/package/scripts/metrics_grafana.py
new file mode 100644
index 0000000..f876036
--- /dev/null
+++ b/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/package/scripts/metrics_grafana.py
@@ -0,0 +1,65 @@
+#!/usr/bin/env python
+"""
+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.
+
+"""
+
+from resource_management import Script, Execute
+from resource_management.libraries.functions import format
+from status import check_service_status
+from ams import ams
+
+class AmsGrafana(Script):
+  def install(self, env):
+    self.install_packages(env, exclude_packages = ['ambari-metrics-collector'])
+
+  def configure(self, env, action = None):
+    import params
+    env.set_params(params)
+    ams(name='grafana')
+
+  def start(self, env):
+    import params
+    env.set_params(params)
+    self.configure(env, action = 'start')
+
+    stop_cmd = format("{ams_grafana_script} stop")
+    Execute(stop_cmd,
+            user=params.ams_user
+            )
+
+    start_cmd = format("{ams_grafana_script} start")
+    Execute(start_cmd,
+            user=params.ams_user
+            )
+
+  def stop(self, env):
+    import params
+    env.set_params(params)
+    self.configure(env, action = 'stop')
+    stop_cmd = format("{ams_grafana_script} stop")
+    Execute(stop_cmd,
+            user=params.ams_user
+            )
+
+  def status(self, env):
+    import status_params
+    env.set_params(status_params)
+    check_service_status(name='grafana')
+
+if __name__ == "__main__":
+  AmsGrafana().execute()

http://git-wip-us.apache.org/repos/asf/ambari/blob/1eb846c1/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/package/scripts/metrics_monitor.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/package/scripts/metrics_monitor.py b/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/package/scripts/metrics_monitor.py
index d98384b..921bed7 100644
--- a/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/package/scripts/metrics_monitor.py
+++ b/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/package/scripts/metrics_monitor.py
@@ -27,7 +27,7 @@ class AmsMonitor(Script):
   def install(self, env):
     import params
     env.set_params(params)
-    self.install_packages(env)
+    self.install_packages(env, exclude_packages = ['ambari-metrics-collector', 'ambari-metrics-grafana'])
     self.configure(env) # for security
 
   def configure(self, env):

http://git-wip-us.apache.org/repos/asf/ambari/blob/1eb846c1/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/package/scripts/params.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/package/scripts/params.py b/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/package/scripts/params.py
index a1de919..d8a19ce 100644
--- a/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/package/scripts/params.py
+++ b/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/package/scripts/params.py
@@ -72,6 +72,13 @@ ams_monitor_dir = "/usr/lib/python2.6/site-packages/resource_monitoring"
 ams_monitor_pid_dir = status_params.ams_monitor_pid_dir
 ams_monitor_script = "/usr/sbin/ambari-metrics-monitor"
 
+ams_grafana_script = "/usr/sbin/ambari-metrics-grafana"
+ams_grafana_home_dir = '/usr/lib/ambari-metrics-grafana'
+ams_grafana_log_dir = default("/configurations/ams-grafana-env/metrics_grafana_log_dir", '/var/log/ambari-metrics-grafana')
+ams_grafana_pid_dir = status_params.ams_grafana_pid_dir
+ams_grafana_conf_dir = '/etc/ambari-metrics-grafana/conf'
+ams_grafana_data_dir = default("/configurations/ams-grafana-env/metrics_grafana_data_dir", '/var/lib/ambari-metrics-grafana')
+
 ams_hbase_home_dir = "/usr/lib/ams-hbase/"
 
 ams_hbase_normalizer_enabled = default("/configurations/ams-hbase-site/hbase.normalizer.enabled", None)
@@ -220,6 +227,8 @@ else:
 
 hbase_env_sh_template = config['configurations']['ams-hbase-env']['content']
 ams_env_sh_template = config['configurations']['ams-env']['content']
+ams_grafana_env_sh_template = config['configurations']['ams-grafana-env']['content']
+ams_grafana_ini_template = config['configurations']['ams-grafana-ini']['content']
 
 hbase_staging_dir = default("/configurations/ams-hbase-site/hbase.bulkload.staging.dir", "/amshbase/staging")
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/1eb846c1/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/package/scripts/status.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/package/scripts/status.py b/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/package/scripts/status.py
index 59466ad..fa4e8a4 100644
--- a/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/package/scripts/status.py
+++ b/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/package/scripts/status.py
@@ -37,6 +37,10 @@ def check_service_status(name):
     pid_file = format("{ams_monitor_pid_dir}/ambari-metrics-monitor.pid")
     check_process_status(pid_file)
 
+  elif name == 'grafana':
+    pid_file = format("{ams_grafana_pid_dir}/grafana-server.pid")
+    check_process_status(pid_file)
+
 @OsFamilyFuncImpl(os_family=OSConst.WINSRV_FAMILY)
 def check_service_status(name):
   import service_mapping

http://git-wip-us.apache.org/repos/asf/ambari/blob/1eb846c1/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/package/scripts/status_params.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/package/scripts/status_params.py b/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/package/scripts/status_params.py
index d446baa..3c4bffc 100644
--- a/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/package/scripts/status_params.py
+++ b/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/package/scripts/status_params.py
@@ -30,6 +30,7 @@ hbase_pid_dir = config['configurations']['ams-hbase-env']['hbase_pid_dir']
 hbase_user = ams_user
 ams_collector_pid_dir = config['configurations']['ams-env']['metrics_collector_pid_dir']
 ams_monitor_pid_dir = config['configurations']['ams-env']['metrics_monitor_pid_dir']
+ams_grafana_pid_dir = config['configurations']['ams-grafana-env']['metrics_grafana_pid_dir']
 
 security_enabled = config['configurations']['cluster-env']['security_enabled']
 ams_hbase_conf_dir = format("{hbase_conf_dir}")

http://git-wip-us.apache.org/repos/asf/ambari/blob/1eb846c1/ambari-server/src/main/resources/stacks/HDP/2.0.6/role_command_order.json
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.0.6/role_command_order.json b/ambari-server/src/main/resources/stacks/HDP/2.0.6/role_command_order.json
index a480e2a..710b0dd 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.0.6/role_command_order.json
+++ b/ambari-server/src/main/resources/stacks/HDP/2.0.6/role_command_order.json
@@ -51,7 +51,9 @@
     "NAMENODE-STOP": ["RESOURCEMANAGER-STOP", "NODEMANAGER-STOP",
         "HISTORYSERVER-STOP", "HBASE_MASTER-STOP", "METRICS_COLLECTOR-STOP"],
     "DATANODE-STOP": ["RESOURCEMANAGER-STOP", "NODEMANAGER-STOP",
-        "HISTORYSERVER-STOP", "HBASE_MASTER-STOP"]
+        "HISTORYSERVER-STOP", "HBASE_MASTER-STOP"],
+    "METRICS_GRAFANA-START": ["METRICS_COLLECTOR-START"],
+    "METRICS_COLLECTOR-STOP": ["METRICS_GRAFANA-STOP"]
   },
   "_comment" : "Dependencies that are used in HA NameNode cluster",
   "namenode_optional_ha": {

http://git-wip-us.apache.org/repos/asf/ambari/blob/1eb846c1/ambari-server/src/test/python/stacks/2.0.6/AMBARI_METRICS/test_metrics_grafana.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/stacks/2.0.6/AMBARI_METRICS/test_metrics_grafana.py b/ambari-server/src/test/python/stacks/2.0.6/AMBARI_METRICS/test_metrics_grafana.py
new file mode 100644
index 0000000..5bc1412
--- /dev/null
+++ b/ambari-server/src/test/python/stacks/2.0.6/AMBARI_METRICS/test_metrics_grafana.py
@@ -0,0 +1,75 @@
+#!/usr/bin/env python
+
+'''
+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.
+'''
+
+from mock.mock import MagicMock, patch
+from stacks.utils.RMFTestCase import *
+
+@patch("os.path.exists", new = MagicMock(return_value=True))
+@patch("platform.linux_distribution", new = MagicMock(return_value="Linux"))
+class TestMetricsGrafana(RMFTestCase):
+  COMMON_SERVICES_PACKAGE_DIR = "AMBARI_METRICS/0.1.0/package"
+  STACK_VERSION = "2.0.6"
+
+  def test_start(self):
+    self.executeScript(self.COMMON_SERVICES_PACKAGE_DIR + "/scripts/metrics_grafana.py",
+                       classname = "AmsGrafana",
+                       command = "start",
+                       config_file="default.json",
+                       hdp_stack_version = self.STACK_VERSION,
+                       target = RMFTestCase.TARGET_COMMON_SERVICES
+                       )
+    self.maxDiff=None
+    self.assert_configure()
+    self.assertResourceCalled('Execute', '/usr/sbin/ambari-metrics-grafana stop',
+                              user = 'ams'
+                              )
+    self.assertResourceCalled('Execute', '/usr/sbin/ambari-metrics-grafana start',
+                              user = 'ams'
+                              )
+    self.assertNoMoreResources()
+
+  def assert_configure(self):
+
+    ams_grafana_directories = [
+      '/etc/ambari-metrics-grafana/conf',
+      '/var/log/ambari-metrics-grafana',
+      '/var/lib/ambari-metrics-grafana',
+      '/var/run/ambari-metrics-grafana'
+    ]
+
+    for ams_grafana_directory in ams_grafana_directories:
+      self.assertResourceCalled('Directory', ams_grafana_directory,
+                              owner = 'ams',
+                              group = 'hadoop',
+                              mode=0755,
+                              recursive_ownership = True
+                              )
+
+    self.assertResourceCalled('File', '/etc/ambari-metrics-grafana/conf/ams-grafana-env.sh',
+                              owner = 'ams',
+                              group = 'hadoop',
+                              content = InlineTemplate(self.getConfig()['configurations']['ams-env']['content'])
+                              )
+
+    self.assertResourceCalled('File', '/etc/ambari-metrics-grafana/conf/ams-grafana.ini',
+                              owner = 'ams',
+                              group = 'hadoop',
+                              content = InlineTemplate(self.getConfig()['configurations']['ams-env']['content'])
+                              )

http://git-wip-us.apache.org/repos/asf/ambari/blob/1eb846c1/ambari-server/src/test/python/stacks/2.0.6/configs/default.json
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/stacks/2.0.6/configs/default.json b/ambari-server/src/test/python/stacks/2.0.6/configs/default.json
index 94f3da0..cb34098 100644
--- a/ambari-server/src/test/python/stacks/2.0.6/configs/default.json
+++ b/ambari-server/src/test/python/stacks/2.0.6/configs/default.json
@@ -853,6 +853,15 @@
             "timeline.metrics.daily.aggregator.minute.interval": "86400",
             "timeline.metrics.cluster.aggregator.minute.interval": "120",
             "timeline.metrics.host.aggregator.hourly.interval": "3600"
+        },
+        "ams-grafana-env": {
+            "metrics_grafana_log_dir": "/var/log/ambari-metrics-grafana",
+            "metrics_grafana_pid_dir": "/var/run/ambari-metrics-grafana",
+            "metrics_grafana_data_dir": "/var/lib/ambari-metrics-grafana",
+            "content": "\n"
+        },
+        "ams-grafana-ini": {
+            "content": "\n"
         }
     },
     "configuration_attributes": {


[04/40] ambari git commit: AMBARI-14820: Implement Activate HAWQ Standby wizard to allow doing failover in HA mode (bhuvnesh2703 via jaoki)

Posted by nc...@apache.org.
AMBARI-14820: Implement Activate HAWQ Standby wizard to allow doing failover in HA mode (bhuvnesh2703 via jaoki)


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

Branch: refs/heads/branch-dev-patch-upgrade
Commit: 65558a5a660062ebb1c9380e4a7101ce45ad4fe2
Parents: ad67efd
Author: Jun Aoki <ja...@apache.org>
Authored: Wed Feb 3 15:27:26 2016 -0800
Committer: Jun Aoki <ja...@apache.org>
Committed: Wed Feb 3 15:27:26 2016 -0800

----------------------------------------------------------------------
 ambari-web/app/assets/test/tests.js             |   1 +
 ambari-web/app/controllers.js                   |   4 +
 .../hawq/activateStandby/step1_controller.js    |  23 +++
 .../hawq/activateStandby/step2_controller.js    | 105 +++++++++++
 .../hawq/activateStandby/step3_controller.js    | 126 +++++++++++++
 .../hawq/activateStandby/wizard_controller.js   | 128 +++++++++++++
 .../main/admin/highAvailability_controller.js   |   9 +
 ambari-web/app/controllers/main/service/item.js |   5 +
 .../HDP2.3/hawq_activate_standby_properties.js  |  43 +++++
 ambari-web/app/data/controller_route.js         |   4 +
 ambari-web/app/messages.js                      |  37 +++-
 .../wizard/wizardProgressPageController.js      |  30 ++++
 ambari-web/app/models/host_component.js         |   9 +-
 .../app/routes/activate_hawq_standby_routes.js  | 179 +++++++++++++++++++
 ambari-web/app/routes/main.js                   |   2 +
 .../hawq/activateStandby/step1.hbs              |  28 +++
 .../hawq/activateStandby/step2.hbs              |  53 ++++++
 .../hawq/activateStandby/step3.hbs              |  18 ++
 .../hawq/activateStandby/wizard.hbs             |  44 +++++
 .../hawq_activate_standby_config_initializer.js |  53 ++++++
 .../utils/configs/hawq_ha_config_initializer.js |   2 +-
 ambari-web/app/utils/db.js                      |   1 +
 ambari-web/app/views.js                         |   4 +
 .../hawq/activateStandby/step1_view.js          |  26 +++
 .../hawq/activateStandby/step2_view.js          |  29 +++
 .../hawq/activateStandby/step3_view.js          |  36 ++++
 .../hawq/activateStandby/wizard_view.js         |  74 ++++++++
 ambari-web/app/views/main/service/item.js       |   2 +
 .../activateStandby/step2_controller_test.js    |  88 +++++++++
 29 files changed, 1160 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/65558a5a/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 215a754..85c814d 100644
--- a/ambari-web/app/assets/test/tests.js
+++ b/ambari-web/app/assets/test/tests.js
@@ -71,6 +71,7 @@ var files = [
   'test/controllers/main/admin/highAvailability/nameNode/step4_controller_test',
   'test/controllers/main/admin/highAvailability/resourceManager/step3_controller_test',
   'test/controllers/main/admin/highAvailability/hawq/addStandby/step3_controller_test',
+  'test/controllers/main/admin/highAvailability/hawq/activateStandby/step2_controller_test',
   'test/controllers/main/dashboard/config_history_controller_test',
   'test/controllers/main/charts/heatmap_test',
   'test/controllers/main/charts/heatmap_metrics/heatmap_metric_test',

http://git-wip-us.apache.org/repos/asf/ambari/blob/65558a5a/ambari-web/app/controllers.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers.js b/ambari-web/app/controllers.js
index eed54dc..8fa9e6b 100644
--- a/ambari-web/app/controllers.js
+++ b/ambari-web/app/controllers.js
@@ -60,6 +60,10 @@ require('controllers/main/admin/highAvailability/hawq/addStandby/step1_controlle
 require('controllers/main/admin/highAvailability/hawq/addStandby/step2_controller');
 require('controllers/main/admin/highAvailability/hawq/addStandby/step3_controller');
 require('controllers/main/admin/highAvailability/hawq/addStandby/step4_controller');
+require('controllers/main/admin/highAvailability/hawq/activateStandby/wizard_controller');
+require('controllers/main/admin/highAvailability/hawq/activateStandby/step1_controller');
+require('controllers/main/admin/highAvailability/hawq/activateStandby/step2_controller');
+require('controllers/main/admin/highAvailability/hawq/activateStandby/step3_controller');
 require('controllers/main/admin/highAvailability/rangerAdmin/wizard_controller');
 require('controllers/main/admin/highAvailability/rangerAdmin/step1_controller');
 require('controllers/main/admin/highAvailability/rangerAdmin/step2_controller');

http://git-wip-us.apache.org/repos/asf/ambari/blob/65558a5a/ambari-web/app/controllers/main/admin/highAvailability/hawq/activateStandby/step1_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/admin/highAvailability/hawq/activateStandby/step1_controller.js b/ambari-web/app/controllers/main/admin/highAvailability/hawq/activateStandby/step1_controller.js
new file mode 100644
index 0000000..5652a2f
--- /dev/null
+++ b/ambari-web/app/controllers/main/admin/highAvailability/hawq/activateStandby/step1_controller.js
@@ -0,0 +1,23 @@
+/**
+ * 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');
+
+App.ActivateHawqStandbyWizardStep1Controller = Em.Controller.extend({
+  name: "activateHawqStandbyWizardStep1Controller"
+});

http://git-wip-us.apache.org/repos/asf/ambari/blob/65558a5a/ambari-web/app/controllers/main/admin/highAvailability/hawq/activateStandby/step2_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/admin/highAvailability/hawq/activateStandby/step2_controller.js b/ambari-web/app/controllers/main/admin/highAvailability/hawq/activateStandby/step2_controller.js
new file mode 100644
index 0000000..a14817a
--- /dev/null
+++ b/ambari-web/app/controllers/main/admin/highAvailability/hawq/activateStandby/step2_controller.js
@@ -0,0 +1,105 @@
+/**
+ * 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.
+ */
+
+/**
+ * @typedef {object} hawqActivateStandbyConfigDependencies
+ */
+
+var App = require('app');
+require('utils/configs/hawq_activate_standby_config_initializer');
+
+App.ActivateHawqStandbyWizardStep2Controller = Em.Controller.extend({
+  name: "activateHawqStandbyWizardStep2Controller",
+
+  selectedService: null,
+
+  versionLoaded: true,
+
+  hideDependenciesInfoBar: true,
+
+  isLoaded: false,
+
+  isSubmitDisabled: Em.computed.not('isLoaded'),
+
+  loadStep: function () {
+    this.renderConfigs();
+  },
+
+  /**
+   * Render configs to show them in <code>App.ServiceConfigView</code>
+   */
+  renderConfigs: function () {
+    newHawqMaster = App.HostComponent.find().findProperty('componentName','HAWQSTANDBY').get('hostName');
+
+    var configs = require('data/HDP2.3/hawq_activate_standby_properties').haConfig;
+
+    var serviceConfig = App.ServiceConfig.create({
+      serviceName: configs.serviceName,
+      displayName: configs.displayName,
+      configCategories: [],
+      showConfig: true,
+      configs: []
+    });
+
+    configs.configCategories.forEach(function (configCategory) {
+      if (App.Service.find().someProperty('serviceName', configCategory.name)) {
+        serviceConfig.configCategories.pushObject(configCategory);
+      }
+    }, this);
+
+    this.renderConfigProperties(configs, serviceConfig);
+    this.setDynamicConfigValues(serviceConfig);
+    this.setProperties({
+      selectedService: serviceConfig,
+      isLoaded: true
+    });
+  },
+
+
+  setDynamicConfigValues: function (configs) {
+    var topologyLocalDB = this.get('content').getProperties(['masterComponentHosts']);
+    configs.configs.forEach(function (config) {
+      App.HawqActivateStandbyConfigInitializer.initialValue(config, topologyLocalDB);
+    });
+    App.HawqActivateStandbyConfigInitializer.cleanup();
+    return configs;
+  },
+
+  /**
+   * Load child components to service config object
+   * @param _componentConfig
+   * @param componentConfig
+   */
+  renderConfigProperties: function (_componentConfig, componentConfig) {
+    _componentConfig.configs.forEach(function (_serviceConfigProperty) {
+      var serviceConfigProperty = App.ServiceConfigProperty.create(_serviceConfigProperty);
+      componentConfig.configs.pushObject(serviceConfigProperty);
+      serviceConfigProperty.set('isEditable', serviceConfigProperty.get('isReconfigurable'));
+      serviceConfigProperty.validate();
+    }, this);
+  },
+
+  submit: function () {
+    if (!this.get('isSubmitDisabled')) {
+      App.get('router.mainAdminKerberosController').getKDCSessionState(function() {
+        App.router.send("next");
+      });
+    }
+  }
+
+});

http://git-wip-us.apache.org/repos/asf/ambari/blob/65558a5a/ambari-web/app/controllers/main/admin/highAvailability/hawq/activateStandby/step3_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/admin/highAvailability/hawq/activateStandby/step3_controller.js b/ambari-web/app/controllers/main/admin/highAvailability/hawq/activateStandby/step3_controller.js
new file mode 100644
index 0000000..55da44e
--- /dev/null
+++ b/ambari-web/app/controllers/main/admin/highAvailability/hawq/activateStandby/step3_controller.js
@@ -0,0 +1,126 @@
+/**
+ * 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');
+require('controllers/main/admin/serviceAccounts_controller');
+
+App.ActivateHawqStandbyWizardStep3Controller = App.HighAvailabilityProgressPageController.extend(App.WizardEnableDone, {
+
+  name: "activateHawqStandbyWizardStep3Controller",
+
+  clusterDeployState: 'ACTIVATE_HAWQ_STANDBY',
+
+  hawqActivateStandbyCustomCommand: "ACTIVATE_STANDBY",
+
+  hawqServiceName: "HAWQ",
+
+  hawqStandbyComponentName: "HAWQSTANDBY",
+
+  hawqMasterComponentName: "HAWQMASTER",
+
+  commands: ['activateStandby', 'stopRequiredServices', 'reconfigureHAWQ', 'installHawqMaster', 'deleteOldHawqMaster',
+              'deleteHawqStandby', 'startRequiredServices'],
+
+  tasksMessagesPrefix: 'admin.activateHawqStandby.wizard.step',
+
+  activateStandby: function () {
+    App.ajax.send({
+      name : 'service.item.executeCustomCommand',
+      sender: this,
+      data : {
+        command : this.hawqActivateStandbyCustomCommand,
+        context : Em.I18n.t('admin.activateHawqStandby.wizard.step3.activateHawqStandbyCommand.context'),
+        hosts : this.get('content.hawqHosts.hawqStandby'),
+        serviceName : this.hawqServiceName,
+        componentName : this.hawqStandbyComponentName
+      },
+      success: 'startPolling',
+      error: 'onTaskError'
+    });
+  },
+
+  stopRequiredServices: function () {
+    this.stopServices([this.hawqServiceName], true);
+  },
+
+  reconfigureHAWQ: function () {
+    App.ajax.send({
+      name: 'config.tags',
+      sender: this,
+      success: 'onLoadHawqConfigsTags',
+      error: 'onTaskError'
+    });
+  },
+
+  onLoadHawqConfigsTags: function (data) {
+    App.ajax.send({
+      name: 'reassign.load_configs',
+      sender: this,
+      data: {
+        urlParams: '(type=hawq-site&tag=' + data.Clusters.desired_configs['hawq-site'].tag + ')',
+        type: 'hawq-site'
+      },
+      success: 'onLoadConfigs',
+      error: 'onTaskError'
+    });
+  },
+
+  onLoadConfigs: function (data, opt, params) {
+    delete data.items[0].properties['hawq_standby_address_host'];
+
+    var propertiesToAdd = this.get('content.configs').filterProperty('filename', params.type);
+    propertiesToAdd.forEach(function (property) {
+      data.items[0].properties[property.name] = property.value;
+    });
+
+    var configData = this.reconfigureSites([params.type], data, Em.I18n.t('admin.addHawqStandby.step4.save.configuration.note').format(App.format.role('HAWQSTANDBY')));
+
+    App.ajax.send({
+      name: 'common.service.configurations',
+      sender: this,
+      data: {
+        desired_config: configData
+      },
+      success: 'onSaveConfigs',
+      error: 'onTaskError'
+    });
+  },
+  onSaveConfigs: function () {
+    this.onTaskCompleted();
+  },
+
+  installHawqMaster: function () {
+    var hostName = this.get('content.hawqHosts.hawqStandby');
+    this.createComponent(this.hawqMasterComponentName, hostName, this.hawqServiceName);
+  },
+
+  deleteOldHawqMaster: function () {
+    var hostName = this.get('content.hawqHosts.hawqMaster');
+    this.deleteComponent(this.hawqMasterComponentName, hostName);
+  },
+
+  deleteHawqStandby: function () {
+    var hostName = this.get('content.hawqHosts.hawqStandby');
+    this.deleteComponent(this.hawqStandbyComponentName, hostName);
+  },
+
+  startRequiredServices: function () {
+    this.startServices(true, [this.hawqServiceName], true);
+  }
+
+});

http://git-wip-us.apache.org/repos/asf/ambari/blob/65558a5a/ambari-web/app/controllers/main/admin/highAvailability/hawq/activateStandby/wizard_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/admin/highAvailability/hawq/activateStandby/wizard_controller.js b/ambari-web/app/controllers/main/admin/highAvailability/hawq/activateStandby/wizard_controller.js
new file mode 100644
index 0000000..aa50b76
--- /dev/null
+++ b/ambari-web/app/controllers/main/admin/highAvailability/hawq/activateStandby/wizard_controller.js
@@ -0,0 +1,128 @@
+/**
+ * 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');
+
+App.ActivateHawqStandbyWizardController = App.WizardController.extend({
+
+  name: 'activateHawqStandbyWizardController',
+
+  totalSteps: 3,
+
+  /**
+   * @type {string}
+   */
+  displayName: Em.I18n.t('admin.activateHawqStandby.wizard.header'),
+
+  isFinished: false,
+
+  content: Em.Object.create({
+    controllerName: 'activateHawqStandbyWizardController'
+  }),
+
+  init: function () {
+    this._super();
+    this.clearStep();
+  },
+
+  clearStep: function () {
+    this.set('isFinished', false);
+  },
+
+  setCurrentStep: function (currentStep, completed) {
+    this._super(currentStep, completed);
+    App.clusterStatus.setClusterStatus({
+      clusterName: this.get('content.cluster.name'),
+      wizardControllerName: this.name,
+      localdb: App.db.data
+    });
+  },
+
+  /**
+   * Save hosts for Hawq Master and Hawq Standby<code>controller.content</code>
+   * @param hawqHosts
+   */
+  saveHawqHosts: function (hawqHosts) {
+    this.set('content.hawqHosts', hawqHosts);
+    this.setDBProperty('hawqHosts', hawqHosts);
+  },
+
+  /**
+   * Load hosts for additional and current ResourceManagers from local db to <code>controller.content</code>
+   */
+  loadHawqHosts: function() {
+    var hawqHosts = this.getDBProperty('hawqHosts');
+    this.set('content.hawqHosts', hawqHosts);
+  },
+
+  /**
+   * Save configs to load and apply them on Configure Components step
+   * @param configs
+   */
+  saveConfigs: function (configs) {
+    this.set('content.configs', configs);
+    this.setDBProperty('configs', configs);
+  },
+
+  /**
+   * Load configs to apply them on Configure Components step
+   */
+  loadConfigs: function() {
+    var configs = this.getDBProperty('configs');
+    this.set('content.configs', configs);
+  },
+
+  /**
+   * Load data for all steps until <code>current step</code>
+   */
+  loadAllPriorSteps: function () {
+    var step = this.get('currentStep');
+    switch (step) {
+      case '3':
+        this.loadTasksStatuses();
+        this.loadTasksRequestIds();
+        this.loadRequestIds();
+        this.loadConfigs();
+      case '2':
+        this.loadHawqHosts();
+        this.loadServicesFromServer();
+        this.loadMasterComponentHosts();
+      case '1':
+        this.load('cluster');
+    }
+  },
+
+  /**
+   * Remove all loaded data.
+   */
+  clearAllSteps: function () {
+    this.clearInstallOptions();
+    // clear temporary information stored during the install
+    this.set('content.cluster', this.getCluster());
+  },
+
+  /**
+   * Clear all temporary data
+   */
+  finish: function () {
+    this.resetDbNamespace();
+    App.router.get('updateController').updateAll();
+    this.set('isFinished', true);
+  }
+});

http://git-wip-us.apache.org/repos/asf/ambari/blob/65558a5a/ambari-web/app/controllers/main/admin/highAvailability_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/admin/highAvailability_controller.js b/ambari-web/app/controllers/main/admin/highAvailability_controller.js
index 29ce167..710e4d0 100644
--- a/ambari-web/app/controllers/main/admin/highAvailability_controller.js
+++ b/ambari-web/app/controllers/main/admin/highAvailability_controller.js
@@ -87,6 +87,15 @@ App.MainAdminHighAvailabilityController = Em.Controller.extend({
   },
 
   /**
+   * activate Hawq Standby
+   * @return {Boolean}
+   */
+  activateHawqStandby: function () {
+    App.router.transitionTo('main.services.activateHawqStandby');
+    return true;
+   },
+
+  /**
    * enable Ranger Admin High Availability
    * @return {Boolean}
    */

http://git-wip-us.apache.org/repos/asf/ambari/blob/65558a5a/ambari-web/app/controllers/main/service/item.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/service/item.js b/ambari-web/app/controllers/main/service/item.js
index 4678c64..a26c820 100644
--- a/ambari-web/app/controllers/main/service/item.js
+++ b/ambari-web/app/controllers/main/service/item.js
@@ -905,6 +905,11 @@ App.MainServiceItemController = Em.Controller.extend(App.SupportClientConfigsDow
     highAvailabilityController.addHawqStandby();
   },
 
+  activateHawqStandby: function() {
+    var highAvailabilityController = App.router.get('mainAdminHighAvailabilityController');
+    highAvailabilityController.activateHawqStandby();
+  },
+
   enableRAHighAvailability: function() {
     var highAvailabilityController = App.router.get('mainAdminHighAvailabilityController');
     highAvailabilityController.enableRAHighAvailability();

http://git-wip-us.apache.org/repos/asf/ambari/blob/65558a5a/ambari-web/app/data/HDP2.3/hawq_activate_standby_properties.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/data/HDP2.3/hawq_activate_standby_properties.js b/ambari-web/app/data/HDP2.3/hawq_activate_standby_properties.js
new file mode 100644
index 0000000..a06009f
--- /dev/null
+++ b/ambari-web/app/data/HDP2.3/hawq_activate_standby_properties.js
@@ -0,0 +1,43 @@
+/**
+ * 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.
+ */
+
+module.exports =
+{
+  "haConfig": {
+    serviceName: 'MISC',
+    displayName: 'MISC',
+    configCategories: [
+      App.ServiceConfigCategory.create({name: 'HAWQ', displayName: 'HAWQ'}),
+    ],
+    sites: ['hawq-site'],
+    configs: [
+    /**********************************************HAWQ***************************************/
+      {
+        "name": "hawq_master_address_host",
+        "displayName": "HAWQ Master Host",
+        "isReconfigurable": false,
+        "recommendedValue": "",
+        "isOverridable": false,
+        "value": "",
+        "category": "HAWQ",
+        "filename": "hawq-site",
+        serviceName: 'MISC'
+      }
+    ]
+  }
+};

http://git-wip-us.apache.org/repos/asf/ambari/blob/65558a5a/ambari-web/app/data/controller_route.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/data/controller_route.js b/ambari-web/app/data/controller_route.js
index 15e89a6..d254edb 100644
--- a/ambari-web/app/data/controller_route.js
+++ b/ambari-web/app/data/controller_route.js
@@ -54,6 +54,10 @@ module.exports = [
     route: 'main.services.addHawqStandby'
   },
   {
+    wizardControllerName: App.router.get('activateHawqStandbyWizardController.name'),
+    route: 'main.services.activateHawqStandby'
+  },
+  {
     wizardControllerName: App.router.get('rAHighAvailabilityWizardController.name'),
     route: 'main.services.enableRAHighAvailability'
   },

http://git-wip-us.apache.org/repos/asf/ambari/blob/65558a5a/ambari-web/app/messages.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/messages.js b/ambari-web/app/messages.js
index 8861b2a..a5421ea 100644
--- a/ambari-web/app/messages.js
+++ b/ambari-web/app/messages.js
@@ -2902,5 +2902,40 @@ Em.I18n.translations = {
   'admin.addHawqStandby.wizard.step4.task2.title': 'Reconfigure HAWQ',
   'admin.addHawqStandby.wizard.step4.task3.title': 'Start HAWQ Service',
   'admin.addHawqStandby.wizard.step4.notice.inProgress':'Please wait while HAWQ Standby Master is being deployed.',
-  'admin.addHawqStandby.wizard.step4.notice.completed':'HAWQ Standby Master has been enabled successfully.'
+  'admin.addHawqStandby.wizard.step4.notice.completed':'HAWQ Standby Master has been added successfully.',
+  'admin.activateHawqStandby.button.enable': 'Activate HAWQ Standby',
+  'admin.activateHawqStandby.wizard.header': 'Activate HAWQ Standby Wizard',
+  'admin.activateHawqStandby.wizard.step1.header': 'Get Started',
+  'admin.activateHawqStandby.wizard.step1.body':'This wizard will walk you through activating HAWQ Standby.' +
+      '<br/>Once activated, HAWQ Standby will become HAWQ Master, and the previous HAWQ master will be removed. ' +
+      'Users will be able to connect to HAWQ database using the new HAWQ Master.' +
+      '<br/><br/><b>You should plan a cluster maintenance window and prepare for cluster downtime when ' +
+      'activating HAWQ Standby. During this operation, HAWQ service will be stopped and started.</b>' +
+      '<br/><br/>Note: In order to add standby for HAWQ service, you can use the "Add HAWQ Standby"</b> wizard.',
+  'admin.activateHawqStandby.wizard.step2.header': 'Review',
+  'admin.highAvailability.wizard.step2.toBeDeleted': 'TO BE DELETED',
+  'admin.activateHawqStandby.wizard.step2.hawqMaster': '<b>Current HAWQ Master:</b>',
+  'admin.activateHawqStandby.wizard.step2.hawqStandby': '<b>New HAWQ Master:</b>',
+  'admin.activateHawqStandby.wizard.step2.toBeActivated': 'STANDBY TO BE ACTIVATED',
+  'admin.activateHawqStandby.wizard.step2.confirm.config.body':'<div class="alert alert-info">' +
+      '<b>Review Configuration Changes.</b></br>The following lists the configuration changes that will be ' +
+      'made by the Wizard to activate HAWQ Standby Master. This information is for <b> review only </b> and is not' +
+      ' editable.<br/><br/><b>Note:</b> hawq_standby_address_host property will be removed from hawq-site.xml as ' +
+      'HAWQ Standby will be activated to HAWQ Master.</div>',
+  'admin.activateHawqStandby.wizard.step2.confirm.host.body':'<b>Review HAWQ Master & Standby role changes.</b>',
+  'admin.activateHawqStandby.wizard.step2.confirmPopup.body': 'Do you wish to continue with activating HAWQ Standy? Please confirm, before proceeding as you will not be able to rollback from Ambari.',
+  'admin.activateHawqStandby.wizard.step3.header': 'Finalize Setup',
+  'admin.activateHawqStandby.wizard.step3.task0.title': 'Activate HAWQ Standby',
+  'admin.activateHawqStandby.wizard.step3.task1.title': 'Stop HAWQ Service',
+  'admin.activateHawqStandby.wizard.step3.task2.title': 'Reconfigure HAWQ',
+  'admin.activateHawqStandby.wizard.step3.task3.title': 'Install Role: New HAWQ Master',
+  'admin.activateHawqStandby.wizard.step3.task4.title': 'Delete Role: Old HAWQ Master',
+  'admin.activateHawqStandby.wizard.step3.task5.title': 'Delete Role: Old HAWQ Standby',
+  'admin.activateHawqStandby.wizard.step3.task6.title': 'Start HAWQ Service',
+  'admin.activateHawqStandby.closePopup':'Activate HAWQ Standby Wizard is in progress. You must allow the wizard to' +
+      ' complete for Ambari to be in usable state. If you choose to quit, you must follow manual instructions to' +
+      ' get back to a stable state. Are you sure you want to exit the wizard?',
+  'admin.activateHawqStandby.wizard.step3.notice.inProgress':'Please wait while HAWQ Standby is being activated',
+  'admin.activateHawqStandby.wizard.step3.notice.completed':'HAWQ Standby has been activated successfully.',
+  'admin.activateHawqStandby.wizard.step3.activateHawqStandbyCommand.context': "Execute HAWQ Standby activate command"
 };

http://git-wip-us.apache.org/repos/asf/ambari/blob/65558a5a/ambari-web/app/mixins/wizard/wizardProgressPageController.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/mixins/wizard/wizardProgressPageController.js b/ambari-web/app/mixins/wizard/wizardProgressPageController.js
index 02cd36a..88b7f87 100644
--- a/ambari-web/app/mixins/wizard/wizardProgressPageController.js
+++ b/ambari-web/app/mixins/wizard/wizardProgressPageController.js
@@ -695,6 +695,36 @@ App.wizardProgressPageControllerMixin = Em.Mixin.create(App.InstallComponent, {
       this.removeObserver('tasks.@each.status', this, 'onTaskStatusChange');
       App.router.send('back');
     }
+  },
+
+  /**
+   * Delete component on single hosts.
+   *
+   * @method deleteComponent
+   * @param {string} componentName - name of the component
+   * @param {string} hostName - host from where components should be deleted
+   */
+  deleteComponent: function (componentName, hostName) {
+    App.ajax.send({
+      name: 'common.delete.host_component',
+      sender: this,
+      data: {
+        componentName: componentName,
+        hostName: hostName
+      },
+      success: 'onTaskCompleted',
+      error: 'onDeleteHostComponentsError'
+    });
+  },
+
+  onDeleteHostComponentsError: function (error) {
+    // If the component does not exist on the host, NoSuchResourceException is thrown.
+    // If NoSuchResourceException is thrown, there is no action required and operation should continue.
+    if (error.responseText.indexOf('org.apache.ambari.server.controller.spi.NoSuchResourceException') !== -1) {
+      this.onTaskCompleted();
+    } else {
+      this.onTaskError();
+    }
   }
 
 });

http://git-wip-us.apache.org/repos/asf/ambari/blob/65558a5a/ambari-web/app/models/host_component.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/models/host_component.js b/ambari-web/app/models/host_component.js
index b205d38..a081d62 100644
--- a/ambari-web/app/models/host_component.js
+++ b/ambari-web/app/models/host_component.js
@@ -405,7 +405,14 @@ App.HostComponentActionMap = {
         cssClass: 'icon-plus',
         isHidden: App.get('isSingleNode') || HS,
         disabled: false
-      }
+      },
+      TOGGLE_ACTIVATE_HAWQ_STANDBY: {
+        action: 'activateHawqStandby',
+        label: Em.I18n.t('admin.activateHawqStandby.button.enable'),
+        cssClass: 'icon-arrow-up',
+        isHidden: App.get('isSingleNode') || !HS,
+        disabled: false
+       }
     };
   }
 };

http://git-wip-us.apache.org/repos/asf/ambari/blob/65558a5a/ambari-web/app/routes/activate_hawq_standby_routes.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/routes/activate_hawq_standby_routes.js b/ambari-web/app/routes/activate_hawq_standby_routes.js
new file mode 100644
index 0000000..c7631ca
--- /dev/null
+++ b/ambari-web/app/routes/activate_hawq_standby_routes.js
@@ -0,0 +1,179 @@
+/**
+ * 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');
+
+module.exports = App.WizardRoute.extend({
+  route: '/highAvailability/Hawq/activate',
+
+  enter: function (router, transition) {
+    var activateHawqStandbyWizardController = router.get('activateHawqStandbyWizardController');
+    activateHawqStandbyWizardController.dataLoading().done(function () {
+      App.router.set('mainServiceItemController.content', App.Service.find().findProperty('serviceName', 'HAWQ'));
+      App.router.get('updateController').set('isWorking', false);
+      var popup = App.ModalPopup.show({
+        classNames: ['full-width-modal'],
+        header: Em.I18n.t('admin.activateHawqStandby.wizard.header'),
+        bodyClass: App.ActivateHawqStandbyWizardView.extend({
+          controller: activateHawqStandbyWizardController
+        }),
+        primary: Em.I18n.t('form.cancel'),
+        showFooter: false,
+        secondary: null,
+        updateClusterStatus: function() {
+          var controller = router.get('activateHawqStandbyWizardController');
+          router.get('updateController').set('isWorking', true);
+          activateHawqStandbyWizardController.finish();
+          App.clusterStatus.setClusterStatus({
+            clusterName: App.router.getClusterName(),
+            clusterState: 'DEFAULT',
+            localdb: App.db.data
+          }, {
+            alwaysCallback: function () {
+              controller.get('popup').hide();
+              router.transitionTo('main.services.index');
+              Em.run.next(function() {
+                location.reload();
+              });
+            }
+          });
+        },
+
+        onClose: function () {
+          var activateHawqStandbyWizardController = router.get('activateHawqStandbyWizardController'),
+              currStep = activateHawqStandbyWizardController.get('currentStep')
+          if (parseInt(currStep) === 3) {
+            App.showConfirmationPopup(function () {
+              popup.updateClusterStatus();
+            }, Em.I18n.t('admin.activateHawqStandby.closePopup'));
+          } else {
+            popup.updateClusterStatus();
+          }
+        },
+        didInsertElement: function () {
+          this.fitHeight();
+        }
+      });
+      activateHawqStandbyWizardController.set('popup', popup);
+      var currentClusterStatus = App.clusterStatus.get('value');
+      if (currentClusterStatus) {
+        switch (currentClusterStatus.clusterState) {
+          case 'ACTIVATE_HAWQ_STANDBY' :
+            activateHawqStandbyWizardController.setCurrentStep(currentClusterStatus.localdb.ActivateHawqStandbyWizard.currentStep);
+            break;
+          default:
+            var currStep = App.router.get('activateHawqStandbyWizardController.currentStep');
+            activateHawqStandbyWizardController.setCurrentStep(currStep);
+            break;
+        }
+      }
+      Em.run.next(function () {
+        App.router.get('wizardWatcherController').setUser(activateHawqStandbyWizardController.get('name'));
+        router.transitionTo('step' + activateHawqStandbyWizardController.get('currentStep'));
+      });
+    });
+  },
+
+  step1: Em.Route.extend({
+    route: '/step1',
+    connectOutlets: function (router) {
+      var controller = router.get('activateHawqStandbyWizardController');
+      controller.dataLoading().done(function () {
+        controller.setCurrentStep('1');
+        controller.connectOutlet('activateHawqStandbyWizardStep1', controller.get('content'));
+      })
+    },
+    unroutePath: function () {
+      return false;
+    },
+    next: function (router) {
+      var controller = router.get('activateHawqStandbyWizardController');
+      var hawqMaster = App.HostComponent.find().findProperty('componentName','HAWQMASTER').get('hostName');
+      var hawqStandby = App.HostComponent.find().findProperty('componentName','HAWQSTANDBY').get('hostName');
+      var hawqHosts = {
+        hawqMaster: hawqMaster,
+        hawqStandby: hawqStandby
+      };
+      controller.saveHawqHosts(hawqHosts);
+      router.transitionTo('step2');
+    }
+  }),
+
+  step2: Em.Route.extend({
+    route: '/step2',
+    connectOutlets: function (router) {
+      var controller = router.get('activateHawqStandbyWizardController');
+      controller.dataLoading().done(function () {
+        controller.setCurrentStep('2');
+        controller.loadAllPriorSteps();
+        controller.connectOutlet('activateHawqStandbyWizardStep2', controller.get('content'));
+      })
+    },
+    unroutePath: function () {
+      return false;
+    },
+    next: function (router) {
+      App.showConfirmationPopup(function() {
+        var wizardController = router.get('activateHawqStandbyWizardController');
+        var stepController = router.get('activateHawqStandbyWizardStep2Controller');
+        var configs = stepController.get('selectedService.configs');
+        wizardController.saveConfigs(configs);
+        router.transitionTo('step3');
+      }, Em.I18n.t('admin.activateHawqStandby.wizard.step2.confirmPopup.body'));
+    },
+    back: Em.Router.transitionTo('step1')
+  }),
+  step3: Em.Route.extend({
+    route: '/step3',
+    connectOutlets: function (router) {
+      var controller = router.get('activateHawqStandbyWizardController');
+      controller.dataLoading().done(function () {
+        controller.setCurrentStep('3');
+        controller.setLowerStepsDisable(3);
+        controller.loadAllPriorSteps();
+        controller.connectOutlet('activateHawqStandbyWizardStep3', controller.get('content'));
+      })
+    },
+    unroutePath: function (router, path) {
+      // allow user to leave route if wizard has finished
+      if (router.get('activateHawqStandbyWizardController').get('isFinished')) {
+        this._super(router, path);
+      } else {
+        return false;
+      }
+    },
+    next: function (router) {
+      var controller = router.get('activateHawqStandbyWizardController');
+      controller.finish();
+      App.clusterStatus.setClusterStatus({
+        clusterName: controller.get('content.cluster.name'),
+        clusterState: 'DEFAULT',
+        localdb: App.db.data
+      }, {
+        alwaysCallback: function () {
+          controller.get('popup').hide();
+          router.transitionTo('main.services.index');
+          Em.run.next(function () {
+            location.reload();
+          });
+        }
+      });
+    }
+  })
+
+});

http://git-wip-us.apache.org/repos/asf/ambari/blob/65558a5a/ambari-web/app/routes/main.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/routes/main.js b/ambari-web/app/routes/main.js
index 48c9b91..bd66945 100644
--- a/ambari-web/app/routes/main.js
+++ b/ambari-web/app/routes/main.js
@@ -719,6 +719,8 @@ module.exports = Em.Route.extend(App.RouterRedirections, {
 
     addHawqStandby: require('routes/add_hawq_standby_routes'),
 
+    activateHawqStandby: require('routes/activate_hawq_standby_routes'),
+
     rollbackHighAvailability: require('routes/rollbackHA_routes')
   }),
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/65558a5a/ambari-web/app/templates/main/admin/highAvailability/hawq/activateStandby/step1.hbs
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates/main/admin/highAvailability/hawq/activateStandby/step1.hbs b/ambari-web/app/templates/main/admin/highAvailability/hawq/activateStandby/step1.hbs
new file mode 100644
index 0000000..47f9dc2
--- /dev/null
+++ b/ambari-web/app/templates/main/admin/highAvailability/hawq/activateStandby/step1.hbs
@@ -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.
+}}
+<div>
+  <h2>{{t admin.activateHawqStandby.wizard.step1.header}}</h2>
+
+  <div class="alert alert-info">
+    {{t admin.activateHawqStandby.wizard.step1.body}}
+  </div>
+
+  <div class="btn-area">
+    <a class="btn btn-success pull-right" {{action next}}>{{t common.next}} &rarr;</a>
+  </div>
+</div>

http://git-wip-us.apache.org/repos/asf/ambari/blob/65558a5a/ambari-web/app/templates/main/admin/highAvailability/hawq/activateStandby/step2.hbs
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates/main/admin/highAvailability/hawq/activateStandby/step2.hbs b/ambari-web/app/templates/main/admin/highAvailability/hawq/activateStandby/step2.hbs
new file mode 100644
index 0000000..02083f4
--- /dev/null
+++ b/ambari-web/app/templates/main/admin/highAvailability/hawq/activateStandby/step2.hbs
@@ -0,0 +1,53 @@
+{{!
+* 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.
+}}
+<h2>{{t admin.activateHawqStandby.wizard.step2.header}}</h2>
+
+<div class="alert alert-info">
+  {{t admin.activateHawqStandby.wizard.step2.confirm.host.body}}
+</div>
+
+<div id="activate-standby-step2-content" class="well pre-scrollable">
+    <div id="activate-standby-step2-info">
+        <table id="ha-step3-review-table">
+            <tr>
+                <td>{{t admin.activateHawqStandby.wizard.step2.hawqMaster}}</td>
+                <td>{{controller.content.hawqHosts.hawqMaster}}</td>
+		        <td><span class="to-be-disabled-red"><i class="icon-minus"></i>&nbsp;{{t admin.highAvailability.wizard.step3.toBeDeleted}}</span></td>
+            </tr>
+            <tr>
+                <td>{{t admin.activateHawqStandby.wizard.step2.hawqStandby}}</td>
+                <td>{{controller.content.hawqHosts.hawqStandby}}</td>
+		        <td><span class="to-be-installed-green"><i class="icon-arrow-up"></i>&nbsp;{{t admin.activateHawqStandby.wizard.step2.toBeActivated}}</span></td>
+            </tr>
+        </table>
+    </div>
+</div>
+
+{{#if controller.isLoaded}}
+  <div id="serviceConfig">
+    {{{t admin.activateHawqStandby.wizard.step2.confirm.config.body}}}
+    {{view App.ServiceConfigView}}
+  </div>
+{{else}}
+  {{view App.SpinnerView}}
+{{/if}}
+
+<div class="btn-area">
+    <a class="btn" {{action back}}>&larr; {{t common.back}}</a>
+    <a class="btn btn-success pull-right" {{action submit target="controller"}} {{bindAttr disabled="controller.isSubmitDisabled"}}>{{t common.next}} &rarr;</a>
+</div>

http://git-wip-us.apache.org/repos/asf/ambari/blob/65558a5a/ambari-web/app/templates/main/admin/highAvailability/hawq/activateStandby/step3.hbs
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates/main/admin/highAvailability/hawq/activateStandby/step3.hbs b/ambari-web/app/templates/main/admin/highAvailability/hawq/activateStandby/step3.hbs
new file mode 100644
index 0000000..6b4923a
--- /dev/null
+++ b/ambari-web/app/templates/main/admin/highAvailability/hawq/activateStandby/step3.hbs
@@ -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.
+}}
+{{{template "templates/common/progress"}}}

http://git-wip-us.apache.org/repos/asf/ambari/blob/65558a5a/ambari-web/app/templates/main/admin/highAvailability/hawq/activateStandby/wizard.hbs
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates/main/admin/highAvailability/hawq/activateStandby/wizard.hbs b/ambari-web/app/templates/main/admin/highAvailability/hawq/activateStandby/wizard.hbs
new file mode 100644
index 0000000..3518122
--- /dev/null
+++ b/ambari-web/app/templates/main/admin/highAvailability/hawq/activateStandby/wizard.hbs
@@ -0,0 +1,44 @@
+{{!
+* 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.
+}}
+
+<div id="hawq-ha-wizard" class="wizard">
+  <div class="container">
+    <div class="container-fluid">
+      <div class="row-fluid">
+        <div class="span3">
+          <!--Sidebar content-->
+          <div class="well">
+            <ul class="nav nav-pills nav-stacked">
+              <li class="nav-header">{{t admin.activateHawqStandby.wizard.header}}</li>
+              <li {{bindAttr class="isStep1:active view.isStep1Disabled:disabled"}}><a href="javascript:void(null);"  {{action gotoStep1 target="controller"}}>{{t admin.activateHawqStandby.wizard.step1.header}}</a></li>
+              <li {{bindAttr class="isStep2:active view.isStep2Disabled:disabled"}}><a href="javascript:void(null);"  {{action gotoStep2 target="controller"}}>{{t admin.activateHawqStandby.wizard.step2.header}}</a></li>
+              <li {{bindAttr class="isStep3:active view.isStep3Disabled:disabled"}}><a href="javascript:void(null);"  {{action gotoStep3 target="controller"}}>{{t admin.activateHawqStandby.wizard.step3.header}}</a></li>
+            </ul>
+          </div>
+        </div>
+          <div class="wizard-content well span9">
+            {{#if view.isLoaded}}
+              {{outlet}}
+            {{else}}
+                {{view App.SpinnerView}}
+            {{/if}}
+          </div>
+      </div>
+    </div>
+  </div>
+</div>

http://git-wip-us.apache.org/repos/asf/ambari/blob/65558a5a/ambari-web/app/utils/configs/hawq_activate_standby_config_initializer.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/utils/configs/hawq_activate_standby_config_initializer.js b/ambari-web/app/utils/configs/hawq_activate_standby_config_initializer.js
new file mode 100644
index 0000000..84e39ff
--- /dev/null
+++ b/ambari-web/app/utils/configs/hawq_activate_standby_config_initializer.js
@@ -0,0 +1,53 @@
+/**
+ * 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');
+require('utils/configs/config_initializer_class');
+require('utils/configs/hosts_based_initializer_mixin');
+
+/**
+ * Initializer for configs that are updated when Hawq Standby is added
+ *
+ * @class {HawqActivateStandbyConfigInitializer}
+ */
+App.HawqActivateStandbyConfigInitializer = App.HaConfigInitializerClass.create(App.HostsBasedInitializerMixin, {
+
+  initializers: function () {
+    return {
+      'hawq_master_address_host': this.getHostWithPortConfig('HAWQSTANDBY', true, '', '', '')
+    };
+  }.property(),
+
+
+  /**
+   * @override
+   * @param {object} settings
+   */
+  setup: function (settings) {
+    this._updateInitializers(settings);
+  },
+
+  /**
+   * @override
+   */
+  cleanup: function () {
+    this._restoreInitializers();
+  }
+
+
+});

http://git-wip-us.apache.org/repos/asf/ambari/blob/65558a5a/ambari-web/app/utils/configs/hawq_ha_config_initializer.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/utils/configs/hawq_ha_config_initializer.js b/ambari-web/app/utils/configs/hawq_ha_config_initializer.js
index 1de2551..3977d53 100644
--- a/ambari-web/app/utils/configs/hawq_ha_config_initializer.js
+++ b/ambari-web/app/utils/configs/hawq_ha_config_initializer.js
@@ -21,7 +21,7 @@ require('utils/configs/config_initializer_class');
 require('utils/configs/hosts_based_initializer_mixin');
 
 /**
- * Initializer for configs that are updated when Hawq Standby is activated
+ * Initializer for configs that are updated when Hawq Standby is added
  *
  * @class {HawqHaConfigInitializer}
  */

http://git-wip-us.apache.org/repos/asf/ambari/blob/65558a5a/ambari-web/app/utils/db.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/utils/db.js b/ambari-web/app/utils/db.js
index 598910a..34d90bf 100644
--- a/ambari-web/app/utils/db.js
+++ b/ambari-web/app/utils/db.js
@@ -44,6 +44,7 @@ var InitialData = {
   'HighAvailabilityWizard': {},
   'RMHighAvailabilityWizard': {},
   'AddHawqStandbyWizard': {},
+  'ActivateHawqStandbyWizard': {},
   'RAHighAvailabilityWizard': {},
   'RollbackHighAvailabilityWizard': {},
   'MainAdminStackAndUpgrade': {},

http://git-wip-us.apache.org/repos/asf/ambari/blob/65558a5a/ambari-web/app/views.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views.js b/ambari-web/app/views.js
index d3c7fdc..afb12e1 100644
--- a/ambari-web/app/views.js
+++ b/ambari-web/app/views.js
@@ -163,6 +163,10 @@ require('views/main/admin/highAvailability/hawq/addStandby/step1_view');
 require('views/main/admin/highAvailability/hawq/addStandby/step2_view');
 require('views/main/admin/highAvailability/hawq/addStandby/step3_view');
 require('views/main/admin/highAvailability/hawq/addStandby/step4_view');
+require('views/main/admin/highAvailability/hawq/activateStandby/wizard_view');
+require('views/main/admin/highAvailability/hawq/activateStandby/step1_view');
+require('views/main/admin/highAvailability/hawq/activateStandby/step2_view');
+require('views/main/admin/highAvailability/hawq/activateStandby/step3_view');
 require('views/main/admin/highAvailability/rangerAdmin/wizard_view');
 require('views/main/admin/highAvailability/rangerAdmin/step1_view');
 require('views/main/admin/highAvailability/rangerAdmin/step2_view');

http://git-wip-us.apache.org/repos/asf/ambari/blob/65558a5a/ambari-web/app/views/main/admin/highAvailability/hawq/activateStandby/step1_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/admin/highAvailability/hawq/activateStandby/step1_view.js b/ambari-web/app/views/main/admin/highAvailability/hawq/activateStandby/step1_view.js
new file mode 100644
index 0000000..5f76565
--- /dev/null
+++ b/ambari-web/app/views/main/admin/highAvailability/hawq/activateStandby/step1_view.js
@@ -0,0 +1,26 @@
+/**
+ * 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');
+
+App.ActivateHawqStandbyWizardStep1View = Em.View.extend({
+
+  templateName: require('templates/main/admin/highAvailability/hawq/activateStandby/step1')
+
+});

http://git-wip-us.apache.org/repos/asf/ambari/blob/65558a5a/ambari-web/app/views/main/admin/highAvailability/hawq/activateStandby/step2_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/admin/highAvailability/hawq/activateStandby/step2_view.js b/ambari-web/app/views/main/admin/highAvailability/hawq/activateStandby/step2_view.js
new file mode 100644
index 0000000..93b11b6
--- /dev/null
+++ b/ambari-web/app/views/main/admin/highAvailability/hawq/activateStandby/step2_view.js
@@ -0,0 +1,29 @@
+/**
+ * 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');
+
+App.ActivateHawqStandbyWizardStep2View = Em.View.extend({
+
+  templateName: require('templates/main/admin/highAvailability/hawq/activateStandby/step2'),
+
+  didInsertElement: function () {
+    this.get('controller').loadStep();
+  }
+});

http://git-wip-us.apache.org/repos/asf/ambari/blob/65558a5a/ambari-web/app/views/main/admin/highAvailability/hawq/activateStandby/step3_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/admin/highAvailability/hawq/activateStandby/step3_view.js b/ambari-web/app/views/main/admin/highAvailability/hawq/activateStandby/step3_view.js
new file mode 100644
index 0000000..184e4b9
--- /dev/null
+++ b/ambari-web/app/views/main/admin/highAvailability/hawq/activateStandby/step3_view.js
@@ -0,0 +1,36 @@
+/**
+ * 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');
+
+App.ActivateHawqStandbyWizardStep3View = App.HighAvailabilityProgressPageView.extend({
+
+  templateName: require('templates/main/admin/highAvailability/hawq/activateStandby/step3'),
+
+  headerTitle: Em.I18n.t('admin.activateHawqStandby.wizard.step3.header'),
+
+  noticeInProgress: Em.I18n.t('admin.activateHawqStandby.wizard.step3.notice.inProgress'),
+
+  noticeCompleted: Em.I18n.t('admin.activateHawqStandby.wizard.step3.notice.completed'),
+
+  submitButtonText: Em.I18n.t('common.complete'),
+
+  labelWidth: 'span5'
+
+});

http://git-wip-us.apache.org/repos/asf/ambari/blob/65558a5a/ambari-web/app/views/main/admin/highAvailability/hawq/activateStandby/wizard_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/admin/highAvailability/hawq/activateStandby/wizard_view.js b/ambari-web/app/views/main/admin/highAvailability/hawq/activateStandby/wizard_view.js
new file mode 100644
index 0000000..068e78a
--- /dev/null
+++ b/ambari-web/app/views/main/admin/highAvailability/hawq/activateStandby/wizard_view.js
@@ -0,0 +1,74 @@
+/**
+ * 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');
+
+App.ActivateHawqStandbyWizardView = Em.View.extend(App.WizardMenuMixin, {
+
+  didInsertElement: function() {
+    var currentStep = this.get('controller.currentStep');
+    if (currentStep > 3) {
+      this.get('controller').setLowerStepsDisable(currentStep);
+    }
+  },
+
+  templateName: require('templates/main/admin/highAvailability/hawq/activateStandby/wizard'),
+
+  isLoaded: false,
+
+  willInsertElement: function() {
+    this.set('isLoaded', false);
+    this.loadHosts();
+  },
+
+  /**
+   * load hosts from server
+   */
+  loadHosts: function () {
+    App.ajax.send({
+      name: 'hosts.high_availability.wizard',
+      data: {},
+      sender: this,
+      success: 'loadHostsSuccessCallback',
+      error: 'loadHostsErrorCallback'
+    });
+  },
+
+  loadHostsSuccessCallback: function (data, opt, params) {
+    var hosts = {};
+
+    data.items.forEach(function (item) {
+      hosts[item.Hosts.host_name] = {
+        name: item.Hosts.host_name,
+        cpu: item.Hosts.cpu_count,
+        memory: item.Hosts.total_mem,
+        disk_info: item.Hosts.disk_info,
+        bootStatus: "REGISTERED",
+        isInstalled: true
+      };
+    });
+    App.db.setHosts(hosts);
+    this.set('controller.content.hosts', hosts);
+    this.set('isLoaded', true);
+  },
+
+  loadHostsErrorCallback: function(){
+    this.set('isLoaded', true);
+  }
+});

http://git-wip-us.apache.org/repos/asf/ambari/blob/65558a5a/ambari-web/app/views/main/service/item.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/service/item.js b/ambari-web/app/views/main/service/item.js
index 048c163..d5d65e4 100644
--- a/ambari-web/app/views/main/service/item.js
+++ b/ambari-web/app/views/main/service/item.js
@@ -36,6 +36,7 @@ App.MainServiceItemView = Em.View.extend({
     'HBASE_MASTER': ['DECOMMISSION'],
     'KNOX_GATEWAY': ['STARTDEMOLDAP','STOPDEMOLDAP'],
     'HAWQMASTER': ['IMMEDIATE_STOP_CLUSTER'],
+    'HAWQSTANDBY': ['ACTIVATE_STANDBY'],
     'HAWQSEGMENT': ['IMMEDIATE_STOP']
   },
 
@@ -171,6 +172,7 @@ App.MainServiceItemView = Em.View.extend({
             break;
           case 'HAWQ':
             options.push(actionMap.TOGGLE_ADD_HAWQ_STANDBY);
+            options.push(actionMap.TOGGLE_ACTIVATE_HAWQ_STANDBY);
             break;
         }
       }

http://git-wip-us.apache.org/repos/asf/ambari/blob/65558a5a/ambari-web/test/controllers/main/admin/highAvailability/hawq/activateStandby/step2_controller_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/main/admin/highAvailability/hawq/activateStandby/step2_controller_test.js b/ambari-web/test/controllers/main/admin/highAvailability/hawq/activateStandby/step2_controller_test.js
new file mode 100644
index 0000000..e702892
--- /dev/null
+++ b/ambari-web/test/controllers/main/admin/highAvailability/hawq/activateStandby/step2_controller_test.js
@@ -0,0 +1,88 @@
+/**
+ * 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');
+require('controllers/main/admin/highAvailability/hawq/activateStandby/step2_controller');
+var testHelpers = require('test/helpers');
+
+describe('App.ActivateHawqStandbyWizardStep2Controller', function () {
+
+  describe('#isSubmitDisabled', function () {
+
+    var controller = App.ActivateHawqStandbyWizardStep2Controller.create({
+        content: Em.Object.create({})
+      }),
+      cases = [
+        {
+          isLoaded: false,
+          isSubmitDisabled: true,
+          title: 'wizard step content not loaded'
+        },
+        {
+          isLoaded: true,
+          isSubmitDisabled: false,
+          title: 'wizard step content loaded'
+        }
+      ];
+
+    cases.forEach(function (item) {
+      it(item.title, function () {
+        controller.set('isLoaded', item.isLoaded);
+        expect(controller.get('isSubmitDisabled')).to.equal(item.isSubmitDisabled);
+      });
+    });
+
+  });
+
+
+  describe('#setDynamicConfigValues', function () {
+
+    var controller = App.ActivateHawqStandbyWizardStep2Controller.create({
+        content: Em.Object.create({
+          masterComponentHosts: [
+            {component: 'HAWQMASTER', hostName: 'h0', isInstalled: true},
+            {component: 'HAWQSTANDBY', hostName: 'h1', isInstalled: true}
+          ],
+          hawqHost: {
+            hawqMaster: 'h0',
+            hawqStandby: 'h1'
+          }
+        })
+      }),
+      configs = {
+        configs: [
+          Em.Object.create({
+            name: 'hawq_master_address_host'
+          })
+        ]
+      };
+
+
+    beforeEach(function () {
+      controller.setDynamicConfigValues(configs);
+    });
+
+    it('hawq_master_address_host value', function () {
+      expect(configs.configs.findProperty('name', 'hawq_master_address_host').get('value')).to.equal('h1');
+    });
+    it('hawq_master_address_host recommendedValue', function () {
+      expect(configs.configs.findProperty('name', 'hawq_master_address_host').get('recommendedValue')).to.equal('h1');
+    });
+  });
+
+});


[33/40] ambari git commit: AMBARI-14923. Log Search: Create Log File Search modal popup (alexantonenko)

Posted by nc...@apache.org.
AMBARI-14923. Log Search: Create Log File Search modal popup (alexantonenko)


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

Branch: refs/heads/branch-dev-patch-upgrade
Commit: 3a2add5dcde4f1cb730253627b87683f3057c5c1
Parents: cd35e80
Author: Alex Antonenko <hi...@gmail.com>
Authored: Fri Feb 5 18:21:10 2016 +0200
Committer: Alex Antonenko <hi...@gmail.com>
Committed: Fri Feb 5 18:21:10 2016 +0200

----------------------------------------------------------------------
 ambari-web/app/assets/licenses/NOTICE.txt       |   5 +-
 ambari-web/app/assets/test/tests.js             |   1 +
 ambari-web/app/config.js                        |   3 +-
 ambari-web/app/messages.js                      |   9 +-
 ambari-web/app/mixins.js                        |   1 +
 .../app/mixins/common/infinite_scroll_mixin.js  | 173 ++++++++++++
 ambari-web/app/styles/log_file_search.less      | 155 +++++++++++
 .../app/templates/common/log_file_search.hbs    | 109 ++++++++
 ambari-web/app/views.js                         |   3 +
 .../app/views/common/form/datepicker_view.js    |  37 +++
 .../app/views/common/log_file_search_view.js    | 272 +++++++++++++++++++
 .../modal_popups/log_file_search_popup.js       |  26 ++
 .../views/common/log_file_search_view_test.js   | 103 +++++++
 .../vendor/scripts/bootstrap-contextmenu.js     | 205 ++++++++++++++
 14 files changed, 1099 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/3a2add5d/ambari-web/app/assets/licenses/NOTICE.txt
----------------------------------------------------------------------
diff --git a/ambari-web/app/assets/licenses/NOTICE.txt b/ambari-web/app/assets/licenses/NOTICE.txt
index bc29209..c750a37 100644
--- a/ambari-web/app/assets/licenses/NOTICE.txt
+++ b/ambari-web/app/assets/licenses/NOTICE.txt
@@ -56,4 +56,7 @@ This product includes bootstrap-checkbox v.1.0.1 (https://github.com/montrezorro
 Copyright (C) 2014 Roberto Montresor (info [at] robertomontresor [*dot*] it)
 
 This product includes sticky-kit v.1.1.2 (https://github.com/leafo/sticky-kit - MIT License)
-Copyright (C) 2015 Leaf Corcoran (leafot [at] gmail [*dot*] com)
\ No newline at end of file
+Copyright (C) 2015 Leaf Corcoran (leafot [at] gmail [*dot*] com)
+
+This product includes bootstrap-contextmenu v.0.3.3 (https://github.com/sydcanem/bootstrap-contextmenu - MIT License)
+Copyright (C) 2015 James Santos

http://git-wip-us.apache.org/repos/asf/ambari/blob/3a2add5d/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 85c814d..e82a27e 100644
--- a/ambari-web/app/assets/test/tests.js
+++ b/ambari-web/app/assets/test/tests.js
@@ -288,6 +288,7 @@ var files = [
   'test/views/common/configs/widgets/time_interval_spinner_view_test',
   'test/views/common/form/spinner_input_view_test',
   'test/views/common/form/manage_kdc_credentials_form_test',
+  'test/views/common/log_file_search_view_test',
   'test/views/wizard/step3/hostLogPopupBody_view_test',
   'test/views/wizard/step3/hostWarningPopupBody_view_test',
   'test/views/wizard/step3/hostWarningPopupFooter_view_test',

http://git-wip-us.apache.org/repos/asf/ambari/blob/3a2add5d/ambari-web/app/config.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/config.js b/ambari-web/app/config.js
index 0beafb3..7d727d7 100644
--- a/ambari-web/app/config.js
+++ b/ambari-web/app/config.js
@@ -80,7 +80,8 @@ App.supports = {
   storeKDCCredentials: true,
   preInstallChecks: false,
   hostComboSearchBox: false,
-  serviceAutoStart: false
+  serviceAutoStart: false,
+  logSearch: false
 };
 
 if (App.enableExperimental) {

http://git-wip-us.apache.org/repos/asf/ambari/blob/3a2add5d/ambari-web/app/messages.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/messages.js b/ambari-web/app/messages.js
index f24876b..8d1f6f1 100644
--- a/ambari-web/app/messages.js
+++ b/ambari-web/app/messages.js
@@ -305,6 +305,13 @@ Em.I18n.translations = {
   'common.openNewWindow': 'Open in New Window',
   'common.fullLogPopup.clickToCopy': 'Click to Copy',
   'common.nothingToDelete': 'Nothing to delete',
+  'common.exclude': 'Exclude',
+  'common.include': 'Include',
+  'common.exclude.short': 'Excl',
+  'common.include.short': 'Incl',
+  'common.filters': 'Filters',
+  'common.keywords': 'Keywods',
+  'common.levels': 'Levels',
 
   'models.alert_instance.tiggered.verbose': "Occurred on {0} <br> Checked on {1}",
   'models.alert_definition.triggered.verbose': "Occurred on {0}",
@@ -1555,7 +1562,7 @@ Em.I18n.translations = {
   'admin.stackUpgrade.failedHosts.details': "Open Details",
   'admin.stackUpgrade.doThisLater': "Do This Later",
   'admin.stackUpgrade.pauseUpgrade': "Pause Upgrade",
-  'admin.stackUpgrade.pauseDowngrade': "Pause Downgrade",  
+  'admin.stackUpgrade.pauseDowngrade': "Pause Downgrade",
   'admin.stackUpgrade.downgrade.proceed': "Proceed with Downgrade",
   'admin.stackUpgrade.downgrade.body': "Are you sure you wish to abort the upgrade process and downgrade to <b>{0}</b>?",
   'admin.stackUpgrade.downgrade.retry.body': "Are you sure you wish to retry downgrade to <b>{0}</b>?",

http://git-wip-us.apache.org/repos/asf/ambari/blob/3a2add5d/ambari-web/app/mixins.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/mixins.js b/ambari-web/app/mixins.js
index 38d112d..460953e 100644
--- a/ambari-web/app/mixins.js
+++ b/ambari-web/app/mixins.js
@@ -22,6 +22,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/userPref');
 require('mixins/common/reload_popup');
 require('mixins/common/serverValidator');

http://git-wip-us.apache.org/repos/asf/ambari/blob/3a2add5d/ambari-web/app/mixins/common/infinite_scroll_mixin.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/mixins/common/infinite_scroll_mixin.js b/ambari-web/app/mixins/common/infinite_scroll_mixin.js
new file mode 100644
index 0000000..70c424e
--- /dev/null
+++ b/ambari-web/app/mixins/common/infinite_scroll_mixin.js
@@ -0,0 +1,173 @@
+/**
+ * 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');
+
+ /**
+ * @typedef {Object} InfiniteScrollMixinOptions
+ * @property {String} appendHtml html to append when scroll ends and callback executed. It's common
+ *   that root node has unique <code>id</code> or <code>class</code> attributes.
+ * @property {Function} callback function to execute when scroll ends. This function should return
+ *   <code>$.Deferred().promise()</code> instance
+ * @property {Function} onReject function to execute when <code>callback</code> rejected.
+ */
+
+/**
+ * @mixin App.InfiniteScrollMixin
+ * This mixin provides methods to attach infinite scroll to specific scrollable element.
+ *
+ * Usage:
+ * <code>
+ *  // mix it
+ *  var myView = Em.View.extend(App.InfiniteScrollMixin, {
+ *    didInsertElement: function() {
+ *    	// call method infiniteScrollInit
+ *    	this.infiniteScrollInit($('.some-scrollable'), {
+ *    		callback: this.someCallbacOnEndReached
+ *    	});
+ *    }
+ *  });
+ * </code>
+ *
+ */
+App.InfiniteScrollMixin = Ember.Mixin.create({
+
+  /**
+   * Stores callback execution progress.
+   *
+   * @type {Boolean}
+   */
+  _infiniteScrollCallbackInProgress: false,
+
+  /**
+   * Stores HTMLElement infinite scroll initiated on.
+   *
+   * @type {HTMLElement}
+   */
+  _infiniteScrollEl: null,
+
+  /**
+   * Default options for infinite scroll.
+   *
+   * @type {InfiniteScrollMixinOptions}
+   */
+  _infiniteScrollDefaults: {
+    appendHtml: '<div id="infinite-scroll-append"><i class="icon-spinner icon-spin"></i></div>',
+    callback: function() { return $.Deferred().resolve().promise(); },
+    onReject: function() {},
+    onResolve: function() {}
+  },
+
+  /**
+   * Initialize infinite scroll on specified HTMLElement.
+   *
+   * @param  {HTMLElement} el DOM element to attach infinite scroll.
+   * @param  {InfiniteScrollMixinOptions} opts
+   */
+  infiniteScrollInit: function(el, opts) {
+    var options = $.extend({}, this.get('_infiniteScrollDefaults'), opts || {});
+    this.set('_infiniteScrollEl', el);
+    this.get('_infiniteScrollEl').on('scroll', this._infiniteScrollHandler.bind(this));
+    this.get('_infiniteScrollEl').on('infinite-scroll-end', this._infiniteScrollEndHandler(options).bind(this));
+  },
+
+  /**
+   * Handler executed on scrolling.
+   * @param  {jQuery.Event} e
+   */
+  _infiniteScrollHandler: function(e) {
+    var el = $(e.target);
+    var height = el.get(0).clientHeight;
+    var scrollHeight = el.prop('scrollHeight');
+    var endPoint = scrollHeight - height;
+    if (endPoint === el.scrollTop() && !this.get('_infiniteScrollCallbackInProgress')) {
+      el.trigger('infinite-scroll-end');
+    }
+  },
+
+  /**
+   * Handler called when scroll ends.
+   *
+   * @param  {InfiniteScrollMixinOptions} options
+   * @return {Function}
+   */
+  _infiniteScrollEndHandler: function(options) {
+    return function(e) {
+      var self = this;
+      if (this.get('_infiniteScrollCallbackInProgress')) return;
+      this._infiniteScrollAppendHtml(options.appendHtml);
+      // always scroll to bottom
+      this.get('_infiniteScrollEl').scrollTop(this.get('_infiniteScrollEl').get(0).scrollHeight);
+      this.set('_infiniteScrollCallbackInProgress', true);
+      options.callback().then(function() {
+        options.onResolve();
+      }, function() {
+        options.onReject();
+      }).always(function() {
+        self.set('_infiniteScrollCallbackInProgress', false);
+        self._infiniteScrollRemoveHtml(options.appendHtml);
+      });
+    }.bind(this);
+  },
+
+  /**
+   * Helper function to append String as html node to.
+   * @param  {String} htmlString string to append
+   */
+  _infiniteScrollAppendHtml: function(htmlString) {
+    this.get('_infiniteScrollEl').append(htmlString);
+  },
+
+  /**
+   * Remove HTMLElement by specified string that can be converted to html. HTMLElement root node
+   * should have unique <code>id</code> or <code>class</code> attribute to avoid removing additional
+   * elements.
+   *
+   * @param  {String} htmlString string to remove
+   */
+  _infiniteScrollRemoveHtml: function(htmlString) {
+    this.get('_infiniteScrollEl').find(this._infiniteScrollGetSelector(htmlString)).remove();
+  },
+
+  /**
+   * Get root node selector.
+   * <code>id</code> attribute has higher priority and will return if found.
+   * <code>class</code> if no <code>id</code> attribute found <code>class</code> attribute
+   * will be used.
+   *
+   * @param  {String} htmlString string processed as HTML
+   * @return {[type]}            [description]
+   */
+  _infiniteScrollGetSelector: function(htmlString) {
+    var html = $(htmlString);
+    var elId = html.attr('id');
+    var elClass = (html.attr('class') || '').split(' ').join('.');
+    html = null;
+    return !!elId ? '#' + elId : '.' + elClass;
+  },
+
+  /**
+   * Remove infinite scroll.
+   * Unbind all listeners.
+   */
+  infiniteScrollDestroy: function() {
+    this.get('_infiniteScrollEl').off('scroll', this._infiniteScrollHandler);
+    this.get('_infiniteScrollEl').off('infinite-scroll-end', this._infiniteScrollHandler);
+    this.set('_infiniteScrollEl', null);
+  }
+});

http://git-wip-us.apache.org/repos/asf/ambari/blob/3a2add5d/ambari-web/app/styles/log_file_search.less
----------------------------------------------------------------------
diff --git a/ambari-web/app/styles/log_file_search.less b/ambari-web/app/styles/log_file_search.less
new file mode 100644
index 0000000..aeeea3f
--- /dev/null
+++ b/ambari-web/app/styles/log_file_search.less
@@ -0,0 +1,155 @@
+/**
+ * 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.
+ */
+
+
+@toolbar-context-menu-width: 40px;
+@toolbar-padding: 10px;
+
+.log-file-search-popup {
+  .modal-body {
+    overflow: hidden;
+  }
+}
+
+.log-file-search-toolbar {
+  border: 1px solid #ddd;
+  margin-bottom: 20px;
+  overflow: hidden;
+  background: #e6f1f6;
+
+  .toolbar-row {
+    margin-bottom: 5px;
+
+    input {
+      margin: 0;
+    }
+    &:last-child {
+      padding-bottom: @toolbar-padding;
+      margin-bottom: 0;
+    }
+  }
+
+  .filter-block {
+    width: calc(~"100%" - @toolbar-context-menu-width + 4px);
+    padding: @toolbar-padding;
+    box-sizing: border-box;
+    margin-bottom: -400px;
+    padding-bottom: 400px;
+
+    input {
+      height: 16px;
+    }
+
+    .date-filter {
+      margin-left: 10px;
+
+      input {
+        width: 100px;
+      }
+    }
+  }
+
+  .levels-filter-block {
+    .level-checkbox {
+      margin-right: 20px;
+    }
+  }
+
+  .include-exclude-filter-block {
+    .keywords-list {
+      display: inline-block;
+
+      .keyword-item {
+        font-size: 12px;
+        display: inline-block;
+        padding: 2px;
+        border-radius: 0;
+
+        .close {
+          color: black;
+          font-size: 16px;
+          margin-left: 4px;
+        }
+      }
+    }
+  }
+
+  .context-menu {
+    width: @toolbar-context-menu-width;
+    border-left: 2px solid #ddd;
+    margin-bottom: -400px;
+    padding-bottom: 400px;
+    text-align: center;
+
+    .icon-external-link,
+    .move-to-top,
+    .move-to-bottom {
+      display: block;
+      font-size: 28px;
+      color: grey;
+    }
+
+    .move-to-top {
+      line-height: 20px;
+    }
+    .move-to-bottom {
+      line-height: 18px;
+    }
+
+    .icon-external-link {
+      margin-top: 5px;
+      font-size: 20px;
+      padding-left: 4px;
+    }
+  }
+}
+
+.log-file-search-content {
+  &.container {
+    width: 100%;
+    height: 300px;
+    overflow-y: auto;
+    border: 1px solid #ddd;
+  }
+
+  .log-data-item {
+    border-bottom: 1px solid #ddd;
+
+    &:nth-child(2n) {
+      background: #f2f2f2;
+    }
+
+    .log-data-date {
+      border-right: 2px solid #ddd;
+      width: 7%;
+      padding-left: 4px;
+    }
+    .log-data-message {
+      width: 91%;
+    }
+  }
+
+  #infinite-scroll-append {
+    text-align: center;
+    margin-top: 10px;
+
+    .icon-spinner {
+      font-size: 33px;
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/3a2add5d/ambari-web/app/templates/common/log_file_search.hbs
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates/common/log_file_search.hbs b/ambari-web/app/templates/common/log_file_search.hbs
new file mode 100644
index 0000000..a874df6
--- /dev/null
+++ b/ambari-web/app/templates/common/log_file_search.hbs
@@ -0,0 +1,109 @@
+{{!
+* 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.
+}}
+
+<div class="log-file-search-toolbar">
+  <div class="filter-block pull-left">
+    <div class="toolbar-row">
+      <div class="display-inline-block">
+        <div class="display-inline-block">{{t common.keywords}}:</div>
+        {{view view.keywordsFilterView classNames="display-inline-block" valueBinding="view.keywordsFilterValue"}}
+        <button {{action submitKeywordsValue target="view"}} class="btn btn-primary display-inline-block">Search</button>
+      </div>
+      <div class="display-inline-block date-filter">
+        <div class="display-inline-block date-filter-item">
+          {{t from}}:
+          {{view App.DatepickerFieldView valueBinding="view.dateFromValue"}}
+        </div>
+        <div class="display-inline-block date-filter-item">
+          {{t to}}:
+          {{view App.DatepickerFieldView valueBinding="view.dateToValue"}}
+        </div>
+      </div>
+      <div class="pull-right">
+        <a {{action resetKeywordsDateFilter target="view"}} href="#" class="reset-link">{{t common.reset}}</a>
+      </div>
+    </div>
+    <div class="clearfix"></div>
+    <div class="toolbar-row levels-filter-block">
+      <div class="display-inline-block">{{t common.levels}}:</div>
+      {{#each level in view.levelsContext}}
+        <div class="display-inline-block level-checkbox">
+          <label>
+            {{view Em.Checkbox checkedBinding="level.checked"}}
+            {{level.displayName}} ({{level.counter}})
+          </label>
+        </div>
+      {{/each}}
+      <div class="pull-right">
+        <a {{action resetLevelsFilter target="view"}} href="#" class="reset-link">{{t common.reset}}</a>
+      </div>
+    </div>
+    <div class="toolbar-row include-exclude-filter-block">
+      <div class="display-inline-block">
+        {{t common.filters}}:
+        <div class="keywords-list">
+          {{#each keyword in view.selectedKeywords}}
+            <div {{bindAttr class=":keyword-item :btn keyword.isIncluded:btn-success:btn-danger"}}>
+              {{#if keyword.isIncluded}}
+                {{t common.include.short}}:
+              {{else}}
+                {{t common.exclude.short}}:
+              {{/if}}
+              <span> '{{keyword.value}}'</span>
+              <a {{action removeKeyword keyword target="view"}} class="close" href="#">x</a>
+            </div>
+          {{/each}}
+        </div>
+      </div>
+      <div class="pull-right">
+        <a {{action resetKeywordsFilter target="view"}} href="#" class="reset-link">{{t common.reset}}</a>
+      </div>
+    </div>
+  </div>
+  <div class="context-menu pull-left">
+    <a href="#" {{action moveTableTop target="view"}} class="move-to-top icon-caret-up"></a>
+    <a href="#" {{action moveTableBottom target="view"}} class="move-to-bottom icon-caret-down"></a>
+    <a href="#" {{action navigateToLogUI target="view"}} class="icon-external-link"></a>
+  </div>
+  <div class="clearfix"></div>
+</div>
+<div class="log-file-search-content container">
+  {{#each logData in view.content}}
+    <div class="row-fluid log-data-item">
+      <div class="span1 log-data-date">
+        {{logData.date}}
+        <br />
+        <span class="log-data-level">
+          {{logData.level}}
+        </span>
+      </div>
+      <div class="span11 log-data-message">{{logData.message}}</div>
+      <div class="clearfix"></div>
+    </div>
+  {{/each}}
+</div>
+<div id="log-file-search-item-context-menu">
+  <ul class="dropdown-menu" role="menu">
+    <li>
+      <a {{action includeSelected target="view"}} href="#">{{t common.include}}</a>
+    </li>
+    <li>
+      <a {{action excludeSelected target="view"}} href="#">{{t common.exclude}}</a>
+    </li>
+  </ul>
+</div>

http://git-wip-us.apache.org/repos/asf/ambari/blob/3a2add5d/ambari-web/app/views.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views.js b/ambari-web/app/views.js
index afb12e1..4404a2a 100644
--- a/ambari-web/app/views.js
+++ b/ambari-web/app/views.js
@@ -20,6 +20,7 @@
 // load all views here
 
 require('views/application');
+require('views/common/log_file_search_view');
 require('views/common/global/spinner');
 require('views/common/ajax_default_error_popup_body');
 require('views/common/chart');
@@ -37,6 +38,7 @@ require('views/common/modal_popups/invalid_KDC_popup');
 require('views/common/modal_popups/dependent_configs_list_popup');
 require('views/common/modal_popups/select_groups_popup');
 require('views/common/modal_popups/logs_popup');
+require('views/common/modal_popups/log_file_search_popup');
 require('views/common/editable_list');
 require('views/common/host_progress_popup_body_view');
 require('views/common/rolling_restart_view');
@@ -45,6 +47,7 @@ require('views/common/metric');
 require('views/common/time_range');
 require('views/common/time_range_list');
 require('views/common/form/field');
+require('views/common/form/datepicker_view');
 require('views/common/form/spinner_input_view');
 require('views/common/form/manage_credentials_form_view');
 require('views/common/quick_view_link_view');

http://git-wip-us.apache.org/repos/asf/ambari/blob/3a2add5d/ambari-web/app/views/common/form/datepicker_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/common/form/datepicker_view.js b/ambari-web/app/views/common/form/datepicker_view.js
new file mode 100644
index 0000000..b5bd104
--- /dev/null
+++ b/ambari-web/app/views/common/form/datepicker_view.js
@@ -0,0 +1,37 @@
+/*
+ * 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');
+
+App.DatepickerFieldView = Em.TextField.extend({
+  value: '',
+  dateFormat: 'dd/mm/yy',
+  maxDate: new Date(),
+
+  didInsertElement: function() {
+    this.$().datetimepicker({
+      format: this.get('dateFormat'),
+      endDate: this.get('maxDate')
+    });
+    this.$().on('changeDate', this.onChangeDate.bind(this));
+  },
+
+  onChangeDate: function(e) {
+    this.set('value', e.target.value);
+  }
+});

http://git-wip-us.apache.org/repos/asf/ambari/blob/3a2add5d/ambari-web/app/views/common/log_file_search_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/common/log_file_search_view.js b/ambari-web/app/views/common/log_file_search_view.js
new file mode 100644
index 0000000..c242ec8
--- /dev/null
+++ b/ambari-web/app/views/common/log_file_search_view.js
@@ -0,0 +1,272 @@
+/**
+ * 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 filters = require('views/common/filter_view');
+
+/**
+* @augments App.InfiniteScrollMixin
+* @type {Em.View}
+*/
+App.LogFileSearchView = Em.View.extend(App.InfiniteScrollMixin, {
+  classNames: ['log-file-search'],
+  templateName: require('templates/common/log_file_search'),
+  logLevels: ['fatal', 'critical', 'error', 'warning', 'info', 'debug'],
+
+  /**
+  * @typedef {Em.Object} FilterKeyword
+  * @property {Boolean} isIncluded determines include/exclude status of keyword
+  * @property {String} id unique identifier
+  * @property {String} value keyword value
+  */
+
+  /**
+  * Stores all selected keywords.
+  *
+  * @type {FilterKeyword[]}
+  */
+  selectedKeywords: [],
+
+  selectedKeywordsDidChange: function() {
+    this.fetchContent();
+  }.observes('selectedKeywords.length'),
+
+  levelsContext: function() {
+    var self = this;
+    var levels = this.get('logLevels');
+
+    return Em.A(levels.map(function(level) {
+      return Em.Object.create({name: level.toUpperCase(), counter: 0, displayName: level.capitalize(), checked: false});
+    }));
+  }.property(),
+
+  levelsContextDidChange: function(e) {
+    this.fetchContent();
+  }.observes('levelsContext.@each.checked'),
+
+  /** mock data **/
+  content: function() {
+    var data = [{
+      message: 'java.lang.NullPointerException',
+      date: '05.12.2016, 10:10:20',
+      level: 'INFO'
+    },
+    {
+      message: 'java.lang.NullPointerException',
+      date: '05.12.2016, 10:10:20',
+      level: 'ERROR'
+    }];
+
+    var initialSize = 20;
+    var ret = [];
+
+    for (var i = 0; i < 20; i++) {
+      ret.push(Em.Object.create(data[Math.ceil(Math.random()*2) - 1]));
+    }
+    return ret;
+  }.property(),
+
+  contentDidChange: function() {
+    this.refreshLevelCounters();
+  }.observes('content.length'),
+
+  dateFromValue: null,
+  dateToValue: null,
+
+  keywordsFilterView: filters.createTextView({
+    layout: Em.Handlebars.compile('{{yield}}')
+  }),
+
+  keywordsFilterValue: null,
+
+  didInsertElement: function() {
+    this._super();
+    this.infiniteScrollInit(this.$().find('.log-file-search-content'), {
+      callback: this.loadMore.bind(this)
+    });
+    this.$().find('.log-file-search-content').contextmenu({
+      target: '#log-file-search-item-context-menu'
+    });
+    this.refreshLevelCounters();
+  },
+
+  /** mock data **/
+  loadMore: function() {
+    var dfd = $.Deferred();
+    var self = this;
+    setTimeout(function() {
+      var data = self.get('content');
+      self.get('content').pushObjects(data.slice(0, 10));
+      dfd.resolve();
+    }, Math.ceil(Math.random()*4000));
+    return dfd.promise();
+  },
+
+  refreshLevelCounters: function() {
+    var self = this;
+    this.get('logLevels').forEach(function(level) {
+      var levelContext = self.get('levelsContext').findProperty('name', level.toUpperCase());
+      levelContext.set('counter', self.get('content').filterProperty('level', level.toUpperCase()).length);
+    });
+  },
+
+  /**
+  * Make request and get content with applied filters.
+  */
+  fetchContent: function(params) {
+    console.debug('Make Request with params:', this.serializeFilters());
+  },
+
+  submitKeywordsValue: function() {
+    this.fetchContent();
+  },
+
+  serializeFilters: function() {
+    var levels = this.serializeLevelFilters();
+    var keywords = this.serializeKeywordsFilter();
+    var date = this.serializeDateFilter();
+    var includedExcludedKeywords = this.serializeIncludedExcludedKeywordFilter();
+
+    return [levels, keywords, date, includedExcludedKeywords].compact().join('&');
+  },
+
+  serializeKeywordsFilter: function() {
+    return !!this.get('keywordsFilterValue') ? 'keywords=' + this.get('keywordsFilterValue'): null;
+  },
+
+  serializeDateFilter: function() {
+    var dateFrom = !!this.get('dateFromValue') ? 'dateFrom=' + this.get('dateFromValue') : null;
+    var dateTo = !!this.get('dateToValue') ? 'dateTo=' + this.get('dateFromValue') : null;
+    var ret = [dateTo, dateFrom].compact();
+    return ret.length ? ret.join('&') : null;
+  },
+
+  serializeLevelFilters: function() {
+    var selectedLevels = this.get('levelsContext').filterProperty('checked').mapProperty('name');
+    return selectedLevels.length ? 'levels=' + selectedLevels.join(',') : null;
+  },
+
+  serializeIncludedExcludedKeywordFilter: function() {
+    var self = this;
+    var getValues = function(included) {
+      return self.get('selectedKeywords').filterProperty('isIncluded', included).mapProperty('value');
+    };
+    var included = getValues(true).join(',');
+    var excluded = getValues(false).join(',');
+    var ret = [];
+    if (included.length) ret.push('include=' + included);
+    if (excluded.length) ret.push('exclude=' + excluded);
+    return ret.length ? ret.join('&') : null;
+  },
+
+  /** include/exclude keywords methods **/
+
+  keywordToId: function(keyword) {
+    return keyword.toLowerCase().split(' ').join('_');
+  },
+
+  /**
+  * Create keyword object
+  * @param  {string} keyword keyword value
+  * @param  {object} [opts]
+  * @return {Em.Object}
+  */
+  createSelectedKeyword: function(keyword, opts) {
+    var defaultOpts = {
+      isIncluded: false,
+      id: this.keywordToId(keyword),
+      value: keyword
+    };
+    return Em.Object.create($.extend({}, defaultOpts, opts));
+  },
+
+  /**
+  * Adds keyword if not added.
+  * @param  {FilterKeyword} keywordObject
+  */
+  addKeywordToList: function(keywordObject) {
+    if (!this.get('selectedKeywords').someProperty('id', keywordObject.get('id'))) {
+      this.get('selectedKeywords').pushObject(keywordObject);
+    }
+  },
+
+  /**
+  * @param  {FilterKeyword} keyword
+  */
+  includeSelectedKeyword: function(keyword) {
+    this.addKeywordToList(this.createSelectedKeyword(keyword, { isIncluded: true }));
+  },
+
+  /**
+  * @param  {FilterKeyword} keyword
+  */
+  excludeSelectedKeyword: function(keyword) {
+    this.addKeywordToList(this.createSelectedKeyword(keyword, { isIncluded: false }));
+  },
+
+  /** view actions **/
+
+  /** toolbar context menu actions **/
+  moveTableTop: function(e) {
+    var $el = $('.log-file-search-content');
+    $el.scrollTop(0);
+    $el = null;
+  },
+
+  moveTableBottom: function(e) {
+    var $el = $('.log-file-search-content');
+    $el.scrollTop($el.get(0).scrollHeight);
+    $el = null;
+  },
+
+  navigateToLogUI: function(e) {
+    console.error('navigate to Log UI');
+  },
+
+  removeKeyword: function(e) {
+    this.get('selectedKeywords').removeObject(e.context);
+  },
+
+  /** toolbar reset filter actions **/
+  resetKeywordsDateFilter: function(e) {
+    this.setProperties({
+      keywordsFilterValue: '',
+      dateFromValue: '',
+      dateToValue: ''
+    });
+  },
+
+  resetLevelsFilter: function(e) {
+    this.get('levelsContext').invoke('set', 'checked', false);
+  },
+
+  resetKeywordsFilter: function(e) {
+    this.get('selectedKeywords').clear();
+  },
+
+  /** log search item context menu actions **/
+  includeSelected: function() {
+    var selection = window.getSelection().toString();
+    if (!!selection) this.includeSelectedKeyword(selection);
+  },
+
+  excludeSelected: function() {
+    var selection = window.getSelection().toString();
+    if (!!selection) this.excludeSelectedKeyword(selection);
+  }
+});

http://git-wip-us.apache.org/repos/asf/ambari/blob/3a2add5d/ambari-web/app/views/common/modal_popups/log_file_search_popup.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/common/modal_popups/log_file_search_popup.js b/ambari-web/app/views/common/modal_popups/log_file_search_popup.js
new file mode 100644
index 0000000..4730a19
--- /dev/null
+++ b/ambari-web/app/views/common/modal_popups/log_file_search_popup.js
@@ -0,0 +1,26 @@
+/**
+ * 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');
+
+App.LogFileSearchPopup = function(header) {
+  return App.ModalPopup.show({
+    classNames: ['modal-full-width', 'sixty-percent-width-modal', 'log-file-search-popup'],
+    bodyClass: App.LogFileSearchView.extend({})
+  });
+};

http://git-wip-us.apache.org/repos/asf/ambari/blob/3a2add5d/ambari-web/test/views/common/log_file_search_view_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/views/common/log_file_search_view_test.js b/ambari-web/test/views/common/log_file_search_view_test.js
new file mode 100644
index 0000000..ca208b3
--- /dev/null
+++ b/ambari-web/test/views/common/log_file_search_view_test.js
@@ -0,0 +1,103 @@
+/**
+ * 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');
+
+describe('App.LogFileSearchView', function() {
+  describe('#serializeFilters', function() {
+    var makeLevelItem = function(level, isChecked) {
+      return Em.Object.create({
+        name: level.toUpperCase(),
+        checked: !!isChecked
+      });
+    };
+    var makeSelectedKeyword = function(keyword, isIncluded) {
+      return Em.Object.create({
+        value: keyword,
+        isIncluded: !!isIncluded
+      });
+    };
+    var cases = [
+      {
+        viewContent: {
+          keywordsFilterValue: 'some_keyword'
+        },
+        e: 'keywords=some_keyword'
+      },
+      {
+        viewContent: {
+          keywordsFilterValue: 'some_keyword',
+          levelsContext: [
+            makeLevelItem('debug', true),
+            makeLevelItem('error', false),
+            makeLevelItem('info', true)
+          ]
+        },
+        e: 'levels=DEBUG,INFO&keywords=some_keyword'
+      },
+      {
+        viewContent: {
+          keywordsFilterValue: 'some_keyword',
+          dateFromValue: '12/12/2015',
+          dateToValue: '14/12/2015',
+          levelsContext: [
+            makeLevelItem('debug', true),
+            makeLevelItem('error', true),
+            makeLevelItem('info', true)
+          ]
+        },
+        e: 'levels=DEBUG,ERROR,INFO&keywords=some_keyword&dateTo=12/12/2015&dateFrom=12/12/2015'
+      },
+      {
+        viewContent: {
+          keywordsFilterValue: 'some_keyword',
+          dateFromValue: '12/12/2015',
+          levelsContext: [
+            makeLevelItem('debug', true),
+            makeLevelItem('error', true),
+            makeLevelItem('info', true)
+          ]
+        },
+        e: 'levels=DEBUG,ERROR,INFO&keywords=some_keyword&dateFrom=12/12/2015'
+      },
+      {
+        viewContent: {
+          keywordsFilterValue: 'some_keyword',
+          dateFromValue: '12/12/2015',
+          levelsContext: [
+            makeLevelItem('debug', true),
+            makeLevelItem('error', true),
+            makeLevelItem('info', true)
+          ],
+          selectedKeywords: [
+            makeSelectedKeyword("keyword1", true),
+            makeSelectedKeyword("keyword2", true),
+            makeSelectedKeyword("keyword3", false)
+          ]
+        },
+        e: 'levels=DEBUG,ERROR,INFO&keywords=some_keyword&dateFrom=12/12/2015&include=keyword1,keyword2&exclude=keyword3'
+      }
+    ].forEach(function(test) {
+      it('validate result: ' + test.e, function() {
+        var view = App.LogFileSearchView.extend(test.viewContent).create();
+        expect(view.serializeFilters()).to.be.eql(test.e);
+        view.destroy();
+      })
+    });
+  });
+});

http://git-wip-us.apache.org/repos/asf/ambari/blob/3a2add5d/ambari-web/vendor/scripts/bootstrap-contextmenu.js
----------------------------------------------------------------------
diff --git a/ambari-web/vendor/scripts/bootstrap-contextmenu.js b/ambari-web/vendor/scripts/bootstrap-contextmenu.js
new file mode 100644
index 0000000..62a60cd
--- /dev/null
+++ b/ambari-web/vendor/scripts/bootstrap-contextmenu.js
@@ -0,0 +1,205 @@
+/*!
+ * Bootstrap Context Menu
+ * Author: @sydcanem
+ * https://github.com/sydcanem/bootstrap-contextmenu
+ *
+ * Inspired by Bootstrap's dropdown plugin.
+ * Bootstrap (http://getbootstrap.com).
+ *
+ * Licensed under MIT
+ * ========================================================= */
+
+;(function($) {
+
+    'use strict';
+
+    /* CONTEXTMENU CLASS DEFINITION
+     * ============================ */
+    var toggle = '[data-toggle="context"]';
+
+    var ContextMenu = function (element, options) {
+        this.$element = $(element);
+
+        this.before = options.before || this.before;
+        this.onItem = options.onItem || this.onItem;
+        this.scopes = options.scopes || null;
+
+        if (options.target) {
+            this.$element.data('target', options.target);
+        }
+
+        this.listen();
+    };
+
+    ContextMenu.prototype = {
+
+        constructor: ContextMenu
+        ,show: function(e) {
+
+            var $menu
+                , evt
+                , tp
+                , items
+                , relatedTarget = { relatedTarget: this, target: e.currentTarget };
+
+            if (this.isDisabled()) return;
+
+            this.closemenu();
+
+            if (this.before.call(this,e,$(e.currentTarget)) === false) return;
+
+            $menu = this.getMenu();
+            $menu.trigger(evt = $.Event('show.bs.context', relatedTarget));
+
+            tp = this.getPosition(e, $menu);
+            items = 'li:not(.divider)';
+            $menu.attr('style', '')
+                .css(tp)
+                .addClass('open')
+                .on('click.context.data-api', items, $.proxy(this.onItem, this, $(e.currentTarget)))
+                .trigger('shown.bs.context', relatedTarget);
+
+            // Delegating the `closemenu` only on the currently opened menu.
+            // This prevents other opened menus from closing.
+            $('html')
+                .on('click.context.data-api', $menu.selector, $.proxy(this.closemenu, this));
+
+            return false;
+        }
+
+        ,closemenu: function(e) {
+            var $menu
+                , evt
+                , items
+                , relatedTarget;
+
+            $menu = this.getMenu();
+
+            if(!$menu.hasClass('open')) return;
+
+            relatedTarget = { relatedTarget: this };
+            $menu.trigger(evt = $.Event('hide.bs.context', relatedTarget));
+
+            items = 'li:not(.divider)';
+            $menu.removeClass('open')
+                .off('click.context.data-api', items)
+                .trigger('hidden.bs.context', relatedTarget);
+
+            $('html')
+                .off('click.context.data-api', $menu.selector);
+            // Don't propagate click event so other currently
+            // opened menus won't close.
+            e.stopPropagation();
+        }
+
+        ,keydown: function(e) {
+            if (e.which == 27) this.closemenu(e);
+        }
+
+        ,before: function(e) {
+            return true;
+        }
+
+        ,onItem: function(e) {
+            return true;
+        }
+
+        ,listen: function () {
+            this.$element.on('contextmenu.context.data-api', this.scopes, $.proxy(this.show, this));
+            $('html').on('click.context.data-api', $.proxy(this.closemenu, this));
+            $('html').on('keydown.context.data-api', $.proxy(this.keydown, this));
+        }
+
+        ,destroy: function() {
+            this.$element.off('.context.data-api').removeData('context');
+            $('html').off('.context.data-api');
+        }
+
+        ,isDisabled: function() {
+            return this.$element.hasClass('disabled') ||
+                    this.$element.attr('disabled');
+        }
+
+        ,getMenu: function () {
+            var selector = this.$element.data('target')
+                , $menu;
+
+            if (!selector) {
+                selector = this.$element.attr('href');
+                selector = selector && selector.replace(/.*(?=#[^\s]*$)/, ''); //strip for ie7
+            }
+
+            $menu = $(selector);
+
+            return $menu && $menu.length ? $menu : this.$element.find(selector);
+        }
+
+        ,getPosition: function(e, $menu) {
+            var mouseX = e.clientX
+                , mouseY = e.clientY
+                , boundsX = $(window).width()
+                , boundsY = $(window).height()
+                , menuWidth = $menu.find('.dropdown-menu').outerWidth()
+                , menuHeight = $menu.find('.dropdown-menu').outerHeight()
+                , tp = {"position":"absolute","z-index":9999}
+                , Y, X, parentOffset;
+
+            if (mouseY + menuHeight > boundsY) {
+                Y = {"top": mouseY - menuHeight + $(window).scrollTop()};
+            } else {
+                Y = {"top": mouseY + $(window).scrollTop()};
+            }
+
+            if ((mouseX + menuWidth > boundsX) && ((mouseX - menuWidth) > 0)) {
+                X = {"left": mouseX - menuWidth + $(window).scrollLeft()};
+            } else {
+                X = {"left": mouseX + $(window).scrollLeft()};
+            }
+
+            // If context-menu's parent is positioned using absolute or relative positioning,
+            // the calculated mouse position will be incorrect.
+            // Adjust the position of the menu by its offset parent position.
+            parentOffset = $menu.offsetParent().offset();
+            X.left = X.left - parentOffset.left;
+            Y.top = Y.top - parentOffset.top;
+
+            return $.extend(tp, Y, X);
+        }
+
+    };
+
+    /* CONTEXT MENU PLUGIN DEFINITION
+     * ========================== */
+
+    $.fn.contextmenu = function (option,e) {
+        return this.each(function () {
+            var $this = $(this)
+                , data = $this.data('context')
+                , options = (typeof option == 'object') && option;
+
+            if (!data) $this.data('context', (data = new ContextMenu($this, options)));
+            if (typeof option == 'string') data[option].call(data, e);
+        });
+    };
+
+    $.fn.contextmenu.Constructor = ContextMenu;
+
+    /* APPLY TO STANDARD CONTEXT MENU ELEMENTS
+     * =================================== */
+
+    $(document)
+       .on('contextmenu.context.data-api', function() {
+            $(toggle).each(function () {
+                var data = $(this).data('context');
+                if (!data) return;
+                data.closemenu();
+            });
+        })
+        .on('contextmenu.context.data-api', toggle, function(e) {
+            $(this).contextmenu('show', e);
+
+            e.preventDefault();
+            e.stopPropagation();
+        });
+
+}(jQuery));


[35/40] ambari git commit: AMBARI-14943 AMS check failed on deploy (dsen)

Posted by nc...@apache.org.
AMBARI-14943 AMS check failed on deploy (dsen)


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

Branch: refs/heads/branch-dev-patch-upgrade
Commit: 13325ab07821cdfc3813457c0ca05c6b065f5879
Parents: b567ca4
Author: Dmytro Sen <ds...@apache.org>
Authored: Fri Feb 5 19:52:19 2016 +0200
Committer: Dmytro Sen <ds...@apache.org>
Committed: Fri Feb 5 19:52:19 2016 +0200

----------------------------------------------------------------------
 .../metrics/timeline/PhoenixHBaseAccessor.java  | 51 ++++++++++++--------
 .../webapp/TimelineWebServices.java             |  7 +--
 .../timeline/PhoenixHBaseAccessorTest.java      |  2 +-
 3 files changed, 33 insertions(+), 27 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/13325ab0/ambari-metrics/ambari-metrics-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/metrics/timeline/PhoenixHBaseAccessor.java
----------------------------------------------------------------------
diff --git a/ambari-metrics/ambari-metrics-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/metrics/timeline/PhoenixHBaseAccessor.java b/ambari-metrics/ambari-metrics-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/metrics/timeline/PhoenixHBaseAccessor.java
index 29662f3..7fa1d2d 100644
--- a/ambari-metrics/ambari-metrics-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/metrics/timeline/PhoenixHBaseAccessor.java
+++ b/ambari-metrics/ambari-metrics-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/metrics/timeline/PhoenixHBaseAccessor.java
@@ -555,34 +555,43 @@ public class PhoenixHBaseAccessor {
         throw new IllegalArgumentException("Multiple aggregate functions not supported.");
       }
       for (Function f : functions) {
-        SingleValuedTimelineMetric metric =
-          TIMELINE_METRIC_READ_HELPER.getAggregatedTimelineMetricFromResultSet(rs, f);
-
-        if (condition.isGrouped()) {
-          metrics.addOrMergeTimelineMetric(metric);
+        if (f.getReadFunction() == Function.ReadFunction.VALUE) {
+          getTimelineMetricsFromResultSet(metrics, condition, rs);
         } else {
-          metrics.getMetrics().add(metric.getTimelineMetric());
+          SingleValuedTimelineMetric metric =
+            TIMELINE_METRIC_READ_HELPER.getAggregatedTimelineMetricFromResultSet(rs, f);
+
+          if (condition.isGrouped()) {
+            metrics.addOrMergeTimelineMetric(metric);
+          } else {
+            metrics.getMetrics().add(metric.getTimelineMetric());
+          }
         }
       }
     } else {
       // No aggregation requested
-      if (condition.getPrecision().equals(Precision.SECONDS)) {
-        TimelineMetric metric = TIMELINE_METRIC_READ_HELPER.getTimelineMetricFromResultSet(rs);
-        if (condition.isGrouped()) {
-          metrics.addOrMergeTimelineMetric(metric);
-        } else {
-          metrics.getMetrics().add(metric);
-        }
+      // Execution never goes here, function always contain at least 1 element
+      getTimelineMetricsFromResultSet(metrics, condition, rs);
+    }
+  }
 
+  private void getTimelineMetricsFromResultSet(TimelineMetrics metrics, Condition condition, ResultSet rs) throws SQLException, IOException {
+    if (condition.getPrecision().equals(Precision.SECONDS)) {
+      TimelineMetric metric = TIMELINE_METRIC_READ_HELPER.getTimelineMetricFromResultSet(rs);
+      if (condition.isGrouped()) {
+        metrics.addOrMergeTimelineMetric(metric);
       } else {
-        SingleValuedTimelineMetric metric =
-          TIMELINE_METRIC_READ_HELPER.getAggregatedTimelineMetricFromResultSet(rs,
-            Function.DEFAULT_VALUE_FUNCTION);
-        if (condition.isGrouped()) {
-          metrics.addOrMergeTimelineMetric(metric);
-        } else {
-          metrics.getMetrics().add(metric.getTimelineMetric());
-        }
+        metrics.getMetrics().add(metric);
+      }
+
+    } else {
+      SingleValuedTimelineMetric metric =
+        TIMELINE_METRIC_READ_HELPER.getAggregatedTimelineMetricFromResultSet(rs,
+          Function.DEFAULT_VALUE_FUNCTION);
+      if (condition.isGrouped()) {
+        metrics.addOrMergeTimelineMetric(metric);
+      } else {
+        metrics.getMetrics().add(metric.getTimelineMetric());
       }
     }
   }

http://git-wip-us.apache.org/repos/asf/ambari/blob/13325ab0/ambari-metrics/ambari-metrics-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/webapp/TimelineWebServices.java
----------------------------------------------------------------------
diff --git a/ambari-metrics/ambari-metrics-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/webapp/TimelineWebServices.java b/ambari-metrics/ambari-metrics-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/webapp/TimelineWebServices.java
index e9d77cc..873671a 100644
--- a/ambari-metrics/ambari-metrics-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/webapp/TimelineWebServices.java
+++ b/ambari-metrics/ambari-metrics-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/webapp/TimelineWebServices.java
@@ -20,7 +20,6 @@ package org.apache.hadoop.yarn.server.applicationhistoryservice.webapp;
 
 import com.google.inject.Inject;
 import com.google.inject.Singleton;
-import org.apache.commons.lang.StringUtils;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.hadoop.classification.InterfaceAudience.Public;
@@ -386,11 +385,9 @@ public class TimelineWebServices {
       throw new PrecisionLimitExceededException(iae.getMessage());
     } catch (IllegalArgumentException iae) {
       throw new BadRequestException(iae.getMessage());
-    } catch (SQLException sql) {
-      throw new WebApplicationException(sql,
+    } catch (SQLException | IOException e) {
+      throw new WebApplicationException(e,
         Response.Status.INTERNAL_SERVER_ERROR);
-    } catch (IOException io) {
-      throw new WebApplicationException(io, Response.Status.INTERNAL_SERVER_ERROR);
     }
   }
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/13325ab0/ambari-metrics/ambari-metrics-timelineservice/src/test/java/org/apache/hadoop/yarn/server/applicationhistoryservice/metrics/timeline/PhoenixHBaseAccessorTest.java
----------------------------------------------------------------------
diff --git a/ambari-metrics/ambari-metrics-timelineservice/src/test/java/org/apache/hadoop/yarn/server/applicationhistoryservice/metrics/timeline/PhoenixHBaseAccessorTest.java b/ambari-metrics/ambari-metrics-timelineservice/src/test/java/org/apache/hadoop/yarn/server/applicationhistoryservice/metrics/timeline/PhoenixHBaseAccessorTest.java
index 0a6f120..9838bca 100644
--- a/ambari-metrics/ambari-metrics-timelineservice/src/test/java/org/apache/hadoop/yarn/server/applicationhistoryservice/metrics/timeline/PhoenixHBaseAccessorTest.java
+++ b/ambari-metrics/ambari-metrics-timelineservice/src/test/java/org/apache/hadoop/yarn/server/applicationhistoryservice/metrics/timeline/PhoenixHBaseAccessorTest.java
@@ -181,7 +181,7 @@ public class PhoenixHBaseAccessorTest {
     PowerMock.replayAll();
     EasyMock.replay(preparedStatementMock, rsMock, pioe1, pioe2, dnrioe);
     try {
-      TimelineMetrics tml = accessor.getMetricRecords(condition, metricFunctions);
+      accessor.getMetricRecords(condition, metricFunctions);
       fail();
     } catch (Exception e) {
       //NOP


[10/40] ambari git commit: AMBARI-14925 Make AMS Grafana component available as a DEB package (dsen)

Posted by nc...@apache.org.
AMBARI-14925 Make AMS Grafana component available as a DEB package (dsen)


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

Branch: refs/heads/branch-dev-patch-upgrade
Commit: 407822583d2d4f1a21e9d610e80fb32de548d9ac
Parents: 549ee24
Author: Dmytro Sen <ds...@apache.org>
Authored: Thu Feb 4 19:49:57 2016 +0200
Committer: Dmytro Sen <ds...@apache.org>
Committed: Thu Feb 4 19:49:57 2016 +0200

----------------------------------------------------------------------
 ambari-metrics/ambari-metrics-assembly/pom.xml | 53 ++++++++++++++++++++-
 1 file changed, 52 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/40782258/ambari-metrics/ambari-metrics-assembly/pom.xml
----------------------------------------------------------------------
diff --git a/ambari-metrics/ambari-metrics-assembly/pom.xml b/ambari-metrics/ambari-metrics-assembly/pom.xml
index dfc9351..511dc1f 100644
--- a/ambari-metrics/ambari-metrics-assembly/pom.xml
+++ b/ambari-metrics/ambari-metrics-assembly/pom.xml
@@ -501,11 +501,14 @@
                   <type>template</type>
                   <paths>
                     <path>/etc/ambari-metrics-monitor/conf</path>
-                    <path>/usr/lib/ambari-metrics-collector</path>
                     <path>/etc/ambari-metrics-collector/conf</path>
+                    <path>/etc/ambari-metrics-grafana/conf</path>
                     <path>/etc/ams-hbase/conf</path>
                     <path>/var/run/ams-hbase</path>
+                    <path>/var/run/ambari-metrics-grafana</path>
+                    <path>/var/log/ambari-metrics-grafana</path>
                     <path>/var/lib/ambari-metrics-collector</path>
+                    <path>/var/lib/ambari-metrics-grafana</path>
                     <path>/usr/lib/ambari-metrics-hadoop-sink</path>
                     <path>/usr/lib/ambari-metrics-kafka-sink</path>
                     <path>/usr/lib/ambari-metrics-kafka-sink/lib</path>
@@ -655,6 +658,54 @@
                   </mapper>
                 </data>
 
+                <!-- Metric Grafana -->
+
+                <data>
+                  <src>${grafana.dir}/target/grafana/${grafana.folder}</src>
+                  <type>directory</type>
+                  <mapper>
+                    <type>perm</type>
+                    <filemode>644</filemode>
+                    <prefix>/usr/lib/ambari-metrics-grafana</prefix>
+                  </mapper>
+                </data>
+                <data>
+                  <src>${grafana.dir}/target/grafana/${grafana.folder}/bin</src>
+                  <type>directory</type>
+                  <mapper>
+                    <type>perm</type>
+                    <filemode>755</filemode>
+                    <prefix>/usr/lib/ambari-metrics-grafana/bin</prefix>
+                  </mapper>
+                </data>
+                <data>
+                  <src>${grafana.dir}/conf/unix/ambari-metrics-grafana</src>
+                  <type>file</type>
+                  <mapper>
+                    <type>perm</type>
+                    <filemode>755</filemode>
+                    <prefix>/usr/sbin</prefix>
+                  </mapper>
+                </data>
+                <data>
+                  <src>${grafana.dir}/conf/unix/ams-grafana-env.sh</src>
+                  <type>file</type>
+                  <mapper>
+                    <type>perm</type>
+                    <filemode>755</filemode>
+                    <prefix>/etc/ambari-metrics-grafana/conf</prefix>
+                  </mapper>
+                </data>
+                <data>
+                  <src>${grafana.dir}/conf/unix/ams-grafana.ini</src>
+                  <type>file</type>
+                  <mapper>
+                    <type>perm</type>
+                    <filemode>644</filemode>
+                    <prefix>/etc/ambari-metrics-grafana/conf</prefix>
+                  </mapper>
+                </data>
+
                 <!-- hadoop sink -->
 
                 <data>


[24/40] ambari git commit: AMBARI-14933 ranger audit db password is required even when audit to db is off.(ababiichuk)

Posted by nc...@apache.org.
AMBARI-14933 ranger audit db password is required even when audit to db is off.(ababiichuk)


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

Branch: refs/heads/branch-dev-patch-upgrade
Commit: 94932c99bb8ff5ad309c15c6a0ecf382f428c73b
Parents: dc8e5c3
Author: ababiichuk <ab...@hortonworks.com>
Authored: Fri Feb 5 09:35:47 2016 +0200
Committer: ababiichuk <ab...@hortonworks.com>
Committed: Fri Feb 5 11:15:13 2016 +0200

----------------------------------------------------------------------
 .../services/RANGER/themes/theme_version_1.json | 20 +++++++++++++++++++-
 .../services/RANGER/themes/theme_version_2.json | 20 +++++++++++++++++++-
 .../configs/widgets/config_widget_view.js       |  3 +++
 3 files changed, 41 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/94932c99/ambari-server/src/main/resources/stacks/HDP/2.2/services/RANGER/themes/theme_version_1.json
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.2/services/RANGER/themes/theme_version_1.json b/ambari-server/src/main/resources/stacks/HDP/2.2/services/RANGER/themes/theme_version_1.json
index e6724cd..cb5aa78 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.2/services/RANGER/themes/theme_version_1.json
+++ b/ambari-server/src/main/resources/stacks/HDP/2.2/services/RANGER/themes/theme_version_1.json
@@ -525,7 +525,25 @@
         },
         {
           "config": "admin-properties/audit_db_password",
-          "subsection-name": "subsection-ranger-audit-db-row2-col2"
+          "subsection-name": "subsection-ranger-audit-db-row2-col2",
+          "depends-on": [
+            {
+              "configs":[
+                "ranger-env/xasecure.audit.destination.db"
+              ],
+              "if": "${ranger-env/xasecure.audit.destination.db}",
+              "then": {
+                "property_value_attributes": {
+                  "visible": true
+                }
+              },
+              "else": {
+                "property_value_attributes": {
+                  "visible": false
+                }
+              }
+            }
+          ]
         }
       ]
     },

http://git-wip-us.apache.org/repos/asf/ambari/blob/94932c99/ambari-server/src/main/resources/stacks/HDP/2.3/services/RANGER/themes/theme_version_2.json
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.3/services/RANGER/themes/theme_version_2.json b/ambari-server/src/main/resources/stacks/HDP/2.3/services/RANGER/themes/theme_version_2.json
index fff50fb..2c469a9 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.3/services/RANGER/themes/theme_version_2.json
+++ b/ambari-server/src/main/resources/stacks/HDP/2.3/services/RANGER/themes/theme_version_2.json
@@ -904,7 +904,25 @@
         },
         {
           "config": "admin-properties/audit_db_password",
-          "subsection-name": "subsection-ranger-audit-db-row2-col2"
+          "subsection-name": "subsection-ranger-audit-db-row2-col2",
+          "depends-on": [
+            {
+              "configs":[
+                "ranger-env/xasecure.audit.destination.db"
+              ],
+              "if": "${ranger-env/xasecure.audit.destination.db}",
+              "then": {
+                "property_value_attributes": {
+                  "visible": true
+                }
+              },
+              "else": {
+                "property_value_attributes": {
+                  "visible": false
+                }
+              }
+            }
+          ]
         },
         {
           "config": "ranger-env/xasecure.audit.destination.solr",

http://git-wip-us.apache.org/repos/asf/ambari/blob/94932c99/ambari-web/app/views/common/configs/widgets/config_widget_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/common/configs/widgets/config_widget_view.js b/ambari-web/app/views/common/configs/widgets/config_widget_view.js
index 9858b75..e9eaed2 100644
--- a/ambari-web/app/views/common/configs/widgets/config_widget_view.js
+++ b/ambari-web/app/views/common/configs/widgets/config_widget_view.js
@@ -434,6 +434,9 @@ App.ConfigWidgetView = Em.View.extend(App.SupportsDependentConfigs, App.WidgetPo
         var conditionalConfig = serviceConfigs.filterProperty('filename',conditionalConfigFileName).findProperty('name', conditionalConfigName);
         if (conditionalConfig) {
           conditionalConfig.set(valueAttribute, valueAttributes[key]);
+          if (valueAttribute === 'isVisible') {
+            conditionalConfig.set('hiddenBySection', !valueAttributes[key]);
+          }
         }
       }
     }


[19/40] ambari git commit: AMBARI-14893. Add Grafana-based Ambari Metrics Dashboard Builder. (Prajwal Rao via yusaku)

Posted by nc...@apache.org.
AMBARI-14893. Add Grafana-based Ambari Metrics Dashboard Builder. (Prajwal Rao via yusaku)


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

Branch: refs/heads/branch-dev-patch-upgrade
Commit: f026accf2df9f2be6e6f4dac049593c90f37bbc9
Parents: eb3f995
Author: Yusaku Sako <yu...@hortonworks.com>
Authored: Thu Feb 4 13:15:49 2016 -0800
Committer: Yusaku Sako <yu...@hortonworks.com>
Committed: Thu Feb 4 13:15:49 2016 -0800

----------------------------------------------------------------------
 ambari-metrics/ambari-metrics-grafana/pom.xml | 1 +
 1 file changed, 1 insertion(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/f026accf/ambari-metrics/ambari-metrics-grafana/pom.xml
----------------------------------------------------------------------
diff --git a/ambari-metrics/ambari-metrics-grafana/pom.xml b/ambari-metrics/ambari-metrics-grafana/pom.xml
index 45ca1a0..8304416 100644
--- a/ambari-metrics/ambari-metrics-grafana/pom.xml
+++ b/ambari-metrics/ambari-metrics-grafana/pom.xml
@@ -67,6 +67,7 @@
         <configuration>
           <excludes>
             <exclude>conf/unix/ams-grafana.ini</exclude>
+            <exclude>**/*.json</exclude>
           </excludes>
         </configuration>
         <executions>


[08/40] ambari git commit: AMBARI-14916. Issues with Login Message dialog (alexantonenko)

Posted by nc...@apache.org.
AMBARI-14916. Issues with Login Message dialog (alexantonenko)


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

Branch: refs/heads/branch-dev-patch-upgrade
Commit: 81b46da33da91d672f16e88c9165e69954d2b292
Parents: 04b0227
Author: Alex Antonenko <hi...@gmail.com>
Authored: Thu Feb 4 13:11:57 2016 +0200
Committer: Alex Antonenko <hi...@gmail.com>
Committed: Thu Feb 4 17:08:46 2016 +0200

----------------------------------------------------------------------
 .../loginActivities/LoginActivitiesMainCtrl.js  |  4 ++--
 .../loginActivities/LoginMessageMainCtrl.js     |  5 ++--
 .../ui/admin-web/app/scripts/i18n.config.js     |  6 +++--
 .../ui/admin-web/app/scripts/routes.js          |  9 ++++++-
 .../ui/admin-web/app/views/leftNavbar.html      |  2 +-
 .../app/views/loginActivities/loginMessage.html | 25 ++++++++------------
 .../app/views/loginActivities/main.html         |  4 ++--
 .../src/main/resources/ui/admin-web/gulpfile.js |  1 -
 ambari-web/app/router.js                        |  2 +-
 9 files changed, 30 insertions(+), 28 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/81b46da3/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/loginActivities/LoginActivitiesMainCtrl.js
----------------------------------------------------------------------
diff --git a/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/loginActivities/LoginActivitiesMainCtrl.js b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/loginActivities/LoginActivitiesMainCtrl.js
index 84af924..3fcf8b2 100644
--- a/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/loginActivities/LoginActivitiesMainCtrl.js
+++ b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/loginActivities/LoginActivitiesMainCtrl.js
@@ -18,6 +18,6 @@
 'use strict';
 
 angular.module('ambariAdminConsole')
-  .controller('LoginActivitiesMainCtrl',['$scope', function($scope) {
-    $scope.tab = 'loginMessage';
+  .controller('LoginActivitiesMainCtrl',['$scope', '$location', function($scope, $location) {
+    $scope.tab = $location.path().substr(1) == "loginActivities" ? "loginMessage" : $location.path().substr(1);
   }]);

http://git-wip-us.apache.org/repos/asf/ambari/blob/81b46da3/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/loginActivities/LoginMessageMainCtrl.js
----------------------------------------------------------------------
diff --git a/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/loginActivities/LoginMessageMainCtrl.js b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/loginActivities/LoginMessageMainCtrl.js
index af78dde..763bd59 100644
--- a/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/loginActivities/LoginMessageMainCtrl.js
+++ b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/loginActivities/LoginMessageMainCtrl.js
@@ -29,18 +29,17 @@ angular.module('ambariAdminConsole')
     $scope.submitDisabled = true;
 
     $http.get('/api/v1/settings/motd').then(function (res) {
-      var response = JSON.parse(res.data.Settings.content);
+      $scope.motdExists = true;
+      var response = JSON.parse(res.data.Settings.content.replace(/\n/g, "\\n"));
       $scope.text = response.text ? response.text : "";
       $scope.buttonText = response.button ? response.button : "";
       $scope.status = response.status && response.status == "true" ? true : false;
-      $scope.motdExists = true;
     });
 
     $scope.inputChangeEvent = function(){
       $scope.submitDisabled = false;
     };
     $scope.changeStatus = function(){
-      $scope.status = !$scope.status;
       $scope.submitDisabled = false;
     };
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/81b46da3/ambari-admin/src/main/resources/ui/admin-web/app/scripts/i18n.config.js
----------------------------------------------------------------------
diff --git a/ambari-admin/src/main/resources/ui/admin-web/app/scripts/i18n.config.js b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/i18n.config.js
index 086bc13..91a1645 100644
--- a/ambari-admin/src/main/resources/ui/admin-web/app/scripts/i18n.config.js
+++ b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/i18n.config.js
@@ -90,8 +90,10 @@ angular.module('ambariAdminConsole')
         'onlySimpleChars': 'Must contain only simple characters.',
         'saveError': 'Save error',
         'message': 'Message',
-        'buttonText': 'Button text',
-        'switch': 'On/Off'
+        'buttonText': 'Button',
+        'status': 'Status',
+        'status.enabled': 'Enabled',
+        'status.disabled': 'Disabled'
       },
 
       'controls': {

http://git-wip-us.apache.org/repos/asf/ambari/blob/81b46da3/ambari-admin/src/main/resources/ui/admin-web/app/scripts/routes.js
----------------------------------------------------------------------
diff --git a/ambari-admin/src/main/resources/ui/admin-web/app/scripts/routes.js b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/routes.js
index 6da7ff4..8691195 100644
--- a/ambari-admin/src/main/resources/ui/admin-web/app/scripts/routes.js
+++ b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/routes.js
@@ -32,9 +32,16 @@ angular.module('ambariAdminConsole')
     }
   },
   loginActivities: {
-      url: '/loginActivities',
+    loginMessage:{
+      url: '/loginMessage',
       templateUrl: 'views/loginActivities/main.html',
       controller: 'LoginActivitiesMainCtrl'
+    },
+    homeDirectory: {
+      url: '/homeDirectory',
+      templateUrl: 'views/loginActivities/main.html',
+      controller: 'LoginActivitiesMainCtrl'
+    }
   },
   users: {
     list: {

http://git-wip-us.apache.org/repos/asf/ambari/blob/81b46da3/ambari-admin/src/main/resources/ui/admin-web/app/views/leftNavbar.html
----------------------------------------------------------------------
diff --git a/ambari-admin/src/main/resources/ui/admin-web/app/views/leftNavbar.html b/ambari-admin/src/main/resources/ui/admin-web/app/views/leftNavbar.html
index 3f01e38..b0a5396 100644
--- a/ambari-admin/src/main/resources/ui/admin-web/app/views/leftNavbar.html
+++ b/ambari-admin/src/main/resources/ui/admin-web/app/views/leftNavbar.html
@@ -110,7 +110,7 @@
     <div class="panel-body">
       <ul class="nav nav-pills nav-stacked">
         <li ng-class="{active: isActive('authentication.main')}"><link-to route="authentication.main">{{'common.authentication' | translate}}</link-to></li>
-        <li ng-class="{active: isActive('loginActivities')}"><link-to route="loginActivities">{{'common.loginActivities.loginActivities' | translate}}</link-to></li>
+        <li ng-class="{active: isActive('loginActivities.loginMessage')}"><link-to route="loginActivities.loginMessage">{{'common.loginActivities.loginActivities' | translate}}</link-to></li>
       </ul>
     </div>
   </div>

http://git-wip-us.apache.org/repos/asf/ambari/blob/81b46da3/ambari-admin/src/main/resources/ui/admin-web/app/views/loginActivities/loginMessage.html
----------------------------------------------------------------------
diff --git a/ambari-admin/src/main/resources/ui/admin-web/app/views/loginActivities/loginMessage.html b/ambari-admin/src/main/resources/ui/admin-web/app/views/loginActivities/loginMessage.html
index 37b6165..1daf54c 100644
--- a/ambari-admin/src/main/resources/ui/admin-web/app/views/loginActivities/loginMessage.html
+++ b/ambari-admin/src/main/resources/ui/admin-web/app/views/loginActivities/loginMessage.html
@@ -21,24 +21,17 @@
   <form class="form-horizontal" novalidate name="form" autocomplete="off">
     <div class="well">
       <fieldset>
-        <div class="form-group" ng-class="{'has-error' : (form.login_text.$error.pattern) && form.submitted}">
-          <label class="col-sm-2 control-label">{{'common.loginActivities.switch' | translate}}</label>
-          <div class="on-off-switch-wrap col-sm-10">
-            <i class="fa fa-toggle-on active"
-               ng-if="status == true"
-               ng-click="changeStatus();">
-            </i>
-            <i class="fa fa-toggle-on fa-rotate-180 inactive"
-               ng-if="status == false"
-               ng-click="changeStatus();">
-            </i>
-            <input type="checkbox" name="status" class="hidden" ng-model="status">
+        <div class="form-group">
+          <label class="col-sm-2 control-label">{{'common.loginActivities.status' | translate}}</label>
+          <div class="col-sm-10">
+            <toggle-switch ng-click="changeStatus();" model="status" on-label="{{'common.loginActivities.status.enabled' | translate}}" off-label="{{'common.loginActivities.status.disabled' | translate}}" class="switch-primary userstatus" data-off-color="disabled"></toggle-switch>
           </div>
+          <input type="checkbox" name="status" class="hidden" ng-model="status">
         </div>
         <div class="form-group" ng-class="{'has-error' : (form.login_text.$error.pattern) && form.submitted}">
           <label class="col-sm-2 control-label">{{'common.loginActivities.message' | translate}}</label>
           <div class="col-sm-10">
-            <input type="text"
+            <textarea type="text"
                  class="form-control"
                  name="login_text"
                  placeholder="{{'common.loginActivities.loginMessage.placeholder' | translate}}"
@@ -47,7 +40,7 @@
                  ng-pattern="/^([a-zA-Z0-9._\s]+)$/"
                  ng-disabled="!status"
                  autocomplete="off">
-
+            </textarea>
             <div class="alert alert-danger top-margin" ng-show="form.login_text.$error.pattern && form.submitted">
              {{'common.loginActivities.onlySimpleChars' | translate}}
             </div>
@@ -55,7 +48,7 @@
         </div>
         <div class="form-group" ng-class="{'has-error' : (form.login_text.$error.pattern) && form.submitted}">
           <label class="col-sm-2 control-label">{{'common.loginActivities.buttonText' | translate}}</label>
-          <div class="col-sm-5">
+          <div class="col-sm-4">
             <input type="text"
                    class="form-control"
                    name="button_text"
@@ -64,6 +57,8 @@
                    ng-change="inputChangeEvent()"
                    ng-disabled="!status"
                    ng-pattern="/^([a-zA-Z0-9._\s]+)$/"
+                   maxlength="25"
+                   size="25"
                    autocomplete="off">
 
             <div class="alert alert-danger top-margin" ng-show="form.button_text.$error.pattern && form.submitted">

http://git-wip-us.apache.org/repos/asf/ambari/blob/81b46da3/ambari-admin/src/main/resources/ui/admin-web/app/views/loginActivities/main.html
----------------------------------------------------------------------
diff --git a/ambari-admin/src/main/resources/ui/admin-web/app/views/loginActivities/main.html b/ambari-admin/src/main/resources/ui/admin-web/app/views/loginActivities/main.html
index 7b35682..e29f50e 100644
--- a/ambari-admin/src/main/resources/ui/admin-web/app/views/loginActivities/main.html
+++ b/ambari-admin/src/main/resources/ui/admin-web/app/views/loginActivities/main.html
@@ -25,10 +25,10 @@
   <hr>
   <ul class="nav nav-tabs">
     <li ng-class="{active: tab == 'loginMessage'}">
-      <a ng-click="tab = 'loginMessage'">{{'common.loginActivities.loginMessage' | translate}}</a>
+      <link-to route="loginActivities.loginMessage">{{'common.loginActivities.loginMessage' | translate}}</link-to>
     </li>
     <li ng-class="{active: tab == 'homeDirectory'}">
-      <a ng-click="tab = 'homeDirectory'">{{'common.loginActivities.homeDirectory' | translate}}</a>
+      <link-to route="loginActivities.homeDirectory">{{'common.loginActivities.homeDirectory' | translate}}</link-to>
     </li>
   </ul>
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/81b46da3/ambari-admin/src/main/resources/ui/admin-web/gulpfile.js
----------------------------------------------------------------------
diff --git a/ambari-admin/src/main/resources/ui/admin-web/gulpfile.js b/ambari-admin/src/main/resources/ui/admin-web/gulpfile.js
index 8b3dd8c..2f47b85 100644
--- a/ambari-admin/src/main/resources/ui/admin-web/gulpfile.js
+++ b/ambari-admin/src/main/resources/ui/admin-web/gulpfile.js
@@ -43,7 +43,6 @@ gulp.task('html', ['styles'], function () {
     .pipe($.plumber())
     .pipe($.useref.assets({searchPath: '{.tmp,app}'}))
     .pipe(jsFilter)
-    .pipe($.uglify())
     .pipe(jsFilter.restore())
     .pipe(cssFilter)
     .pipe(cssFilter.restore())

http://git-wip-us.apache.org/repos/asf/ambari/blob/81b46da3/ambari-web/app/router.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/router.js b/ambari-web/app/router.js
index c7cba27..360480f 100644
--- a/ambari-web/app/router.js
+++ b/ambari-web/app/router.js
@@ -363,7 +363,7 @@ App.Router = Em.Router.extend({
    * @param {object} data
    */
   showLoginMessage: function (data){
-    var response = JSON.parse(data.Settings.content),
+    var response = JSON.parse(data.Settings.content.replace(/\n/g, "\\n")),
       text = response.text ? response.text : "",
       buttonText = response.button ? response.button : Em.I18n.t('ok'),
       status = response.status && response.status == "true" ? true : false;


[38/40] ambari git commit: AMBARI-14910: HAWQ hdfs-client.xml should be updated when NN HA in enabled (mithmatt via jaoki)

Posted by nc...@apache.org.
AMBARI-14910: HAWQ hdfs-client.xml should be updated when NN HA in enabled (mithmatt via jaoki)


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

Branch: refs/heads/branch-dev-patch-upgrade
Commit: 26ad97b6406008981ce8bec6158f6a47bb1459a4
Parents: bb864df
Author: Jun Aoki <ja...@apache.org>
Authored: Fri Feb 5 13:23:36 2016 -0800
Committer: Jun Aoki <ja...@apache.org>
Committed: Fri Feb 5 13:23:36 2016 -0800

----------------------------------------------------------------------
 .../nameNode/rollback_controller.js             | 24 +++----
 .../nameNode/step3_controller.js                |  3 +
 .../nameNode/step9_controller.js                | 23 ++++---
 ambari-web/app/data/HDP2/ha_properties.js       | 68 +++++++++++++++++++-
 .../nameNode/step3_controller_test.js           | 49 ++++++++++++--
 5 files changed, 139 insertions(+), 28 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/26ad97b6/ambari-web/app/controllers/main/admin/highAvailability/nameNode/rollback_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/admin/highAvailability/nameNode/rollback_controller.js b/ambari-web/app/controllers/main/admin/highAvailability/nameNode/rollback_controller.js
index 465a1d2..6895c6c 100644
--- a/ambari-web/app/controllers/main/admin/highAvailability/nameNode/rollback_controller.js
+++ b/ambari-web/app/controllers/main/admin/highAvailability/nameNode/rollback_controller.js
@@ -251,17 +251,19 @@ App.HighAvailabilityRollbackController = App.HighAvailabilityProgressPageControl
     });
   },
   restoreHawqConfigs: function(){
-    this.loadConfigTag("hawqSiteTag");
-    var hawqSiteTag = this.get("content.hawqSiteTag");
-    App.ajax.send({
-      name: 'admin.high_availability.load_hawq_configs',
-      sender: this,
-      data: {
-        hawqSiteTag: hawqSiteTag
-      },
-      success: 'onLoadHawqConfigs',
-      error: 'onTaskError'
-    });
+    var tags = ['hawqSiteTag', 'hdfsClientTag'];
+    tags.forEach(function (tagName) {
+      var tag = this.get("content." + tagName);
+      App.ajax.send({
+        name: 'admin.high_availability.load_hawq_configs',
+        sender: this,
+        data: {
+          tagName: tag
+        },
+        success: 'onLoadHawqConfigs',
+        error: 'onTaskError'
+      });
+    }, this);
   },
 
   deletePXF: function(){

http://git-wip-us.apache.org/repos/asf/ambari/blob/26ad97b6/ambari-web/app/controllers/main/admin/highAvailability/nameNode/step3_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/admin/highAvailability/nameNode/step3_controller.js b/ambari-web/app/controllers/main/admin/highAvailability/nameNode/step3_controller.js
index b420687..4e4df60 100644
--- a/ambari-web/app/controllers/main/admin/highAvailability/nameNode/step3_controller.js
+++ b/ambari-web/app/controllers/main/admin/highAvailability/nameNode/step3_controller.js
@@ -100,6 +100,9 @@ App.HighAvailabilityWizardStep3Controller = Em.Controller.extend({
       var hawqSiteTag = data.Clusters.desired_configs['hawq-site'].tag;
       urlParams.push('(type=hawq-site&tag=' + hawqSiteTag + ')');
       this.set("hawqSiteTag", {name : "hawqSiteTag", value : hawqSiteTag});
+      var hdfsClientTag = data.Clusters.desired_configs['hdfs-client'].tag;
+      urlParams.push('(type=hdfs-client&tag=' + hdfsClientTag + ')');
+      this.set("hdfsClientTag", {name : "hdfsClientTag", value : hdfsClientTag});
     }
     App.ajax.send({
       name: 'admin.get.all_configurations',

http://git-wip-us.apache.org/repos/asf/ambari/blob/26ad97b6/ambari-web/app/controllers/main/admin/highAvailability/nameNode/step9_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/admin/highAvailability/nameNode/step9_controller.js b/ambari-web/app/controllers/main/admin/highAvailability/nameNode/step9_controller.js
index 7745c6b..934d133 100644
--- a/ambari-web/app/controllers/main/admin/highAvailability/nameNode/step9_controller.js
+++ b/ambari-web/app/controllers/main/admin/highAvailability/nameNode/step9_controller.js
@@ -118,16 +118,19 @@ App.HighAvailabilityWizardStep9Controller = App.HighAvailabilityProgressPageCont
 
   reconfigureHawq: function () {
     var data = this.get('content.serviceConfigProperties');
-    var configData = this.reconfigureSites(['hawq-site'], data, Em.I18n.t('admin.highAvailability.step4.save.configuration.note').format(App.format.role('NAMENODE')));
-    App.ajax.send({
-      name: 'common.service.configurations',
-      sender: this,
-      data: {
-        desired_config: configData
-      },
-      success: 'saveConfigTag',
-      error: 'onTaskError'
-    });
+    var reconfigureFiles = ['hawq-site', 'hdfs-client'];
+    reconfigureFiles.forEach(function (fileName) {
+      var configData = this.reconfigureSites([fileName], data, Em.I18n.t('admin.highAvailability.step4.save.configuration.note').format(App.format.role('NAMENODE')));
+      App.ajax.send({
+        name: 'common.service.configurations',
+        sender: this,
+        data: {
+          desired_config: configData
+        },
+        success: 'saveConfigTag',
+        error: 'onTaskError'
+      });
+    }, this);
   },
 
   saveConfigTag: function () {

http://git-wip-us.apache.org/repos/asf/ambari/blob/26ad97b6/ambari-web/app/data/HDP2/ha_properties.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/data/HDP2/ha_properties.js b/ambari-web/app/data/HDP2/ha_properties.js
index 8b2960d..9d268d9 100644
--- a/ambari-web/app/data/HDP2/ha_properties.js
+++ b/ambari-web/app/data/HDP2/ha_properties.js
@@ -28,7 +28,7 @@ module.exports =
       App.ServiceConfigCategory.create({ name: 'AMBARI_METRICS', displayName: 'Ambari Metrics'}),
       App.ServiceConfigCategory.create({ name: 'HAWQ', displayName: 'HAWQ'})
     ],
-    sites: ['core-site', 'hdfs-site', 'hbase-site', 'accumulo-site', 'ams-hbase-site', 'hawq-site'],
+    sites: ['core-site', 'hdfs-site', 'hbase-site', 'accumulo-site', 'ams-hbase-site', 'hawq-site', 'hdfs-client'],
     configs: [
     /**********************************************HDFS***************************************/
       {
@@ -263,6 +263,72 @@ module.exports =
         "category": "HAWQ",
         "filename": "hawq-site",
         "serviceName": 'MISC'
+      },
+      {
+        "name": "dfs.nameservices",
+        "displayName": "dfs.nameservices",
+        "description": "Comma-separated list of nameservices.",
+        "isReconfigurable": false,
+        "recommendedValue": "haCluster",
+        "value": "haCluster",
+        "category": "HAWQ",
+        "filename": "hdfs-client",
+        "serviceName": 'MISC'
+      },
+      {
+        "name": "dfs.ha.namenodes.${dfs.nameservices}",
+        "displayName": "dfs.ha.namenodes.${dfs.nameservices}",
+        "description": "The prefix for a given nameservice, contains a comma-separated list of namenodes for a given nameservice.",
+        "isReconfigurable": false,
+        "recommendedValue": "nn1,nn2",
+        "value": "nn1,nn2",
+        "category": "HAWQ",
+        "filename": "hdfs-client",
+        "serviceName": 'MISC'
+      },
+      {
+        "name": "dfs.namenode.rpc-address.${dfs.nameservices}.nn1",
+        "displayName": "dfs.namenode.rpc-address.${dfs.nameservices}.nn1",
+        "description": "RPC address that handles all clients requests for nn1.",
+        "isReconfigurable": false,
+        "recommendedValue": "0.0.0.0:8020",
+        "value": "0.0.0.0:8020",
+        "category": "HAWQ",
+        "filename": "hdfs-client",
+        "serviceName": 'MISC'
+      },
+      {
+        "name": "dfs.namenode.rpc-address.${dfs.nameservices}.nn2",
+        "displayName": "dfs.namenode.rpc-address.${dfs.nameservices}.nn2",
+        "description": "RPC address that handles all clients requests for nn2.",
+        "isReconfigurable": false,
+        "recommendedValue": "0.0.0.0:8020",
+        "value": "0.0.0.0:8020",
+        "category": "HAWQ",
+        "filename": "hdfs-client",
+        "serviceName": 'MISC'
+      },
+      {
+        "name": "dfs.namenode.http-address.${dfs.nameservices}.nn1",
+        "displayName": "dfs.namenode.http-address.${dfs.nameservices}.nn1",
+        "description": "The fully-qualified HTTP address for nn1 NameNode.",
+        "isReconfigurable": false,
+        "recommendedValue": "0.0.0.0:50070",
+        "value": "0.0.0.0:50070",
+        "category": "HAWQ",
+        "filename": "hdfs-client",
+        "serviceName": 'MISC'
+      },
+      {
+        "name": "dfs.namenode.http-address.${dfs.nameservices}.nn2",
+        "displayName": "dfs.namenode.http-address.${dfs.nameservices}.nn2",
+        "description": "The fully-qualified HTTP address for nn2 NameNode.",
+        "isReconfigurable": false,
+        "recommendedValue": "0.0.0.0:50070",
+        "value": "0.0.0.0:50070",
+        "category": "HAWQ",
+        "filename": "hdfs-client",
+        "serviceName": 'MISC'
       }
     ]
   }

http://git-wip-us.apache.org/repos/asf/ambari/blob/26ad97b6/ambari-web/test/controllers/main/admin/highAvailability/nameNode/step3_controller_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/main/admin/highAvailability/nameNode/step3_controller_test.js b/ambari-web/test/controllers/main/admin/highAvailability/nameNode/step3_controller_test.js
index 938b2c9..8067320 100644
--- a/ambari-web/test/controllers/main/admin/highAvailability/nameNode/step3_controller_test.js
+++ b/ambari-web/test/controllers/main/admin/highAvailability/nameNode/step3_controller_test.js
@@ -237,42 +237,79 @@ describe('App.HighAvailabilityWizardStep3Controller', function() {
     Em.A([
       {
         config: {
-          name: 'dfs.namenode.rpc-address.${dfs.nameservices}.nn1'
+          name: 'dfs.namenode.rpc-address.${dfs.nameservices}.nn1',
+          filename: 'hdfs-site'
         },
         value: 'h1:1111',
         name: 'dfs.namenode.rpc-address.' + nameServiceId + '.nn1'
       },
       {
         config: {
-          name: 'dfs.namenode.rpc-address.${dfs.nameservices}.nn2'
+          name: 'dfs.namenode.rpc-address.${dfs.nameservices}.nn2',
+          filename: 'hdfs-site'
         },
         value: 'h2:8020',
         name: 'dfs.namenode.rpc-address.' + nameServiceId + '.nn2'
       },
       {
         config: {
-          name: 'dfs.namenode.http-address.${dfs.nameservices}.nn1'
+          name: 'dfs.namenode.http-address.${dfs.nameservices}.nn1',
+          filename: 'hdfs-site'
         },
         value: 'h1:1234',
         name: 'dfs.namenode.http-address.' + nameServiceId + '.nn1'
       },
       {
         config: {
-          name: 'dfs.namenode.http-address.${dfs.nameservices}.nn2'
+          name: 'dfs.namenode.http-address.${dfs.nameservices}.nn2',
+          filename: 'hdfs-site'
+        },
+        value: 'h2:50070',
+        name: 'dfs.namenode.http-address.' + nameServiceId + '.nn2'
+      },{
+        config: {
+          name: 'dfs.namenode.rpc-address.${dfs.nameservices}.nn1',
+          filename: 'hdfs-client'
+        },
+        value: 'h1:1111',
+        name: 'dfs.namenode.rpc-address.' + nameServiceId + '.nn1'
+      },
+      {
+        config: {
+          name: 'dfs.namenode.rpc-address.${dfs.nameservices}.nn2',
+          filename: 'hdfs-client'
+        },
+        value: 'h2:8020',
+        name: 'dfs.namenode.rpc-address.' + nameServiceId + '.nn2'
+      },
+      {
+        config: {
+          name: 'dfs.namenode.http-address.${dfs.nameservices}.nn1',
+          filename: 'hdfs-client'
+        },
+        value: 'h1:1234',
+        name: 'dfs.namenode.http-address.' + nameServiceId + '.nn1'
+      },
+      {
+        config: {
+          name: 'dfs.namenode.http-address.${dfs.nameservices}.nn2',
+          filename: 'hdfs-client'
         },
         value: 'h2:50070',
         name: 'dfs.namenode.http-address.' + nameServiceId + '.nn2'
       },
       {
         config: {
-          name: 'dfs.namenode.https-address.${dfs.nameservices}.nn1'
+          name: 'dfs.namenode.https-address.${dfs.nameservices}.nn1',
+          filename: 'hdfs-site'
         },
         value: 'h1:4321',
         name: 'dfs.namenode.https-address.' + nameServiceId + '.nn1'
       },
       {
         config: {
-          name: 'dfs.namenode.https-address.${dfs.nameservices}.nn2'
+          name: 'dfs.namenode.https-address.${dfs.nameservices}.nn2',
+          filename: 'hdfs-site'
         },
         value: 'h2:50470',
         name: 'dfs.namenode.https-address.' + nameServiceId + '.nn2'


[25/40] ambari git commit: AMBARI-14934 Can't remove YARN or MapReduce2.(ababiichuk)

Posted by nc...@apache.org.
AMBARI-14934 Can't remove YARN or MapReduce2.(ababiichuk)


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

Branch: refs/heads/branch-dev-patch-upgrade
Commit: 315f502b0e7fed166f7d91387fa41f85e8dc891a
Parents: 94932c9
Author: ababiichuk <ab...@hortonworks.com>
Authored: Fri Feb 5 12:37:25 2016 +0200
Committer: ababiichuk <ab...@hortonworks.com>
Committed: Fri Feb 5 12:37:25 2016 +0200

----------------------------------------------------------------------
 ambari-web/app/controllers/main/service/item.js | 107 ++++++++++++----
 ambari-web/app/messages.js                      |   4 +
 ambari-web/app/models/stack_service.js          |   2 +-
 ambari-web/app/utils/ajax/ajax.js               |   5 -
 .../test/controllers/main/service/item_test.js  | 122 +++++++++++++++----
 5 files changed, 189 insertions(+), 51 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/315f502b/ambari-web/app/controllers/main/service/item.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/service/item.js b/ambari-web/app/controllers/main/service/item.js
index a26c820..1aae7cd 100644
--- a/ambari-web/app/controllers/main/service/item.js
+++ b/ambari-web/app/controllers/main/service/item.js
@@ -966,31 +966,76 @@ App.MainServiceItemController = Em.Controller.extend(App.SupportClientConfigsDow
   },
 
   /**
+   * Returns interdependent services
+   *
+   * @param serviceName
+   * @returns {string[]}
+   */
+  interDependentServices: function(serviceName) {
+    var interDependentServices = [];
+    App.StackService.find(serviceName).get('requiredServices').forEach(function(requiredService) {
+      if (App.StackService.find(requiredService).get('requiredServices').contains(serviceName)) {
+        interDependentServices.push(requiredService);
+      }
+    });
+    return interDependentServices;
+  },
+
+  /**
    * find dependent services
-   * @param {string} serviceName
+   * @param {string[]} serviceNamesToDelete
    * @returns {Array}
    */
-  findDependentServices: function(serviceName) {
+  findDependentServices: function (serviceNamesToDelete) {
     var dependentServices = [];
 
-    App.StackService.find().forEach(function(stackService) {
-      if (App.Service.find(stackService.get('serviceName')).get('isLoaded')
-          && stackService.get('requiredServices').contains(serviceName)) {
-        dependentServices.push(stackService.get('serviceName'));
+    App.Service.find().forEach(function (service) {
+      if (!serviceNamesToDelete.contains(service.get('serviceName'))) {
+        var requiredServices = App.StackService.find(service.get('serviceName')).get('requiredServices');
+        serviceNamesToDelete.forEach(function (dependsOnService) {
+          if (requiredServices.contains(dependsOnService)) {
+            dependentServices.push(service.get('serviceName'));
+          }
+        });
       }
     }, this);
     return dependentServices;
   },
 
   /**
+   * @param serviceNames
+   * @returns {string}
+   */
+  servicesDisplayNames: function(serviceNames) {
+    return serviceNames.map(function(serviceName) {
+      return App.format.role(serviceName);
+    }).join(',');
+  },
+
+  /**
+   * Is services can be removed based on work status
+   * @param serviceNames
+   */
+  allowUninstallServices: function(serviceNames) {
+    return !App.Service.find().filter(function (service) {
+      return serviceNames.contains(service.get('serviceName'));
+    }).mapProperty('workStatus').some(function (workStatus) {
+      return !App.Service.allowUninstallStates.contains(workStatus);
+    });
+  },
+
+  /**
    * delete service action
    * @param {string} serviceName
    */
   deleteService: function(serviceName) {
-    var dependentServices = this.findDependentServices(serviceName),
-        self = this,
-        displayName = App.format.role(serviceName),
-        popupHeader = Em.I18n.t('services.service.delete.popup.header');
+    var self = this,
+      interDependentServices = this.interDependentServices(serviceName),
+      serviceNamesToDelete = interDependentServices.concat(serviceName),
+      dependentServices = this.findDependentServices(serviceNamesToDelete),
+      displayName = App.format.role(serviceName),
+      popupHeader = Em.I18n.t('services.service.delete.popup.header'),
+      dependentServicesToDeleteFmt = this.servicesDisplayNames(interDependentServices);
 
     if (App.Service.find().get('length') === 1) {
       //at least one service should be installed
@@ -1002,21 +1047,26 @@ App.MainServiceItemController = Em.Controller.extend(App.SupportClientConfigsDow
       });
     } else if (dependentServices.length > 0) {
       this.dependentServicesWarning(serviceName, dependentServices);
-    } else if (App.Service.allowUninstallStates.contains(App.Service.find(serviceName).get('workStatus'))) {
+    } else if (this.allowUninstallServices(serviceNamesToDelete)) {
       App.showConfirmationPopup(
-        function() {self.confirmDeleteService(serviceName)},
-        Em.I18n.t('services.service.delete.popup.warning').format(displayName),
+        function() {self.confirmDeleteService(serviceName, interDependentServices, dependentServicesToDeleteFmt)},
+        Em.I18n.t('services.service.delete.popup.warning').format(displayName) +
+        (interDependentServices.length ? Em.I18n.t('services.service.delete.popup.warning.dependent').format(dependentServicesToDeleteFmt) : ''),
         null,
         popupHeader,
         Em.I18n.t('common.delete'),
         true
       );
     } else {
+      var body = Em.I18n.t('services.service.delete.popup.mustBeStopped').format(displayName);
+      if (interDependentServices.length) {
+        body += Em.I18n.t('services.service.delete.popup.mustBeStopped.dependent').format(dependentServicesToDeleteFmt)
+      }
       App.ModalPopup.show({
         secondary: null,
         header: popupHeader,
         encodeBody: false,
-        body: Em.I18n.t('services.service.delete.popup.mustBeStopped').format(displayName)
+        body: body
       });
     }
   },
@@ -1048,9 +1098,13 @@ App.MainServiceItemController = Em.Controller.extend(App.SupportClientConfigsDow
   /**
    * Confirmation popup of service deletion
    * @param {string} serviceName
+   * @param {string[]} [dependentServiceNames]
+   * @param {string} [servicesToDeleteFmt]
    */
-  confirmDeleteService: function (serviceName) {
-    var message = Em.I18n.t('services.service.confirmDelete.popup.body').format(App.format.role(serviceName)),
+  confirmDeleteService: function (serviceName, dependentServiceNames, servicesToDeleteFmt) {
+    var message = dependentServiceNames && dependentServiceNames.length
+        ? Em.I18n.t('services.service.confirmDelete.popup.body.dependent').format(App.format.role(serviceName), servicesToDeleteFmt)
+        : Em.I18n.t('services.service.confirmDelete.popup.body').format(App.format.role(serviceName)),
         confirmKey = 'yes',
         self = this;
 
@@ -1060,7 +1114,7 @@ App.MainServiceItemController = Em.Controller.extend(App.SupportClientConfigsDow
        * @function onPrimary
        */
       onPrimary: function() {
-        self.deleteServiceCall(serviceName);
+        self.deleteServiceCall([serviceName].concat(dependentServiceNames));
         this._super();
       },
 
@@ -1105,22 +1159,31 @@ App.MainServiceItemController = Em.Controller.extend(App.SupportClientConfigsDow
 
   /**
    * Ajax call to delete service
-   * @param {string} serviceName
+   * @param {string[]} serviceNames
    * @returns {$.ajax}
    */
-  deleteServiceCall: function(serviceName) {
+  deleteServiceCall: function(serviceNames) {
+    var serviceToDeleteNow = serviceNames[0];
+    if (serviceNames.length > 1) {
+      var servicesToDeleteNext = serviceNames.slice(1);
+    }
     return App.ajax.send({
-      name : 'service.item.delete',
+      name : 'common.delete.service',
       sender: this,
       data : {
-        serviceName : serviceName
+        serviceName : serviceToDeleteNow,
+        servicesToDeleteNext: servicesToDeleteNext
       },
       success : 'deleteServiceCallSuccessCallback'
     });
   },
 
   deleteServiceCallSuccessCallback: function(data, ajaxOptions, params) {
-    window.location.reload();
+    if (params.servicesToDeleteNext) {
+      this.deleteServiceCall(params.servicesToDeleteNext);
+    } else {
+      window.location.reload();
+    }
   }
 
 });

http://git-wip-us.apache.org/repos/asf/ambari/blob/315f502b/ambari-web/app/messages.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/messages.js b/ambari-web/app/messages.js
index e341de4..f24876b 100644
--- a/ambari-web/app/messages.js
+++ b/ambari-web/app/messages.js
@@ -1693,12 +1693,16 @@ Em.I18n.translations = {
   'services.service.delete.lastService.popup.body': 'The <b>{0}</b> service can\'t be deleted, at least one service must be installed.',
   'services.service.delete.popup.dependentServices': 'Prior to deleting <b>{0}</b>, you must delete the following dependent services:',
   'services.service.delete.popup.mustBeStopped': 'Prior to deleting <b>{0}</b>, you must stop the service.',
+  'services.service.delete.popup.mustBeStopped.dependent': ' Along with dependent service <b>{0}</b>.',
   'services.service.delete.popup.warning': 'The <b>{0} service will be removed from Ambari and all configurations' +
   ' and configuration history will be lost.</b>',
+  'services.service.delete.popup.warning.dependent': '<b>Note! {0} will be deleted too.</b>',
   'services.service.confirmDelete.popup.header': 'Confirm Delete',
   'services.service.confirmDelete.popup.body': 'You must confirm delete of <b>{0}</b> by typing "yes"' +
   ' in the confirmation box. <b>This operation is not reversible and all configuration history will be lost.</b>',
 
+  'services.service.confirmDelete.popup.body.dependent': 'You must confirm delete of <b>{0}</b> and <b>{1}</b> by typing "yes"' +
+  ' in the confirmation box. <b>This operation is not reversible and all configuration history will be lost.</b>',
   'services.service.summary.unknown':'unknown',
   'services.service.summary.notRunning':'Not Running',
   'services.service.summary.notAvailable':'n/a',

http://git-wip-us.apache.org/repos/asf/ambari/blob/315f502b/ambari-web/app/models/stack_service.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/models/stack_service.js b/ambari-web/app/models/stack_service.js
index a7f5f4e..5814386 100644
--- a/ambari-web/app/models/stack_service.js
+++ b/ambari-web/app/models/stack_service.js
@@ -42,7 +42,7 @@ App.StackService = DS.Model.extend({
   stack: DS.belongsTo('App.Stack'),
   serviceComponents: DS.hasMany('App.StackServiceComponent'),
   configs: DS.attr('array'),
-  requiredServices: DS.attr('array'),
+  requiredServices: DS.attr('array', {defaultValue: []}),
 
   /**
    * @type {String[]}

http://git-wip-us.apache.org/repos/asf/ambari/blob/315f502b/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 423941f..8b89365 100644
--- a/ambari-web/app/utils/ajax/ajax.js
+++ b/ambari-web/app/utils/ajax/ajax.js
@@ -498,11 +498,6 @@ var urls = {
       };
     }
   },
-  'service.item.delete': {
-    'real': '/clusters/{clusterName}/services/{serviceName}',
-    'mock': '',
-    'type': 'DELETE'
-  },
   'service.item.smoke': {
     'real': '/clusters/{clusterName}/requests',
     'mock': '/data/wizard/deploy/poll_1.json',

http://git-wip-us.apache.org/repos/asf/ambari/blob/315f502b/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 90a1d90..8fb772a 100644
--- a/ambari-web/test/controllers/main/service/item_test.js
+++ b/ambari-web/test/controllers/main/service/item_test.js
@@ -28,6 +28,28 @@ require('controllers/main/service/reassign_controller');
 require('controllers/main/service/item');
 var batchUtils = require('utils/batch_scheduled_requests');
 var testHelpers = require('test/helpers');
+var stackSerivceModel = {
+  'HDFS': Em.Object.create({
+    serviceName: 'HDFS',
+    requiredServices: ['ZOOKEEPER']
+  }),
+  'YARN': Em.Object.create({
+    serviceName: 'YARN',
+    requiredServices: ['MAPREDUCE2', 'HDFS']
+  }),
+  'MAPREDUCE2': Em.Object.create({
+    serviceName: 'MAPREDUCE2',
+    requiredServices: ['YARN']
+  }),
+  'TEZ': Em.Object.create({
+    serviceName: 'TEZ',
+    requiredServices: ['YARN']
+  }),
+  'HIVE': Em.Object.create({
+    serviceName: 'HIVE',
+    requiredServices: ['YARN', 'TEZ']
+  })
+};
 
 describe('App.MainServiceItemController', function () {
 
@@ -1182,35 +1204,50 @@ describe('App.MainServiceItemController', function () {
 
     beforeEach(function() {
       mainServiceItemController = App.MainServiceItemController.create({});
-      this.mockStackService = sinon.stub(App.StackService, 'find');
+      sinon.stub(App.StackService, 'find', function (serviceName) {
+        return stackSerivceModel[serviceName];
+      });
       this.mockService = sinon.stub(App.Service, 'find');
     });
     afterEach(function() {
-      this.mockStackService.restore();
+      App.StackService.find.restore();
       this.mockService.restore();
     });
 
-    it("no stack services", function() {
-      this.mockStackService.returns([]);
-      expect(mainServiceItemController.findDependentServices('S1')).to.be.empty;
+    it("no services", function() {
+      this.mockService.returns([]);
+      expect(mainServiceItemController.findDependentServices(['S1'])).to.be.empty;
     });
 
-    it("dependent service not installed", function() {
-      this.mockStackService.returns([Em.Object.create({serviceName: 'S2'})]);
-      this.mockService.withArgs('S2').returns(Em.Object.create({isLoaded: false}));
-      expect(mainServiceItemController.findDependentServices('S1')).to.be.empty;
+    it("service has dependencies", function() {
+      this.mockService.returns([
+        Em.Object.create({ serviceName: 'HDFS' }),
+        Em.Object.create({ serviceName: 'YARN' }),
+        Em.Object.create({ serviceName: 'MAPREDUCE2' }),
+        Em.Object.create({ serviceName: 'TEZ' }),
+        Em.Object.create({ serviceName: 'HIVE' })
+      ]);
+      expect(mainServiceItemController.findDependentServices(['YARN', 'MAPREDUCE2'])).to.eql(['TEZ', 'HIVE']);
     });
 
     it("service has no dependencies", function() {
-      this.mockStackService.returns([Em.Object.create({serviceName: 'S2', requiredServices: []})]);
-      this.mockService.withArgs('S2').returns(Em.Object.create({isLoaded: true}));
-      expect(mainServiceItemController.findDependentServices('S1')).to.be.empty;
+       this.mockService.returns([
+         Em.Object.create({ serviceName: 'HDFS' }),
+         Em.Object.create({ serviceName: 'YARN' }),
+         Em.Object.create({ serviceName: 'MAPREDUCE2' }),
+         Em.Object.create({ serviceName: 'TEZ' }),
+         Em.Object.create({ serviceName: 'HIVE' })
+      ]);
+      expect(mainServiceItemController.findDependentServices(['HIVE'])).to.be.empty;
     });
 
-    it("service has dependencies", function() {
-      this.mockStackService.returns([Em.Object.create({serviceName: 'S2', requiredServices: ['S1']})]);
-      this.mockService.withArgs('S2').returns(Em.Object.create({isLoaded: true}));
-      expect(mainServiceItemController.findDependentServices('S1')).to.eql(['S2']);
+    it("service has no dependencies (except interdependent)", function() {
+      this.mockService.returns([
+        Em.Object.create({ serviceName: 'HDFS' }),
+        Em.Object.create({ serviceName: 'YARN' }),
+        Em.Object.create({ serviceName: 'MAPREDUCE2' })
+      ]);
+      expect(mainServiceItemController.findDependentServices(['YARN', 'MAPREDUCE2'])).to.be.empty;
     });
 
   });
@@ -1222,12 +1259,20 @@ describe('App.MainServiceItemController', function () {
       mainServiceItemController = App.MainServiceItemController.create({});
       this.mockDependentServices = sinon.stub(mainServiceItemController, 'findDependentServices');
       sinon.stub(mainServiceItemController, 'dependentServicesWarning');
+      sinon.stub(mainServiceItemController, 'servicesDisplayNames', function(servicesDisplayNames) {
+        return servicesDisplayNames;
+      });
+      sinon.stub(mainServiceItemController, 'interDependentServices').returns([]);
+      this.allowUninstallServices = sinon.stub(mainServiceItemController, 'allowUninstallServices');
       this.mockService = sinon.stub(App.Service, 'find');
       sinon.stub(App, 'showConfirmationPopup');
       sinon.stub(App.ModalPopup, 'show');
       sinon.stub(App.format, 'role', function(name) {return name});
     });
     afterEach(function() {
+      mainServiceItemController.allowUninstallServices.restore();
+      mainServiceItemController.interDependentServices.restore();
+      mainServiceItemController.servicesDisplayNames.restore();
       this.mockDependentServices.restore();
       this.mockService.restore();
       mainServiceItemController.dependentServicesWarning.restore();
@@ -1250,21 +1295,23 @@ describe('App.MainServiceItemController', function () {
 
     it("service has installed dependent services", function() {
       this.mockDependentServices.returns(['S2']);
-      this.mockService.returns(Em.Object.create({workStatus: App.Service.statesMap.stopped}));
+      this.mockService.returns([Em.Object.create({workStatus: App.Service.statesMap.stopped}), Em.Object.create({workStatus: App.Service.statesMap.stopped})]);
       mainServiceItemController.deleteService('S1');
       expect(mainServiceItemController.dependentServicesWarning.calledWith('S1', ['S2'])).to.be.true;
     });
 
     it("service has not dependent services, and stopped", function() {
       this.mockDependentServices.returns([]);
-      this.mockService.returns(Em.Object.create({workStatus: App.Service.statesMap.stopped}));
+      this.allowUninstallServices.returns(true);
+      this.mockService.returns([Em.Object.create({workStatus: App.Service.statesMap.stopped}), Em.Object.create({workStatus: App.Service.statesMap.stopped})]);
       mainServiceItemController.deleteService('S1');
       expect(App.showConfirmationPopup.calledOnce).to.be.true;
     });
 
     it("service has not dependent services, and install failed", function() {
       this.mockDependentServices.returns([]);
-      this.mockService.returns(Em.Object.create({workStatus: App.Service.statesMap.install_failed}));
+      this.allowUninstallServices.returns(true);
+      this.mockService.returns([Em.Object.create({workStatus: App.Service.statesMap.install_failed}), Em.Object.create({workStatus: App.Service.statesMap.install_failed})]);
       mainServiceItemController.deleteService('S1');
       expect(App.showConfirmationPopup.calledOnce).to.be.true;
     });
@@ -1318,6 +1365,26 @@ describe('App.MainServiceItemController', function () {
     });
   });
 
+  describe('#interDependentServices', function() {
+    var mainServiceItemController;
+
+    beforeEach(function() {
+      sinon.stub(App.StackService, 'find', function (serviceName) {
+        return stackSerivceModel[serviceName];
+      });
+      mainServiceItemController = App.MainServiceItemController.create({});
+    });
+
+    afterEach(function() {
+      App.StackService.find.restore();
+    });
+
+    it('get interdependent services', function() {
+      expect(mainServiceItemController.interDependentServices('YARN')).to.eql(['MAPREDUCE2']);
+      expect(mainServiceItemController.interDependentServices('MAPREDUCE2')).to.eql(['YARN']);
+    });
+  });
+
   describe("#deleteServiceCall()", function() {
     var mainServiceItemController;
 
@@ -1326,12 +1393,13 @@ describe('App.MainServiceItemController', function () {
     });
 
     it("App.ajax.send should be called", function() {
-      mainServiceItemController.deleteServiceCall('S1');
-      var args = testHelpers.findAjaxRequest('name', 'service.item.delete');
+      mainServiceItemController.deleteServiceCall(['S1', 'S2']);
+      var args = testHelpers.findAjaxRequest('name', 'common.delete.service');
       expect(args[0]).exists;
       expect(args[0].sender).to.be.eql(mainServiceItemController);
       expect(args[0].data).to.be.eql({
-        serviceName : 'S1'
+        serviceName : 'S1',
+        servicesToDeleteNext: ['S2']
       });
     });
   });
@@ -1342,15 +1410,23 @@ describe('App.MainServiceItemController', function () {
     beforeEach(function() {
       mainServiceItemController = App.MainServiceItemController.create({});
       sinon.stub(window.location, 'reload');
+      sinon.spy(mainServiceItemController, 'deleteServiceCall');
     });
     afterEach(function() {
       window.location.reload.restore();
     });
 
     it("window.location.reload should be called", function() {
-      mainServiceItemController.deleteServiceCallSuccessCallback();
+      mainServiceItemController.deleteServiceCallSuccessCallback([], null, {});
+      expect(mainServiceItemController.deleteServiceCall.called).to.be.false;
       expect(window.location.reload.calledOnce).to.be.true;
     });
+
+    it("deleteServiceCall should be called", function() {
+      mainServiceItemController.deleteServiceCallSuccessCallback([], null, {servicesToDeleteNext: true});
+      expect(mainServiceItemController.deleteServiceCall.calledOnce).to.be.true;
+      expect(window.location.reload.called).to.be.false;
+    });
   });
 
 });


[40/40] ambari git commit: Merge branch 'trunk' into branch-dev-patch-upgrade

Posted by nc...@apache.org.
Merge branch 'trunk' into branch-dev-patch-upgrade


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

Branch: refs/heads/branch-dev-patch-upgrade
Commit: c11a41138b02994e54070177efc99241bebfade0
Parents: 0f2c337 f57f9b2
Author: Nate Cole <nc...@hortonworks.com>
Authored: Fri Feb 5 16:55:44 2016 -0500
Committer: Nate Cole <nc...@hortonworks.com>
Committed: Fri Feb 5 16:55:44 2016 -0500

----------------------------------------------------------------------
 .../loginActivities/LoginActivitiesMainCtrl.js  |   4 +-
 .../loginActivities/LoginMessageMainCtrl.js     |   5 +-
 .../stackVersions/StackVersionsCreateCtrl.js    |   2 +-
 .../stackVersions/StackVersionsEditCtrl.js      |  10 +
 .../ui/admin-web/app/scripts/i18n.config.js     |   6 +-
 .../ui/admin-web/app/scripts/routes.js          |   9 +-
 .../admin-web/app/scripts/services/Cluster.js   |  15 +-
 .../ui/admin-web/app/scripts/services/Stack.js  |   2 +-
 .../ui/admin-web/app/views/leftNavbar.html      |   2 +-
 .../app/views/loginActivities/loginMessage.html |  25 +-
 .../app/views/loginActivities/main.html         |   4 +-
 .../src/main/resources/ui/admin-web/gulpfile.js |   1 -
 ambari-agent/pom.xml                            | 118 +++++--
 .../src/main/package/dependencies.properties    |  32 ++
 .../libraries/functions/conf_select.py          |   2 +-
 .../src/main/repo/install_ambari_tarball.py     | 250 +++++++++++++
 ambari-metrics/ambari-metrics-assembly/pom.xml  | 348 +++++++++++++------
 .../src/main/assembly/grafana.xml               |  59 ++++
 ambari-metrics/ambari-metrics-grafana/README.md | 243 +++++++++++++
 .../ambari-metrics/datasource.js                | 304 ++++++++++++++++
 .../ambari-metrics/directives.js                |  36 ++
 .../ambari-metrics/partials/config.html         |  19 +
 .../ambari-metrics/partials/query.editor.html   | 133 +++++++
 .../ambari-metrics/partials/query.options.html  |  42 +++
 .../ambari-metrics/plugin.json                  |  14 +
 .../ambari-metrics/queryCtrl.js                 | 131 +++++++
 .../conf/unix/ambari-metrics-grafana            | 181 ++++++++++
 .../conf/unix/ams-grafana-env.sh                |  29 ++
 .../conf/unix/ams-grafana.ini                   | 255 ++++++++++++++
 ambari-metrics/ambari-metrics-grafana/pom.xml   | 125 +++++++
 .../screenshots/1-add-datasource.png            | Bin 0 -> 108602 bytes
 .../screenshots/10-choose-hostname.png          | Bin 0 -> 298654 bytes
 .../11-choose-agg-rate-precision.png            | Bin 0 -> 276486 bytes
 .../screenshots/12-change-panel-title.png       | Bin 0 -> 258642 bytes
 .../screenshots/13-save-dashboard.png           | Bin 0 -> 262005 bytes
 .../screenshots/14-change-timerange.png         | Bin 0 -> 310766 bytes
 .../screenshots/15-change-units.png             | Bin 0 -> 322069 bytes
 .../screenshots/16-display-style-graph-1.png    | Bin 0 -> 285467 bytes
 .../screenshots/17-series-specific-override.png | Bin 0 -> 302825 bytes
 .../screenshots/18-override-time.png            | Bin 0 -> 255655 bytes
 .../screenshots/19-edit-graph.png               | Bin 0 -> 191904 bytes
 .../screenshots/2-datasource-details.png        | Bin 0 -> 125313 bytes
 .../screenshots/3-test-datasource.png           | Bin 0 -> 136121 bytes
 .../screenshots/4-dashboard-dropdown.png        | Bin 0 -> 126964 bytes
 .../screenshots/5-dashboard-graph-menu.png      | Bin 0 -> 146851 bytes
 .../screenshots/6-graph-panels.png              | Bin 0 -> 105383 bytes
 .../screenshots/7-choose-datasource.png         | Bin 0 -> 246860 bytes
 .../screenshots/8-choose-component.png          | Bin 0 -> 199123 bytes
 .../screenshots/9-choose-metric.png             | Bin 0 -> 216473 bytes
 .../screenshots/add-dashboard.png               | Bin 0 -> 107965 bytes
 .../screenshots/full-dashboard.png              | Bin 0 -> 161956 bytes
 .../src/main/assemblies/empty.xml               |  21 ++
 .../metrics/timeline/PhoenixHBaseAccessor.java  |  53 +--
 .../webapp/TimelineWebServices.java             |   7 +-
 .../timeline/AbstractMiniHBaseClusterTest.java  |   1 +
 .../timeline/PhoenixHBaseAccessorTest.java      |   2 +-
 ambari-metrics/pom.xml                          |   5 +
 ambari-server/conf/unix/install-helper.sh       |  52 +--
 ambari-server/pom.xml                           | 148 +++++---
 ambari-server/src/main/assemblies/server.xml    |   2 +-
 .../ambari/server/agent/HeartbeatMonitor.java   |  45 ++-
 .../resources/ClusterResourceDefinition.java    |   3 +-
 .../ambari/server/checks/CheckDescription.java  |   8 +
 .../HardcodedStackVersionPropertiesCheck.java   | 132 +++++++
 .../server/configuration/Configuration.java     |   8 +
 .../AmbariManagementControllerImpl.java         |  44 ++-
 .../ambari/server/controller/AmbariServer.java  |  22 +-
 .../server/controller/KerberosHelper.java       |  26 +-
 .../server/controller/KerberosHelperImpl.java   |   5 +
 .../internal/AlertTargetResourceProvider.java   |  12 +-
 .../BlueprintConfigurationProcessor.java        | 206 +++++++----
 .../serveraction/upgrades/FixLzoCodecPath.java  | 103 ++++++
 .../upgrades/OozieConfigCalculation.java        |  94 +++++
 .../topology/ClusterConfigurationRequest.java   |  63 +++-
 .../ambari/server/topology/Configuration.java   |  15 +
 .../server/upgrade/UpgradeCatalog222.java       |  46 +++
 .../src/main/package/deb/control/postinst       |   6 +-
 .../src/main/package/deb/control/preinst        |  23 +-
 .../src/main/package/deb/control/prerm          |   6 +-
 .../src/main/package/dependencies.properties    |  33 ++
 .../0.1.0/configuration/ams-grafana-env.xml     |  59 ++++
 .../0.1.0/configuration/ams-grafana-ini.xml     | 282 +++++++++++++++
 .../0.1.0/configuration/ams-site.xml            |   4 +-
 .../AMBARI_METRICS/0.1.0/metainfo.xml           |  18 +
 .../AMBARI_METRICS/0.1.0/package/scripts/ams.py |  30 ++
 .../0.1.0/package/scripts/metrics_collector.py  |   2 +-
 .../0.1.0/package/scripts/metrics_grafana.py    |  65 ++++
 .../0.1.0/package/scripts/metrics_monitor.py    |   2 +-
 .../0.1.0/package/scripts/params.py             |   9 +
 .../0.1.0/package/scripts/status.py             |   4 +
 .../0.1.0/package/scripts/status_params.py      |   1 +
 .../OOZIE/4.0.0.2.0/configuration/oozie-env.xml |   3 +
 .../OOZIE/4.2.0.2.3/configuration/oozie-env.xml |   3 +
 .../stacks/HDP/2.0.6/role_command_order.json    |   8 +-
 .../stacks/HDP/2.0.6/services/stack_advisor.py  |  32 +-
 .../HDP/2.1/upgrades/nonrolling-upgrade-2.3.xml |  12 +
 .../services/OOZIE/configuration/oozie-env.xml  |   3 +
 .../services/RANGER/themes/theme_version_1.json |  20 +-
 .../HDP/2.2/upgrades/nonrolling-upgrade-2.2.xml |  12 +
 .../HDP/2.2/upgrades/nonrolling-upgrade-2.3.xml |  13 +-
 .../HDP/2.2/upgrades/nonrolling-upgrade-2.4.xml |  12 +
 .../stacks/HDP/2.2/upgrades/upgrade-2.2.xml     |   8 +
 .../stacks/HDP/2.2/upgrades/upgrade-2.3.xml     |   7 +
 .../stacks/HDP/2.2/upgrades/upgrade-2.4.xml     |   8 +
 .../services/RANGER/themes/theme_version_2.json |  20 +-
 .../HDP/2.3/upgrades/nonrolling-upgrade-2.3.xml |  15 +
 .../HDP/2.3/upgrades/nonrolling-upgrade-2.4.xml |  18 +-
 .../stacks/HDP/2.3/upgrades/upgrade-2.3.xml     |   8 +
 .../stacks/HDP/2.3/upgrades/upgrade-2.4.xml     |   8 +
 .../HDP/2.4/upgrades/nonrolling-upgrade-2.4.xml |  15 +
 .../stacks/HDP/2.4/upgrades/upgrade-2.4.xml     |   8 +
 ...ardcodedStackVersionPropertiesCheckTest.java |  60 ++++
 .../AmbariManagementControllerImplTest.java     |  12 +
 .../server/controller/AmbariServerTest.java     |   9 +
 .../server/controller/KerberosHelperTest.java   |  66 +++-
 .../AlertTargetResourceProviderTest.java        | 150 +++++++-
 .../BlueprintConfigurationProcessorTest.java    | 243 ++++++++++++-
 .../upgrades/FixLzoCodecPathTest.java           |  76 ++++
 .../upgrades/OozieConfigCalculationTest.java    |  87 +++++
 .../ClusterConfigurationRequestTest.java        | 172 ++++++++-
 .../ClusterInstallWithoutStartTest.java         |   2 +
 .../server/topology/ConfigurationTest.java      |  14 +
 .../server/topology/TopologyManagerTest.java    |   2 +
 .../server/upgrade/UpgradeCatalog222Test.java   |  81 +++++
 .../AMBARI_METRICS/test_metrics_grafana.py      |  75 ++++
 .../stacks/2.0.6/common/test_stack_advisor.py   |  54 ++-
 .../python/stacks/2.0.6/configs/default.json    |   9 +
 ambari-web/app/assets/licenses/NOTICE.txt       |   5 +-
 ambari-web/app/assets/test/tests.js             |   2 +
 ambari-web/app/config.js                        |   4 +-
 ambari-web/app/controllers.js                   |   4 +
 .../app/controllers/global/update_controller.js |   4 +-
 .../hawq/activateStandby/step1_controller.js    |  23 ++
 .../hawq/activateStandby/step2_controller.js    | 105 ++++++
 .../hawq/activateStandby/step3_controller.js    | 126 +++++++
 .../hawq/activateStandby/wizard_controller.js   | 128 +++++++
 .../nameNode/rollback_controller.js             |  34 +-
 .../nameNode/step3_controller.js                |   3 +
 .../nameNode/step9_controller.js                |  23 +-
 .../main/admin/highAvailability_controller.js   |   9 +
 .../main/admin/service_auto_start.js            |  21 +-
 .../alerts/definition_configs_controller.js     |  13 +-
 .../manage_alert_notifications_controller.js    |   7 +
 ambari-web/app/controllers/main/host/details.js |  39 ++-
 ambari-web/app/controllers/main/service/item.js | 112 ++++--
 .../app/controllers/wizard/step7_controller.js  |   2 +-
 .../HDP2.3/hawq_activate_standby_properties.js  |  43 +++
 ambari-web/app/data/HDP2.3/site_properties.js   |   7 +
 ambari-web/app/data/HDP2/ha_properties.js       |  68 +++-
 ambari-web/app/data/controller_route.js         |   4 +
 ambari-web/app/messages.js                      |  60 +++-
 ambari-web/app/mixins.js                        |   1 +
 .../app/mixins/common/infinite_scroll_mixin.js  | 173 +++++++++
 .../wizard/wizardProgressPageController.js      |  30 ++
 ambari-web/app/models/alerts/alert_config.js    |   1 +
 ambari-web/app/models/host_component.js         |   9 +-
 ambari-web/app/models/stack_service.js          |   2 +-
 ambari-web/app/router.js                        |   2 +-
 .../app/routes/activate_hawq_standby_routes.js  | 179 ++++++++++
 ambari-web/app/routes/main.js                   |  13 +
 ambari-web/app/styles/alerts.less               |   2 +-
 ambari-web/app/styles/application.less          |   7 +-
 ambari-web/app/styles/log_file_search.less      | 155 +++++++++
 ambari-web/app/styles/widgets.less              |  71 ++--
 .../app/templates/common/log_file_search.hbs    | 109 ++++++
 .../hawq/activateStandby/step1.hbs              |  28 ++
 .../hawq/activateStandby/step2.hbs              |  53 +++
 .../hawq/activateStandby/step3.hbs              |  18 +
 .../hawq/activateStandby/wizard.hbs             |  44 +++
 .../templates/main/admin/service_auto_start.hbs |  11 +-
 ambari-web/app/templates/main/host/logs.hbs     |  62 ++++
 ambari-web/app/templates/main/service/item.hbs  |   2 +-
 ambari-web/app/utils/ajax/ajax.js               |  11 +-
 .../hawq_activate_standby_config_initializer.js |  53 +++
 .../utils/configs/hawq_ha_config_initializer.js |   2 +-
 ambari-web/app/utils/db.js                      |   1 +
 ambari-web/app/views.js                         |   8 +
 .../configs/widgets/config_widget_view.js       |   3 +
 .../app/views/common/form/datepicker_view.js    |  37 ++
 .../app/views/common/log_file_search_view.js    | 272 +++++++++++++++
 .../modal_popups/log_file_search_popup.js       |  26 ++
 .../app/views/common/quick_view_link_view.js    |  14 +-
 ambari-web/app/views/main/admin.js              |  12 +-
 .../hawq/activateStandby/step1_view.js          |  26 ++
 .../hawq/activateStandby/step2_view.js          |  29 ++
 .../hawq/activateStandby/step3_view.js          |  36 ++
 .../hawq/activateStandby/wizard_view.js         |  74 ++++
 .../app/views/main/admin/service_auto_start.js  |  64 +++-
 ambari-web/app/views/main/host/logs_view.js     | 147 ++++++++
 ambari-web/app/views/main/host/menu.js          |  11 +-
 ambari-web/app/views/main/menu.js               |  12 +-
 ambari-web/app/views/main/service/item.js       |   2 +
 ambari-web/config.coffee                        |   2 +
 ambari-web/karma.conf.js                        |   1 +
 ambari-web/pom.xml                              |   3 +-
 .../activateStandby/step2_controller_test.js    |  87 +++++
 .../nameNode/step3_controller_test.js           |  49 ++-
 .../definitions_configs_controller_test.js      |  26 ++
 .../test/controllers/main/service/item_test.js  | 122 +++++--
 .../test/controllers/wizard/step7_test.js       |  20 +-
 .../views/common/log_file_search_view_test.js   | 103 ++++++
 .../test/views/common/quick_link_view_test.js   |  13 +-
 ambari-web/test/views/main/host/menu_test.js    |  20 +-
 .../vendor/scripts/bootstrap-contextmenu.js     | 205 +++++++++++
 pom.xml                                         |  22 +-
 205 files changed, 8085 insertions(+), 664 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/c11a4113/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/stackVersions/StackVersionsCreateCtrl.js
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/ambari/blob/c11a4113/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/stackVersions/StackVersionsEditCtrl.js
----------------------------------------------------------------------
diff --cc ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/stackVersions/StackVersionsEditCtrl.js
index 9c5b2eb,39a6700..cd9cf40
--- a/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/stackVersions/StackVersionsEditCtrl.js
+++ b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/stackVersions/StackVersionsEditCtrl.js
@@@ -80,37 -69,58 +80,47 @@@ angular.module('ambariAdminConsole'
      });
    };
  
 -  $scope.isDeletable = function() {
 -    return !($scope.repoStatus == 'current' || $scope.repoStatus == 'installed');
 +  /**
 +   * Load supported OS list
 +   */
 +  $scope.afterStackVersionRead = function () {
 +    Stack.getSupportedOSList($scope.upgradeStack.stack_name, $scope.upgradeStack.stack_version)
 +      .then(function (data) {
 +        var operatingSystems = data.operating_systems;
 +        operatingSystems.map(function (os) {
 +          var existingOSHash = {};
 +          angular.forEach($scope.osList, function (os) {
 +            existingOSHash[os.OperatingSystems.os_type] = os;
 +          });
 +          // if os not in the list, mark as un-selected, add this to the osList
 +          if (!existingOSHash[os.OperatingSystems.os_type]) {
 +            os.selected = false;
 +            os.repositories.forEach(function(repo) {
 +              repo.Repositories.base_url = '';
 +            });
 +            $scope.osList.push(os);
 +          }
 +        });
 +      })
 +      .catch(function (data) {
 +        Alert.error($t('versions.alerts.osListError'), data.message);
 +      });
    };
  
 -  $scope.addMissingOSList = function() {
 -    return Stack.getSupportedOSList($scope.stackName, $scope.stackVersion)
 -    .then(function (data) {
 -      var existingOSHash = {};
 -      angular.forEach($scope.osList, function (os) {
 -        existingOSHash[os.OperatingSystems.os_type] = os;
 -      });
 -      var osList = data.operating_systems.map(function (os) {
 -        return existingOSHash[os.OperatingSystems.os_type] || {
 -          OperatingSystems: {
 -            os_type : os.OperatingSystems.os_type
 -          },
 -          repositories: [
 -            {
 -              Repositories: {
 -                base_url: '',
 -                repo_id: 'HDP-' + $routeParams.versionId,
 -                repo_name: 'HDP'
 -              }
 -            },
 -            {
 -              Repositories: {
 -                base_url: '',
 -                repo_id: 'HDP-UTILS-' + $routeParams.versionId,
 -                repo_name: 'HDP-UTILS'
 -              }
 -            }
 -          ],
 -          selected: false
 -        };
 -      });
 -      $scope.osList = osList;
 -    })
 -    .catch(function (data) {
 -      Alert.error($t('versions.alerts.osListError'), data.message);
 -    });
 +  $scope.isDeletable = function() {
 +    return !($scope.repoStatus == 'current' || $scope.repoStatus == 'installed');
    };
  
+   $scope.disableUnusedOS = function() {
+     Cluster.getClusterOS().then(function(usedOS){
+       angular.forEach($scope.osList, function (os) {
+         if (os.OperatingSystems.os_type !== usedOS) {
+           os.disabled = true;
+         }
+       });
+     });
+   };
+ 
    $scope.defaulfOSRepos = {};
  
    $scope.save = function () {

http://git-wip-us.apache.org/repos/asf/ambari/blob/c11a4113/ambari-admin/src/main/resources/ui/admin-web/app/scripts/i18n.config.js
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/ambari/blob/c11a4113/ambari-admin/src/main/resources/ui/admin-web/app/scripts/services/Stack.js
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/ambari/blob/c11a4113/ambari-server/src/main/java/org/apache/ambari/server/configuration/Configuration.java
----------------------------------------------------------------------


[15/40] ambari git commit: AMBARI-14786. Localhost configuration value for multiple host properties does not work properly. (Daniel Gergely via rnettleton)

Posted by nc...@apache.org.
AMBARI-14786. Localhost configuration value for multiple host properties does not work properly. (Daniel Gergely via rnettleton)


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

Branch: refs/heads/branch-dev-patch-upgrade
Commit: 7616e0f5d6939509d1914857dc03150eacc9e3b9
Parents: 8ff0b5e
Author: Bob Nettleton <rn...@hortonworks.com>
Authored: Thu Feb 4 14:06:34 2016 -0500
Committer: Bob Nettleton <rn...@hortonworks.com>
Committed: Thu Feb 4 14:07:02 2016 -0500

----------------------------------------------------------------------
 .../BlueprintConfigurationProcessor.java        | 206 ++++++++++------
 .../BlueprintConfigurationProcessorTest.java    | 243 ++++++++++++++++++-
 2 files changed, 370 insertions(+), 79 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/7616e0f5/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/BlueprintConfigurationProcessor.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/BlueprintConfigurationProcessor.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/BlueprintConfigurationProcessor.java
index 9f42901..de31a0d 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/BlueprintConfigurationProcessor.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/BlueprintConfigurationProcessor.java
@@ -126,6 +126,11 @@ public class BlueprintConfigurationProcessor {
   private static Pattern HOSTGROUP_PORT_REGEX = Pattern.compile("%HOSTGROUP::(\\S+?)%:?(\\d+)?");
 
   /**
+   * Compiled regex for hostgroup token with port information.
+   */
+  private static Pattern LOCALHOST_PORT_REGEX = Pattern.compile("localhost:?(\\d+)?");
+
+  /**
    * Statically-defined set of properties that can support HA using a nameservice name
    *   in the configuration, rather than just a host name.
    *   This set also contains other HA properties that will be exported if the
@@ -1583,7 +1588,9 @@ public class BlueprintConfigurationProcessor {
      */
     private final boolean usePrefixForEachHost;
 
-    private final Set<String> setOfKnownURLSchemes = Collections.singleton("thrift://");
+    private final boolean useSuffixForEachHost;
+
+    private final boolean usePortForEachHost;
 
     /**
      * Constructor.
@@ -1591,7 +1598,7 @@ public class BlueprintConfigurationProcessor {
      * @param component  component name associated with the property
      */
     public MultipleHostTopologyUpdater(String component) {
-      this(component, DEFAULT_SEPARATOR, false);
+      this(component, DEFAULT_SEPARATOR, false, false, true);
     }
 
     /**
@@ -1601,10 +1608,12 @@ public class BlueprintConfigurationProcessor {
      * @param separator the separator character to use when multiple hosts
      *                  are specified in a property or URL
      */
-    public MultipleHostTopologyUpdater(String component, Character separator, boolean userPrefixForEachHost) {
+    public MultipleHostTopologyUpdater(String component, Character separator, boolean usePrefixForEachHost, boolean useSuffixForEachHost, boolean usePortForEachHost) {
       this.component = component;
       this.separator = separator;
-      this.usePrefixForEachHost = userPrefixForEachHost;
+      this.usePrefixForEachHost = usePrefixForEachHost;
+      this.useSuffixForEachHost = useSuffixForEachHost;
+      this.usePortForEachHost = usePortForEachHost;
     }
 
     /**
@@ -1625,36 +1634,101 @@ public class BlueprintConfigurationProcessor {
 
       StringBuilder sb = new StringBuilder();
 
-      if (!origValue.contains("%HOSTGROUP") &&
-          (!origValue.contains("localhost"))) {
+      if (!origValue.contains("%HOSTGROUP") && (!origValue.contains("localhost"))) {
         // this property must contain FQDNs specified directly by the user
         // of the Blueprint, so the processor should not attempt to update them
         return origValue;
       }
 
-      if (origValue.contains("localhost") && topology.getHostGroupsForComponent(component).size() == 1) {
-        return origValue.replace("localhost", topology.getHostAssignmentsForComponent(component).iterator().next());
+      Collection<String> hostStrings = getHostStrings(origValue, topology);
+      hostStrings.addAll(getHostStringsFromLocalhost(origValue, topology));
+
+      return resolveHostGroupPlaceholder(origValue, hostStrings);
+    }
+
+    /**
+     * Gets the prefix for hosts
+     * @param value property value
+     * @return prefix
+     */
+    private String getPrefix(String value) {
+      Matcher localhostMatcher = LOCALHOST_PORT_REGEX.matcher(value);
+      Matcher hostGroupMatcher = HOSTGROUP_PORT_REGEX.matcher(value);
+      String prefixCandidate = null;
+
+      if(localhostMatcher.find()) {
+        prefixCandidate = value.substring(0,localhostMatcher.start());
+      } else if(hostGroupMatcher.find()) {
+        prefixCandidate = value.substring(0,hostGroupMatcher.start());
+      } else {
+        return prefixCandidate;
+      }
+
+      // remove YAML array notation
+      if(prefixCandidate.startsWith("[")) {
+        prefixCandidate = prefixCandidate.substring(1);
+      }
+      // remove YAML string notation
+      if(prefixCandidate.startsWith("'")) {
+        prefixCandidate = prefixCandidate.substring(1);
       }
 
-      String prefix = null;
-      Collection<String> hostStrings = getHostStrings(origValue, topology);
-      if (hostStrings.isEmpty()) {
-        //default non-exported original value
-        String port;
-        for (String urlScheme : setOfKnownURLSchemes) {
-          if (origValue.startsWith(urlScheme)) {
-            prefix = urlScheme;
-          }
-        }
+      return prefixCandidate;
+    }
 
-        if (prefix != null) {
-          String valueWithoutPrefix = origValue.substring(prefix.length());
-          port = calculatePort(valueWithoutPrefix);
-          sb.append(prefix);
-        } else {
-          port = calculatePort(origValue);
-        }
+    /**
+     * Gets the suffix for hosts
+     * @param value property value
+     * @return suffix
+     */
+    private String getSuffix(String value) {
+      Matcher localhostMatcher = LOCALHOST_PORT_REGEX.matcher(value);
+      Matcher hostGroupMatcher = HOSTGROUP_PORT_REGEX.matcher(value);
+
+
+      Matcher activeMatcher = null;
 
+      if(localhostMatcher.find()) {
+        activeMatcher = localhostMatcher;
+      } else if(hostGroupMatcher.find()) {
+        activeMatcher = hostGroupMatcher;
+      } else {
+        return null;
+      }
+
+      String suffixCandidate = null;
+      int indexOfEnd;
+      do {
+        indexOfEnd = activeMatcher.end();
+      } while (activeMatcher.find());
+      suffixCandidate = value.substring(indexOfEnd);
+
+      // remove YAML array notation
+      if(suffixCandidate.endsWith("]")) {
+        suffixCandidate = suffixCandidate.substring(0, suffixCandidate.length()-1);
+      }
+      // remove YAML string notation
+      if(suffixCandidate.endsWith("'")) {
+        suffixCandidate = suffixCandidate.substring(0, suffixCandidate.length()-1);
+      }
+
+      return suffixCandidate;
+    }
+
+    /**
+     * Resolves localhost value to "host:port" elements (port is optional)
+     * @param origValue property value
+     * @param topology cluster topology
+     * @return list of hosts that have the given components
+     */
+    private Collection<String> getHostStringsFromLocalhost(String origValue, ClusterTopology topology) {
+      Set<String> hostStrings = new HashSet<String>();
+      if(origValue.contains("localhost")) {
+        Matcher localhostMatcher = LOCALHOST_PORT_REGEX.matcher(origValue);
+        String port = null;
+        if(localhostMatcher.find()) {
+          port = calculatePort(localhostMatcher.group());
+        }
         for (String host : topology.getHostAssignmentsForComponent(component)) {
           if (port != null) {
             host += ":" + port;
@@ -1662,62 +1736,52 @@ public class BlueprintConfigurationProcessor {
           hostStrings.add(host);
         }
       }
-
-      return sb.append(resolveHostGroupPlaceholder(origValue, prefix, hostStrings)).toString();
+      return hostStrings;
     }
 
     /**
      * Resolves the host group place holders in the passed in original value.
      * @param originalValue The original value containing the place holders to be resolved.
-     * @param prefix The prefix to be added to the returned value.
      * @param hostStrings The collection of host names that are mapped to the host groups to be resolved
      * @return The new value with place holders resolved.
      */
-    protected String resolveHostGroupPlaceholder(String originalValue, String prefix, Collection<String> hostStrings) {
-      String suffix = null;
-      StringBuilder sb = new StringBuilder();
+    protected String resolveHostGroupPlaceholder(String originalValue, Collection<String> hostStrings) {
+      String prefix = getPrefix(originalValue);
+      String suffix = getSuffix(originalValue);
+      String port = removePorts(hostStrings);
 
-      // parse out prefix if one exists
-      Matcher matcher = HOSTGROUP_PORT_REGEX.matcher(originalValue);
-      if (matcher.find()) {
-        int indexOfStart = matcher.start();
-        // handle the case of a YAML config property
-        if ((indexOfStart > 0) && (!originalValue.substring(0, indexOfStart).equals("['")) && (!originalValue.substring(0, indexOfStart).equals("[")) ) {
-          // append prefix before adding host names
-          prefix = originalValue.substring(0, indexOfStart);
-          sb.append(prefix);
-        }
+      String sep = (useSuffixForEachHost ? suffix : "") + separator + (usePrefixForEachHost ? prefix : "");
+      String combinedHosts = (usePrefixForEachHost ? prefix : "") + StringUtils.join(hostStrings, sep);
 
-        // parse out suffix if one exists
-        int indexOfEnd;
-        do {
-          indexOfEnd = matcher.end();
-        } while (matcher.find());
+      return (usePrefixForEachHost ? "" : prefix) + combinedHosts + (usePortForEachHost || port == null ? "" : ":" + port) + suffix;
+    }
 
-        if (indexOfEnd < (originalValue.length())) {
-          suffix = originalValue.substring(indexOfEnd);
-        }
-      }
+    /**
+     * Removes "port" part of the hosts and returns it
+     * @param hostStrings list of "host:port" strings (port is optional)
+     * @return the port
+     */
+    private String removePorts(Collection<String> hostStrings) {
+      String port = null;
+      if(!usePortForEachHost && !hostStrings.isEmpty()) {
+        Set<String> temp = new HashSet<String>();
 
-      // add hosts to property, using the specified separator
-      boolean firstHost = true;
-      for (String host : hostStrings) {
-        if (!firstHost) {
-          sb.append(separator);
-          // support config properties that use a list of full URIs
-          if (usePrefixForEachHost && (prefix != null)) {
-            sb.append(prefix);
+        // extract port
+        Iterator<String> i = hostStrings.iterator();
+        do {
+          port = calculatePort(i.next());
+        } while (i.hasNext() && port == null);
+
+        // update hosts
+        if(port != null) {
+          for(String host : hostStrings) {
+            temp.add(host.replace(":"+port,""));
           }
-        } else {
-          firstHost = false;
         }
-        sb.append(host);
+        hostStrings.clear();
+        hostStrings.addAll(temp);
       }
-
-      if ((suffix != null) && (!suffix.equals("']")) && (!suffix.equals("]")) ) {
-        sb.append(suffix);
-      }
-      return sb.toString();
+      return port;
     }
 
     private static String calculatePort(String origValue) {
@@ -1988,7 +2052,7 @@ public class BlueprintConfigurationProcessor {
     TempletonHivePropertyUpdater() {
       // the only known property that requires hostname substitution is hive.metastore.uris,
       // but this updater should be flexible enough for other properties in the future.
-      mapOfKeysToUpdaters.put("hive.metastore.uris", new MultipleHostTopologyUpdater("HIVE_METASTORE", ',', true));
+      mapOfKeysToUpdaters.put("hive.metastore.uris", new MultipleHostTopologyUpdater("HIVE_METASTORE", ',', true, false, true));
     }
 
     @Override
@@ -2180,8 +2244,8 @@ public class BlueprintConfigurationProcessor {
     hbaseSiteMap.put("hbase.rootdir", new SingleHostTopologyUpdater("NAMENODE"));
     accumuloSiteMap.put("instance.volumes", new SingleHostTopologyUpdater("NAMENODE"));
     // HDFS shared.edits JournalNode Quorum URL uses semi-colons as separators
-    multiHdfsSiteMap.put("dfs.namenode.shared.edits.dir", new MultipleHostTopologyUpdater("JOURNALNODE", ';', false));
-    multiHdfsSiteMap.put("dfs.encryption.key.provider.uri", new MultipleHostTopologyUpdater("RANGER_KMS_SERVER", ';', false));
+    multiHdfsSiteMap.put("dfs.namenode.shared.edits.dir", new MultipleHostTopologyUpdater("JOURNALNODE", ';', false, false, true));
+    multiHdfsSiteMap.put("dfs.encryption.key.provider.uri", new MultipleHostTopologyUpdater("RANGER_KMS_SERVER", ';', false, false, false));
 
     // SECONDARY_NAMENODE
     hdfsSiteMap.put("dfs.secondary.http.address", new SingleHostTopologyUpdater("SECONDARY_NAMENODE"));
@@ -2213,14 +2277,14 @@ public class BlueprintConfigurationProcessor {
     yarnSiteMap.put("yarn.timeline-service.webapp.https.address", new SingleHostTopologyUpdater("APP_TIMELINE_SERVER"));
 
     // HIVE_SERVER
-    multiHiveSiteMap.put("hive.metastore.uris", new MultipleHostTopologyUpdater("HIVE_METASTORE", ',', true));
+    multiHiveSiteMap.put("hive.metastore.uris", new MultipleHostTopologyUpdater("HIVE_METASTORE", ',', true, true, true));
     dbHiveSiteMap.put("javax.jdo.option.ConnectionURL",
         new DBTopologyUpdater("MYSQL_SERVER", "hive-env", "hive_database"));
     multiCoreSiteMap.put("hadoop.proxyuser.hive.hosts", new MultipleHostTopologyUpdater("HIVE_SERVER"));
     multiCoreSiteMap.put("hadoop.proxyuser.HTTP.hosts", new MultipleHostTopologyUpdater("WEBHCAT_SERVER"));
     multiCoreSiteMap.put("hadoop.proxyuser.hcat.hosts", new MultipleHostTopologyUpdater("WEBHCAT_SERVER"));
     multiCoreSiteMap.put("hadoop.proxyuser.yarn.hosts", new MultipleHostTopologyUpdater("RESOURCEMANAGER"));
-    multiCoreSiteMap.put("hadoop.security.key.provider.path", new MultipleHostTopologyUpdater("RANGER_KMS_SERVER", ';', false));
+    multiCoreSiteMap.put("hadoop.security.key.provider.path", new MultipleHostTopologyUpdater("RANGER_KMS_SERVER", ';', false, false, true));
     multiWebhcatSiteMap.put("templeton.hive.properties", new TempletonHivePropertyUpdater());
     multiWebhcatSiteMap.put("templeton.kerberos.principal", new MultipleHostTopologyUpdater("WEBHCAT_SERVER"));
     hiveEnvMap.put("hive_hostname", new SingleHostTopologyUpdater("HIVE_SERVER"));

http://git-wip-us.apache.org/repos/asf/ambari/blob/7616e0f5/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/BlueprintConfigurationProcessorTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/BlueprintConfigurationProcessorTest.java b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/BlueprintConfigurationProcessorTest.java
index 1afd6a8..7a77a25 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/BlueprintConfigurationProcessorTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/BlueprintConfigurationProcessorTest.java
@@ -41,6 +41,7 @@ import org.apache.ambari.server.topology.HostGroupInfo;
 import org.apache.ambari.server.topology.InvalidTopologyException;
 import org.apache.ambari.server.utils.CollectionPresentationUtils;
 import org.junit.After;
+import org.junit.Assert;
 import org.junit.Before;
 import org.junit.Test;
 
@@ -2354,6 +2355,116 @@ public class BlueprintConfigurationProcessorTest {
   }
 
   @Test
+  public void testMultipleHostTopologyUpdater__localhost__singleHost() throws Exception {
+
+    final String typeName = "hbase-site";
+    final String propertyName = "hbase.zookeeper.quorum";
+    final String originalValue = "localhost";
+    final String component1 = "ZOOKEEPER_SERVER";
+    final String component2 = "ZOOKEEPER_CLIENT";
+
+    Map<String, Map<String, String>> properties = new HashMap<String, Map<String, String>>();
+    Map<String, String> typeProps = new HashMap<String, String>();
+    typeProps.put(propertyName, originalValue);
+    properties.put(typeName, typeProps);
+
+    Configuration clusterConfig = new Configuration(properties, Collections.<String, Map<String, Map<String, String>>>emptyMap());
+
+    Collection<String> hgComponents = new HashSet<String>();
+    hgComponents.add(component1);
+    Set<String> hosts1 = new HashSet<String>();
+    hosts1.add("testhost1a");
+    TestHostGroup group1 = new TestHostGroup("group1", hgComponents, hosts1);
+
+    Collection<String> hgComponents2 = new HashSet<String>();
+    hgComponents2.add(component2);
+    Set<String> hosts2 = new HashSet<String>();
+    hosts2.add("testhost2");
+    TestHostGroup group2 = new TestHostGroup("group2", hgComponents2, hosts2);
+
+    Collection<TestHostGroup> hostGroups = new HashSet<TestHostGroup>();
+    hostGroups.add(group1);
+    hostGroups.add(group2);
+
+    ClusterTopology topology = createClusterTopology(bp, clusterConfig, hostGroups);
+
+    BlueprintConfigurationProcessor.MultipleHostTopologyUpdater mhtu = new BlueprintConfigurationProcessor.MultipleHostTopologyUpdater(component1);
+    String newValue = mhtu.updateForClusterCreate(propertyName, originalValue, properties, topology);
+
+    assertEquals("testhost1a", newValue);
+  }
+
+  @Test
+  public void testMultipleHostTopologyUpdater__localhost__singleHostGroup() throws Exception {
+
+    final String typeName = "hbase-site";
+    final String propertyName = "hbase.zookeeper.quorum";
+    final String originalValue = "localhost";
+    final String component1 = "ZOOKEEPER_SERVER";
+
+    Map<String, Map<String, String>> properties = new HashMap<String, Map<String, String>>();
+    Map<String, String> typeProps = new HashMap<String, String>();
+    typeProps.put(propertyName, originalValue);
+    properties.put(typeName, typeProps);
+
+    Configuration clusterConfig = new Configuration(properties, Collections.<String, Map<String, Map<String, String>>>emptyMap());
+
+    Collection<String> hgComponents = new HashSet<String>();
+    hgComponents.add(component1);
+    Set<String> hosts1 = new HashSet<String>();
+    hosts1.add("testhost1a");
+    hosts1.add("testhost1b");
+    hosts1.add("testhost1c");
+    TestHostGroup group1 = new TestHostGroup("group1", hgComponents, hosts1);
+
+    Collection<TestHostGroup> hostGroups = new HashSet<TestHostGroup>();
+    hostGroups.add(group1);
+
+    ClusterTopology topology = createClusterTopology(bp, clusterConfig, hostGroups);
+
+    BlueprintConfigurationProcessor.MultipleHostTopologyUpdater mhtu = new BlueprintConfigurationProcessor.MultipleHostTopologyUpdater(component1);
+    String newValue = mhtu.updateForClusterCreate(propertyName, originalValue, properties, topology);
+
+    List<String> hostArray = Arrays.asList(newValue.split(","));
+    Assert.assertTrue(hostArray.containsAll(hosts1) && hosts1.containsAll(hostArray));
+  }
+
+  @Test
+  public void testMultipleHostTopologyUpdater__hostgroup__singleHostGroup() throws Exception {
+
+    final String typeName = "hbase-site";
+    final String propertyName = "hbase.zookeeper.quorum";
+    final String originalValue = "%HOSTGROUP::group1%";
+    final String component1 = "ZOOKEEPER_SERVER";
+
+    Map<String, Map<String, String>> properties = new HashMap<String, Map<String, String>>();
+    Map<String, String> typeProps = new HashMap<String, String>();
+    typeProps.put(propertyName, originalValue);
+    properties.put(typeName, typeProps);
+
+    Configuration clusterConfig = new Configuration(properties, Collections.<String, Map<String, Map<String, String>>>emptyMap());
+
+    Collection<String> hgComponents = new HashSet<String>();
+    hgComponents.add(component1);
+    Set<String> hosts1 = new HashSet<String>();
+    hosts1.add("testhost1a");
+    hosts1.add("testhost1b");
+    hosts1.add("testhost1c");
+    TestHostGroup group1 = new TestHostGroup("group1", hgComponents, hosts1);
+
+    Collection<TestHostGroup> hostGroups = new HashSet<TestHostGroup>();
+    hostGroups.add(group1);
+
+    ClusterTopology topology = createClusterTopology(bp, clusterConfig, hostGroups);
+
+    BlueprintConfigurationProcessor.MultipleHostTopologyUpdater mhtu = new BlueprintConfigurationProcessor.MultipleHostTopologyUpdater(component1);
+    String newValue = mhtu.updateForClusterCreate(propertyName, originalValue, properties, topology);
+
+    List<String> hostArray = Arrays.asList(newValue.split(","));
+    Assert.assertTrue(hostArray.containsAll(hosts1) && hosts1.containsAll(hostArray));
+  }
+
+  @Test
   public void testDoUpdateForClusterVerifyRetrySettingsDefault() throws Exception {
     Map<String, Map<String, String>> configProperties =
       new HashMap<String, Map<String, String>>();
@@ -5887,8 +5998,16 @@ public class BlueprintConfigurationProcessorTest {
     // When
     configProcessor.doUpdateForClusterCreate();
 
+    String updatedVal = clusterConfig.getPropertyValue(configType, "dfs.encryption.key.provider.uri");
+    Assert.assertTrue(updatedVal.startsWith("kms://http@"));
+    Assert.assertTrue(updatedVal.endsWith(":9292/kms"));
+    String hostsString = updatedVal.substring(11,updatedVal.length()-9);
+
+    List<String> hostArray = Arrays.asList(hostsString.split(";"));
+    List<String> expected = Arrays.asList("host1","host2");
+
     // Then
-    assertEquals("kms://http@host1;host2:9292/kms", clusterConfig.getPropertyValue(configType, "dfs.encryption.key.provider.uri"));
+    Assert.assertTrue(hostArray.containsAll(expected) && expected.containsAll(hostArray));
   }
 
 
@@ -5982,6 +6101,114 @@ public class BlueprintConfigurationProcessorTest {
     assertEquals("kms://http@host1:9292/kms", clusterConfig.getPropertyValue(configType, "dfs.encryption.key.provider.uri"));
   }
 
+  @Test
+  public void testHdfsWithRangerKmsServer__multiple_hosts__localhost() throws Exception {
+    // Given
+    final String configType = "hdfs-site";
+    Map<String, Map<String, String>> properties = new HashMap<String, Map<String, String>>();
+    Map<String, String> configProperties = new HashMap<String, String>();
+
+    properties.put(configType, configProperties);
+    configProperties.put("dfs.encryption.key.provider.uri", "kms://http@localhost:9292/kms");
+
+
+    Map<String, Map<String, String>> parentProperties = new HashMap<String, Map<String, String>>();
+    Configuration parentClusterConfig = new Configuration(parentProperties,
+      Collections.<String, Map<String, Map<String, String>>>emptyMap());
+    Configuration clusterConfig = new Configuration(properties,
+      Collections.<String, Map<String, Map<String, String>>>emptyMap(), parentClusterConfig);
+
+
+    Collection<String> kmsServerComponents = new HashSet<String>();
+    kmsServerComponents.add("RANGER_KMS_SERVER");
+
+    Collection<String> hdfsComponents = new HashSet<String>();
+    hdfsComponents.add("NAMENODE");
+    hdfsComponents.add("DATANODE");
+
+    Collection<String> hosts = new HashSet<String>();
+    hosts.add("host1");
+    hosts.add("host2");
+
+    TestHostGroup group1 = new TestHostGroup("group1", kmsServerComponents, hosts);
+    group1.components.add("DATANODE");
+
+    TestHostGroup group2 = new TestHostGroup("group2", hdfsComponents, Collections.singleton("host3"));
+
+    Collection<TestHostGroup> hostGroups = Lists.newArrayList(group1, group2);
+
+    ClusterTopology topology = createClusterTopology(bp, clusterConfig, hostGroups);
+    BlueprintConfigurationProcessor configProcessor = new BlueprintConfigurationProcessor(topology);
+
+    // When
+    configProcessor.doUpdateForClusterCreate();
+
+    String updatedVal = clusterConfig.getPropertyValue(configType, "dfs.encryption.key.provider.uri");
+    Assert.assertTrue(updatedVal.startsWith("kms://http@"));
+    Assert.assertTrue(updatedVal.endsWith(":9292/kms"));
+    String hostsString = updatedVal.substring(11,updatedVal.length()-9);
+
+    List<String> hostArray = Arrays.asList(hostsString.split(";"));
+    List<String> expected = Arrays.asList("host1","host2");
+
+    // Then
+    Assert.assertTrue(hostArray.containsAll(expected) && expected.containsAll(hostArray));
+  }
+
+  @Test
+  public void testHdfsWithRangerKmsServer__multiple_hosts__hostgroup() throws Exception {
+    // Given
+    final String configType = "hdfs-site";
+    Map<String, Map<String, String>> properties = new HashMap<String, Map<String, String>>();
+    Map<String, String> configProperties = new HashMap<String, String>();
+
+    properties.put(configType, configProperties);
+    configProperties.put("dfs.encryption.key.provider.uri", "kms://http@%HOSTGROUP::group1%:9292/kms");
+
+
+    Map<String, Map<String, String>> parentProperties = new HashMap<String, Map<String, String>>();
+    Configuration parentClusterConfig = new Configuration(parentProperties,
+      Collections.<String, Map<String, Map<String, String>>>emptyMap());
+    Configuration clusterConfig = new Configuration(properties,
+      Collections.<String, Map<String, Map<String, String>>>emptyMap(), parentClusterConfig);
+
+
+    Collection<String> kmsServerComponents = new HashSet<String>();
+    kmsServerComponents.add("RANGER_KMS_SERVER");
+
+    Collection<String> hdfsComponents = new HashSet<String>();
+    hdfsComponents.add("NAMENODE");
+    hdfsComponents.add("DATANODE");
+
+    Collection<String> hosts = new HashSet<String>();
+    hosts.add("host1");
+    hosts.add("host2");
+
+    TestHostGroup group1 = new TestHostGroup("group1", kmsServerComponents, hosts);
+    group1.components.add("DATANODE");
+
+    TestHostGroup group2 = new TestHostGroup("group2", hdfsComponents, Collections.singleton("host3"));
+
+    Collection<TestHostGroup> hostGroups = Lists.newArrayList(group1, group2);
+
+    ClusterTopology topology = createClusterTopology(bp, clusterConfig, hostGroups);
+    BlueprintConfigurationProcessor configProcessor = new BlueprintConfigurationProcessor(topology);
+
+    // When
+    configProcessor.doUpdateForClusterCreate();
+
+    String updatedVal = clusterConfig.getPropertyValue(configType, "dfs.encryption.key.provider.uri");
+    Assert.assertTrue(updatedVal.startsWith("kms://http@"));
+    Assert.assertTrue(updatedVal.endsWith(":9292/kms"));
+    String hostsString = updatedVal.substring(11,updatedVal.length()-9);
+
+    List<String> hostArray = Arrays.asList(hostsString.split(";"));
+    List<String> expected = Arrays.asList("host1","host2");
+
+    // Then
+    Assert.assertTrue(hostArray.containsAll(expected) && expected.containsAll(hostArray));
+  }
+
 
   @Test
   public void testHadoopWithRangerKmsServer() throws Exception {
@@ -6248,8 +6475,8 @@ public class BlueprintConfigurationProcessorTest {
     String propertyOriginalValue2 = "[%HOSTGROUP::group_1%]";
 
     // When
-    String updatedValue1 = mhtu.resolveHostGroupPlaceholder(propertyOriginalValue1, null, ImmutableList.<String>of("host1:100"));
-    String updatedValue2 = mhtu.resolveHostGroupPlaceholder(propertyOriginalValue2, null, ImmutableList.<String>of("host1:100"));
+    String updatedValue1 = mhtu.resolveHostGroupPlaceholder(propertyOriginalValue1, ImmutableList.<String>of("host1:100"));
+    String updatedValue2 = mhtu.resolveHostGroupPlaceholder(propertyOriginalValue2, ImmutableList.<String>of("host1:100"));
 
     // Then
     assertEquals("host1:100", updatedValue1);
@@ -6269,8 +6496,8 @@ public class BlueprintConfigurationProcessorTest {
     String propertyOriginalValue2 = "[%HOSTGROUP::group_1%, %HOSTGROUP::group_2%]";
 
     // When
-    String updatedValue1 = mhtu.resolveHostGroupPlaceholder(propertyOriginalValue1, null, ImmutableList.<String>of("host1:100", "host2:200"));
-    String updatedValue2 = mhtu.resolveHostGroupPlaceholder(propertyOriginalValue2, null, ImmutableList.<String>of("host1:100", "host2:200"));
+    String updatedValue1 = mhtu.resolveHostGroupPlaceholder(propertyOriginalValue1, ImmutableList.<String>of("host1:100", "host2:200"));
+    String updatedValue2 = mhtu.resolveHostGroupPlaceholder(propertyOriginalValue2, ImmutableList.<String>of("host1:100", "host2:200"));
 
     // Then
     assertEquals("host1:100,host2:200", updatedValue1);
@@ -6288,7 +6515,7 @@ public class BlueprintConfigurationProcessorTest {
     String propertyOriginalValue = "http://%HOSTGROUP::group_1%#";
 
     // When
-    String updatedValue = mhtu.resolveHostGroupPlaceholder(propertyOriginalValue, null, ImmutableList.<String>of("host1:100"));
+    String updatedValue = mhtu.resolveHostGroupPlaceholder(propertyOriginalValue, ImmutableList.<String>of("host1:100"));
 
     // Then
     assertEquals("http://host1:100#", updatedValue);
@@ -6303,7 +6530,7 @@ public class BlueprintConfigurationProcessorTest {
     String propertyOriginalValue = "http://%HOSTGROUP::group_1,HOSTGROUP::group_2%/resource";
 
     // When
-    String updatedValue = mhtu.resolveHostGroupPlaceholder(propertyOriginalValue, null, ImmutableList.<String>of("host1:100", "host2:200"));
+    String updatedValue = mhtu.resolveHostGroupPlaceholder(propertyOriginalValue, ImmutableList.<String>of("host1:100", "host2:200"));
 
     // Then
     assertEquals("http://host1:100,host2:200/resource", updatedValue);
@@ -6318,7 +6545,7 @@ public class BlueprintConfigurationProcessorTest {
     String propertyOriginalValue = "%HOSTGROUP::group_1%:11,%HOSTGROUP::group_2%:11";
 
     // When
-    String updatedValue = mhtu.resolveHostGroupPlaceholder(propertyOriginalValue, null, ImmutableList.<String>of("host1:100", "host2:200"));
+    String updatedValue = mhtu.resolveHostGroupPlaceholder(propertyOriginalValue, ImmutableList.<String>of("host1:100", "host2:200"));
 
     // Then
     assertEquals("host1:100,host2:200", updatedValue);


[17/40] ambari git commit: AMBARI-14929. Enable security wizard hangs (srimanth)

Posted by nc...@apache.org.
AMBARI-14929. Enable security wizard hangs (srimanth)


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

Branch: refs/heads/branch-dev-patch-upgrade
Commit: ab06c68acafd9e31a24e6b136f5772fdbf25655c
Parents: 7af40ca
Author: Srimanth Gunturi <sg...@hortonworks.com>
Authored: Thu Feb 4 11:19:12 2016 -0800
Committer: Srimanth Gunturi <sg...@hortonworks.com>
Committed: Thu Feb 4 11:19:12 2016 -0800

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


http://git-wip-us.apache.org/repos/asf/ambari/blob/ab06c68a/ambari-web/app/controllers/wizard/step7_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/wizard/step7_controller.js b/ambari-web/app/controllers/wizard/step7_controller.js
index 011833b..c92e83d 100644
--- a/ambari-web/app/controllers/wizard/step7_controller.js
+++ b/ambari-web/app/controllers/wizard/step7_controller.js
@@ -699,7 +699,7 @@ App.WizardStep7Controller = Em.Controller.extend(App.ServerValidatorMixin, App.E
       if (App.get('isHaEnabled')) this.addHawqConfigsOnNnHa(configs);
       if (App.get('isRMHaEnabled')) this.addHawqConfigsOnRMHa(configs);
     }
-    if (Object.keys(this.get('content.hosts')).length === 1) this.removeHawqStandbyHostAddressConfig(configs);
+    if (this.get('content.hosts') && Object.keys(this.get('content.hosts')).length === 1) this.removeHawqStandbyHostAddressConfig(configs);
     return configs
   },
 


[14/40] ambari git commit: AMBARI-14893. Add Grafana-based Ambari Metrics Dashboard Builder. (Prajwal Rao via yusaku)

Posted by nc...@apache.org.
AMBARI-14893. Add Grafana-based Ambari Metrics Dashboard Builder. (Prajwal Rao via yusaku)


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

Branch: refs/heads/branch-dev-patch-upgrade
Commit: 8ff0b5ed82784a202978017345348d0d130b64af
Parents: d0bec5c
Author: Yusaku Sako <yu...@hortonworks.com>
Authored: Thu Feb 4 11:05:37 2016 -0800
Committer: Yusaku Sako <yu...@hortonworks.com>
Committed: Thu Feb 4 11:05:37 2016 -0800

----------------------------------------------------------------------
 ambari-metrics/ambari-metrics-grafana/README.md | 243 +++++++++++++++
 .../ambari-metrics/datasource.js                | 304 +++++++++++++++++++
 .../ambari-metrics/directives.js                |  36 +++
 .../ambari-metrics/partials/config.html         |  19 ++
 .../ambari-metrics/partials/query.editor.html   | 133 ++++++++
 .../ambari-metrics/partials/query.options.html  |  42 +++
 .../ambari-metrics/plugin.json                  |  14 +
 .../ambari-metrics/queryCtrl.js                 | 131 ++++++++
 ambari-metrics/pom.xml                          |   1 +
 9 files changed, 923 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/8ff0b5ed/ambari-metrics/ambari-metrics-grafana/README.md
----------------------------------------------------------------------
diff --git a/ambari-metrics/ambari-metrics-grafana/README.md b/ambari-metrics/ambari-metrics-grafana/README.md
new file mode 100644
index 0000000..0a138e8
--- /dev/null
+++ b/ambari-metrics/ambari-metrics-grafana/README.md
@@ -0,0 +1,243 @@
+<!--
+  ~ 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.
+  -->
+# AMS (Ambari Metrics Service) Datasource Plugin for Grafana
+
+Use **ambari-metrics** to visualize metrics exposed via AMS in Grafana. 
+
+### If you already have Ambari Metrics UI as a part of your AMS Install, [go here](#createdash) to get started
+
+
+**ToC**
+ - [Install Grafana](#installg)
+ - [Install Datasource Plugin](#installam)
+ - [Access Grafana](#accessgraf)
+ - [Add Datasource to Grafana](#addds)
+  	- [Test Datasource](#testds)
+ - [Create Dashboard](#createdash)
+ - [Add a Graph](#addgraph)
+ - [Save Dashboard](#savedash)
+ - [Time Ranges](#timerange)
+ - [Edit Panel/Graph](#editpanel)
+
+
+----------
+![enter image description here](screenshots/full-dashboard.png)
+
+----------
+<a name="installg"></a>
+### Install Grafana
+
+
+You can install Grafana on any host.  It does not need to be co-located with Ambari Metrics Collector.  The only requirement is that it has network access to Ambari Metrics Collector.
+
+**Install on CentOS/Red Hat:**
+```
+sudo yum install https://grafanarel.s3.amazonaws.com/builds/grafana-2.6.0-1.x86_64.rpm
+```
+
+**Install on Ubuntu/Debian:**
+```
+wget https://grafanarel.s3.amazonaws.com/builds/grafana_2.6.0_amd64.deb
+sudo apt-get install -y adduser libfontconfig
+sudo dpkg -i grafana_2.6.0_amd64.deb
+```
+
+**Install on SUSE/SLES:**
+```
+sudo rpm -i --nodeps grafana-2.6.0-1.x86_64.rpm
+```
+<a name="installam"></a> 
+### Deploy ambari-metrics 
+
+**On your Grafana Server**
+
+```
+cp -R ambari/ambari-metrics/ambari-metrics-grafana/ambari-metrics /usr/share/grafana/public/app/plugins/datasource
+```
+
+### Start Grafana
+
+```
+sudo service grafana-server start
+```
+
+<a name="accessgraf"></a> 
+### Access Grafana
+
+```
+http://GRAFANA_HOST:3000 
+```
+
+---
+
+<a name="addds"></a>
+## Add Ambari Metrics Datasource in Grafana UI
+
+**Add a Datasource**
+>	- Click on "Datasources"
+> 	- Click on "Add New" at the top 
+
+![add-datasource](screenshots/1-add-datasource.png)
+
+**Add a Datasource (continued)**
+
+> 	1. Name of your Datasource
+>	2. Type = AmbariMetrics
+> 	3. Host+Port of your AMS installation. (usually host:6188) 
+>  		- No trailing slashes
+> 		- Nothing else needs to be changed
+>  		- Click on Save.
+
+![datasource-details](screenshots/2-datasource-details.png)
+
+
+<a name="testds"></a>
+**Test your Datasource**
+
+>	To make sure it's all working, click on **Test Connection** and you should see a message that says "Data source is working". 
+
+
+![test-datasource](screenshots/3-test-datasource.png)
+
+---
+
+<a name="createdash"></a>
+## Creating a Dashboard
+
+**To create a dashboard**
+
+>	- Click on Dashboards on the left
+>	- Click on "Home"
+>	- Click on New at the bottom of the dropdown 
+
+![Dashboard Dropdown](screenshots/4-dashboard-dropdown.png)
+
+
+
+**To add a panel to your newly created dashboard**
+
+>	- Click on the green button on the left(see image below)
+>	- This will expand a flyout menu that will allow you to add a panel
+>	- Choose Graph / Table / Single Stat
+
+![Add Panel](screenshots/5-dashboard-graph-menu.png)
+
+![Types of Panels](screenshots/6-graph-panels.png)
+
+
+---
+
+<a name="addgraph"></a>
+**To add a Graph**
+
+
+>	- Choose the Datasource you created earlier
+>	- Once you've chosen the datasource, you should see the query editor show you some options
+
+![Add a Graph](screenshots/7-choose-datasource.png)
+
+
+
+>	- Choose the component you wish to see metrics for
+
+![Add a Graph](screenshots/8-choose-component.png)
+
+
+
+>	- Based on the component chosen, you should now see a list of metrics for it
+
+![Add a Graph](screenshots/9-choose-metric.png)
+
+
+
+>	- Choose hostname from the list of hosts if you wish to see metrics for a specific host.
+>		- if hostname isn't chosen, metrics will be shown on a service component level. 
+
+![Add a Graph](screenshots/10-choose-hostname.png)
+
+
+> 	- By default the aggregator is avg. You can change it via the dropdown
+> 	- You can choose to enable Rate by selecting the checkbox.
+> 	- You can specify precision by checking the box and then selecting "days, hours, minutes or seconds"
+
+![Select Options](screenshots/11-choose-agg-rate-precision.png)
+
+
+**To change the title of the Panel**
+
+>	- Click on the "General" tab
+>	- Enter the name to change the title of the panel
+
+![Change Panel Title](screenshots/12-change-panel-title.png)
+
+**To change the Units for your metric**
+
+>	- You can edit the units of your graph by clicking on **Axes & Grid** tab and clicking on "unit" as shown.
+
+![Change Units](screenshots/15-change-units.png)
+
+**To customise your graphs**
+
+> 	- You can customise your graph by clicking on the **Display Styles** tab.
+> 	- For ex: you can change the color of a specific metric by choosing a series specific override at the bottom.
+
+![series specific override](screenshots/17-series-specific-override.png)
+
+
+<a name="savedash"></a>
+**To Save the Dashboard**
+
+> 	- Click on the save icon next to the dashboard list dropdown on the top to save your dashboard.
+
+![Save Dashboard](screenshots/13-save-dashboard.png)
+
+<a name="editpanel"></a>
+**To Edit a Graph**
+
+> 	- Click on the title of your graph/panel and click on edit.
+
+![Edit Graph](screenshots/19-edit-graph.png)
+
+
+---
+<a name="timerange"></a>
+### Time Ranges
+
+**To change the Time Range**
+
+>	- To change the timerange click on the top right of your UI.
+>		- This setting affects all your graphs inside the dashboard. If you wish to customise time for a specific graph [look here](#timeshift)
+> 	- You can use the quick ranges provided or choose a time range of your choice. You can also choose a refresh duration for your dashboard or leave it at "off" to manually refresh.
+
+![Timerange](screenshots/14-change-timerange.png)
+
+<a name="timeshift"></a>
+**To change the time range of one graph only**
+
+>	- Use this in case you wish to change the time range for a specific graph without affecting the other graphs in your dashboard
+>		- Click on the **Time Range** tab of your Graph
+>		- You can then enter a value in the "Override Relative time" input box
+>		- You will be able to confirm that this change has occured by looking at the top right of your graph which will show the override message.
+>		- You can choose to hide this message if you wish to do so (by checking the "hide time override info")
+
+![Timerange Override](screenshots/18-override-time.png)
+
+
+---
+
+

http://git-wip-us.apache.org/repos/asf/ambari/blob/8ff0b5ed/ambari-metrics/ambari-metrics-grafana/ambari-metrics/datasource.js
----------------------------------------------------------------------
diff --git a/ambari-metrics/ambari-metrics-grafana/ambari-metrics/datasource.js b/ambari-metrics/ambari-metrics-grafana/ambari-metrics/datasource.js
new file mode 100644
index 0000000..374501c
--- /dev/null
+++ b/ambari-metrics/ambari-metrics-grafana/ambari-metrics/datasource.js
@@ -0,0 +1,304 @@
+/**
+ * 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.
+ */
+define([
+      'angular',
+      'lodash',
+      'jquery',
+      './directives',
+      './queryCtrl'
+    ],
+    function (angular, _) {
+      'use strict';
+
+      var module = angular.module('grafana.services');
+
+      module.factory('AmbariMetricsDatasource', function ($q, backendSrv) {
+        /**
+         * AMS Datasource Constructor
+         */
+        function AmbariMetricsDatasource(datasource) {
+          this.name = datasource.name;
+          this.url = datasource.url;
+          this.initMetricAppidMapping();
+        }
+        var allMetrics = [];
+        var appIds = [];
+        AmbariMetricsDatasource.prototype.initMetricAppidMapping = function () {
+          backendSrv.get(this.url + '/ws/v1/timeline/metrics/metadata')
+            .then(function (items) {
+              allMetrics = [];
+              appIds = [];
+              var fake = "timeline_metric_store_watcher"; delete items[fake];
+              for (var key in items) {
+                if (items.hasOwnProperty(key)) {
+                  items[key].forEach(function (_item) {
+                    allMetrics.push({
+                      metric: _item.metricname,
+                      app: key
+                    });
+                  });
+                }
+                appIds = _.keys(items);
+              }
+            });
+        };
+
+        /**
+         * AMS Datasource  Authentication
+         */
+        AmbariMetricsDatasource.prototype.doAmbariRequest = function (options) {
+          if (this.basicAuth || this.withCredentials) {
+            options.withCredentials = true;
+          }
+          if (this.basicAuth) {
+            options.headers = options.headers || {};
+            options.headers.Authorization = this.basicAuth;
+          }
+
+          options.url = this.url + options.url;
+          options.inspect = {type: 'discovery'};
+
+          return backendSrv.datasourceRequest(options);
+        };
+
+        /**
+         * AMS Datasource  Query
+         */
+        AmbariMetricsDatasource.prototype.query = function (options) {
+          var emptyData = function (metric) {
+            return {
+              data: {
+                target: metric,
+                datapoints: []
+              }
+            };
+          };
+          var self = this;
+          var getMetricsData = function (target) {
+            return function (res) {
+              console.log('processing metric ' + target.metric);
+              if (!res.metrics[0] || target.hide) {
+                return $q.when(emptyData(target.metric));
+              }
+              var series = [];
+              var metricData = res.metrics[0].metrics;
+              var timeSeries = {};
+              if (target.hosts === undefined || target.hosts.trim() === "") {
+                timeSeries = {
+                  target: target.metric,
+                  datapoints: []
+                };
+              } else {
+                timeSeries = {
+                  target: target.metric + ' on ' + target.hosts,
+                  datapoints: []
+                };
+              }
+              for (var k in metricData){
+                if (metricData.hasOwnProperty(k)) {
+                  timeSeries.datapoints.push([metricData[k], (k - k % 1000)]);
+                }
+              }
+              series.push(timeSeries);
+              return $q.when({data: series});
+            };
+
+          };
+          var precisionSetting = '';
+          var getHostAppIdData = function(target) {
+            if (target.shouldAddPrecision) {
+              precisionSetting = '&precision=' + target.precision;
+            } else {
+              precisionSetting = '';
+            }
+            if (target.shouldAddPrecision && target.shouldComputeRate) {
+              return backendSrv.get(self.url + '/ws/v1/timeline/metrics?metricNames=' + target.metric + "._rate._"
+                + target.aggregator + "&hostname=" + target.hosts + '&appId=' + target.app + '&startTime=' + from
+                + '&endTime=' + to + precisionSetting).then(
+                  getMetricsData(target)
+                );
+            } else if (target.shouldComputeRate) {
+              return backendSrv.get(self.url + '/ws/v1/timeline/metrics?metricNames=' + target.metric + "._rate._"
+                + target.aggregator + "&hostname=" + target.hosts + '&appId=' + target.app + '&startTime=' + from
+                + '&endTime=' + to).then(
+                  getMetricsData(target)
+                );
+            } else if (target.shouldAddPrecision){
+              return backendSrv.get(self.url + '/ws/v1/timeline/metrics?metricNames=' + target.metric + "._"
+                + target.aggregator + "&hostname=" + target.hosts + '&appId=' + target.app + '&startTime=' + from
+                + '&endTime=' + to + precisionSetting).then(
+                  getMetricsData(target)
+                );
+            } else {
+              return backendSrv.get(self.url + '/ws/v1/timeline/metrics?metricNames=' + target.metric + "._"
+                + target.aggregator + "&hostname=" + target.hosts + '&appId=' + target.app + '&startTime=' + from
+                + '&endTime=' + to).then(
+                getMetricsData(target)
+              );
+            }
+          };
+
+          var getServiceAppIdData = function(target) {
+            if (target.shouldAddPrecision) { precisionSetting = '&precision=' + target.precision;
+            } else { precisionSetting = ''; }
+            if (target.shouldAddPrecision && target.shouldComputeRate) {
+              return backendSrv.get(self.url + '/ws/v1/timeline/metrics?metricNames=' + target.metric + "._rate._"
+                + target.aggregator + '&appId=' + target.app + '&startTime=' + from + '&endTime=' + to + precisionSetting)
+              .then(
+                getMetricsData(target)
+              );
+            } else if (target.shouldAddPrecision) {
+              return backendSrv.get(self.url + '/ws/v1/timeline/metrics?metricNames=' + target.metric + "._"
+                + target.aggregator + '&appId=' + target.app + '&startTime=' + from + '&endTime=' + to + precisionSetting)
+              .then(
+                getMetricsData(target)
+              );
+            } else if (target.shouldComputeRate) {
+              return backendSrv.get(self.url + '/ws/v1/timeline/metrics?metricNames=' + target.metric + "._rate._"
+                + target.aggregator + '&appId=' + target.app + '&startTime=' + from + '&endTime=' + to).then(
+                getMetricsData(target)
+              );
+            } else {
+              return backendSrv.get(self.url + '/ws/v1/timeline/metrics?metricNames=' + target.metric + "._"
+                + target.aggregator + '&appId=' + target.app + '&startTime=' + from + '&endTime=' + to).then(
+                getMetricsData(target)
+              );
+            }
+          };
+
+          // Time Ranges
+          var from = Math.floor(options.range.from.valueOf() / 1000);
+          var to = Math.floor(options.range.to.valueOf() / 1000);
+
+          var metricsPromises = _.map(options.targets, function(target) {
+            console.debug('target app=' + target.app + ',' +
+              'target metric=' + target.metric + ' on host=' + target.hosts);
+            if (!!target.hosts) {
+              return getHostAppIdData(target);
+            } else {
+              return getServiceAppIdData(target);
+            }
+          });
+          return $q.all(metricsPromises).then(function(metricsDataArray) {
+            var data = _.map(metricsDataArray, function(metricsData) {
+              return metricsData.data;
+            });
+            var metricsDataResult = {data: _.flatten(data)};
+            return $q.when(metricsDataResult);
+          });
+        };
+
+        /**
+         * AMS Datasource  List Series.
+         */
+        AmbariMetricsDatasource.prototype.listSeries = function (query) {
+          // wrap in regex
+          if (query && query.length > 0 && query[0] !== '/') {
+            query = '/' + query + '/';
+          }
+          return $q.when([]);
+        };
+
+        /**
+         * AMS Datasource  - Test Data Source Connection.
+         *
+         * Added Check to see if Datasource is working. Throws up an error in the
+         * Datasources page if incorrect info is passed on.
+         */
+        AmbariMetricsDatasource.prototype.testDatasource = function () {
+          return backendSrv.datasourceRequest({
+            url: this.url + '/ws/v1/timeline/metrics/metadata',
+            method: 'GET'
+          }).then(function(response) {
+            console.log(response);
+            if (response.status === 200) {
+              return { status: "success", message: "Data source is working", title: "Success" };
+            }
+          });
+        };
+
+        /**
+         * AMS Datasource - Suggest AppId.
+         *
+         * Read AppIds from cache.
+         */
+        AmbariMetricsDatasource.prototype.suggestApps = function (query) {
+          console.log(query);
+
+          appIds = appIds.sort();
+          var appId = _.map(appIds, function (k) {
+            return {text: k};
+          });
+          return $q.when(appId);
+        };
+
+        /**
+         * AMS Datasource - Suggest Metrics.
+         *
+         * Read Metrics based on AppId chosen.
+         */
+        AmbariMetricsDatasource.prototype.suggestMetrics = function (query, app) {
+          if (!app) {
+            return $q.when([]);
+          }
+          var metrics = allMetrics.filter(function(item) {
+            return (item.app === app);
+          });
+          var keys = [];
+          _.forEach(metrics, function (k) { keys.push(k.metric); });
+          keys = _.map(keys,function(m) {
+            return {text: m};
+          });
+          keys = _.sortBy(keys, function (i) { return i.text.toLowerCase(); });
+          return $q.when(keys);
+        };
+
+        /**
+         * AMS Datasource - Suggest Hosts.
+         *
+         * Query Hosts on the cluster.
+         */
+        AmbariMetricsDatasource.prototype.suggestHosts = function (query) {
+          console.log(query);
+          return this.doAmbariRequest({method: 'GET', url: '/ws/v1/timeline/metrics/hosts'})
+            .then(function (results) {
+              var fake = "fakehostname"; delete results.data[fake];
+              return _.map(Object.keys(results.data), function (hostName) {
+                return {text: hostName};
+              });
+            });
+        };
+
+        /**
+         * AMS Datasource Aggregators.
+         */
+        var aggregatorsPromise = null;
+        AmbariMetricsDatasource.prototype.getAggregators = function () {
+          if (aggregatorsPromise) {
+            return aggregatorsPromise;
+          }
+          aggregatorsPromise = $q.when([
+            'avg', 'sum', 'min', 'max'
+          ]);
+          return aggregatorsPromise;
+        };
+
+        return AmbariMetricsDatasource;
+      });
+    }
+);

http://git-wip-us.apache.org/repos/asf/ambari/blob/8ff0b5ed/ambari-metrics/ambari-metrics-grafana/ambari-metrics/directives.js
----------------------------------------------------------------------
diff --git a/ambari-metrics/ambari-metrics-grafana/ambari-metrics/directives.js b/ambari-metrics/ambari-metrics-grafana/ambari-metrics/directives.js
new file mode 100644
index 0000000..aade7d7
--- /dev/null
+++ b/ambari-metrics/ambari-metrics-grafana/ambari-metrics/directives.js
@@ -0,0 +1,36 @@
+/**
+ * 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.
+ */
+ define([
+  'angular',
+],
+function (angular) {
+  'use strict';
+  var module = angular.module('grafana.directives');
+
+  module.directive('metricQueryEditorAmbarimetrics', function() {
+    return {
+      controller: 'AmbariMetricsQueryCtrl',
+      templateUrl: 'app/plugins/datasource/ambari-metrics/partials/query.editor.html',
+    };
+  });
+
+  module.directive('metricQueryOptionsAmbarimetrics', function() {
+    return {templateUrl: 'app/plugins/datasource/ambari-metrics/partials/query.options.html'};
+  });
+
+});

http://git-wip-us.apache.org/repos/asf/ambari/blob/8ff0b5ed/ambari-metrics/ambari-metrics-grafana/ambari-metrics/partials/config.html
----------------------------------------------------------------------
diff --git a/ambari-metrics/ambari-metrics-grafana/ambari-metrics/partials/config.html b/ambari-metrics/ambari-metrics-grafana/ambari-metrics/partials/config.html
new file mode 100644
index 0000000..360c15c
--- /dev/null
+++ b/ambari-metrics/ambari-metrics-grafana/ambari-metrics/partials/config.html
@@ -0,0 +1,19 @@
+<!--
+  ~ 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.
+  -->
+<div ng-include="httpConfigPartialSrc"></div>
+<br>

http://git-wip-us.apache.org/repos/asf/ambari/blob/8ff0b5ed/ambari-metrics/ambari-metrics-grafana/ambari-metrics/partials/query.editor.html
----------------------------------------------------------------------
diff --git a/ambari-metrics/ambari-metrics-grafana/ambari-metrics/partials/query.editor.html b/ambari-metrics/ambari-metrics-grafana/ambari-metrics/partials/query.editor.html
new file mode 100644
index 0000000..d4dffb4
--- /dev/null
+++ b/ambari-metrics/ambari-metrics-grafana/ambari-metrics/partials/query.editor.html
@@ -0,0 +1,133 @@
+<!--
+  ~ 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.
+  -->
+<div class="tight-form">
+    <ul class="tight-form-list pull-right">
+        <li class="tight-form-item small" ng-show="target.datasource">
+            <em>{{target.datasource}}</em>
+        </li>
+        <li class="tight-form-item">
+            <div class="dropdown">
+                <a class="pointer dropdown-toggle" data-toggle="dropdown" tabindex="1">
+                    <i class="fa fa-bars"></i>
+                </a>
+                <ul class="dropdown-menu pull-right" role="menu">
+                    <li role="menuitem"><a tabindex="1" ng-click="toggleQueryMode()">Switch editor mode</a></li>
+                    <li role="menuitem"><a tabindex="1" ng-click="duplicateDataQuery(target)">Duplicate</a></li>
+                    <li role="menuitem"><a tabindex="1" ng-click="moveDataQuery($index, $index-1)">Move up</a></li>
+                    <li role="menuitem"><a tabindex="1" ng-click="moveDataQuery($index, $index+1)">Move down</a></li>
+                </ul>
+            </div>
+        </li>
+        <li class="tight-form-item last">
+            <a class="pointer" tabindex="1" ng-click="removeDataQuery(target)">
+                <i class="fa fa-remove"></i>
+            </a>
+        </li>
+    </ul>
+
+    <ul class="tight-form-list">
+        <li class="tight-form-item" style="min-width: 15px; text-align: center">
+            {{target.refId}}
+        </li>
+        <li>
+            <a  class="tight-form-item"
+                ng-click="target.hide = !target.hide; get_data();"
+                role="menuitem">
+                <i class="fa fa-eye"></i>
+            </a>
+        </li>
+    </ul>
+
+    <ul class="tight-form-list" role="menu">
+
+        <li class="tight-form-item" style="width: 86px">
+        Component
+    </li>
+        <li>
+            <input type="text" class="input-large tight-form-input" ng-model="target.app"
+                   spellcheck='false' bs-typeahead="suggestApps" placeholder="Component Name" data-min-length=0 data-items=100
+                   ng-blur="targetBlur()">
+            </input>
+            <a bs-tooltip="target.errors.metric" style="color: rgb(229, 189, 28)" ng-show="target.errors.metric">
+                <i class="fa fa-warning"></i>
+            </a>
+        </li>
+
+        <li class="tight-form-item" style="width: 86px">
+            Metric
+        </li>
+        <li>
+            <input type="text" class="input-large tight-form-input" ng-model="target.metric"
+                   spellcheck='false' bs-typeahead="suggestMetrics" placeholder="metric name" data-min-length=0 data-items=100
+                   ng-blur="targetBlur()">
+            </input>
+            <a bs-tooltip="target.errors.metric" style="color: rgb(229, 189, 28)" ng-show="target.errors.metric">
+                <i class="fa fa-warning"></i>
+            </a>
+        </li>
+
+
+        <li class="tight-form-item" style="width: 86px">
+            Hosts <a bs-tooltip="'if host is selected, aggregator is ignored.'" data-placement="bottom"><i class="fa fa-info-circle"></i></a>
+        </li>
+        <li>
+            <input type="text" class="input-large tight-form-input" ng-model="target.hosts"
+                   spellcheck='false' bs-typeahead="suggestHosts" placeholder="host name" data-min-length=0 data-items=100
+                   ng-blur="targetBlur()">
+            </input>
+            <a bs-tooltip="target.errors.metric" style="color: rgb(229, 189, 28)" ng-show="target.errors.metric">
+                <i class="fa fa-warning"></i>
+            </a>
+        </li>
+
+
+
+        <li class="tight-form-item">
+            Aggregator
+        </li>
+        <li>
+            <select ng-model="target.aggregator" class="tight-form-input input-small"
+                    ng-options="agg for agg in aggregators"
+                    ng-change="targetBlur()">
+            </select>
+            <a bs-tooltip="target.errors.aggregator" style="color: rgb(229, 189, 28)" ng-show="target.errors.aggregator">
+                <i class="fa fa-warning"></i>
+            </a>
+        </li>
+    </ul>
+
+    <div class="clearfix"></div>
+</div>
+
+<div class="tight-form">
+    <ul class="tight-form-list" role="menu">
+        <li class="tight-form-item tight-form-align" style="width: 86px">
+            <editor-checkbox text="Rate" model="target.shouldComputeRate" change="targetBlur()"></editor-checkbox>
+        </li>
+
+        <li class="tight-form-item tight-form-align">
+            <editor-checkbox text="Precision" model="target.shouldAddPrecision" change="targetBlur()"></editor-checkbox>
+        </li>
+        <li ng-show="target.shouldAddPrecision">
+            <select ng-model="target.precision" class="tight-form-input input-small"
+                    ng-options="precision for precision in precisions"
+                    ng-change="targetBlur()">
+            </select>
+        </li>
+    <div class="clearfix"></div>
+</div>

http://git-wip-us.apache.org/repos/asf/ambari/blob/8ff0b5ed/ambari-metrics/ambari-metrics-grafana/ambari-metrics/partials/query.options.html
----------------------------------------------------------------------
diff --git a/ambari-metrics/ambari-metrics-grafana/ambari-metrics/partials/query.options.html b/ambari-metrics/ambari-metrics-grafana/ambari-metrics/partials/query.options.html
new file mode 100644
index 0000000..e58ca64
--- /dev/null
+++ b/ambari-metrics/ambari-metrics-grafana/ambari-metrics/partials/query.options.html
@@ -0,0 +1,42 @@
+<!--
+  ~ 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.
+  -->
+<section class="grafana-metric-options">
+	<div class="tight-form last">
+		<ul class="tight-form-list">
+			<li class="tight-form-item tight-form-item-icon">
+				<i class="fa fa-info-circle"></i>
+			</li>
+			<li class="tight-form-item">
+				<a ng-click="toggleEditorHelp(1);" bs-tooltip="'click to show helpful info'" data-placement="bottom">
+					Single Stats
+				</a>
+			</li>
+		</ul>
+		<div class="clearfix"></div>
+	</div>
+</section>
+
+<div class="editor-row">
+	<div class="pull-left" style="margin-top: 30px;">
+		<div class="grafana-info-box span6" ng-if="editorHelpIndex === 1">
+			<h5>Single Stats</h5>
+			<blockquote>To get the current value of the metric selected, Click on the <strong>Options</strong> tab above
+				and set the <strong>Big Value's</strong> value to <strong>"current"</strong>.</blockquote>
+		</div>
+	</div>
+</div>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/8ff0b5ed/ambari-metrics/ambari-metrics-grafana/ambari-metrics/plugin.json
----------------------------------------------------------------------
diff --git a/ambari-metrics/ambari-metrics-grafana/ambari-metrics/plugin.json b/ambari-metrics/ambari-metrics-grafana/ambari-metrics/plugin.json
new file mode 100644
index 0000000..5226ae7
--- /dev/null
+++ b/ambari-metrics/ambari-metrics-grafana/ambari-metrics/plugin.json
@@ -0,0 +1,14 @@
+{
+  "pluginType": "datasource",
+  "name": "AmbariMetrics",
+
+  "type": "ambarimetrics",
+  "serviceName": "AmbariMetricsDatasource",
+
+  "module": "app/plugins/datasource/ambari-metrics/datasource",
+    "partials": {
+    "config": "app/plugins/datasource/ambari-metrics/partials/config.html"
+  },
+
+  "metrics": true
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/8ff0b5ed/ambari-metrics/ambari-metrics-grafana/ambari-metrics/queryCtrl.js
----------------------------------------------------------------------
diff --git a/ambari-metrics/ambari-metrics-grafana/ambari-metrics/queryCtrl.js b/ambari-metrics/ambari-metrics-grafana/ambari-metrics/queryCtrl.js
new file mode 100644
index 0000000..d6e93a8
--- /dev/null
+++ b/ambari-metrics/ambari-metrics-grafana/ambari-metrics/queryCtrl.js
@@ -0,0 +1,131 @@
+/**
+ * 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.
+ */
+define([
+      'angular',
+      'lodash'
+    ],
+    function (angular, _) {
+      'use strict';
+
+      var module = angular.module('grafana.controllers');
+
+      module.controller('AmbariMetricsQueryCtrl', function($scope) {
+
+        $scope.init = function() {
+          $scope.target.errors = validateTarget($scope.target);
+          $scope.aggregators = ['avg', 'sum', 'min', 'max'];
+          $scope.precisions = ['seconds', 'minutes', 'hours', 'days'];
+
+          if (!$scope.target.aggregator) {
+            $scope.target.aggregator = 'avg';
+          }
+
+          if (!$scope.target.downsampleAggregator) {
+            $scope.target.downsampleAggregator = 'avg';
+          }
+
+          $scope.datasource.getAggregators().then(function(aggs) {
+            $scope.aggregators = aggs;
+          });
+        };
+
+        $scope.targetBlur = function() {
+          $scope.target.errors = validateTarget($scope.target);
+
+          // this does not work so good
+          if (!_.isEqual($scope.oldTarget, $scope.target) && _.isEmpty($scope.target.errors)) {
+            $scope.oldTarget = angular.copy($scope.target);
+            $scope.get_data();
+          }
+        };
+
+        $scope.getTextValues = function(metricFindResult) {
+          return _.map(metricFindResult, function(value) { return value.text; });
+        };
+
+        $scope.suggestApps = function(query, callback) {
+          $scope.datasource.suggestApps(query)
+            .then($scope.getTextValues)
+            .then(callback);
+        };
+
+        $scope.suggestHosts = function(query, callback) {
+          $scope.datasource.suggestHosts(query)
+            .then($scope.getTextValues)
+            .then(callback);
+        };
+
+        $scope.suggestMetrics = function(query, callback) {
+          $scope.datasource.suggestMetrics(query, $scope.target.app)
+            .then($scope.getTextValues)
+            .then(callback);
+        };
+
+        $scope.suggestTagKeys = function(query, callback) {
+          $scope.datasource.metricFindQuery('tag_names(' + $scope.target.metric + ')')
+              .then($scope.getTextValues)
+              .then(callback);
+        };
+
+        $scope.suggestTagValues = function(query, callback) {
+          $scope.datasource.metricFindQuery('tag_values(' + $scope.target.metric + ',' + $scope.target.currentTagKey + ')')
+              .then($scope.getTextValues)
+              .then(callback);
+        };
+
+        $scope.addTag = function() {
+          if (!$scope.addTagMode) {
+            $scope.addTagMode = true;
+            return;
+          }
+
+          if (!$scope.target.tags) {
+            $scope.target.tags = {};
+          }
+
+          $scope.target.errors = validateTarget($scope.target);
+
+          if (!$scope.target.errors.tags) {
+            $scope.target.tags[$scope.target.currentTagKey] = $scope.target.currentTagValue;
+            $scope.target.currentTagKey = '';
+            $scope.target.currentTagValue = '';
+            $scope.targetBlur();
+          }
+
+          $scope.addTagMode = false;
+        };
+
+        $scope.removeTag = function(key) {
+          delete $scope.target.tags[key];
+          $scope.targetBlur();
+        };
+
+        function validateTarget(target) {
+          var errs = {};
+
+          if (target.tags && _.has(target.tags, target.currentTagKey)) {
+            errs.tags = "Duplicate tag key '" + target.currentTagKey + "'.";
+          }
+
+          return errs;
+        }
+
+        $scope.init();
+      });
+
+    });
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/8ff0b5ed/ambari-metrics/pom.xml
----------------------------------------------------------------------
diff --git a/ambari-metrics/pom.xml b/ambari-metrics/pom.xml
index 3ca8d54..9a39122 100644
--- a/ambari-metrics/pom.xml
+++ b/ambari-metrics/pom.xml
@@ -276,6 +276,7 @@
             <exclude>pass.txt</exclude>
             <exclude>derby.log</exclude>
             <exclude>**/*.nuspec</exclude>
+            <exclude>**/*.json</exclude>
           </excludes>
         </configuration>
         <executions>


[39/40] ambari git commit: AMBARI-14766 - Selecting ALL groups does not work under Manage Alert Notifications (Keta Patel via jonathanhurley)

Posted by nc...@apache.org.
AMBARI-14766 - Selecting ALL groups does not work under Manage Alert Notifications (Keta Patel via jonathanhurley)


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

Branch: refs/heads/branch-dev-patch-upgrade
Commit: f57f9b2910ad1d888b2bd608e3d8b450154a0a23
Parents: 26ad97b
Author: Jonathan Hurley <jh...@hortonworks.com>
Authored: Fri Feb 5 16:24:12 2016 -0500
Committer: Jonathan Hurley <jh...@hortonworks.com>
Committed: Fri Feb 5 16:24:28 2016 -0500

----------------------------------------------------------------------
 .../internal/AlertTargetResourceProvider.java   |  12 +-
 .../AlertTargetResourceProviderTest.java        | 150 ++++++++++++++++++-
 .../manage_alert_notifications_controller.js    |   7 +
 3 files changed, 162 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/f57f9b29/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AlertTargetResourceProvider.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AlertTargetResourceProvider.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AlertTargetResourceProvider.java
index d28987d..992d33f 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AlertTargetResourceProvider.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AlertTargetResourceProvider.java
@@ -380,7 +380,10 @@ public class AlertTargetResourceProvider extends
     String notificationType = (String) requestMap.get(ALERT_TARGET_NOTIFICATION_TYPE);
     Collection<String> alertStates = (Collection<String>) requestMap.get(ALERT_TARGET_STATES);
     Collection<Long> groupIds = (Collection<Long>) requestMap.get(ALERT_TARGET_GROUPS);
-
+    String isGlobal = (String) requestMap.get(ALERT_TARGET_GLOBAL);
+    if(null != isGlobal){
+      entity.setGlobal(Boolean.parseBoolean(isGlobal));
+    }
     if (!StringUtils.isBlank(name)) {
       entity.setTargetName(name);
     }
@@ -425,6 +428,13 @@ public class AlertTargetResourceProvider extends
       }
 
       entity.setAlertGroups(groups);
+    } else if (entity.isGlobal()){
+      Set<AlertGroupEntity> groups = new HashSet<AlertGroupEntity>(s_dao.findAllGroups());
+      for (AlertGroupEntity group : groups) {
+        group.addAlertTarget(entity);
+        s_dao.merge(group);
+      }
+      entity.setAlertGroups(groups);
     }
 
     s_dao.merge(entity);

http://git-wip-us.apache.org/repos/asf/ambari/blob/f57f9b29/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/AlertTargetResourceProviderTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/AlertTargetResourceProviderTest.java b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/AlertTargetResourceProviderTest.java
index f80b6f7..7277b67 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/AlertTargetResourceProviderTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/AlertTargetResourceProviderTest.java
@@ -894,6 +894,126 @@ public class AlertTargetResourceProviderTest {
     verify(m_amc, m_dao);
   }
 
+  @Test
+  public void testUpdateAlertTargetsWithCustomGroups() throws Exception{
+    Capture<AlertTargetEntity> entityCapture = new Capture<AlertTargetEntity>();
+    m_dao.create(capture(entityCapture));
+    expectLastCall().times(1);
+
+    AlertTargetEntity target = new AlertTargetEntity();
+    expect(m_dao.findTargetById(ALERT_TARGET_ID)).andReturn(target).once();
+
+    Capture<AlertGroupEntity> groupEntityCapture = new Capture<AlertGroupEntity>();
+
+    //All Groups in the Database with CLuster ID = 1L
+    List<AlertGroupEntity> groups = getMockGroupEntities();
+
+    //List of group ids to be selected in Custom option
+    List<Long> groupIds = Arrays.asList(1L, 2L, 3L);
+
+    expect(m_dao.findGroupsById(EasyMock.eq(groupIds))).andReturn(groups).anyTimes();
+    expect(m_dao.findAllGroups()).andReturn(groups).anyTimes();
+    for(AlertGroupEntity group: groups){
+      expect(m_dao.merge(capture(groupEntityCapture))).andReturn(group).anyTimes();
+    }
+    expect(m_dao.merge(capture(entityCapture))).andReturn(target).anyTimes();
+
+    //start execution with the above Expectation setters
+    replay(m_amc, m_dao);
+
+    SecurityContextHolder.getContext().setAuthentication(TestAuthenticationFactory.createAdministrator());
+
+    AlertTargetResourceProvider provider = createProvider(m_amc);
+    Map<String, Object> requestProps = getCreationProperties();
+    Request request = PropertyHelper.getCreateRequest(
+      Collections.singleton(requestProps), null);
+    provider.createResources(request);
+
+    requestProps = new HashMap<String, Object>();
+    requestProps.put(AlertTargetResourceProvider.ALERT_TARGET_ID, ALERT_TARGET_ID.toString());
+
+    //selecting CUSTOM option for Groups, 2 group ids selected from the available options
+    requestProps.put(AlertTargetResourceProvider.ALERT_TARGET_GLOBAL, "false");
+    requestProps.put(AlertTargetResourceProvider.ALERT_TARGET_GROUPS, groupIds);
+
+    Predicate predicate = new PredicateBuilder().property(
+      AlertTargetResourceProvider.ALERT_TARGET_ID).equals(
+      ALERT_TARGET_ID.toString()).toPredicate();
+
+    request = PropertyHelper.getUpdateRequest(requestProps, null);
+    provider.updateResources(request, predicate);
+
+    assertTrue(entityCapture.hasCaptured());
+    AlertTargetEntity entity = entityCapture.getValue();
+
+    //verify that only the selected 2 groups were mapped with the target
+    assertEquals(3, entity.getAlertGroups().size());
+
+    //target must not be global for CUSTOM option
+    assertEquals(false,entity.isGlobal());
+
+    verify(m_amc, m_dao);
+  }
+
+  @Test
+  public void testUpdateAlertTargetsWithAllGroups() throws Exception{
+    Capture<AlertTargetEntity> entityCapture = new Capture<AlertTargetEntity>();
+    m_dao.create(capture(entityCapture));
+    expectLastCall().times(1);
+
+    AlertTargetEntity target = new AlertTargetEntity();
+    expect(m_dao.findTargetById(ALERT_TARGET_ID)).andReturn(target).once();
+
+    Capture<AlertGroupEntity> groupEntityCapture = new Capture<AlertGroupEntity>();
+
+    //All Groups in the Database with CLuster ID = 1L
+    List<AlertGroupEntity> groups = getMockGroupEntities();
+
+    //Groups to be selected for ALL option
+    List<Long> groupIds = Arrays.asList(1L, 2L, 3L);
+
+    expect(m_dao.findGroupsById(EasyMock.eq(groupIds))).andReturn(groups).anyTimes();
+    expect(m_dao.findAllGroups()).andReturn(groups).once();
+    for(AlertGroupEntity group: groups){
+      expect(m_dao.merge(capture(groupEntityCapture))).andReturn(group).once();
+    }
+    expect(m_dao.merge(capture(entityCapture))).andReturn(target).anyTimes();
+
+    //start execution with these Expectation setters
+    replay(m_amc, m_dao);
+
+    SecurityContextHolder.getContext().setAuthentication(TestAuthenticationFactory.createAdministrator());
+
+    AlertTargetResourceProvider provider = createProvider(m_amc);
+    Map<String, Object> requestProps = getCreationProperties();
+    Request request = PropertyHelper.getCreateRequest(
+      Collections.singleton(requestProps), null);
+    provider.createResources(request);
+
+    requestProps = new HashMap<String, Object>();
+    requestProps.put(AlertTargetResourceProvider.ALERT_TARGET_ID, ALERT_TARGET_ID.toString());
+
+    //selecting ALL option for Groups
+    requestProps.put(AlertTargetResourceProvider.ALERT_TARGET_GLOBAL, "true");
+
+    Predicate predicate = new PredicateBuilder().property(
+      AlertTargetResourceProvider.ALERT_TARGET_ID).equals(
+      ALERT_TARGET_ID.toString()).toPredicate();
+
+    request = PropertyHelper.getUpdateRequest(requestProps, null);
+    provider.updateResources(request, predicate);
+
+    assertTrue(entityCapture.hasCaptured());
+    AlertTargetEntity entity = entityCapture.getValue();
+
+    //verify that all the groups got mapped with target
+    assertEquals(3, entity.getAlertGroups().size());
+
+    //Target must be global for ALL option
+    assertEquals(true,entity.isGlobal());
+
+    verify(m_amc, m_dao);
+  }
 
   /**
    * @param amc
@@ -932,20 +1052,20 @@ public class AlertTargetResourceProviderTest {
   private Map<String, Object> getCreationProperties() throws Exception {
     Map<String, Object> requestProps = new HashMap<String, Object>();
     requestProps.put(AlertTargetResourceProvider.ALERT_TARGET_NAME,
-        ALERT_TARGET_NAME);
+            ALERT_TARGET_NAME);
 
     requestProps.put(AlertTargetResourceProvider.ALERT_TARGET_DESCRIPTION,
-        ALERT_TARGET_DESC);
+            ALERT_TARGET_DESC);
 
     requestProps.put(
-        AlertTargetResourceProvider.ALERT_TARGET_NOTIFICATION_TYPE,
-        ALERT_TARGET_TYPE);
+            AlertTargetResourceProvider.ALERT_TARGET_NOTIFICATION_TYPE,
+            ALERT_TARGET_TYPE);
 
     requestProps.put(AlertTargetResourceProvider.ALERT_TARGET_PROPERTIES
-        + "/foo", "bar");
+            + "/foo", "bar");
 
     requestProps.put(AlertTargetResourceProvider.ALERT_TARGET_PROPERTIES
-        + "/foobar", "baz");
+            + "/foobar", "baz");
 
     return requestProps;
   }
@@ -976,6 +1096,24 @@ public class AlertTargetResourceProviderTest {
   }
 
   /**
+   * @return
+   */
+  @SuppressWarnings({ "rawtypes", "unchecked" })
+  private List<AlertGroupEntity> getMockGroupEntities() throws Exception {
+    AlertGroupEntity group1 = new AlertGroupEntity();
+    AlertGroupEntity group2 = new AlertGroupEntity();
+    AlertGroupEntity group3 = new AlertGroupEntity();
+    group1.setGroupId(1L);
+    group1.setClusterId(1L);
+    group2.setGroupId(2L);
+    group2.setClusterId(1L);
+    group3.setGroupId(3L);
+    group3.setClusterId(1L);
+
+    return Arrays.asList(group1, group2, group3);
+  }
+
+  /**
   *
   */
   private class MockModule implements Module {

http://git-wip-us.apache.org/repos/asf/ambari/blob/f57f9b29/ambari-web/app/controllers/main/alerts/manage_alert_notifications_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/alerts/manage_alert_notifications_controller.js b/ambari-web/app/controllers/main/alerts/manage_alert_notifications_controller.js
index 38e4e75..79e524e 100644
--- a/ambari-web/app/controllers/main/alerts/manage_alert_notifications_controller.js
+++ b/ambari-web/app/controllers/main/alerts/manage_alert_notifications_controller.js
@@ -702,6 +702,13 @@ App.ManageAlertNotificationsController = Em.Controller.extend({
    * @method updateAlertNotification
    */
   updateAlertNotification: function (apiObject) {
+    if(apiObject!=null){
+      if(apiObject.AlertTarget.global == false){
+        this.get('selectedAlertNotification').set('global',false);
+      } else {
+        this.get('selectedAlertNotification').set('global',true);
+      }
+    }
     return App.ajax.send({
       name: 'alerts.update_alert_notification',
       sender: this,


[18/40] ambari git commit: AMBARI-14905. Add API directive to force toggling Kerberos if the cluster's security type has not changed (rlevas)

Posted by nc...@apache.org.
AMBARI-14905. Add API directive to force toggling Kerberos if the cluster's security type has not changed (rlevas)


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

Branch: refs/heads/branch-dev-patch-upgrade
Commit: eb3f995965b2749910ceae9e5cc8f8bc043e6862
Parents: ab06c68
Author: Robert Levas <rl...@hortonworks.com>
Authored: Thu Feb 4 15:46:18 2016 -0500
Committer: Robert Levas <rl...@hortonworks.com>
Committed: Thu Feb 4 15:46:23 2016 -0500

----------------------------------------------------------------------
 .../resources/ClusterResourceDefinition.java    |  3 +-
 .../AmbariManagementControllerImpl.java         | 44 +++++++------
 .../server/controller/KerberosHelper.java       | 26 +++++++-
 .../server/controller/KerberosHelperImpl.java   |  5 ++
 .../AmbariManagementControllerImplTest.java     | 12 ++++
 .../server/controller/KerberosHelperTest.java   | 66 +++++++++++++++++++-
 6 files changed, 133 insertions(+), 23 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/eb3f9959/ambari-server/src/main/java/org/apache/ambari/server/api/resources/ClusterResourceDefinition.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/api/resources/ClusterResourceDefinition.java b/ambari-server/src/main/java/org/apache/ambari/server/api/resources/ClusterResourceDefinition.java
index b2be291..e57364f 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/api/resources/ClusterResourceDefinition.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/api/resources/ClusterResourceDefinition.java
@@ -81,8 +81,9 @@ public class ClusterResourceDefinition extends BaseResourceDefinition {
   @Override
   public Collection<String> getUpdateDirectives() {
     Collection<String> directives = super.getUpdateDirectives();
-    directives.add("regenerate_keytabs");
+    directives.add(KerberosHelper.DIRECTIVE_REGENERATE_KEYTABS);
     directives.add(KerberosHelper.DIRECTIVE_MANAGE_KERBEROS_IDENTITIES);
+    directives.add(KerberosHelper.DIRECTIVE_FORCE_TOGGLE_KERBEROS);
     return directives;
   }
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/eb3f9959/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java
index 5010311..69b3348 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java
@@ -1708,29 +1708,35 @@ public class AmbariManagementControllerImpl implements AmbariManagementControlle
         } catch (KerberosOperationException e) {
           throw new IllegalArgumentException(e.getMessage(), e);
         }
-      } else if (cluster.getSecurityType() != securityType) {
-        LOG.info("Received cluster security type change request from {} to {}",
-            cluster.getSecurityType().name(), securityType.name());
+      } else {
+        // If force_toggle_kerberos is not specified, null will be returned. Therefore, perform an
+        // equals check to yield true if the result is Boolean.TRUE, otherwise false.
+        boolean forceToggleKerberos = kerberosHelper.getForceToggleKerberosDirective(requestProperties);
 
-        if ((securityType == SecurityType.KERBEROS) || (securityType == SecurityType.NONE)) {
-          if(!AuthorizationHelper.isAuthorized(ResourceType.CLUSTER, cluster.getResourceId(), EnumSet.of(RoleAuthorization.CLUSTER_TOGGLE_KERBEROS))) {
-            throw new AuthorizationException("The authenticated user does not have authorization to enable or disable Kerberos");
-          }
+        if (forceToggleKerberos || (cluster.getSecurityType() != securityType)) {
+          LOG.info("Received cluster security type change request from {} to {} (forced: {})",
+              cluster.getSecurityType().name(), securityType.name(), forceToggleKerberos);
 
-          // Since the security state of the cluster has changed, invoke toggleKerberos to handle
-          // adding or removing Kerberos from the cluster. This may generate multiple stages
-          // or not depending the current state of the cluster.
-          try {
-            requestStageContainer = kerberosHelper.toggleKerberos(cluster, securityType, requestStageContainer,
-                kerberosHelper.getManageIdentitiesDirective(requestProperties));
-          } catch (KerberosOperationException e) {
-            throw new IllegalArgumentException(e.getMessage(), e);
+          if ((securityType == SecurityType.KERBEROS) || (securityType == SecurityType.NONE)) {
+            if (!AuthorizationHelper.isAuthorized(ResourceType.CLUSTER, cluster.getResourceId(), EnumSet.of(RoleAuthorization.CLUSTER_TOGGLE_KERBEROS))) {
+              throw new AuthorizationException("The authenticated user does not have authorization to enable or disable Kerberos");
+            }
+
+            // Since the security state of the cluster has changed, invoke toggleKerberos to handle
+            // adding or removing Kerberos from the cluster. This may generate multiple stages
+            // or not depending the current state of the cluster.
+            try {
+              requestStageContainer = kerberosHelper.toggleKerberos(cluster, securityType, requestStageContainer,
+                  kerberosHelper.getManageIdentitiesDirective(requestProperties));
+            } catch (KerberosOperationException e) {
+              throw new IllegalArgumentException(e.getMessage(), e);
+            }
+          } else {
+            throw new IllegalArgumentException(String.format("Unexpected security type encountered: %s", securityType.name()));
           }
-        } else {
-          throw new IllegalArgumentException(String.format("Unexpected security type encountered: %s", securityType.name()));
-        }
 
-        cluster.setSecurityType(securityType);
+          cluster.setSecurityType(securityType);
+        }
       }
     }
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/eb3f9959/ambari-server/src/main/java/org/apache/ambari/server/controller/KerberosHelper.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/KerberosHelper.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/KerberosHelper.java
index 5008d60..39f55cd 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/KerberosHelper.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/KerberosHelper.java
@@ -45,6 +45,15 @@ public interface KerberosHelper {
    */
   String DIRECTIVE_MANAGE_KERBEROS_IDENTITIES = "manage_kerberos_identities";
   /**
+   * directive used to indicate that the enable Kerberos operation is only to regenerate keytab files
+   */
+  String DIRECTIVE_REGENERATE_KEYTABS = "regenerate_keytabs";
+  /**
+   * directive used to indicate that the enable Kerberos operation should proceed even if the
+   * cluster's security type is not changing
+   */
+  String DIRECTIVE_FORCE_TOGGLE_KERBEROS = "force_toggle_kerberos";
+  /**
    * config type which contains the property used to determine if Kerberos is enabled
    */
   String SECURITY_ENABLED_CONFIG_TYPE = "cluster-env";
@@ -472,13 +481,28 @@ public interface KerberosHelper {
    * If manage_kerberos_identities does exists in the map of request properties, a Boolean value
    * is returned indicating whether its value is "false" (Boolean.FALSE) or not (Boolean.TRUE).
    *
-   * @param requestProperties a map of the requst property name/value pairs
+   * @param requestProperties a map of the request property name/value pairs
    * @return Boolean.TRUE or Boolean.FALSE if the manage_kerberos_identities property exists in the map;
    * otherwise false
    */
   Boolean getManageIdentitiesDirective(Map<String, String> requestProperties);
 
   /**
+   * Retrieves the value of the force_toggle_kerberos directive from the request properties,
+   * if it exists.
+   * <p/>
+   * If force_toggle_kerberos does not exist in the map of request properties, <code>false</code> is
+   * returned.
+   * <p/>
+   * If force_toggle_kerberos does exists in the map of request properties and is equal to "true",
+   * then <code>true</code> is returned; otherwise <code>false</code> is returned.
+   *
+   * @param requestProperties a map of the request property name/value pairs
+   * @return true if force_toggle_kerberos is "true"; otherwise false
+   */
+  boolean getForceToggleKerberosDirective(Map<String, String> requestProperties);
+
+  /**
    * Given a list of KerberosIdentityDescriptors, returns a Map fo configuration types to property
    * names and values.
    * <p/>

http://git-wip-us.apache.org/repos/asf/ambari/blob/eb3f9959/ambari-server/src/main/java/org/apache/ambari/server/controller/KerberosHelperImpl.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/KerberosHelperImpl.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/KerberosHelperImpl.java
index 63aa92d..556bed8 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/KerberosHelperImpl.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/KerberosHelperImpl.java
@@ -2078,6 +2078,11 @@ public class KerberosHelperImpl implements KerberosHelper {
   }
 
   @Override
+  public boolean getForceToggleKerberosDirective(Map<String, String> requestProperties) {
+    return (requestProperties != null) && "true".equalsIgnoreCase(requestProperties.get(DIRECTIVE_FORCE_TOGGLE_KERBEROS));
+  }
+
+  @Override
   public Map<String, Map<String, String>> getIdentityConfigurations(List<KerberosIdentityDescriptor> identityDescriptors) {
     Map<String, Map<String, String>> map = new HashMap<String, Map<String, String>>();
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/eb3f9959/ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariManagementControllerImplTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariManagementControllerImplTest.java b/ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariManagementControllerImplTest.java
index 5838001..6069ba6 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariManagementControllerImplTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariManagementControllerImplTest.java
@@ -728,6 +728,9 @@ public class AmbariManagementControllerImplTest {
     expect(kerberosHelper.shouldExecuteCustomOperations(SecurityType.KERBEROS, null))
         .andReturn(false)
         .once();
+    expect(kerberosHelper.getForceToggleKerberosDirective(anyObject(Map.class)))
+        .andReturn(false)
+        .once();
     // Note: kerberosHelper.toggleKerberos is not called
 
     // replay mocks
@@ -775,6 +778,9 @@ public class AmbariManagementControllerImplTest {
     expect(kerberosHelper.shouldExecuteCustomOperations(SecurityType.KERBEROS, null))
         .andReturn(false)
         .once();
+    expect(kerberosHelper.getForceToggleKerberosDirective(null))
+        .andReturn(false)
+        .once();
     expect(kerberosHelper.getManageIdentitiesDirective(null))
         .andReturn(null)
         .once();
@@ -856,6 +862,9 @@ public class AmbariManagementControllerImplTest {
     expect(kerberosHelper.shouldExecuteCustomOperations(SecurityType.NONE, null))
         .andReturn(false)
         .once();
+    expect(kerberosHelper.getForceToggleKerberosDirective(anyObject(Map.class)))
+        .andReturn(false)
+        .once();
     expect(kerberosHelper.getManageIdentitiesDirective(anyObject(Map.class)))
         .andReturn(manageIdentities)
         .once();
@@ -920,6 +929,9 @@ public class AmbariManagementControllerImplTest {
     expect(kerberosHelper.shouldExecuteCustomOperations(SecurityType.NONE, null))
         .andReturn(false)
         .once();
+    expect(kerberosHelper.getForceToggleKerberosDirective(anyObject(Map.class)))
+        .andReturn(false)
+        .once();
     expect(kerberosHelper.getManageIdentitiesDirective(anyObject(Map.class)))
         .andReturn(null)
         .once();

http://git-wip-us.apache.org/repos/asf/ambari/blob/eb3f9959/ambari-server/src/test/java/org/apache/ambari/server/controller/KerberosHelperTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/controller/KerberosHelperTest.java b/ambari-server/src/test/java/org/apache/ambari/server/controller/KerberosHelperTest.java
index 869d187..2dcde00 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/controller/KerberosHelperTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/controller/KerberosHelperTest.java
@@ -420,7 +420,7 @@ public class KerberosHelperTest extends EasyMockSupport {
     final Cluster cluster = createNiceMock(Cluster.class);
 
     kerberosHelper.executeCustomOperations(cluster,
-        Collections.singletonMap("regenerate_keytabs", "false"), null, true);
+        Collections.singletonMap(KerberosHelper.DIRECTIVE_REGENERATE_KEYTABS, "false"), null, true);
     Assert.fail("AmbariException should have failed");
   }
 
@@ -1751,7 +1751,7 @@ public class KerberosHelperTest extends EasyMockSupport {
     credentialStoreService.setCredential(cluster.getClusterName(), KerberosHelper.KDC_ADMINISTRATOR_CREDENTIAL_ALIAS,
         PrincipalKeyCredential, CredentialStoreType.TEMPORARY);
 
-    Assert.assertNotNull(kerberosHelper.executeCustomOperations(cluster, Collections.singletonMap("regenerate_keytabs", "true"), requestStageContainer, true));
+    Assert.assertNotNull(kerberosHelper.executeCustomOperations(cluster, Collections.singletonMap(KerberosHelper.DIRECTIVE_REGENERATE_KEYTABS, "true"), requestStageContainer, true));
 
     verifyAll();
   }
@@ -1845,6 +1845,68 @@ public class KerberosHelperTest extends EasyMockSupport {
   }
 
   @Test
+  public void testGetForceToggleKerberosDirective_NotSet() throws Exception {
+    KerberosHelper kerberosHelper = injector.getInstance(KerberosHelper.class);
+
+    assertEquals(false, kerberosHelper.getForceToggleKerberosDirective(null));
+    assertEquals(false, kerberosHelper.getForceToggleKerberosDirective(Collections.<String, String>emptyMap()));
+
+    assertEquals(false, kerberosHelper.getForceToggleKerberosDirective(
+        new HashMap<String, String>() {
+          {
+            put(KerberosHelper.DIRECTIVE_FORCE_TOGGLE_KERBEROS, null);
+            put("some_directive_0", "false");
+            put("some_directive_1", null);
+          }
+        }
+    ));
+
+    assertEquals(false, kerberosHelper.getForceToggleKerberosDirective(
+        new HashMap<String, String>() {
+          {
+            put("some_directive_0", "false");
+            put("some_directive_1", null);
+          }
+        }
+    ));
+  }
+
+  @Test
+  public void testGetForceToggleKerberosDirective_True() throws Exception {
+    KerberosHelper kerberosHelper = injector.getInstance(KerberosHelper.class);
+
+    assertEquals(true, kerberosHelper.getForceToggleKerberosDirective(Collections.singletonMap(KerberosHelper.DIRECTIVE_FORCE_TOGGLE_KERBEROS, "true")));
+    assertEquals(false, kerberosHelper.getForceToggleKerberosDirective(Collections.singletonMap(KerberosHelper.DIRECTIVE_FORCE_TOGGLE_KERBEROS, "not_true")));
+
+    assertEquals(true, kerberosHelper.getForceToggleKerberosDirective(
+        new HashMap<String, String>() {
+          {
+            put(KerberosHelper.DIRECTIVE_FORCE_TOGGLE_KERBEROS, "true");
+            put("some_directive_0", "false");
+            put("some_directive_1", null);
+          }
+        }
+    ));
+  }
+
+  @Test
+  public void testGetForceToggleKerberosDirective_False() throws Exception {
+    KerberosHelper kerberosHelper = injector.getInstance(KerberosHelper.class);
+
+    assertEquals(false, kerberosHelper.getForceToggleKerberosDirective(Collections.singletonMap(KerberosHelper.DIRECTIVE_FORCE_TOGGLE_KERBEROS, "false")));
+
+    assertEquals(false, kerberosHelper.getForceToggleKerberosDirective(
+        new HashMap<String, String>() {
+          {
+            put(KerberosHelper.DIRECTIVE_FORCE_TOGGLE_KERBEROS, "false");
+            put("some_directive_0", "false");
+            put("some_directive_1", null);
+          }
+        }
+    ));
+  }
+
+  @Test
   public void testSetAuthToLocalRules() throws Exception {
     KerberosHelper kerberosHelper = injector.getInstance(KerberosHelper.class);
 


[36/40] ambari git commit: AMBARI-14871: Better messages when Ambari web UI can't resolve hosts to build quicklinks (dili)

Posted by nc...@apache.org.
AMBARI-14871: Better messages when Ambari web UI can't resolve hosts to build quicklinks (dili)


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

Branch: refs/heads/branch-dev-patch-upgrade
Commit: 14d53f79156b0b0badb118714948be883881f213
Parents: 13325ab
Author: Di Li <di...@apache.org>
Authored: Fri Feb 5 12:56:39 2016 -0500
Committer: Di Li <di...@apache.org>
Committed: Fri Feb 5 12:56:39 2016 -0500

----------------------------------------------------------------------
 ambari-web/app/messages.js                           |  5 +++--
 ambari-web/app/templates/main/service/item.hbs       |  2 +-
 ambari-web/app/views/common/quick_view_link_view.js  | 14 +++++++++++---
 ambari-web/test/views/common/quick_link_view_test.js | 13 +++++++++++--
 4 files changed, 26 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/14d53f79/ambari-web/app/messages.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/messages.js b/ambari-web/app/messages.js
index a8b5db6..9be6d86 100644
--- a/ambari-web/app/messages.js
+++ b/ambari-web/app/messages.js
@@ -2850,8 +2850,9 @@ Em.I18n.translations = {
   'common.combobox.dropdown.issues': 'Show property issues',
   'common.combobox.dropdown.warnings': 'Show property warnings',
 
-  'quick.links.error.label': 'Hostname is undefined',
-  'quick.links.error.label2': 'Quick Links are not available',
+  'quick.links.error.quicklinks.unavailable.label': 'Quick Links are not available',
+  'quick.links.error.nohosts.label': 'Failed to obtain host information for {0}',
+  'quick.links.error.oozie.label': 'Quick Links are not available. Make sure Oozie server is running.',
   'quick.links.publicHostName': '{0} ({1})',
   'quick.links.label.active': 'Active',
   'quick.links.label.standby': 'Standby',

http://git-wip-us.apache.org/repos/asf/ambari/blob/14d53f79/ambari-web/app/templates/main/service/item.hbs
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates/main/service/item.hbs b/ambari-web/app/templates/main/service/item.hbs
index f61695e..bc7f05f 100644
--- a/ambari-web/app/templates/main/service/item.hbs
+++ b/ambari-web/app/templates/main/service/item.hbs
@@ -43,7 +43,7 @@
                       <li><a {{bindAttr href="url"}} {{bindAttr target="view.linkTarget"}}>{{label}}</a></li>
                     {{/each}}
                   {{else}}
-                    <div class="alert alert-danger"><small>{{t quick.links.error.label2}}</small></div>
+                    <div class="alert alert-danger"><small>{{t quick.links.error.quicklinks.unavailable.label}}</small></div>
                   {{/if}}
                 {{/if}}
               {{else}}

http://git-wip-us.apache.org/repos/asf/ambari/blob/14d53f79/ambari-web/app/views/common/quick_view_link_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/common/quick_view_link_view.js b/ambari-web/app/views/common/quick_view_link_view.js
index c2f7dcc..567f65c 100644
--- a/ambari-web/app/views/common/quick_view_link_view.js
+++ b/ambari-web/app/views/common/quick_view_link_view.js
@@ -25,6 +25,8 @@ App.QuickViewLinks = Em.View.extend({
 
   hasQuickLinksConfiged: false,
 
+  quickLinksErrorMessage: '',
+
   /**
    * service which has blank target of link
    * @type {Array}
@@ -317,9 +319,9 @@ App.QuickViewLinks = Em.View.extend({
    * set empty links
    */
   setEmptyLinks: function () {
+    //display an error message
     var quickLinks = [{
-      label: this.t('quick.links.error.label'),
-      url: 'javascript:alert("' + this.t('contact.administrator') + '");return false;'
+      label: this.get('quickLinksErrorMessage')
     }];
     this.set('quickLinks', quickLinks);
     this.set('isLoaded', true);
@@ -432,10 +434,14 @@ App.QuickViewLinks = Em.View.extend({
       .filterProperty('workStatus', 'STARTED')
       .mapProperty('hostName');
 
-    return hosts.filter(function (host) {
+    var oozieHostsArray = hosts.filter(function (host) {
       host.status = Em.I18n.t('quick.links.label.active');
       return activeOozieServers.contains(host.hostName);
     }, this);
+
+    if (oozieHostsArray.length == 0)
+      this.set('quickLinksErrorMessage', Em.I18n.t('quick.links.error.oozie.label'));
+    return oozieHostsArray;
   },
 
   /**
@@ -506,6 +512,8 @@ App.QuickViewLinks = Em.View.extend({
    * @method getHosts
    */
   getHosts: function (response, serviceName) {
+    //The default error message when we cannot obtain the host information for the given service
+    this.set('quickLinksErrorMessage', Em.I18n.t('quick.links.error.nohosts.label').format(serviceName));
     if (App.get('singleNodeInstall')) {
       return [{
         hostName: App.get('singleNodeAlias'),

http://git-wip-us.apache.org/repos/asf/ambari/blob/14d53f79/ambari-web/test/views/common/quick_link_view_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/views/common/quick_link_view_test.js b/ambari-web/test/views/common/quick_link_view_test.js
index 93a235c..3a604fe 100644
--- a/ambari-web/test/views/common/quick_link_view_test.js
+++ b/ambari-web/test/views/common/quick_link_view_test.js
@@ -334,8 +334,7 @@ describe('App.QuickViewLinks', function () {
     it("empty links are set", function () {
       quickViewLinks.setEmptyLinks();
       expect(quickViewLinks.get('quickLinks')).to.eql([{
-        label: quickViewLinks.t('quick.links.error.label'),
-        url: 'javascript:alert("' + quickViewLinks.t('contact.administrator') + '");return false;' // eslint-disable-line no-script-url
+        label: quickViewLinks.get('quickLinksErrorMessage'),
       }]);
       expect(quickViewLinks.get('isLoaded')).to.be.true;
     });
@@ -352,6 +351,16 @@ describe('App.QuickViewLinks', function () {
       quickViewLinks.processOozieHosts([host]);
       expect(host.status).to.equal(Em.I18n.t('quick.links.label.active'));
     });
+    it("host status is invalid", function () {
+      quickViewLinks.set('content.hostComponents', [Em.Object.create({
+        componentName: 'OOZIE_SERVER',
+        workStatus: 'INSTALLED',
+        hostName: 'host1'
+      })]);
+      var host = {hostName: 'host1'};
+      quickViewLinks.processOozieHosts([host]);
+      expect(quickViewLinks.get('quickLinksErrorMessage')).to.equal(Em.I18n.t('quick.links.error.oozie.label'));
+    });
   });
 
   describe("#processHdfsHosts()", function () {


[22/40] ambari git commit: AMBARI-14917. Edit WEB Alert issues (onechiporenko)

Posted by nc...@apache.org.
AMBARI-14917. Edit WEB Alert issues (onechiporenko)


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

Branch: refs/heads/branch-dev-patch-upgrade
Commit: 74d5a016711c8c9d8641953e8732e65534db1a88
Parents: 3d7643b
Author: Oleg Nechiporenko <on...@apache.org>
Authored: Thu Feb 4 14:13:28 2016 +0200
Committer: Oleg Nechiporenko <on...@apache.org>
Committed: Fri Feb 5 10:02:36 2016 +0200

----------------------------------------------------------------------
 .../alerts/definition_configs_controller.js     | 13 +++++-----
 ambari-web/app/models/alerts/alert_config.js    |  1 +
 ambari-web/app/styles/alerts.less               |  2 +-
 .../activateStandby/step2_controller_test.js    |  1 -
 .../definitions_configs_controller_test.js      | 26 ++++++++++++++++++++
 5 files changed, 34 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/74d5a016/ambari-web/app/controllers/main/alerts/definition_configs_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/alerts/definition_configs_controller.js b/ambari-web/app/controllers/main/alerts/definition_configs_controller.js
index 3fd5510..ec5680c 100644
--- a/ambari-web/app/controllers/main/alerts/definition_configs_controller.js
+++ b/ambari-web/app/controllers/main/alerts/definition_configs_controller.js
@@ -499,12 +499,8 @@ App.MainAlertDefinitionConfigsController = Em.Controller.extend({
       return c.get('name') !== 'parameter';
     });
     configs.forEach(function (property) {
-      var apiProperties = property.get('apiProperty');
-      var apiFormattedValues = property.get('apiFormattedValue');
-      if (!Em.isArray(property.get('apiProperty'))) {
-        apiProperties = [property.get('apiProperty')];
-        apiFormattedValues = [property.get('apiFormattedValue')];
-      }
+      var apiProperties = Em.makeArray(property.get('apiProperty'));
+      var apiFormattedValues = Em.makeArray(property.get('apiFormattedValue'));
       apiProperties.forEach(function (apiProperty, i) {
         if (apiProperty.contains('source.')) {
           if (!propertiesToUpdate['AlertDefinition/source']) {
@@ -531,7 +527,6 @@ App.MainAlertDefinitionConfigsController = Em.Controller.extend({
             }
             Ember.setFullPath(propertiesToUpdate['AlertDefinition/source'], apiProperty.replace('source.', ''), apiFormattedValues[i]);
           }
-
         }
         else {
           if (apiProperty) {
@@ -541,6 +536,10 @@ App.MainAlertDefinitionConfigsController = Em.Controller.extend({
       }, this);
     }, this);
 
+    if (Em.get(propertiesToUpdate, 'AlertDefinition/source.uri.id')) {
+      delete propertiesToUpdate['AlertDefinition/source'].uri.id;
+    }
+
     // `source.parameters` is an array and should be updated separately from other configs
     if (this.get('content.parameters.length')) {
       propertiesToUpdate['AlertDefinition/source/parameters'] = this.get('content.rawSourceData.parameters');

http://git-wip-us.apache.org/repos/asf/ambari/blob/74d5a016/ambari-web/app/models/alerts/alert_config.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/models/alerts/alert_config.js b/ambari-web/app/models/alerts/alert_config.js
index a9a8154..c86b19a 100644
--- a/ambari-web/app/models/alerts/alert_config.js
+++ b/ambari-web/app/models/alerts/alert_config.js
@@ -437,6 +437,7 @@ App.AlertConfigProperties = {
     displayType: 'textField',
     classNames: 'alert-connection-timeout',
     apiProperty: 'source.uri.connection_timeout',
+    unit: 'Seconds',
     isValid: function () {
       var value = this.get('value');
       return numericUtils.isPositiveNumber(value);

http://git-wip-us.apache.org/repos/asf/ambari/blob/74d5a016/ambari-web/app/styles/alerts.less
----------------------------------------------------------------------
diff --git a/ambari-web/app/styles/alerts.less b/ambari-web/app/styles/alerts.less
index 1063ecf..c4f163d 100644
--- a/ambari-web/app/styles/alerts.less
+++ b/ambari-web/app/styles/alerts.less
@@ -324,7 +324,7 @@
     padding-right: 13px;
   }
 
-  .alert-interval-input {
+  .alert-interval-input, .alert-connection-timeout {
     input {
       width: 20%;
     }

http://git-wip-us.apache.org/repos/asf/ambari/blob/74d5a016/ambari-web/test/controllers/main/admin/highAvailability/hawq/activateStandby/step2_controller_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/main/admin/highAvailability/hawq/activateStandby/step2_controller_test.js b/ambari-web/test/controllers/main/admin/highAvailability/hawq/activateStandby/step2_controller_test.js
index e702892..845c932 100644
--- a/ambari-web/test/controllers/main/admin/highAvailability/hawq/activateStandby/step2_controller_test.js
+++ b/ambari-web/test/controllers/main/admin/highAvailability/hawq/activateStandby/step2_controller_test.js
@@ -18,7 +18,6 @@
 
 var App = require('app');
 require('controllers/main/admin/highAvailability/hawq/activateStandby/step2_controller');
-var testHelpers = require('test/helpers');
 
 describe('App.ActivateHawqStandbyWizardStep2Controller', function () {
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/74d5a016/ambari-web/test/controllers/main/alerts/definitions_configs_controller_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/main/alerts/definitions_configs_controller_test.js b/ambari-web/test/controllers/main/alerts/definitions_configs_controller_test.js
index 4061f35..c957efd 100644
--- a/ambari-web/test/controllers/main/alerts/definitions_configs_controller_test.js
+++ b/ambari-web/test/controllers/main/alerts/definitions_configs_controller_test.js
@@ -482,6 +482,32 @@ describe('App.MainAlertDefinitionConfigsController', function () {
       });
     });
 
+    describe('Some fields should be removed', function () {
+
+      beforeEach(function () {
+        controller.set('content', Em.Object.create({
+          rawSourceData: {
+            uri: {
+              id: 123
+            }
+          }
+        }));
+        controller.set('configs', [
+          Em.Object.create({
+            apiProperty: 'source.uri.connection_timeout',
+            apiFormattedValue: 123,
+            wasChanged: true
+          })
+        ]);
+        this.result = controller.getPropertiesToUpdate();
+      });
+
+      it('`AlertDefinition/source.uri.id`', function () {
+        expect(this.result).to.not.have.deep.property('AlertDefinition/source.uri.id');
+      });
+
+    });
+
     describe('`source/parameters` for SCRIPT configs', function () {
 
       beforeEach(function () {


[16/40] ambari git commit: AMBARI-14893. Add Grafana-based Ambari Metrics Dashboard Builder. (Prajwal Rao via yusaku)

Posted by nc...@apache.org.
AMBARI-14893. Add Grafana-based Ambari Metrics Dashboard Builder. (Prajwal Rao via yusaku)


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

Branch: refs/heads/branch-dev-patch-upgrade
Commit: 7af40ca158e83c6d8c0de3d8381a6ad0c8a6b903
Parents: 7616e0f
Author: Yusaku Sako <yu...@hortonworks.com>
Authored: Thu Feb 4 11:13:19 2016 -0800
Committer: Yusaku Sako <yu...@hortonworks.com>
Committed: Thu Feb 4 11:13:24 2016 -0800

----------------------------------------------------------------------
 .../screenshots/1-add-datasource.png              | Bin 0 -> 108602 bytes
 .../screenshots/10-choose-hostname.png            | Bin 0 -> 298654 bytes
 .../screenshots/11-choose-agg-rate-precision.png  | Bin 0 -> 276486 bytes
 .../screenshots/12-change-panel-title.png         | Bin 0 -> 258642 bytes
 .../screenshots/13-save-dashboard.png             | Bin 0 -> 262005 bytes
 .../screenshots/14-change-timerange.png           | Bin 0 -> 310766 bytes
 .../screenshots/15-change-units.png               | Bin 0 -> 322069 bytes
 .../screenshots/16-display-style-graph-1.png      | Bin 0 -> 285467 bytes
 .../screenshots/17-series-specific-override.png   | Bin 0 -> 302825 bytes
 .../screenshots/18-override-time.png              | Bin 0 -> 255655 bytes
 .../screenshots/19-edit-graph.png                 | Bin 0 -> 191904 bytes
 .../screenshots/2-datasource-details.png          | Bin 0 -> 125313 bytes
 .../screenshots/3-test-datasource.png             | Bin 0 -> 136121 bytes
 .../screenshots/4-dashboard-dropdown.png          | Bin 0 -> 126964 bytes
 .../screenshots/5-dashboard-graph-menu.png        | Bin 0 -> 146851 bytes
 .../screenshots/6-graph-panels.png                | Bin 0 -> 105383 bytes
 .../screenshots/7-choose-datasource.png           | Bin 0 -> 246860 bytes
 .../screenshots/8-choose-component.png            | Bin 0 -> 199123 bytes
 .../screenshots/9-choose-metric.png               | Bin 0 -> 216473 bytes
 .../screenshots/add-dashboard.png                 | Bin 0 -> 107965 bytes
 .../screenshots/full-dashboard.png                | Bin 0 -> 161956 bytes
 21 files changed, 0 insertions(+), 0 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/7af40ca1/ambari-metrics/ambari-metrics-grafana/screenshots/1-add-datasource.png
----------------------------------------------------------------------
diff --git a/ambari-metrics/ambari-metrics-grafana/screenshots/1-add-datasource.png b/ambari-metrics/ambari-metrics-grafana/screenshots/1-add-datasource.png
new file mode 100644
index 0000000..1c1eaa4
Binary files /dev/null and b/ambari-metrics/ambari-metrics-grafana/screenshots/1-add-datasource.png differ

http://git-wip-us.apache.org/repos/asf/ambari/blob/7af40ca1/ambari-metrics/ambari-metrics-grafana/screenshots/10-choose-hostname.png
----------------------------------------------------------------------
diff --git a/ambari-metrics/ambari-metrics-grafana/screenshots/10-choose-hostname.png b/ambari-metrics/ambari-metrics-grafana/screenshots/10-choose-hostname.png
new file mode 100644
index 0000000..d6a7d1a
Binary files /dev/null and b/ambari-metrics/ambari-metrics-grafana/screenshots/10-choose-hostname.png differ

http://git-wip-us.apache.org/repos/asf/ambari/blob/7af40ca1/ambari-metrics/ambari-metrics-grafana/screenshots/11-choose-agg-rate-precision.png
----------------------------------------------------------------------
diff --git a/ambari-metrics/ambari-metrics-grafana/screenshots/11-choose-agg-rate-precision.png b/ambari-metrics/ambari-metrics-grafana/screenshots/11-choose-agg-rate-precision.png
new file mode 100644
index 0000000..363fdf1
Binary files /dev/null and b/ambari-metrics/ambari-metrics-grafana/screenshots/11-choose-agg-rate-precision.png differ

http://git-wip-us.apache.org/repos/asf/ambari/blob/7af40ca1/ambari-metrics/ambari-metrics-grafana/screenshots/12-change-panel-title.png
----------------------------------------------------------------------
diff --git a/ambari-metrics/ambari-metrics-grafana/screenshots/12-change-panel-title.png b/ambari-metrics/ambari-metrics-grafana/screenshots/12-change-panel-title.png
new file mode 100644
index 0000000..fe34f82
Binary files /dev/null and b/ambari-metrics/ambari-metrics-grafana/screenshots/12-change-panel-title.png differ

http://git-wip-us.apache.org/repos/asf/ambari/blob/7af40ca1/ambari-metrics/ambari-metrics-grafana/screenshots/13-save-dashboard.png
----------------------------------------------------------------------
diff --git a/ambari-metrics/ambari-metrics-grafana/screenshots/13-save-dashboard.png b/ambari-metrics/ambari-metrics-grafana/screenshots/13-save-dashboard.png
new file mode 100644
index 0000000..65d7a9d
Binary files /dev/null and b/ambari-metrics/ambari-metrics-grafana/screenshots/13-save-dashboard.png differ

http://git-wip-us.apache.org/repos/asf/ambari/blob/7af40ca1/ambari-metrics/ambari-metrics-grafana/screenshots/14-change-timerange.png
----------------------------------------------------------------------
diff --git a/ambari-metrics/ambari-metrics-grafana/screenshots/14-change-timerange.png b/ambari-metrics/ambari-metrics-grafana/screenshots/14-change-timerange.png
new file mode 100644
index 0000000..80211f5
Binary files /dev/null and b/ambari-metrics/ambari-metrics-grafana/screenshots/14-change-timerange.png differ

http://git-wip-us.apache.org/repos/asf/ambari/blob/7af40ca1/ambari-metrics/ambari-metrics-grafana/screenshots/15-change-units.png
----------------------------------------------------------------------
diff --git a/ambari-metrics/ambari-metrics-grafana/screenshots/15-change-units.png b/ambari-metrics/ambari-metrics-grafana/screenshots/15-change-units.png
new file mode 100644
index 0000000..eb36708
Binary files /dev/null and b/ambari-metrics/ambari-metrics-grafana/screenshots/15-change-units.png differ

http://git-wip-us.apache.org/repos/asf/ambari/blob/7af40ca1/ambari-metrics/ambari-metrics-grafana/screenshots/16-display-style-graph-1.png
----------------------------------------------------------------------
diff --git a/ambari-metrics/ambari-metrics-grafana/screenshots/16-display-style-graph-1.png b/ambari-metrics/ambari-metrics-grafana/screenshots/16-display-style-graph-1.png
new file mode 100644
index 0000000..718d96b
Binary files /dev/null and b/ambari-metrics/ambari-metrics-grafana/screenshots/16-display-style-graph-1.png differ

http://git-wip-us.apache.org/repos/asf/ambari/blob/7af40ca1/ambari-metrics/ambari-metrics-grafana/screenshots/17-series-specific-override.png
----------------------------------------------------------------------
diff --git a/ambari-metrics/ambari-metrics-grafana/screenshots/17-series-specific-override.png b/ambari-metrics/ambari-metrics-grafana/screenshots/17-series-specific-override.png
new file mode 100644
index 0000000..e0979ec
Binary files /dev/null and b/ambari-metrics/ambari-metrics-grafana/screenshots/17-series-specific-override.png differ

http://git-wip-us.apache.org/repos/asf/ambari/blob/7af40ca1/ambari-metrics/ambari-metrics-grafana/screenshots/18-override-time.png
----------------------------------------------------------------------
diff --git a/ambari-metrics/ambari-metrics-grafana/screenshots/18-override-time.png b/ambari-metrics/ambari-metrics-grafana/screenshots/18-override-time.png
new file mode 100644
index 0000000..562747d
Binary files /dev/null and b/ambari-metrics/ambari-metrics-grafana/screenshots/18-override-time.png differ

http://git-wip-us.apache.org/repos/asf/ambari/blob/7af40ca1/ambari-metrics/ambari-metrics-grafana/screenshots/19-edit-graph.png
----------------------------------------------------------------------
diff --git a/ambari-metrics/ambari-metrics-grafana/screenshots/19-edit-graph.png b/ambari-metrics/ambari-metrics-grafana/screenshots/19-edit-graph.png
new file mode 100644
index 0000000..17a8ef2
Binary files /dev/null and b/ambari-metrics/ambari-metrics-grafana/screenshots/19-edit-graph.png differ

http://git-wip-us.apache.org/repos/asf/ambari/blob/7af40ca1/ambari-metrics/ambari-metrics-grafana/screenshots/2-datasource-details.png
----------------------------------------------------------------------
diff --git a/ambari-metrics/ambari-metrics-grafana/screenshots/2-datasource-details.png b/ambari-metrics/ambari-metrics-grafana/screenshots/2-datasource-details.png
new file mode 100644
index 0000000..68427f1
Binary files /dev/null and b/ambari-metrics/ambari-metrics-grafana/screenshots/2-datasource-details.png differ

http://git-wip-us.apache.org/repos/asf/ambari/blob/7af40ca1/ambari-metrics/ambari-metrics-grafana/screenshots/3-test-datasource.png
----------------------------------------------------------------------
diff --git a/ambari-metrics/ambari-metrics-grafana/screenshots/3-test-datasource.png b/ambari-metrics/ambari-metrics-grafana/screenshots/3-test-datasource.png
new file mode 100644
index 0000000..9d20b96
Binary files /dev/null and b/ambari-metrics/ambari-metrics-grafana/screenshots/3-test-datasource.png differ

http://git-wip-us.apache.org/repos/asf/ambari/blob/7af40ca1/ambari-metrics/ambari-metrics-grafana/screenshots/4-dashboard-dropdown.png
----------------------------------------------------------------------
diff --git a/ambari-metrics/ambari-metrics-grafana/screenshots/4-dashboard-dropdown.png b/ambari-metrics/ambari-metrics-grafana/screenshots/4-dashboard-dropdown.png
new file mode 100644
index 0000000..7a418a5
Binary files /dev/null and b/ambari-metrics/ambari-metrics-grafana/screenshots/4-dashboard-dropdown.png differ

http://git-wip-us.apache.org/repos/asf/ambari/blob/7af40ca1/ambari-metrics/ambari-metrics-grafana/screenshots/5-dashboard-graph-menu.png
----------------------------------------------------------------------
diff --git a/ambari-metrics/ambari-metrics-grafana/screenshots/5-dashboard-graph-menu.png b/ambari-metrics/ambari-metrics-grafana/screenshots/5-dashboard-graph-menu.png
new file mode 100644
index 0000000..0b5e00a
Binary files /dev/null and b/ambari-metrics/ambari-metrics-grafana/screenshots/5-dashboard-graph-menu.png differ

http://git-wip-us.apache.org/repos/asf/ambari/blob/7af40ca1/ambari-metrics/ambari-metrics-grafana/screenshots/6-graph-panels.png
----------------------------------------------------------------------
diff --git a/ambari-metrics/ambari-metrics-grafana/screenshots/6-graph-panels.png b/ambari-metrics/ambari-metrics-grafana/screenshots/6-graph-panels.png
new file mode 100644
index 0000000..01f04c1
Binary files /dev/null and b/ambari-metrics/ambari-metrics-grafana/screenshots/6-graph-panels.png differ

http://git-wip-us.apache.org/repos/asf/ambari/blob/7af40ca1/ambari-metrics/ambari-metrics-grafana/screenshots/7-choose-datasource.png
----------------------------------------------------------------------
diff --git a/ambari-metrics/ambari-metrics-grafana/screenshots/7-choose-datasource.png b/ambari-metrics/ambari-metrics-grafana/screenshots/7-choose-datasource.png
new file mode 100644
index 0000000..537831f
Binary files /dev/null and b/ambari-metrics/ambari-metrics-grafana/screenshots/7-choose-datasource.png differ

http://git-wip-us.apache.org/repos/asf/ambari/blob/7af40ca1/ambari-metrics/ambari-metrics-grafana/screenshots/8-choose-component.png
----------------------------------------------------------------------
diff --git a/ambari-metrics/ambari-metrics-grafana/screenshots/8-choose-component.png b/ambari-metrics/ambari-metrics-grafana/screenshots/8-choose-component.png
new file mode 100644
index 0000000..e876612
Binary files /dev/null and b/ambari-metrics/ambari-metrics-grafana/screenshots/8-choose-component.png differ

http://git-wip-us.apache.org/repos/asf/ambari/blob/7af40ca1/ambari-metrics/ambari-metrics-grafana/screenshots/9-choose-metric.png
----------------------------------------------------------------------
diff --git a/ambari-metrics/ambari-metrics-grafana/screenshots/9-choose-metric.png b/ambari-metrics/ambari-metrics-grafana/screenshots/9-choose-metric.png
new file mode 100644
index 0000000..bb923c2
Binary files /dev/null and b/ambari-metrics/ambari-metrics-grafana/screenshots/9-choose-metric.png differ

http://git-wip-us.apache.org/repos/asf/ambari/blob/7af40ca1/ambari-metrics/ambari-metrics-grafana/screenshots/add-dashboard.png
----------------------------------------------------------------------
diff --git a/ambari-metrics/ambari-metrics-grafana/screenshots/add-dashboard.png b/ambari-metrics/ambari-metrics-grafana/screenshots/add-dashboard.png
new file mode 100644
index 0000000..e1ec962
Binary files /dev/null and b/ambari-metrics/ambari-metrics-grafana/screenshots/add-dashboard.png differ

http://git-wip-us.apache.org/repos/asf/ambari/blob/7af40ca1/ambari-metrics/ambari-metrics-grafana/screenshots/full-dashboard.png
----------------------------------------------------------------------
diff --git a/ambari-metrics/ambari-metrics-grafana/screenshots/full-dashboard.png b/ambari-metrics/ambari-metrics-grafana/screenshots/full-dashboard.png
new file mode 100644
index 0000000..a2c43de
Binary files /dev/null and b/ambari-metrics/ambari-metrics-grafana/screenshots/full-dashboard.png differ


[07/40] ambari git commit: AMBARI-14919. [Ambari tarballs] Create script to install ambari tar.gz into custom root (aonishuk)

Posted by nc...@apache.org.
AMBARI-14919. [Ambari tarballs] Create script to install ambari tar.gz into custom root (aonishuk)


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

Branch: refs/heads/branch-dev-patch-upgrade
Commit: 04b02273a611377602f023f4b6700856dc8eb115
Parents: ed3ca61
Author: Andrew Onishuk <ao...@hortonworks.com>
Authored: Thu Feb 4 14:06:02 2016 +0200
Committer: Andrew Onishuk <ao...@hortonworks.com>
Committed: Thu Feb 4 14:06:02 2016 +0200

----------------------------------------------------------------------
 ambari-agent/pom.xml                            |  44 +++++-
 .../src/main/repo/install_ambari_tarball.py     | 145 +++++++++++++++++++
 ambari-server/conf/unix/install-helper.sh       |  52 ++++---
 ambari-server/pom.xml                           | 106 ++++++++++----
 .../src/main/package/deb/control/postinst       |   6 +-
 .../src/main/package/deb/control/preinst        |  23 +--
 .../src/main/package/deb/control/prerm          |   6 +-
 7 files changed, 313 insertions(+), 69 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/04b02273/ambari-agent/pom.xml
----------------------------------------------------------------------
diff --git a/ambari-agent/pom.xml b/ambari-agent/pom.xml
index 918065f..7531650 100644
--- a/ambari-agent/pom.xml
+++ b/ambari-agent/pom.xml
@@ -334,6 +334,48 @@
               </resources>
             </configuration>
           </execution>
+          <execution>
+            <id>copy-repo-resources</id>
+            <phase>package</phase>
+            <goals>
+              <goal>copy-resources</goal>
+            </goals>
+            <configuration>
+              <outputDirectory>${basedir}/target/repo</outputDirectory>
+              <resources>
+                <resource>
+                  <directory>${project.basedir}/../ambari-common/src/main/repo</directory>
+                </resource>
+                <resource>
+                  <directory>${project.build.directory}</directory>
+                  <includes>
+                    <include>${project.artifactId}-${project.version}.tar.gz</include>
+                  </includes>
+                </resource>
+                <resource>
+                  <directory>${basedir}/src/main/package/deb/control</directory>
+                </resource>
+              </resources>
+            </configuration>
+          </execution>
+        </executions>
+      </plugin>
+      <plugin>
+        <groupId>com.coderplus.maven.plugins</groupId>
+        <artifactId>copy-rename-maven-plugin</artifactId>
+        <version>1.0.1</version>
+        <executions>
+          <execution>
+            <id>rename-file</id>
+            <phase>package</phase>
+            <goals>
+              <goal>rename</goal>
+            </goals>
+            <configuration>
+              <sourceFile>${basedir}/target/repo/${project.artifactId}-${project.version}.tar.gz</sourceFile>
+              <destinationFile>${basedir}/target/repo/${project.artifactId}.tar.gz</destinationFile>
+            </configuration>
+          </execution>
         </executions>
       </plugin>
       <plugin>
@@ -449,7 +491,7 @@
             <executions>
               <execution>
                 <id>build-windows-zip</id>
-                <phase>prepare-package</phase>
+                <phase>package</phase>
                 <goals>
                   <goal>single</goal>
                 </goals>

http://git-wip-us.apache.org/repos/asf/ambari/blob/04b02273/ambari-common/src/main/repo/install_ambari_tarball.py
----------------------------------------------------------------------
diff --git a/ambari-common/src/main/repo/install_ambari_tarball.py b/ambari-common/src/main/repo/install_ambari_tarball.py
new file mode 100644
index 0000000..aa33ede
--- /dev/null
+++ b/ambari-common/src/main/repo/install_ambari_tarball.py
@@ -0,0 +1,145 @@
+#!/usr/bin/env python2
+'''
+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 os
+import sys
+import logging
+import subprocess
+from optparse import OptionParser
+
+USAGE = "Usage: %prog [OPTION]... URL"
+DESCRIPTION = "URL should point to full tar.gz location e.g.: https://public-repo-1.hortonworks.com/something/ambari-server.tar.gz"
+
+logger = logging.getLogger("install_ambari_tarball")
+
+PREINST_SCRIPT = "preinst"
+PRERM_SCRIPT = "prerm"
+POSTINST_SCRIPT = "postinst"
+POSTRM_SCRIPT = "postrm"
+
+ROOT_FOLDER_ENV_VARIABLE = "AMBARI_ROOT_FOLDER"
+
+class Utils:
+  verbose = False
+  @staticmethod
+  def os_call(command, logoutput=None, env={}):
+    shell = not isinstance(command, list)
+    print_output = logoutput==True or (logoutput==None and Utils.verbose)
+    
+    if not print_output:
+      stdout = subprocess.PIPE
+      stderr = subprocess.STDOUT
+    else:
+      stdout = stderr = None
+    
+    logger.info("Running '{0}'".format(command))
+    proc = subprocess.Popen(command, shell=shell, stdout=stdout, stderr=stderr, env=env)
+      
+    if not print_output:
+      out = proc.communicate()[0].strip('\n')
+    else:
+      proc.wait()
+      out = None
+      
+    code = proc.returncode
+  
+    if code:
+      err_msg = ("Execution of '%s'\n returned %d. %s") % (command, code, out)
+      raise OsCallFailure(err_msg)
+      
+    return out
+  
+class OsCallFailure(RuntimeError):
+  pass
+
+class Installer:
+  def __init__(self, archive_url, root_folder, verbose):
+    splited_url = archive_url.split('/')
+    self.archive_name = splited_url[-1]
+    self.base_url = '/'.join(splited_url[0:-1])
+    self.root_folder = root_folder
+    self.verbose = verbose
+    
+  def download_files(self):
+    for name in [ self.archive_name, PREINST_SCRIPT, PRERM_SCRIPT, POSTINST_SCRIPT, POSTRM_SCRIPT]: 
+      url = "{0}/{1}".format(self.base_url, name)
+      logger.info("Downloading {0}".format(url))
+      Utils.os_call(["wget", "-O", name, url])
+    
+  def run(self):
+    self.download_files()
+    
+    self.run_script(PRERM_SCRIPT, ["remove"]) # in case we are upgrading
+    self.run_script(POSTRM_SCRIPT, ["remove"]) # in case we are upgrading
+    
+    self.run_script(PREINST_SCRIPT, ["install"])
+    self.extract_archive()
+    self.run_script(POSTINST_SCRIPT, ["configure"])
+    
+  def run_script(self, script_name, args):
+    bash_args = []
+    if self.verbose:
+      bash_args.append("-x")
+      
+    Utils.os_call(["bash"] + bash_args + [script_name] + args, env={ROOT_FOLDER_ENV_VARIABLE: self.root_folder})
+    
+
+class TargzInstaller(Installer):
+  def extract_archive(self):
+    Utils.os_call(['tar','--no-same-owner', '-xvf', self.archive_name, '-C', self.root_folder+os.sep], logoutput=False)
+
+
+class Runner:
+  def parse_opts(self):
+    parser = OptionParser(usage=USAGE, description=DESCRIPTION)
+    parser.add_option("-v", "--verbose", dest="verbose", action="store_true",
+                      help="sets output level to more detailed")
+    parser.add_option("-r", "--root-folder", dest="root_folder", default="/",
+                      help="root folder to install Ambari to. E.g.: /opt")
+    
+    (self.options, args) = parser.parse_args()
+    
+    if len(args) != 1:
+      help = parser.print_help()
+      sys.exit(1)
+      
+    self.url = args[0]
+    
+  @staticmethod
+  def setup_logger(verbose):
+    logging_level = logging.DEBUG if verbose else logging.INFO
+    logger.setLevel(logging_level)
+
+    formatter = logging.Formatter('%(asctime)s %(levelname)s %(message)s')
+    stdout_handler = logging.StreamHandler(sys.stdout)
+    stdout_handler.setLevel(logging_level)
+    stdout_handler.setFormatter(formatter)
+    logger.addHandler(stdout_handler)
+    
+  def run(self):
+    self.parse_opts()
+    Runner.setup_logger(self.options.verbose)
+    Utils.verbose = self.options.verbose
+    
+    # TODO: check if ends with tar.gz?
+    targz_installer = TargzInstaller(self.url, self.options.root_folder, self.options.verbose)
+    targz_installer.run()
+      
+if __name__ == '__main__':
+  Runner().run()
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/04b02273/ambari-server/conf/unix/install-helper.sh
----------------------------------------------------------------------
diff --git a/ambari-server/conf/unix/install-helper.sh b/ambari-server/conf/unix/install-helper.sh
index c7d05b4..a1405e0 100644
--- a/ambari-server/conf/unix/install-helper.sh
+++ b/ambari-server/conf/unix/install-helper.sh
@@ -17,24 +17,33 @@
 #                      SERVER INSTALL HELPER                     #
 ##################################################################
 
-COMMON_DIR="/usr/lib/python2.6/site-packages/ambari_commons"
-RESOURCE_MANAGEMENT_DIR="/usr/lib/python2.6/site-packages/resource_management"
-JINJA_DIR="/usr/lib/python2.6/site-packages/ambari_jinja2"
-SIMPLEJSON_DIR="/usr/lib/python2.6/site-packages/ambari_simplejson"
-OLD_COMMON_DIR="/usr/lib/python2.6/site-packages/common_functions"
-AMBARI_SERVER="/usr/lib/python2.6/site-packages/ambari_server"
-INSTALL_HELPER_AGENT="/var/lib/ambari-agent/install-helper.sh"
-COMMON_DIR_SERVER="/usr/lib/ambari-server/lib/ambari_commons"
-RESOURCE_MANAGEMENT_DIR_SERVER="/usr/lib/ambari-server/lib/resource_management"
-JINJA_SERVER_DIR="/usr/lib/ambari-server/lib/ambari_jinja2"
-SIMPLEJSON_SERVER_DIR="/usr/lib/ambari-server/lib/ambari_simplejson"
-
-PYTHON_WRAPER_TARGET="/usr/bin/ambari-python-wrap"
-PYTHON_WRAPER_SOURCE="/var/lib/ambari-server/ambari-python-wrap"
+ROOT="${AMBARI_ROOT_FOLDER}"
+
+COMMON_DIR="${ROOT}/usr/lib/python2.6/site-packages/ambari_commons"
+RESOURCE_MANAGEMENT_DIR="${ROOT}/usr/lib/python2.6/site-packages/resource_management"
+JINJA_DIR="${ROOT}/usr/lib/python2.6/site-packages/ambari_jinja2"
+SIMPLEJSON_DIR="${ROOT}/usr/lib/python2.6/site-packages/ambari_simplejson"
+OLD_COMMON_DIR="${ROOT}/usr/lib/python2.6/site-packages/common_functions"
+AMBARI_SERVER="${ROOT}/usr/lib/python2.6/site-packages/ambari_server"
+INSTALL_HELPER_AGENT="${ROOT}/var/lib/ambari-agent/install-helper.sh"
+COMMON_DIR_SERVER="${ROOT}/usr/lib/ambari-server/lib/ambari_commons"
+RESOURCE_MANAGEMENT_DIR_SERVER="${ROOT}/usr/lib/ambari-server/lib/resource_management"
+JINJA_SERVER_DIR="${ROOT}/usr/lib/ambari-server/lib/ambari_jinja2"
+SIMPLEJSON_SERVER_DIR="${ROOT}/usr/lib/ambari-server/lib/ambari_simplejson"
+
+PYTHON_WRAPER_TARGET="${ROOT}/usr/bin/ambari-python-wrap"
+PYTHON_WRAPER_SOURCE="${ROOT}/var/lib/ambari-server/ambari-python-wrap"
+
+AMBARI_SERVER_EXECUTABLE_LINK="${ROOT}/usr/sbin/ambari-server"
+AMBARI_SERVER_EXECUTABLE="${ROOT}/etc/init.d/ambari-server"
+
+AMBARI_CONFIGS_DIR="${ROOT}/etc/ambari-server/conf"
+AMBARI_CONFIGS_DIR_SAVE="${ROOT}/etc/ambari-server/conf.save"
+AMBARI_CONFIGS_DIR_SAVE_BACKUP="${ROOT}/etc/ambari-server/conf_$(date '+%d_%m_%y_%H_%M').save"
 
 do_install(){
-  rm -f /usr/sbin/ambari-server
-  ln -s /etc/init.d/ambari-server /usr/sbin/ambari-server
+  rm -f "$AMBARI_SERVER_EXECUTABLE_LINK"
+  ln -s "$AMBARI_SERVER_EXECUTABLE" "$AMBARI_SERVER_EXECUTABLE_LINK"
  
   # setting ambari_commons shared resource
   rm -rf "$OLD_COMMON_DIR"
@@ -69,14 +78,13 @@ do_install(){
 }
 
 do_remove(){
-  /usr/sbin/ambari-server stop > /dev/null 2>&1
-  if [ -d "/etc/ambari-server/conf.save" ]; then
-      mv /etc/ambari-server/conf.save /etc/ambari-server/conf_$(date '+%d_%m_%y_%H_%M').save
+  $AMBARI_SERVER_EXECUTABLE stop > /dev/null 2>&1
+  if [ -d "$AMBARI_CONFIGS_DIR_SAVE" ]; then
+    mv "$AMBARI_CONFIGS_DIR_SAVE" "$AMBARI_CONFIGS_DIR_SAVE_BACKUP"
   fi
   # Remove link created during install
-  rm -f /usr/sbin/ambari-server
-
-  mv /etc/ambari-server/conf /etc/ambari-server/conf.save
+  rm -f "$AMBARI_SERVER_EXECUTABLE_LINK"
+  mv "$AMBARI_CONFIGS_DIR" "$AMBARI_CONFIGS_DIR_SAVE"
     
   if [ -f "$PYTHON_WRAPER_TARGET" ]; then
     rm -f "$PYTHON_WRAPER_TARGET"

http://git-wip-us.apache.org/repos/asf/ambari/blob/04b02273/ambari-server/pom.xml
----------------------------------------------------------------------
diff --git a/ambari-server/pom.xml b/ambari-server/pom.xml
index c601baa..6fb090a 100644
--- a/ambari-server/pom.xml
+++ b/ambari-server/pom.xml
@@ -80,38 +80,6 @@
         </executions>
       </plugin>
       <plugin>
-        <artifactId>maven-resources-plugin</artifactId>
-        <version>2.6</version>
-        <executions>
-          <execution>
-            <id>copy-resources</id>
-            <phase>generate-test-resources</phase>
-            <goals>
-              <goal>copy-resources</goal>
-            </goals>
-            <configuration>
-              <outputDirectory>${basedir}/target/</outputDirectory>
-              <resources>
-                <resource>
-                  <directory>${basedir}/../</directory>
-                  <includes>
-                    <include>version</include>
-                  </includes>
-                  <filtering>true</filtering>
-                </resource>
-                <resource>
-                  <directory>${basedir}/sbin/</directory>
-                  <includes>
-                    <include>ambari-server</include>
-                  </includes>
-                  <filtering>true</filtering>
-                </resource>
-              </resources>
-            </configuration>
-          </execution>
-        </executions>
-      </plugin>
-      <plugin>
         <artifactId>maven-compiler-plugin</artifactId>
         <version>3.0</version>
       </plugin>
@@ -177,6 +145,80 @@
         </executions>
       </plugin>
       <plugin>
+        <artifactId>maven-resources-plugin</artifactId>
+        <version>2.6</version>
+        <executions>
+          <execution>
+            <id>copy-resources</id>
+            <phase>generate-test-resources</phase>
+            <goals>
+              <goal>copy-resources</goal>
+            </goals>
+            <configuration>
+              <outputDirectory>${basedir}/target/</outputDirectory>
+              <resources>
+                <resource>
+                  <directory>${basedir}/../</directory>
+                  <includes>
+                    <include>version</include>
+                  </includes>
+                  <filtering>true</filtering>
+                </resource>
+                <resource>
+                  <directory>${basedir}/sbin/</directory>
+                  <includes>
+                    <include>ambari-server</include>
+                  </includes>
+                  <filtering>true</filtering>
+                </resource>
+              </resources>
+            </configuration>
+          </execution>
+          <execution>
+            <id>copy-repo-resources</id>
+            <phase>package</phase>
+            <goals>
+              <goal>copy-resources</goal>
+            </goals>
+            <configuration>
+              <outputDirectory>${basedir}/target/repo</outputDirectory>
+              <resources>
+                <resource>
+                  <directory>${project.basedir}/../ambari-common/src/main/repo</directory>
+                </resource>
+                <resource>
+                  <directory>${project.build.directory}</directory>
+                  <includes>
+                    <include>${project.artifactId}-${project.version}-dist.tar.gz</include>
+                  </includes>
+                </resource>
+                <resource>
+                  <directory>${basedir}/src/main/package/deb/control</directory>
+                </resource>
+              </resources>
+            </configuration>
+          </execution>
+        </executions>
+      </plugin>
+      <plugin>
+        <groupId>com.coderplus.maven.plugins</groupId>
+        <artifactId>copy-rename-maven-plugin</artifactId>
+        <version>1.0.1</version>
+        <executions>
+          <execution>
+            <id>rename-file</id>
+            <phase>package</phase>
+            <goals>
+              <goal>rename</goal>
+            </goals>
+            <configuration>
+              <sourceFile>${basedir}/target/repo/${project.artifactId}-${project.version}-dist.tar.gz</sourceFile>
+              <destinationFile>${basedir}/target/repo/${project.artifactId}.tar.gz</destinationFile>
+            </configuration>
+          </execution>
+        </executions>
+      </plugin>
+      <plugin>
         <groupId>org.apache.rat</groupId>
         <artifactId>apache-rat-plugin</artifactId>
         <configuration>

http://git-wip-us.apache.org/repos/asf/ambari/blob/04b02273/ambari-server/src/main/package/deb/control/postinst
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/package/deb/control/postinst b/ambari-server/src/main/package/deb/control/postinst
index e8d12c3..886e4fc 100644
--- a/ambari-server/src/main/package/deb/control/postinst
+++ b/ambari-server/src/main/package/deb/control/postinst
@@ -16,9 +16,11 @@
 
 # Warning: don't add changes to this script directly, please add changes to install-helper.sh.
 
+INSTALL_HELPER="${AMBARI_ROOT_FOLDER}/var/lib/ambari-server/install-helper.sh"
+
 if [ "$1" == "configure" ] ; then
-  if [ -f "/var/lib/ambari-server/install-helper.sh" ]; then
-      /var/lib/ambari-server/install-helper.sh install
+  if [ -f "$INSTALL_HELPER" ]; then
+      "$INSTALL_HELPER" install
   fi
 fi
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/04b02273/ambari-server/src/main/package/deb/control/preinst
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/package/deb/control/preinst b/ambari-server/src/main/package/deb/control/preinst
index 7bf7365..db66d92 100644
--- a/ambari-server/src/main/package/deb/control/preinst
+++ b/ambari-server/src/main/package/deb/control/preinst
@@ -14,27 +14,30 @@
 # See the License for the specific language governing permissions and
 # limitations under the License
 
-STACKS_FOLDER="/var/lib/ambari-server/resources/stacks"
-STACKS_FOLDER_OLD=/var/lib/ambari-server/resources/stacks_$(date '+%d_%m_%y_%H_%M').old
+STACKS_FOLDER="${AMBARI_ROOT_FOLDER}/var/lib/ambari-server/resources/stacks"
+STACKS_FOLDER_OLD=${AMBARI_ROOT_FOLDER}/var/lib/ambari-server/resources/stacks_$(date '+%d_%m_%y_%H_%M').old
 
-COMMON_SERVICES_FOLDER="/var/lib/ambari-server/resources/common-services"
-COMMON_SERVICES_FOLDER_OLD=/var/lib/ambari-server/resources/common-services_$(date '+%d_%m_%y_%H_%M').old
+COMMON_SERVICES_FOLDER="${AMBARI_ROOT_FOLDER}/var/lib/ambari-server/resources/common-services"
+COMMON_SERVICES_FOLDER_OLD=${AMBARI_ROOT_FOLDER}/var/lib/ambari-server/resources/common-services_$(date '+%d_%m_%y_%H_%M').old
 
-AMBARI_PROPERTIES="/etc/ambari-server/conf/ambari.properties"
+AMBARI_PROPERTIES="${AMBARI_ROOT_FOLDER}/etc/ambari-server/conf/ambari.properties"
 AMBARI_PROPERTIES_OLD="$AMBARI_PROPERTIES.rpmsave"
 
-AMBARI_ENV="/var/lib/ambari-server/ambari-env.sh"
+AMBARI_ENV="${AMBARI_ROOT_FOLDER}/var/lib/ambari-server/ambari-env.sh"
 AMBARI_ENV_OLD="$AMBARI_ENV.rpmsave"
 
-AMBARI_KRB_JAAS_LOGIN_FILE="/etc/ambari-server/conf/krb5JAASLogin.conf"
+AMBARI_KRB_JAAS_LOGIN_FILE="${AMBARI_ROOT_FOLDER}/etc/ambari-server/conf/krb5JAASLogin.conf"
 AMBARI_KRB_JAAS_LOGIN_FILE_OLD="$AMBARI_KRB_JAAS_LOGIN_FILE.rpmsave"
 
-AMBARI_VIEWS_FOLDER="/var/lib/ambari-server/resources/views"
+AMBARI_VIEWS_FOLDER="${AMBARI_ROOT_FOLDER}/var/lib/ambari-server/resources/views"
 AMBARI_VIEWS_BACKUP_FOLDER="$AMBARI_VIEWS_FOLDER/backups"
 
-if [ -d "/etc/ambari-server/conf.save" ]
+SERVER_CONF_SAVE="${AMBARI_ROOT_FOLDER}/etc/ambari-server/conf.save"
+SERVER_CONF_SAVE_BACKUP="${AMBARI_ROOT_FOLDER}/etc/ambari-server/conf_$(date '+%d_%m_%y_%H_%M').save"
+
+if [ -d "$SERVER_CONF_SAVE" ]
 then
-    mv /etc/ambari-server/conf.save /etc/ambari-server/conf_$(date '+%d_%m_%y_%H_%M').save
+    mv "$SERVER_CONF_SAVE" "SERVER_CONF_SAVE_BACKUP"
 fi
 
 if [ -f "$AMBARI_PROPERTIES" ]

http://git-wip-us.apache.org/repos/asf/ambari/blob/04b02273/ambari-server/src/main/package/deb/control/prerm
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/package/deb/control/prerm b/ambari-server/src/main/package/deb/control/prerm
index 98e3be5..cac2abe 100644
--- a/ambari-server/src/main/package/deb/control/prerm
+++ b/ambari-server/src/main/package/deb/control/prerm
@@ -16,9 +16,11 @@
 
 # Warning: don't add changes to this script directly, please add changes to install-helper.sh.
 
+INSTALL_HELPER="${AMBARI_ROOT_FOLDER}/var/lib/ambari-server/install-helper.sh"
+
 if [ "$1" == "remove" ] ; then # Action is uninstall
-    if [ -f "/var/lib/ambari-server/install-helper.sh" ]; then
-      /var/lib/ambari-server/install-helper.sh remove
+    if [ -f "$INSTALL_HELPER" ]; then
+      $INSTALL_HELPER remove
     fi
 fi
 


[23/40] ambari git commit: AMBARI-14936. Tweaks to reduce build time (aonishuk)

Posted by nc...@apache.org.
AMBARI-14936. Tweaks to reduce build time (aonishuk)


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

Branch: refs/heads/branch-dev-patch-upgrade
Commit: dc8e5c3c68d25e74ab875a87f66959fc86a9631c
Parents: 74d5a01
Author: Andrew Onishuk <ao...@hortonworks.com>
Authored: Fri Feb 5 11:02:39 2016 +0200
Committer: Andrew Onishuk <ao...@hortonworks.com>
Committed: Fri Feb 5 11:02:39 2016 +0200

----------------------------------------------------------------------
 ambari-agent/pom.xml                         | 40 +++++++++++------------
 ambari-server/pom.xml                        |  6 ++--
 ambari-server/src/main/assemblies/server.xml |  2 +-
 ambari-web/pom.xml                           |  3 +-
 pom.xml                                      | 18 +---------
 5 files changed, 27 insertions(+), 42 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/dc8e5c3c/ambari-agent/pom.xml
----------------------------------------------------------------------
diff --git a/ambari-agent/pom.xml b/ambari-agent/pom.xml
index 7531650..d049a6c 100644
--- a/ambari-agent/pom.xml
+++ b/ambari-agent/pom.xml
@@ -89,24 +89,6 @@
         <version>3.0</version>
       </plugin>
       <plugin>
-        <artifactId>maven-assembly-plugin</artifactId>
-        <configuration>
-          <tarLongFileMode>gnu</tarLongFileMode>
-          <descriptors>
-            <descriptor>src/packages/tarball/all.xml</descriptor>
-          </descriptors>
-        </configuration>
-        <executions>
-          <execution>
-            <id>build-tarball</id>
-            <phase>prepare-package</phase>
-            <goals>
-              <goal>single</goal>
-            </goals>
-          </execution>
-        </executions>
-      </plugin>
-      <plugin>
         <groupId>org.apache.maven.plugins</groupId>
         <artifactId>maven-surefire-plugin</artifactId>
         <configuration>
@@ -264,6 +246,24 @@
         </configuration>
       </plugin>
       <plugin>
+        <artifactId>maven-assembly-plugin</artifactId>
+        <configuration>
+          <tarLongFileMode>gnu</tarLongFileMode>
+          <descriptors>
+            <descriptor>src/packages/tarball/all.xml</descriptor>
+          </descriptors>
+        </configuration>
+        <executions>
+          <execution>
+            <id>build-tarball</id>
+            <phase>${assemblyPhase}</phase>
+            <goals>
+              <goal>single</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>
+      <plugin>
         <artifactId>maven-resources-plugin</artifactId>
         <version>2.6</version>
         <executions>
@@ -336,7 +336,7 @@
           </execution>
           <execution>
             <id>copy-repo-resources</id>
-            <phase>package</phase>
+            <phase>${assemblyPhase}</phase>
             <goals>
               <goal>copy-resources</goal>
             </goals>
@@ -367,7 +367,7 @@
         <executions>
           <execution>
             <id>rename-file</id>
-            <phase>package</phase>
+            <phase>${assemblyPhase}</phase>
             <goals>
               <goal>rename</goal>
             </goals>

http://git-wip-us.apache.org/repos/asf/ambari/blob/dc8e5c3c/ambari-server/pom.xml
----------------------------------------------------------------------
diff --git a/ambari-server/pom.xml b/ambari-server/pom.xml
index 6fb090a..623ddca 100644
--- a/ambari-server/pom.xml
+++ b/ambari-server/pom.xml
@@ -137,7 +137,7 @@
         <executions>
           <execution>
             <id>build-tarball</id>
-            <phase>package</phase>
+            <phase>${assemblyPhase}</phase>
             <goals>
               <goal>single</goal>
             </goals>
@@ -176,7 +176,7 @@
           </execution>
           <execution>
             <id>copy-repo-resources</id>
-            <phase>package</phase>
+            <phase>${assemblyPhase}</phase>
             <goals>
               <goal>copy-resources</goal>
             </goals>
@@ -207,7 +207,7 @@
         <executions>
           <execution>
             <id>rename-file</id>
-            <phase>package</phase>
+            <phase>${assemblyPhase}</phase>
             <goals>
               <goal>rename</goal>
             </goals>

http://git-wip-us.apache.org/repos/asf/ambari/blob/dc8e5c3c/ambari-server/src/main/assemblies/server.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/assemblies/server.xml b/ambari-server/src/main/assemblies/server.xml
index 17d6bdb..8bfad0c 100644
--- a/ambari-server/src/main/assemblies/server.xml
+++ b/ambari-server/src/main/assemblies/server.xml
@@ -306,7 +306,7 @@
     </file>
     <file>
       <fileMode>755</fileMode>
-      <source>target/classes/stacks/stack_advisor.py</source>
+      <source>src/main/resources/stacks/stack_advisor.py</source>
       <outputDirectory>/var/lib/ambari-server/resources/stacks</outputDirectory>
     </file>
     <file>

http://git-wip-us.apache.org/repos/asf/ambari/blob/dc8e5c3c/ambari-web/pom.xml
----------------------------------------------------------------------
diff --git a/ambari-web/pom.xml b/ambari-web/pom.xml
index 761a3f0..6304b3d 100644
--- a/ambari-web/pom.xml
+++ b/ambari-web/pom.xml
@@ -32,6 +32,7 @@
   <properties>
     <ambari.dir>${project.parent.parent.basedir}</ambari.dir>
     <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+    <nodemodules.dir>node_modules</nodemodules.dir> <!-- specify -Dnodemodules.dir option to reduce ambari-web build time by not re-downloading npm modules -->
   </properties>
   <build>
     <plugins>
@@ -100,7 +101,7 @@
             <configuration>
               <executable>${executable.rmdir}</executable>
               <workingDirectory>${basedir}</workingDirectory>
-              <commandlineArgs>${args.rm.clean} public node_modules</commandlineArgs>
+              <commandlineArgs>${args.rm.clean} public ${nodemodules.dir}</commandlineArgs>
               <successCodes>
                 <successCode>0</successCode>
                 <successCode>1</successCode>

http://git-wip-us.apache.org/repos/asf/ambari/blob/dc8e5c3c/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 57c6de7..8f321fd 100644
--- a/pom.xml
+++ b/pom.xml
@@ -60,6 +60,7 @@
     <distMgmtStagingId>apache.staging.https</distMgmtStagingId>
     <distMgmtStagingName>Apache Release Distribution Repository</distMgmtStagingName>
     <distMgmtStagingUrl>https://repository.apache.org/service/local/staging/deploy/maven2</distMgmtStagingUrl>
+    <assemblyPhase>package</assemblyPhase> <!-- use -DassemblyPhase=none to skip building tarball, useful when you want purely compile jar -->
   </properties>
   <pluginRepositories>
     <pluginRepository>
@@ -203,23 +204,6 @@
         </configuration>
       </plugin>
       <plugin>
-        <artifactId>maven-assembly-plugin</artifactId>
-        <configuration>
-          <descriptors>
-            <descriptor>${ambari.dir}/ambari-project/src/main/assemblies/empty.xml</descriptor>
-          </descriptors>
-        </configuration>
-        <executions>
-          <execution>
-            <id>make-assembly</id>
-            <phase>package</phase>
-            <goals>
-              <goal>single</goal>
-            </goals>
-          </execution>
-        </executions>
-      </plugin>
-      <plugin>
         <groupId>org.codehaus.mojo</groupId>
         <artifactId>rpm-maven-plugin</artifactId>
         <version>2.0.1</version>


[30/40] ambari git commit: AMBARI-14942 Reinstallation of a failed component should ask for Kerberos password. (ababiichuk)

Posted by nc...@apache.org.
AMBARI-14942 Reinstallation of a failed component should ask for Kerberos password. (ababiichuk)


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

Branch: refs/heads/branch-dev-patch-upgrade
Commit: b02150a8e1ad66128857370db005e00602a09eac
Parents: 83bef41
Author: ababiichuk <ab...@hortonworks.com>
Authored: Fri Feb 5 17:00:51 2016 +0200
Committer: ababiichuk <ab...@hortonworks.com>
Committed: Fri Feb 5 17:01:30 2016 +0200

----------------------------------------------------------------------
 ambari-web/app/controllers/main/host/details.js | 39 +++++++++++---------
 1 file changed, 22 insertions(+), 17 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/b02150a8/ambari-web/app/controllers/main/host/details.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/host/details.js b/ambari-web/app/controllers/main/host/details.js
index 251d7ab..a161342 100644
--- a/ambari-web/app/controllers/main/host/details.js
+++ b/ambari-web/app/controllers/main/host/details.js
@@ -1411,23 +1411,28 @@ App.MainHostDetailsController = Em.Controller.extend(App.SupportClientConfigsDow
         templateName: require('templates/main/host/details/installComponentPopup')
       }),
       onPrimary: function () {
-        this.hide();
-
-        App.ajax.send({
-          name: 'common.host.host_component.update',
-          sender: self,
-          data: {
-            hostName: self.get('content.hostName'),
-            serviceName: component.get('service.serviceName'),
-            componentName: componentName,
-            component: component,
-            context: Em.I18n.t('requestInfo.installHostComponent') + " " + displayName,
-            HostRoles: {
-              state: 'INSTALLED'
-            }
-          },
-          success: 'installComponentSuccessCallback',
-          error: 'ajaxErrorCallback'
+        var _this = this;
+        App.get('router.mainAdminKerberosController').getSecurityType(function () {
+          App.get('router.mainAdminKerberosController').getKDCSessionState(function () {
+            _this.hide();
+
+            App.ajax.send({
+              name: 'common.host.host_component.update',
+              sender: self,
+              data: {
+                hostName: self.get('content.hostName'),
+                serviceName: component.get('service.serviceName'),
+                componentName: componentName,
+                component: component,
+                context: Em.I18n.t('requestInfo.installHostComponent') + " " + displayName,
+                HostRoles: {
+                  state: 'INSTALLED'
+                }
+              },
+              success: 'installComponentSuccessCallback',
+              error: 'ajaxErrorCallback'
+            });
+          })
         });
       }
     });


[03/40] ambari git commit: AMBARI-14902 Make AMS Grafana component available as a repo package (dsen)

Posted by nc...@apache.org.
AMBARI-14902 Make AMS Grafana component available as a repo package (dsen)


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

Branch: refs/heads/branch-dev-patch-upgrade
Commit: ad67efd2d67dfefb2fb20249bfc42e4d569b7a07
Parents: d89f8a5
Author: Dmytro Sen <ds...@apache.org>
Authored: Thu Feb 4 01:09:56 2016 +0200
Committer: Dmytro Sen <ds...@apache.org>
Committed: Thu Feb 4 01:09:56 2016 +0200

----------------------------------------------------------------------
 ambari-metrics/ambari-metrics-assembly/pom.xml  | 289 ++++++-------------
 .../src/main/assembly/grafana.xml               |  59 ++++
 .../conf/unix/ambari-metrics-grafana            | 172 +++++++++++
 .../conf/unix/ams-grafana-env.sh                |  38 +++
 .../conf/unix/ams-grafana.ini                   | 255 ++++++++++++++++
 ambari-metrics/ambari-metrics-grafana/pom.xml   | 124 ++++++++
 .../src/main/assemblies/empty.xml               |  21 ++
 ambari-metrics/pom.xml                          |   4 +
 pom.xml                                         |   4 +-
 9 files changed, 769 insertions(+), 197 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/ad67efd2/ambari-metrics/ambari-metrics-assembly/pom.xml
----------------------------------------------------------------------
diff --git a/ambari-metrics/ambari-metrics-assembly/pom.xml b/ambari-metrics/ambari-metrics-assembly/pom.xml
index e963b00..dfc9351 100644
--- a/ambari-metrics/ambari-metrics-assembly/pom.xml
+++ b/ambari-metrics/ambari-metrics-assembly/pom.xml
@@ -30,11 +30,12 @@
   <name>Ambari Metrics Assembly</name>
   <packaging>pom</packaging>
   <version>2.0.0.0-SNAPSHOT</version>
-  <description>Ambari Metrics</description>
+  <description>Ambari Metrics Assembly</description>
 
   <properties>
     <collector.dir>${project.basedir}/../ambari-metrics-timelineservice</collector.dir>
     <monitor.dir>${project.basedir}/../ambari-metrics-host-monitoring</monitor.dir>
+    <grafana.dir>${project.basedir}/../ambari-metrics-grafana</grafana.dir>
     <hadoop-sink.dir>${project.basedir}/../ambari-metrics-hadoop-sink</hadoop-sink.dir>
     <storm-sink.dir>${project.basedir}/../ambari-metrics-storm-sink</storm-sink.dir>
     <flume-sink.dir>${project.basedir}/../ambari-metrics-flume-sink</flume-sink.dir>
@@ -119,6 +120,22 @@
             </configuration>
           </execution>
           <execution>
+            <id>grafana</id>
+            <phase>package</phase>
+            <goals>
+              <goal>single</goal>
+            </goals>
+            <configuration>
+              <attach>false</attach>
+              <finalName>ambari-metrics-grafana-${project.version}</finalName>
+              <appendAssemblyId>false</appendAssemblyId>
+              <descriptors>
+                <descriptor>src/main/assembly/grafana.xml</descriptor>
+              </descriptors>
+              <tarLongFileMode>gnu</tarLongFileMode>
+            </configuration>
+          </execution>
+          <execution>
             <id>hadoop-sink</id>
             <phase>package</phase>
             <goals>
@@ -191,85 +208,39 @@
               <defaultGroupname>root</defaultGroupname>
             </configuration>
             <executions>
-              <!--ambari-metrics-monitor-->
+              <!--ambari-metrics-grafana-->
               <execution>
-                <id>ambari-metrics-monitor</id>
+                <id>ambari-metrics-grafana</id>
                 <!-- unbinds rpm creation from maven lifecycle -->
                 <phase>package</phase>
                 <goals>
                   <goal>rpm</goal>
                 </goals>
                 <configuration>
-                  <name>ambari-metrics-monitor</name>
+                  <name>ambari-metrics-grafana</name>
                   <group>Development</group>
                   <needarch>x86_64</needarch>
                   <autoRequires>false</autoRequires>
-                  <requires>
-                    <require>${python.ver}</require>
-                    <require>gcc</require>
-                    <require>${python.devel}</require>
-                  </requires>
-                  <preremoveScriptlet>
-                    <scriptFile>src/main/package/rpm/preremove.sh</scriptFile>
-                    <fileEncoding>utf-8</fileEncoding>
-                  </preremoveScriptlet>
                   <mappings>
                     <mapping>
-                      <directory>${resmonitor.install.dir}</directory>
-                      <username>root</username>
-                      <groupname>root</groupname>
+                      <!--grafana-->
+                      <directory>/usr/lib/ambari-metrics-grafana/</directory>
                       <sources>
                         <source>
-                          <location>
-                            ${monitor.dir}/src/main/python/__init__.py
-                          </location>
-                        </source>
-                        <source>
-                          <location>
-                            ${monitor.dir}/src/main/python/main.py
-                          </location>
+                          <location>${grafana.dir}/target/grafana/${grafana.folder}</location>
                         </source>
                       </sources>
                     </mapping>
                     <mapping>
-                      <directory>${resmonitor.install.dir}/core</directory>
-                      <sources>
-                        <source>
-                          <location>
-                            ${monitor.dir}/src/main/python/core
-                          </location>
-                        </source>
-                      </sources>
-                    </mapping>
-                    <mapping>
-                      <directory>${resmonitor.install.dir}/psutil</directory>
-                      <sources>
-                        <source>
-                          <location>
-                            ${monitor.dir}/src/main/python/psutil
-                          </location>
-                          <excludes>
-                            <exclude>build/**</exclude>
-                            <exclude>build/*</exclude>
-                          </excludes>
-                        </source>
-                      </sources>
-                    </mapping>
-                    <mapping>
-                      <directory>${resmonitor.install.dir}/ambari_commons</directory>
+                      <directory>/usr/lib/ambari-metrics-grafana/bin</directory>
+                      <filemode>755</filemode>
                       <sources>
                         <source>
-                          <location>
-                            ${project.basedir}/../../ambari-common/src/main/python/ambari_commons
-                          </location>
+                          <location>${grafana.dir}/target/grafana/${grafana.folder}/bin</location>
                         </source>
                       </sources>
                     </mapping>
                     <mapping>
-                      <directory>/etc/ambari-metrics-monitor/conf</directory>
-                      <configuration>true</configuration>
-                    </mapping>
-                    <mapping>
                       <directory>/usr/sbin</directory>
                       <filemode>755</filemode>
                       <username>root</username>
@@ -277,219 +248,144 @@
                       <directoryIncluded>false</directoryIncluded>
                       <sources>
                         <source>
-                          <location>
-                            ${monitor.dir}/conf/unix/ambari-metrics-monitor
-                          </location>
-                          <filter>true</filter>
-                        </source>
-                      </sources>
-                    </mapping>
-                  </mappings>
-                </configuration>
-              </execution>
-
-              <!--ambari-metrics-collector-->
-              <execution>
-                <id>ambari-metrics-collector</id>
-                <phase>package</phase>
-                <goals>
-                  <goal>rpm</goal>
-                </goals>
-                <configuration>
-                  <name>ambari-metrics-collector</name>
-                  <copyright>2012, Apache Software Foundation</copyright>
-                  <group>Development</group>
-                  <description>Maven Recipe: RPM Package.</description>
-                  <autoRequires>false</autoRequires>
-                  <requires>
-                    <require>${python.ver}</require>
-                  </requires>
-
-                  <defaultFilemode>644</defaultFilemode>
-                  <defaultDirmode>755</defaultDirmode>
-                  <defaultUsername>root</defaultUsername>
-                  <defaultGroupname>root</defaultGroupname>
-
-                  <mappings>
-                    <mapping>
-                      <!--jars-->
-                      <directory>/usr/lib/ambari-metrics-collector/</directory>
-                      <sources>
-                        <source>
-                          <location>${collector.dir}/target/lib</location>
-                        </source>
-                        <source>
-                          <location>
-                            ${collector.dir}/target/ambari-metrics-timelineservice-${project.version}.jar
-                          </location>
-                        </source>
-                      </sources>
-                    </mapping>
-                    <mapping>
-                      <!--embedded applications-->
-                      <directory>/usr/lib/ams-hbase/</directory>
-                      <sources>
-                        <source>
-                          <location>${collector.dir}/target/embedded/${hbase.folder}</location>
-                          <excludes>
-                            <exclude>bin/**</exclude>
-                            <exclude>bin/*</exclude>
-                          </excludes>
-                        </source>
-                      </sources>
-                    </mapping>
-                    <mapping>
-                      <directory>/usr/lib/ams-hbase/bin</directory>
-                      <filemode>755</filemode>
-                      <sources>
-                        <source>
-                          <location>${collector.dir}/target/embedded/${hbase.folder}/bin</location>
-                        </source>
-                      </sources>
-                    </mapping>
-                    <mapping>
-                      <directory>/usr/lib/ams-hbase/lib/</directory>
-                      <sources>
-                        <source>
-                          <location>${collector.dir}/target/lib</location>
-                          <includes>
-                            <include>phoenix*.jar</include>
-                            <include>antlr*.jar</include>
-                          </includes>
-                        </source>
-                      </sources>
-                    </mapping>
-                    <mapping>
-                      <directory>/usr/lib/ams-hbase/lib/hadoop-native/</directory>
-                      <sources>
-                        <source>
-                          <location>${project.build.directory}/ambari-metrics-collector-${project.version}/ambari-metrics-collector-${project.version}/hbase/lib/hadoop-native</location>
+                          <location>${grafana.dir}/conf/unix/ambari-metrics-grafana</location>
+                          <filter>false</filter>
                         </source>
                       </sources>
                     </mapping>
                     <mapping>
-                      <directory>/usr/sbin</directory>
+                      <directory>/etc/ambari-metrics-grafana/conf</directory>
                       <filemode>755</filemode>
                       <username>root</username>
                       <groupname>root</groupname>
                       <directoryIncluded>false</directoryIncluded>
                       <sources>
                         <source>
-                          <location>${collector.dir}/conf/unix/ambari-metrics-collector</location>
+                          <location>${grafana.dir}/conf/unix/ams-grafana-env.sh</location>
                           <filter>false</filter>
                         </source>
                       </sources>
                     </mapping>
                     <mapping>
-                      <directory>/etc/ambari-metrics-collector/conf</directory>
+                      <directory>/etc/ambari-metrics-grafana/conf</directory>
                       <configuration>true</configuration>
                       <sources>
                         <source>
-                          <location>${collector.dir}/conf/unix/ams-env.sh</location>
-                        </source>
-                        <source>
-                          <location>${collector.dir}/conf/unix/ams-site.xml</location>
-                        </source>
-                        <source>
-                          <location>${collector.dir}/conf/unix/log4j.properties</location>
-                        </source>
-                        <source>
-                          <location>${collector.dir}/target/embedded/${hbase.folder}/conf/hbase-site.xml</location>
+                          <location>${grafana.dir}/conf/unix/ams-grafana.ini</location>
                         </source>
                       </sources>
                     </mapping>
                     <mapping>
-                      <directory>/etc/ams-hbase/conf</directory>
-                      <configuration>true</configuration>
-                      <sources>
-                        <source>
-                          <location>${collector.dir}/target/embedded/${hbase.folder}/conf</location>
-                          <includes>
-                            <include>*.*</include>
-                          </includes>
-                        </source>
-                      </sources>
+                      <directory>/var/run/ambari-metrics-grafana</directory>
                     </mapping>
                     <mapping>
-                      <directory>/var/run/ams-hbase</directory>
+                      <directory>/var/lib/ambari-metrics-grafana</directory>
                     </mapping>
                     <mapping>
-                      <directory>/var/lib/ambari-metrics-collector</directory>
+                      <directory>/var/log/ambari-metrics-grafana</directory>
                     </mapping>
                   </mappings>
                 </configuration>
               </execution>
 
-              <!--hadoop-sink-->
+              <!--ambari-metrics-monitor-->
               <execution>
-                <id>ambari-metrics-hadoop-sink</id>
+                <id>ambari-metrics-monitor</id>
+                <!-- unbinds rpm creation from maven lifecycle -->
                 <phase>package</phase>
                 <goals>
                   <goal>rpm</goal>
                 </goals>
-
                 <configuration>
-                  <name>ambari-metrics-hadoop-sink</name>
-                  <copyright>2012, Apache Software Foundation</copyright>
+                  <name>ambari-metrics-monitor</name>
                   <group>Development</group>
-                  <description>Maven Recipe: RPM Package.</description>
-
-                  <defaultDirmode>755</defaultDirmode>
-                  <defaultFilemode>644</defaultFilemode>
-                  <defaultUsername>root</defaultUsername>
-                  <defaultGroupname>root</defaultGroupname>
-
-                  <postinstallScriptlet>
-                    <scriptFile>${project.build.directory}/resources/rpm/sink/postinstall.sh</scriptFile>
+                  <needarch>x86_64</needarch>
+                  <autoRequires>false</autoRequires>
+                  <requires>
+                    <require>${python.ver}</require>
+                    <require>gcc</require>
+                    <require>${python.devel}</require>
+                  </requires>
+                  <preremoveScriptlet>
+                    <scriptFile>src/main/package/rpm/preremove.sh</scriptFile>
                     <fileEncoding>utf-8</fileEncoding>
-                  </postinstallScriptlet>
-
+                  </preremoveScriptlet>
                   <mappings>
                     <mapping>
-                      <directory>/usr/lib/ambari-metrics-hadoop-sink</directory>
+                      <directory>${resmonitor.install.dir}</directory>
+                      <username>root</username>
+                      <groupname>root</groupname>
                       <sources>
                         <source>
-                          <location>${hadoop-sink.dir}/target/ambari-metrics-hadoop-sink-with-common-${project.version}.jar</location>
+                          <location>
+                            ${monitor.dir}/src/main/python/__init__.py
+                          </location>
+                        </source>
+                        <source>
+                          <location>
+                            ${monitor.dir}/src/main/python/main.py
+                          </location>
                         </source>
                       </sources>
                     </mapping>
                     <mapping>
-                      <directory>/usr/lib/flume/lib</directory>
+                      <directory>${resmonitor.install.dir}/core</directory>
                       <sources>
                         <source>
-                          <location>${flume-sink.dir}/target/ambari-metrics-flume-sink-with-common-${project.version}.jar</location>
+                          <location>
+                            ${monitor.dir}/src/main/python/core
+                          </location>
                         </source>
                       </sources>
                     </mapping>
                     <mapping>
-                      <directory>/usr/lib/storm/lib</directory>
+                      <directory>${resmonitor.install.dir}/psutil</directory>
                       <sources>
                         <source>
-                          <location>${storm-sink.dir}/target/ambari-metrics-storm-sink-with-common-${project.version}.jar</location>
+                          <location>
+                            ${monitor.dir}/src/main/python/psutil
+                          </location>
+                          <excludes>
+                            <exclude>build/**</exclude>
+                            <exclude>build/*</exclude>
+                          </excludes>
                         </source>
                       </sources>
                     </mapping>
                     <mapping>
-                      <directory>/usr/lib/ambari-metrics-kafka-sink</directory>
+                      <directory>${resmonitor.install.dir}/ambari_commons</directory>
                       <sources>
                         <source>
-                          <location>${kafka-sink.dir}/target/${kafka.sink.jar}</location>
+                          <location>
+                            ${project.basedir}/../../ambari-common/src/main/python/ambari_commons
+                          </location>
                         </source>
                       </sources>
                     </mapping>
-                     <mapping>
-                      <directory>/usr/lib/ambari-metrics-kafka-sink/lib</directory>
+                    <mapping>
+                      <directory>/etc/ambari-metrics-monitor/conf</directory>
+                      <configuration>true</configuration>
+                    </mapping>
+                    <mapping>
+                      <directory>/usr/sbin</directory>
+                      <filemode>755</filemode>
+                      <username>root</username>
+                      <groupname>root</groupname>
+                      <directoryIncluded>false</directoryIncluded>
                       <sources>
                         <source>
-                          <location>${kafka-sink.dir}/target/lib</location>
+                          <location>
+                            ${monitor.dir}/conf/unix/ambari-metrics-monitor
+                          </location>
+                          <filter>true</filter>
                         </source>
                       </sources>
                     </mapping>
                   </mappings>
                 </configuration>
-
               </execution>
 
+
             </executions>
           </plugin>
         </plugins>
@@ -844,6 +740,7 @@
         <assemblydescriptor.collector>src/main/assembly/collector.xml</assemblydescriptor.collector>
         <assemblydescriptor.monitor>src/main/assembly/monitor.xml</assemblydescriptor.monitor>
         <assemblydescriptor.sink>src/main/assembly/sink.xml</assemblydescriptor.sink>
+        <assemblydescriptor.grafana>src/main/assembly/grafana.xml</assemblydescriptor.grafana>
         <packagingFormat>jar</packagingFormat>
       </properties>
       <build>

http://git-wip-us.apache.org/repos/asf/ambari/blob/ad67efd2/ambari-metrics/ambari-metrics-assembly/src/main/assembly/grafana.xml
----------------------------------------------------------------------
diff --git a/ambari-metrics/ambari-metrics-assembly/src/main/assembly/grafana.xml b/ambari-metrics/ambari-metrics-assembly/src/main/assembly/grafana.xml
new file mode 100644
index 0000000..fe6da7f
--- /dev/null
+++ b/ambari-metrics/ambari-metrics-assembly/src/main/assembly/grafana.xml
@@ -0,0 +1,59 @@
+<?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.
+  -->
+
+<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.1 http://maven.apache.org/xsd/assembly-1.1.1.xsd">
+  <id>grafana</id>
+  <formats>
+    <format>dir</format>
+    <format>tar.gz</format>
+  </formats>
+
+  <fileSets>
+    <fileSet>
+      <directory>${grafana.dir}/target/grafana/${grafana.folder}</directory>
+      <outputDirectory>lib</outputDirectory>
+    </fileSet>
+  </fileSets>
+
+  <files>
+    <file>
+      <source>${grafana.dir}/conf/unix/ams-grafana.ini</source>
+      <outputDirectory>conf</outputDirectory>
+    </file>
+    <file>
+      <source>${grafana.dir}/conf/unix/ams-grafana-env.sh</source>
+      <outputDirectory>conf</outputDirectory>
+    </file>
+    <file>
+      <source>${grafana.dir}/conf/unix/ambari-metrics-grafana</source>
+      <outputDirectory>bin</outputDirectory>
+    </file>
+  </files>
+
+  <dependencySets>
+    <dependencySet>
+      <useProjectArtifact>false</useProjectArtifact>
+      <excludes>
+        <exclude>*</exclude>
+      </excludes>
+    </dependencySet>
+  </dependencySets>
+
+</assembly>

http://git-wip-us.apache.org/repos/asf/ambari/blob/ad67efd2/ambari-metrics/ambari-metrics-grafana/conf/unix/ambari-metrics-grafana
----------------------------------------------------------------------
diff --git a/ambari-metrics/ambari-metrics-grafana/conf/unix/ambari-metrics-grafana b/ambari-metrics/ambari-metrics-grafana/conf/unix/ambari-metrics-grafana
new file mode 100644
index 0000000..1de5401
--- /dev/null
+++ b/ambari-metrics/ambari-metrics-grafana/conf/unix/ambari-metrics-grafana
@@ -0,0 +1,172 @@
+#!/usr/bin/env bash
+
+# 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
+
+# chkconfig: 2345 80 05
+# description: Grafana web server & backend
+# processname: grafana
+# config: /etc/grafana/ams-grafana.ini
+# pidfile: /var/run/grafana.pid
+
+### BEGIN INIT INFO
+# Provides:          grafana
+# Required-Start:    $all
+# Required-Stop:     $remote_fs $syslog
+# Default-Start:     2 3 4 5
+# Default-Stop:      0 1 6
+# Short-Description: Start grafana at boot time
+### END INIT INFO
+
+#  tested on
+#  1. New lsb that define start-stop-daemon
+#  3. Centos with initscripts package installed
+
+PATH=/bin:/usr/bin:/sbin:/usr/sbin
+NAME=grafana-server
+DESC="Grafana Server"
+
+if [ -f "/etc/ambari-metrics-grafana/conf/ams-grafana-env.sh" ]; then
+  . "/etc/ambari-metrics-grafana/conf/ams-grafana-env.sh"
+fi
+
+GRAFANA_USER=${AMS_USER}
+GRAFANA_GROUP=${AMS_USER_GROUP}
+GRAFANA_HOME=${AMS_GRAFANA_HOME_DIR}
+CONF_DIR=${AMS_GRAFANA_CONF_DIR}
+WORK_DIR=$GRAFANA_HOME
+DATA_DIR=${AMS_GRAFANA_DATA_DIR}
+LOG_DIR=${AMS_GRAFANA_LOG_DIR}
+CONF_FILE=$CONF_DIR/ams-grafana.ini
+MAX_OPEN_FILES=10000
+PID_FILE=${AMS_GRAFANA_PID_DIR}/$NAME.pid
+DAEMON=$GRAFANA_HOME/bin/$NAME
+
+if [ `id -u` -ne 0 ]; then
+  echo "You need root privileges to run this script"
+  exit 4
+fi
+
+if [ ! -x $DAEMON ]; then
+  echo "Program not installed or not executable"
+  exit 5
+fi
+
+#
+# init.d / servicectl compatibility (openSUSE)
+#
+if [ -f /etc/rc.status ]; then
+    . /etc/rc.status
+    rc_reset
+fi
+
+#
+# Source function library.
+#
+if [ -f /etc/rc.d/init.d/functions ]; then
+    . /etc/rc.d/init.d/functions
+fi
+
+# overwrite settings from default file
+[ -e /etc/sysconfig/$NAME ] && . /etc/sysconfig/$NAME
+
+DAEMON_OPTS="--pidfile=${PID_FILE} --config=${CONF_FILE} cfg:default.paths.data=${DATA_DIR} cfg:default.paths.logs=${LOG_DIR}"
+
+function isRunning() {
+  status -p $PID_FILE $NAME > /dev/null 2>&1
+}
+
+case "$1" in
+  start)
+    echo -n $"Starting $DESC: .... "
+
+    isRunning
+    if [ $? -eq 0 ]; then
+      echo "Already running."
+      exit 0
+    fi
+
+    # Prepare environment
+    mkdir -p "$LOG_DIR" "$DATA_DIR" && chown "$GRAFANA_USER":"$GRAFANA_GROUP" "$LOG_DIR" "$DATA_DIR"
+    touch "$PID_FILE" && chown "$GRAFANA_USER":"$GRAFANA_GROUP" "$PID_FILE"
+
+    if [ -n "$MAX_OPEN_FILES" ]; then
+      ulimit -n $MAX_OPEN_FILES
+    fi
+
+    # Start Daemon
+    cd $GRAFANA_HOME
+    su -s /bin/sh -c "nohup ${DAEMON} ${DAEMON_OPTS} >> /dev/null 3>&1 &" $GRAFANA_USER 2> /dev/null
+    return=$?
+    if [ $return -eq 0 ]
+    then
+      sleep 1
+      # check if pid file has been written two
+      if ! [[ -s $PID_FILE ]]; then
+        echo "FAILED"
+        exit 1
+      fi
+      i=0
+      timeout=10
+      # Wait for the process to be properly started before exiting
+      until { cat "$PID_FILE" | xargs kill -0; } >/dev/null 2>&1
+      do
+        sleep 1
+        i=$(($i + 1))
+        if [ $i -gt $timeout ]; then
+          echo "FAILED"
+          exit 1
+        fi
+      done
+    fi
+
+    echo "OK"
+    exit $return
+    ;;
+  stop)
+    echo -n "Stopping $DESC ..."
+
+    if [ -f "$PID_FILE" ]; then
+      killproc -p $PID_FILE -d 20 $NAME
+      if [ $? -eq 1 ]; then
+        echo -n "$DESC is not running but pid file exists, cleaning up"
+      elif [ $? -eq 3 ]; then
+        PID="`cat $PID_FILE`"
+        echo -n "Failed to stop $DESC (pid $PID)"
+        exit 1
+      fi
+      rm -f "$PID_FILE"
+      echo "OK"
+      exit 0
+    else
+      echo -n "(not running)"
+    fi
+    exit 0
+    ;;
+  status)
+    status -p $PID_FILE $NAME
+    exit $?
+    ;;
+  restart|force-reload)
+    if [ -f "$PID_FILE" ]; then
+      $0 stop
+      sleep 1
+    fi
+    $0 start
+    ;;
+  *)
+    echo "Usage: $0 {start|stop|restart|force-reload|status}"
+    exit 3
+    ;;
+esac

http://git-wip-us.apache.org/repos/asf/ambari/blob/ad67efd2/ambari-metrics/ambari-metrics-grafana/conf/unix/ams-grafana-env.sh
----------------------------------------------------------------------
diff --git a/ambari-metrics/ambari-metrics-grafana/conf/unix/ams-grafana-env.sh b/ambari-metrics/ambari-metrics-grafana/conf/unix/ams-grafana-env.sh
new file mode 100644
index 0000000..20986cb
--- /dev/null
+++ b/ambari-metrics/ambari-metrics-grafana/conf/unix/ams-grafana-env.sh
@@ -0,0 +1,38 @@
+#!/usr/bin/env bash
+
+# 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
+
+# Set environment variables here.
+
+# AMS user
+export AMS_USER=ams
+
+# AMS user group
+export AMS_USER_GROUP=hadoop
+
+# AMS Grafana Home Dir
+export AMS_GRAFANA_HOME_DIR=/usr/lib/ambari-metrics-grafana
+
+# AMS Grafana Conf Dir
+export AMS_GRAFANA_CONF_DIR=/etc/ambari-metrics-grafana/conf
+
+# AMS Grafana Data Dir
+export AMS_GRAFANA_DATA_DIR=/var/lib/ambari-metrics-grafana
+
+# AMS Grafana Log Dir
+export AMS_GRAFANA_LOG_DIR=/var/log/ambari-metrics-grafana
+
+# AMS Grafana PID Dir
+export AMS_GRAFANA_PID_DIR=/var/run/ambari-metrics-grafana

http://git-wip-us.apache.org/repos/asf/ambari/blob/ad67efd2/ambari-metrics/ambari-metrics-grafana/conf/unix/ams-grafana.ini
----------------------------------------------------------------------
diff --git a/ambari-metrics/ambari-metrics-grafana/conf/unix/ams-grafana.ini b/ambari-metrics/ambari-metrics-grafana/conf/unix/ams-grafana.ini
new file mode 100644
index 0000000..e42a92f
--- /dev/null
+++ b/ambari-metrics/ambari-metrics-grafana/conf/unix/ams-grafana.ini
@@ -0,0 +1,255 @@
+
+##################### Grafana Configuration Example #####################
+#
+# Everything has defaults so you only need to uncomment things you want to
+# change
+
+# possible values : production, development
+; app_mode = production
+
+#################################### Paths ####################################
+[paths]
+# Path to where grafana can store temp files, sessions, and the sqlite3 db (if that is used)
+#
+;data = /var/lib/grafana
+data = /var/lib/ambari-metrics-grafana
+#
+# Directory where grafana can store logs
+#
+;logs = /var/log/grafana
+logs = /var/log/ambari-metrics-grafana
+
+
+#################################### Server ####################################
+[server]
+# Protocol (http or https)
+;protocol = http
+
+# The ip address to bind to, empty will bind to all interfaces
+;http_addr =
+
+# The http port  to use
+;http_port = 3000
+
+# The public facing domain name used to access grafana from a browser
+;domain = localhost
+
+# Redirect to correct domain if host header does not match domain
+# Prevents DNS rebinding attacks
+;enforce_domain = false
+
+# The full public facing url
+;root_url = %(protocol)s://%(domain)s:%(http_port)s/
+
+# Log web requests
+;router_logging = false
+
+# the path relative working path
+;static_root_path = public
+static_root_path = /usr/lib/ambari-metrics-grafana/public
+
+# enable gzip
+;enable_gzip = false
+
+# https certs & key file
+;cert_file =
+;cert_key =
+
+#################################### Database ####################################
+[database]
+# Either "mysql", "postgres" or "sqlite3", it's your choice
+;type = sqlite3
+;host = 127.0.0.1:3306
+;name = grafana
+;user = root
+;password =
+
+# For "postgres" only, either "disable", "require" or "verify-full"
+;ssl_mode = disable
+
+# For "sqlite3" only, path relative to data_path setting
+;path = grafana.db
+
+#################################### Session ####################################
+[session]
+# Either "memory", "file", "redis", "mysql", "postgres", default is "file"
+;provider = file
+
+# Provider config options
+# memory: not have any config yet
+# file: session dir path, is relative to grafana data_path
+# redis: config like redis server e.g. `addr=127.0.0.1:6379,pool_size=100,db=grafana`
+# mysql: go-sql-driver/mysql dsn config string, e.g. `user:password@tcp(127.0.0.1:3306)/database_name`
+# postgres: user=a password=b host=localhost port=5432 dbname=c sslmode=disable
+;provider_config = sessions
+
+# Session cookie name
+;cookie_name = grafana_sess
+
+# If you use session in https only, default is false
+;cookie_secure = false
+
+# Session life time, default is 86400
+;session_life_time = 86400
+
+#################################### Analytics ####################################
+[analytics]
+# Server reporting, sends usage counters to stats.grafana.org every 24 hours.
+# No ip addresses are being tracked, only simple counters to track
+# running instances, dashboard and error counts. It is very helpful to us.
+# Change this option to false to disable reporting.
+;reporting_enabled = true
+
+# Google Analytics universal tracking code, only enabled if you specify an id here
+;google_analytics_ua_id =
+
+#################################### Security ####################################
+[security]
+# default admin user, created on startup
+;admin_user = admin
+
+# default admin password, can be changed before first start of grafana,  or in profile settings
+;admin_password = admin
+
+# used for signing
+;secret_key = SW2YcwTIb9zpOOhoPsMm
+
+# Auto-login remember days
+;login_remember_days = 7
+;cookie_username = grafana_user
+;cookie_remember_name = grafana_remember
+
+# disable gravatar profile images
+;disable_gravatar = false
+
+# data source proxy whitelist (ip_or_domain:port seperated by spaces)
+;data_source_proxy_whitelist =
+
+#################################### Users ####################################
+[users]
+# disable user signup / registration
+;allow_sign_up = true
+
+# Allow non admin users to create organizations
+;allow_org_create = true
+
+# Set to true to automatically assign new users to the default organization (id 1)
+;auto_assign_org = true
+
+# Default role new users will be automatically assigned (if disabled above is set to true)
+;auto_assign_org_role = Viewer
+
+# Background text for the user field on the login page
+;login_hint = email or username
+
+#################################### Anonymous Auth ##########################
+[auth.anonymous]
+# enable anonymous access
+;enabled = false
+
+# specify organization name that should be used for unauthenticated users
+;org_name = Main Org.
+
+# specify role for unauthenticated users
+;org_role = Viewer
+
+#################################### Github Auth ##########################
+[auth.github]
+;enabled = false
+;allow_sign_up = false
+;client_id = some_id
+;client_secret = some_secret
+;scopes = user:email,read:org
+;auth_url = https://github.com/login/oauth/authorize
+;token_url = https://github.com/login/oauth/access_token
+;api_url = https://api.github.com/user
+;team_ids =
+;allowed_organizations =
+
+#################################### Google Auth ##########################
+[auth.google]
+;enabled = false
+;allow_sign_up = false
+;client_id = some_client_id
+;client_secret = some_client_secret
+;scopes = https://www.googleapis.com/auth/userinfo.profile https://www.googleapis.com/auth/userinfo.email
+;auth_url = https://accounts.google.com/o/oauth2/auth
+;token_url = https://accounts.google.com/o/oauth2/token
+;api_url = https://www.googleapis.com/oauth2/v1/userinfo
+;allowed_domains =
+
+#################################### Auth Proxy ##########################
+[auth.proxy]
+;enabled = false
+;header_name = X-WEBAUTH-USER
+;header_property = username
+;auto_sign_up = true
+
+#################################### Basic Auth ##########################
+[auth.basic]
+;enabled = true
+
+#################################### Auth LDAP ##########################
+[auth.ldap]
+;enabled = false
+;config_file = /etc/grafana/ldap.toml
+
+#################################### SMTP / Emailing ##########################
+[smtp]
+;enabled = false
+;host = localhost:25
+;user =
+;password =
+;cert_file =
+;key_file =
+;skip_verify = false
+;from_address = admin@grafana.localhost
+
+[emails]
+;welcome_email_on_sign_up = false
+
+#################################### Logging ##########################
+[log]
+# Either "console", "file", default is "console"
+# Use comma to separate multiple modes, e.g. "console, file"
+;mode = console, file
+
+# Buffer length of channel, keep it as it is if you don't know what it is.
+;buffer_len = 10000
+
+# Either "Trace", "Debug", "Info", "Warn", "Error", "Critical", default is "Trace"
+;level = Info
+
+# For "console" mode only
+[log.console]
+;level =
+
+# For "file" mode only
+[log.file]
+;level =
+# This enables automated log rotate(switch of following options), default is true
+;log_rotate = true
+
+# Max line number of single file, default is 1000000
+;max_lines = 1000000
+
+# Max size shift of single file, default is 28 means 1 << 28, 256MB
+;max_lines_shift = 28
+
+# Segment log daily, default is true
+;daily_rotate = true
+
+# Expired days of log file(delete after max days), default is 7
+;max_days = 7
+
+#################################### AMPQ Event Publisher ##########################
+[event_publisher]
+;enabled = false
+;rabbitmq_url = amqp://localhost/
+;exchange = grafana_events
+
+;#################################### Dashboard JSON files ##########################
+[dashboards.json]
+;enabled = false
+;path = /var/lib/grafana/dashboards
+path = /usr/lib/ambari-metrics-grafana/public/dashboards

http://git-wip-us.apache.org/repos/asf/ambari/blob/ad67efd2/ambari-metrics/ambari-metrics-grafana/pom.xml
----------------------------------------------------------------------
diff --git a/ambari-metrics/ambari-metrics-grafana/pom.xml b/ambari-metrics/ambari-metrics-grafana/pom.xml
new file mode 100644
index 0000000..45ca1a0
--- /dev/null
+++ b/ambari-metrics/ambari-metrics-grafana/pom.xml
@@ -0,0 +1,124 @@
+<?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.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+  <parent>
+    <artifactId>ambari-metrics</artifactId>
+    <groupId>org.apache.ambari</groupId>
+    <version>2.0.0.0-SNAPSHOT</version>
+  </parent>
+  <modelVersion>4.0.0</modelVersion>
+
+  <artifactId>ambari-metrics-grafana</artifactId>
+  <name>Ambari Metrics Grafana</name>
+  <packaging>pom</packaging>
+  <version>2.1.0.0.0</version>
+  <description>Ambari Metrics Grafana</description>
+
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.codehaus.mojo</groupId>
+        <artifactId>build-helper-maven-plugin</artifactId>
+        <version>1.8</version>
+        <executions>
+          <execution>
+            <id>parse-version</id>
+            <phase>validate</phase>
+            <goals>
+              <goal>parse-version</goal>
+            </goals>
+          </execution>
+          <execution>
+            <id>regex-property</id>
+            <goals>
+              <goal>regex-property</goal>
+            </goals>
+            <configuration>
+              <name>ambariVersion</name>
+              <value>${project.version}</value>
+              <regex>^([0-9]+)\.([0-9]+)\.([0-9]+)\.([0-9]+)(\.|-).*</regex>
+              <replacement>$1.$2.$3.$4</replacement>
+              <failIfNoMatch>false</failIfNoMatch>
+            </configuration>
+          </execution>
+        </executions>
+      </plugin>
+
+      <plugin>
+        <groupId>org.apache.rat</groupId>
+        <artifactId>apache-rat-plugin</artifactId>
+        <configuration>
+          <excludes>
+            <exclude>conf/unix/ams-grafana.ini</exclude>
+          </excludes>
+        </configuration>
+        <executions>
+          <execution>
+            <phase>test</phase>
+            <goals>
+              <goal>check</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>
+
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-antrun-plugin</artifactId>
+        <version>1.7</version>
+        <executions>
+          <execution>
+            <phase>generate-resources</phase>
+            <goals>
+              <goal>run</goal>
+            </goals>
+            <configuration>
+              <target name="Download Ambari Grafana">
+                <mkdir dir="${project.build.directory}/grafana" />
+                <get
+                  src="${grafana.tar}"
+                  dest="${project.build.directory}/grafana/grafana.tgz"
+                  usetimestamp="true"
+                  />
+                <untar
+                  src="${project.build.directory}/grafana/grafana.tgz"
+                  dest="${project.build.directory}/grafana"
+                  compression="gzip"
+                  />
+                <get
+                  src="${ambari-grafana.tar}"
+                  dest="${project.build.directory}/grafana/ambari-grafana.tgz"
+                  usetimestamp="true"
+                  />
+                <untar
+                  src="${project.build.directory}/grafana/ambari-grafana.tgz"
+                  dest="${project.build.directory}/grafana/${grafana.folder}/public/app/plugins/datasource"
+                  compression="gzip"
+                  />
+              </target>
+            </configuration>
+          </execution>
+        </executions>
+      </plugin>
+    </plugins>
+
+  </build>
+
+</project>

http://git-wip-us.apache.org/repos/asf/ambari/blob/ad67efd2/ambari-metrics/ambari-metrics-grafana/src/main/assemblies/empty.xml
----------------------------------------------------------------------
diff --git a/ambari-metrics/ambari-metrics-grafana/src/main/assemblies/empty.xml b/ambari-metrics/ambari-metrics-grafana/src/main/assemblies/empty.xml
new file mode 100644
index 0000000..35738b1
--- /dev/null
+++ b/ambari-metrics/ambari-metrics-grafana/src/main/assemblies/empty.xml
@@ -0,0 +1,21 @@
+<!--
+  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.
+-->
+<assembly>
+    <id>empty</id>
+    <formats/>
+</assembly>

http://git-wip-us.apache.org/repos/asf/ambari/blob/ad67efd2/ambari-metrics/pom.xml
----------------------------------------------------------------------
diff --git a/ambari-metrics/pom.xml b/ambari-metrics/pom.xml
index 44964d4..3ca8d54 100644
--- a/ambari-metrics/pom.xml
+++ b/ambari-metrics/pom.xml
@@ -34,6 +34,7 @@
     <module>ambari-metrics-storm-sink</module>
     <module>ambari-metrics-timelineservice</module>
     <module>ambari-metrics-host-monitoring</module>
+    <module>ambari-metrics-grafana</module>
     <module>ambari-metrics-assembly</module>
   </modules>
   <properties>
@@ -49,6 +50,9 @@
     <hbase.winpkg.folder>hbase-0.98.4.2.2.4.2-0002-hadoop2</hbase.winpkg.folder>
     <hadoop.winpkg.zip>https://msibuilds.blob.core.windows.net/hdp/2.x/2.2.4.2/2/hadoop-2.6.0.2.2.4.2-0002.winpkg.zip</hadoop.winpkg.zip>
     <hadoop.winpkg.folder>hadoop-2.6.0.2.2.4.2-0002</hadoop.winpkg.folder>
+    <grafana.folder>grafana-2.6.0</grafana.folder>
+    <grafana.tar>https://grafanarel.s3.amazonaws.com/builds/grafana-2.6.0.linux-x64.tar.gz</grafana.tar>
+    <ambari-grafana.tar>https://github.com/u39kun/ambari-grafana/raw/master/dist/ambari-grafana.tgz</ambari-grafana.tar>
     <resmonitor.install.dir>
       /usr/lib/python2.6/site-packages/resource_monitoring
     </resmonitor.install.dir>

http://git-wip-us.apache.org/repos/asf/ambari/blob/ad67efd2/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index fe139b8..57c6de7 100644
--- a/pom.xml
+++ b/pom.xml
@@ -335,7 +335,7 @@
             <exclude>contrib/views/slider/src/main/resources/ui/app/assets/javascripts/**</exclude>
             <exclude>contrib/views/slider/src/main/resources/ui/bower_components/**</exclude>
             <exclude>contrib/views/slider/src/main/resources/ui/runner.js</exclude>
-	    <exclude>contrib/views/storm/src/main/resources/libs/**</exclude>
+	          <exclude>contrib/views/storm/src/main/resources/libs/**</exclude>
             <exclude>contrib/views/storm/src/main/resources/styles/default.css</exclude>
             <exclude>contrib/views/storm/src/main/resources/templates/**</exclude>
             <exclude>contrib/addons/package/deb/nagios_addon_deb_control</exclude>
@@ -355,6 +355,8 @@
             <exclude>**/velocity.log*</exclude>
 
             <!-- Metrics module -->
+            <!-- grafana -->
+            <exclude>ambari-metrics/ambari-metrics-grafana/conf/unix/ams-grafana.ini</exclude>
             <!-- psutil : external lib, Apache 2.0 license included as a source file -->
             <exclude>ambari-metrics/target/**</exclude>
             <exclude>ambari-metrics/ambari-metrics-host-monitoring/src/main/python/psutil/**</exclude>


[05/40] ambari git commit: AMBARI-14884: Hawq standby host config should be removed on single node cluster during initial cluster installation (bhuvnesh2703 via jaoki)

Posted by nc...@apache.org.
AMBARI-14884: Hawq standby host config should be removed on single node cluster during initial cluster installation (bhuvnesh2703 via jaoki)


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

Branch: refs/heads/branch-dev-patch-upgrade
Commit: 4fbf172c31e65bab503ab8e0acbfefd2b7a3adbe
Parents: 65558a5
Author: Jun Aoki <ja...@apache.org>
Authored: Wed Feb 3 15:38:40 2016 -0800
Committer: Jun Aoki <ja...@apache.org>
Committed: Wed Feb 3 15:38:40 2016 -0800

----------------------------------------------------------------------
 .../app/controllers/wizard/step7_controller.js  |  2 +-
 .../test/controllers/wizard/step7_test.js       | 20 ++++++--------------
 2 files changed, 7 insertions(+), 15 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/4fbf172c/ambari-web/app/controllers/wizard/step7_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/wizard/step7_controller.js b/ambari-web/app/controllers/wizard/step7_controller.js
index f6b6cb3..011833b 100644
--- a/ambari-web/app/controllers/wizard/step7_controller.js
+++ b/ambari-web/app/controllers/wizard/step7_controller.js
@@ -699,7 +699,7 @@ App.WizardStep7Controller = Em.Controller.extend(App.ServerValidatorMixin, App.E
       if (App.get('isHaEnabled')) this.addHawqConfigsOnNnHa(configs);
       if (App.get('isRMHaEnabled')) this.addHawqConfigsOnRMHa(configs);
     }
-    if (App.get('isSingleNode')) this.removeHawqStandbyHostAddressConfig(configs);
+    if (Object.keys(this.get('content.hosts')).length === 1) this.removeHawqStandbyHostAddressConfig(configs);
     return configs
   },
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/4fbf172c/ambari-web/test/controllers/wizard/step7_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/wizard/step7_test.js b/ambari-web/test/controllers/wizard/step7_test.js
index d4dcb24..8a4a96f 100644
--- a/ambari-web/test/controllers/wizard/step7_test.js
+++ b/ambari-web/test/controllers/wizard/step7_test.js
@@ -1180,8 +1180,10 @@ describe('App.InstallerStep7Controller', function () {
 
   });
 
-  describe('#updateHawqConfigs', function() {
-    var isSingleNode = false;
+  describe('#removeHawqStandbyHostAddressConfig', function() {
+    installerStep7Controller = App.WizardStep7Controller.create({
+      content: Em.Object.create({}),
+    });
     var testHawqSiteConfigs = [
       {
         name: 'hawq_standby_address_host',
@@ -1194,19 +1196,9 @@ describe('App.InstallerStep7Controller', function () {
     ];
     var oldHawqSiteLength = testHawqSiteConfigs.length;
 
-    beforeEach(function () {
-      sinon.stub(App, 'get', function () {
-        return isSingleNode;
-      });
-    });
-
-    afterEach(function () {
-      App.get.restore()
-    });
-
     it('hawq_standby_address_host should be removed on single node cluster', function() {
-      isSingleNode = true;
       var hawqSiteConfigs = testHawqSiteConfigs.slice();
+      installerStep7Controller.set('content.hosts', {'hostname': 'h1'});
       var updatedHawqSiteConfigs = installerStep7Controller.updateHawqConfigs(hawqSiteConfigs);
       expect(updatedHawqSiteConfigs.length).to.be.equal(oldHawqSiteLength-1);
       expect(updatedHawqSiteConfigs.findProperty('name', 'hawq_standby_address_host')).to.not.exist;
@@ -1214,8 +1206,8 @@ describe('App.InstallerStep7Controller', function () {
     });
 
     it('hawq_standby_address_host should not be removed on multi node clusters', function() {
-      isSingleNode = false;
       var hawqSiteConfigs = testHawqSiteConfigs.slice();
+      installerStep7Controller.set('content.hosts', Em.A([{'hostname': 'h1'}, {'hostname': 'h2'}]));
       var updatedHawqSiteConfigs = installerStep7Controller.updateHawqConfigs(hawqSiteConfigs);
       expect(updatedHawqSiteConfigs.length).to.be.equal(oldHawqSiteLength);
       expect(updatedHawqSiteConfigs.findProperty('name', 'hawq_standby_address_host').value).to.be.equal('h2');


[32/40] ambari git commit: AMBARI-14745. Ambari server throws error when unused configs are present in blueprint. (Oliver Szabo via rnettleton)

Posted by nc...@apache.org.
AMBARI-14745. Ambari server throws error when unused configs are present in blueprint. (Oliver Szabo via rnettleton)


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

Branch: refs/heads/branch-dev-patch-upgrade
Commit: cd35e806c0cfd63056afea61d2168e74cf1c1ae8
Parents: 1eb846c
Author: Bob Nettleton <rn...@hortonworks.com>
Authored: Fri Feb 5 11:07:51 2016 -0500
Committer: Bob Nettleton <rn...@hortonworks.com>
Committed: Fri Feb 5 11:08:23 2016 -0500

----------------------------------------------------------------------
 .../topology/ClusterConfigurationRequest.java   | 28 ++++++++
 .../ambari/server/topology/Configuration.java   | 15 ++++
 .../ClusterConfigurationRequestTest.java        | 75 +++++++++++++++++---
 .../ClusterInstallWithoutStartTest.java         |  2 +
 .../server/topology/ConfigurationTest.java      | 14 ++++
 .../server/topology/TopologyManagerTest.java    |  2 +
 6 files changed, 128 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/cd35e806/ambari-server/src/main/java/org/apache/ambari/server/topology/ClusterConfigurationRequest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/topology/ClusterConfigurationRequest.java b/ambari-server/src/main/java/org/apache/ambari/server/topology/ClusterConfigurationRequest.java
index 70fa880..c9120de 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/topology/ClusterConfigurationRequest.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/topology/ClusterConfigurationRequest.java
@@ -30,6 +30,7 @@ import org.apache.ambari.server.serveraction.kerberos.KerberosInvalidConfigurati
 import org.apache.ambari.server.state.Cluster;
 import org.apache.ambari.server.state.SecurityType;
 import org.apache.ambari.server.utils.StageUtils;
+import org.apache.commons.collections.MapUtils;
 import org.apache.commons.lang.StringUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -74,11 +75,38 @@ public class ClusterConfigurationRequest {
     // set initial configuration (not topology resolved)
     this.configurationProcessor = new BlueprintConfigurationProcessor(clusterTopology);
     this.stackAdvisorBlueprintProcessor = stackAdvisorBlueprintProcessor;
+    removeOrphanConfigTypes(clusterTopology);
     if (setInitial) {
       setConfigurationsOnCluster(clusterTopology, TopologyManager.INITIAL_CONFIG_TAG, Collections.<String>emptySet());
     }
   }
 
+  /**
+   * Remove config-types, if there is no any services related to them (except cluster-env and global).
+   */
+  private void removeOrphanConfigTypes(ClusterTopology clusterTopology) {
+    Configuration configuration = clusterTopology.getConfiguration();
+    Collection<String> configTypes = configuration.getAllConfigTypes();
+    for (String configType : configTypes) {
+      if (!configType.equals("cluster-env") && !configType.equals("global")) {
+        String service = clusterTopology.getBlueprint().getStack().getServiceForConfigType(configType);
+        if (!clusterTopology.getBlueprint().getServices().contains(service)) {
+          configuration.removeConfigType(configType);
+          LOG.info("Not found any service for config type '{}'. It will be removed from configuration.", configType);
+          Map<String, HostGroupInfo> hostGroupInfoMap = clusterTopology.getHostGroupInfo();
+          if (MapUtils.isNotEmpty(hostGroupInfoMap)) {
+            for (Map.Entry<String, HostGroupInfo> hostGroupInfo : hostGroupInfoMap.entrySet()) {
+              if (hostGroupInfo.getValue().getConfiguration() != null) {
+                hostGroupInfo.getValue().getConfiguration().removeConfigType(configType);
+                LOG.info("Not found any service for config type '{}'. It will be removed from host group scoped configuration.", configType);
+              }
+            }
+          }
+        }
+      }
+    }
+  }
+
   public ClusterConfigurationRequest(AmbariContext ambariContext, ClusterTopology topology, boolean setInitial, StackAdvisorBlueprintProcessor stackAdvisorBlueprintProcessor, boolean configureSecurity) {
     this(ambariContext, topology, setInitial, stackAdvisorBlueprintProcessor);
     this.configureSecurity = configureSecurity;

http://git-wip-us.apache.org/repos/asf/ambari/blob/cd35e806/ambari-server/src/main/java/org/apache/ambari/server/topology/Configuration.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/topology/Configuration.java b/ambari-server/src/main/java/org/apache/ambari/server/topology/Configuration.java
index 108ff74..79281b4 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/topology/Configuration.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/topology/Configuration.java
@@ -344,4 +344,19 @@ public class Configuration {
   public void setParentConfiguration(Configuration parent) {
     parentConfiguration = parent;
   }
+
+  /**
+   * Remove all occurrences of a config type
+   */
+  public void removeConfigType(String configType) {
+    if (properties != null && properties.containsKey(configType)) {
+      properties.remove(configType);
+    }
+    if (attributes != null && attributes.containsKey(configType)) {
+      attributes.remove(configType);
+    }
+    if (parentConfiguration != null) {
+      parentConfiguration.removeConfigType(configType);
+    }
+  }
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/cd35e806/ambari-server/src/test/java/org/apache/ambari/server/topology/ClusterConfigurationRequestTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/topology/ClusterConfigurationRequestTest.java b/ambari-server/src/test/java/org/apache/ambari/server/topology/ClusterConfigurationRequestTest.java
index 2e7bd3b..ece1287 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/topology/ClusterConfigurationRequestTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/topology/ClusterConfigurationRequestTest.java
@@ -28,6 +28,17 @@ import org.apache.ambari.server.controller.internal.Stack;
 import org.apache.ambari.server.serveraction.kerberos.KerberosInvalidConfigurationException;
 import org.apache.ambari.server.state.Cluster;
 import org.apache.ambari.server.state.Clusters;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import com.google.common.collect.Maps;
+import org.easymock.EasyMock;
 import org.easymock.Capture;
 import org.easymock.CaptureType;
 import org.easymock.EasyMockRule;
@@ -40,14 +51,6 @@ import org.powermock.api.easymock.PowerMock;
 import org.powermock.core.classloader.annotations.PrepareForTest;
 import org.powermock.modules.junit4.PowerMockRunner;
 
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
 import static org.easymock.EasyMock.anyBoolean;
 import static org.easymock.EasyMock.anyObject;
 import static org.easymock.EasyMock.anyString;
@@ -56,6 +59,8 @@ import static org.easymock.EasyMock.expectLastCall;
 import static org.easymock.EasyMock.eq;
 import static org.easymock.EasyMock.newCapture;
 import static org.easymock.EasyMock.verify;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
 import static org.easymock.EasyMock.capture;
 import static org.junit.Assert.assertEquals;
 
@@ -184,6 +189,7 @@ public class ClusterConfigurationRequestTest {
     expect(clusters.getCluster("testCluster")).andReturn(cluster).anyTimes();
 
     expect(blueprint.getStack()).andReturn(stack).anyTimes();
+    expect(stack.getServiceForConfigType(anyString())).andReturn("KERBEROS").anyTimes();
     expect(stack.getAllConfigurationTypes(anyString())).andReturn(Collections.<String>singletonList("testConfigType")
     ).anyTimes();
     expect(stack.getExcludedConfigurationTypes(anyString())).andReturn(Collections.<String>emptySet()).anyTimes();
@@ -308,4 +314,57 @@ public class ClusterConfigurationRequestTest {
 
   }
 
+  @Test
+  public void testProcessClusterConfigRequestRemoveUnusedConfigTypes() {
+    // GIVEN
+    Configuration configuration = createConfigurations();
+    Set<String> services = new HashSet<String>();
+    services.add("HDFS");
+    services.add("RANGER");
+    Map<String, HostGroupInfo> hostGroupInfoMap = Maps.newHashMap();
+    HostGroupInfo hg1 = new HostGroupInfo("hg1");
+    hg1.setConfiguration(createConfigurations());
+    hostGroupInfoMap.put("hg1", hg1);
+
+    expect(topology.getConfiguration()).andReturn(configuration).anyTimes();
+    expect(topology.getBlueprint()).andReturn(blueprint).anyTimes();
+    expect(topology.getHostGroupInfo()).andReturn(hostGroupInfoMap);
+    expect(blueprint.getStack()).andReturn(stack).anyTimes();
+    expect(blueprint.getServices()).andReturn(services).anyTimes();
+    expect(stack.getServiceForConfigType("hdfs-site")).andReturn("HDFS").anyTimes();
+    expect(stack.getServiceForConfigType("admin-properties")).andReturn("RANGER").anyTimes();
+    expect(stack.getServiceForConfigType("yarn-site")).andReturn("YARN").anyTimes();
+
+    EasyMock.replay(stack, blueprint, topology);
+    // WHEN
+    new ClusterConfigurationRequest(ambariContext, topology, false, stackAdvisorBlueprintProcessor);
+    // THEN
+    assertFalse(configuration.getFullProperties().containsKey("yarn-site"));
+    assertFalse(configuration.getFullAttributes().containsKey("yarn-site"));
+    assertTrue(configuration.getFullAttributes().containsKey("hdfs-site"));
+    assertTrue(configuration.getFullProperties().containsKey("cluster-env"));
+    assertTrue(configuration.getFullProperties().containsKey("global"));
+    assertFalse(hg1.getConfiguration().getFullAttributes().containsKey("yarn-site"));
+    verify(stack, blueprint, topology);
+  }
+
+  private Configuration createConfigurations() {
+    Map<String, Map<String, String>> firstLevelConfig = Maps.newHashMap();
+    firstLevelConfig.put("hdfs-site", new HashMap<String, String>());
+    firstLevelConfig.put("yarn-site", new HashMap<String, String>());
+    firstLevelConfig.put("cluster-env", new HashMap<String, String>());
+    firstLevelConfig.put("global", new HashMap<String, String>());
+
+    Map<String, Map<String, Map<String, String>>> firstLevelAttributes = Maps.newHashMap();
+    firstLevelAttributes.put("hdfs-site", new HashMap<String, Map<String, String>>());
+
+    Map<String, Map<String, String>> secondLevelConfig = Maps.newHashMap();
+    secondLevelConfig.put("admin-properties", new HashMap<String, String>());
+    Map<String, Map<String, Map<String, String>>> secondLevelAttributes = Maps.newHashMap();
+    secondLevelAttributes.put("admin-properties", new HashMap<String, Map<String, String>>());
+    secondLevelAttributes.put("yarn-site", new HashMap<String, Map<String, String>>());
+
+    Configuration secondLevelConf = new Configuration(secondLevelConfig, secondLevelAttributes);
+    return new Configuration(firstLevelConfig, firstLevelAttributes, secondLevelConf);
+  }
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/cd35e806/ambari-server/src/test/java/org/apache/ambari/server/topology/ClusterInstallWithoutStartTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/topology/ClusterInstallWithoutStartTest.java b/ambari-server/src/test/java/org/apache/ambari/server/topology/ClusterInstallWithoutStartTest.java
index dd66b1b..156580a 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/topology/ClusterInstallWithoutStartTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/topology/ClusterInstallWithoutStartTest.java
@@ -251,6 +251,8 @@ public class ClusterInstallWithoutStartTest {
     expect(stack.getConfiguration()).andReturn(stackConfig).anyTimes();
     expect(stack.getName()).andReturn(STACK_NAME).anyTimes();
     expect(stack.getVersion()).andReturn(STACK_VERSION).anyTimes();
+    expect(stack.getServiceForConfigType("service1-site")).andReturn("service1");
+    expect(stack.getServiceForConfigType("service2-site")).andReturn("service2");
     expect(stack.getExcludedConfigurationTypes("service1")).andReturn(Collections.<String>emptySet()).anyTimes();
     expect(stack.getExcludedConfigurationTypes("service2")).andReturn(Collections.<String>emptySet()).anyTimes();
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/cd35e806/ambari-server/src/test/java/org/apache/ambari/server/topology/ConfigurationTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/topology/ConfigurationTest.java b/ambari-server/src/test/java/org/apache/ambari/server/topology/ConfigurationTest.java
index e971e03..c4d70b5 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/topology/ConfigurationTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/topology/ConfigurationTest.java
@@ -346,6 +346,20 @@ public class ConfigurationTest {
     assertNull(configuration.getPropertyValue("type1", "XXXXX"));
   }
 
+  @Test
+  public void testRemoveConfigTypes() {
+    Configuration configuration = createConfigurationWithParents_PropsOnly();
+    configuration.removeConfigType("type1");
+    assertNull(configuration.getProperties().get("type1"));
+  }
+
+  @Test
+  public void testRemoveConfigTypesForAttributes() {
+    Configuration configuration = createConfigurationWithParents_PropsOnly();
+    configuration.removeConfigType("type1");
+    assertNull(configuration.getAttributes().get("type1"));
+  }
+
   private Configuration createConfigurationWithParents_PropsOnly() {
     // parents parent config properties
     Map<String, Map<String, String>> parentParentProperties = new HashMap<String, Map<String, String>>();

http://git-wip-us.apache.org/repos/asf/ambari/blob/cd35e806/ambari-server/src/test/java/org/apache/ambari/server/topology/TopologyManagerTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/topology/TopologyManagerTest.java b/ambari-server/src/test/java/org/apache/ambari/server/topology/TopologyManagerTest.java
index 7810f92..69c1935 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/topology/TopologyManagerTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/topology/TopologyManagerTest.java
@@ -228,6 +228,8 @@ public class TopologyManagerTest {
     expect(stack.getComponents()).andReturn(serviceComponents).anyTimes();
     expect(stack.getComponents("service1")).andReturn(serviceComponents.get("service1")).anyTimes();
     expect(stack.getComponents("service2")).andReturn(serviceComponents.get("service2")).anyTimes();
+    expect(stack.getServiceForConfigType("service1-site")).andReturn("service1");
+    expect(stack.getServiceForConfigType("service2-site")).andReturn("service2");
     expect(stack.getConfiguration()).andReturn(stackConfig).anyTimes();
     expect(stack.getName()).andReturn(STACK_NAME).anyTimes();
     expect(stack.getVersion()).andReturn(STACK_VERSION).anyTimes();


[02/40] ambari git commit: AMBARI-14906: Text update for conf_select.py (dili)

Posted by nc...@apache.org.
AMBARI-14906: Text update for conf_select.py (dili)


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

Branch: refs/heads/branch-dev-patch-upgrade
Commit: d89f8a5f91bba77b68ff32a221baac589b017896
Parents: 5833aab
Author: Di Li <di...@apache.org>
Authored: Wed Feb 3 17:24:03 2016 -0500
Committer: Di Li <di...@apache.org>
Committed: Wed Feb 3 17:24:03 2016 -0500

----------------------------------------------------------------------
 .../python/resource_management/libraries/functions/conf_select.py  | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/d89f8a5f/ambari-common/src/main/python/resource_management/libraries/functions/conf_select.py
----------------------------------------------------------------------
diff --git a/ambari-common/src/main/python/resource_management/libraries/functions/conf_select.py b/ambari-common/src/main/python/resource_management/libraries/functions/conf_select.py
index 2bc01ee..dc7fa6e 100644
--- a/ambari-common/src/main/python/resource_management/libraries/functions/conf_select.py
+++ b/ambari-common/src/main/python/resource_management/libraries/functions/conf_select.py
@@ -412,7 +412,7 @@ def convert_conf_directories_to_symlinks(package, version, dirs, skip_existing_l
       # check if conf is a link already
       old_conf = dir_def['conf_dir']
       if os.path.islink(old_conf):
-        Logger.info("{0} is already link to {1}".format(old_conf, os.path.realpath(old_conf)))
+        Logger.info("{0} is already linked to {1}".format(old_conf, os.path.realpath(old_conf)))
         bad_dirs.append(old_conf)
 
   if len(bad_dirs) > 0:


[37/40] ambari git commit: AMBARI-14764. MapReduce, Oozie service check failures after upgrade finished (dlysnichenko)

Posted by nc...@apache.org.
AMBARI-14764. MapReduce, Oozie service check failures after upgrade finished (dlysnichenko)

Conflicts:
	ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/nonrolling-upgrade-2.4.xml


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

Branch: refs/heads/branch-dev-patch-upgrade
Commit: bb864df5da25093ff386433dd591898d713fd092
Parents: 14d53f7
Author: Lisnichenko Dmitro <dl...@hortonworks.com>
Authored: Fri Feb 5 19:52:57 2016 +0200
Committer: Lisnichenko Dmitro <dl...@hortonworks.com>
Committed: Fri Feb 5 19:58:32 2016 +0200

----------------------------------------------------------------------
 .../ambari/server/agent/HeartbeatMonitor.java   |  45 +++----
 .../ambari/server/checks/CheckDescription.java  |   8 ++
 .../HardcodedStackVersionPropertiesCheck.java   | 132 +++++++++++++++++++
 .../serveraction/upgrades/FixLzoCodecPath.java  | 103 +++++++++++++++
 .../upgrades/OozieConfigCalculation.java        |  94 +++++++++++++
 .../OOZIE/4.0.0.2.0/configuration/oozie-env.xml |   3 +
 .../OOZIE/4.2.0.2.3/configuration/oozie-env.xml |   3 +
 .../HDP/2.1/upgrades/nonrolling-upgrade-2.3.xml |  12 ++
 .../services/OOZIE/configuration/oozie-env.xml  |   3 +
 .../HDP/2.2/upgrades/nonrolling-upgrade-2.2.xml |  12 ++
 .../HDP/2.2/upgrades/nonrolling-upgrade-2.3.xml |  13 +-
 .../HDP/2.2/upgrades/nonrolling-upgrade-2.4.xml |  12 ++
 .../stacks/HDP/2.2/upgrades/upgrade-2.2.xml     |   8 ++
 .../stacks/HDP/2.2/upgrades/upgrade-2.3.xml     |   7 +
 .../stacks/HDP/2.2/upgrades/upgrade-2.4.xml     |   8 ++
 .../HDP/2.3/upgrades/nonrolling-upgrade-2.3.xml |  15 +++
 .../HDP/2.3/upgrades/nonrolling-upgrade-2.4.xml |  18 ++-
 .../stacks/HDP/2.3/upgrades/upgrade-2.3.xml     |   8 ++
 .../stacks/HDP/2.3/upgrades/upgrade-2.4.xml     |   8 ++
 .../HDP/2.4/upgrades/nonrolling-upgrade-2.4.xml |  15 +++
 .../stacks/HDP/2.4/upgrades/upgrade-2.4.xml     |   8 ++
 ...ardcodedStackVersionPropertiesCheckTest.java |  60 +++++++++
 .../upgrades/FixLzoCodecPathTest.java           |  76 +++++++++++
 .../upgrades/OozieConfigCalculationTest.java    |  87 ++++++++++++
 24 files changed, 730 insertions(+), 28 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/bb864df5/ambari-server/src/main/java/org/apache/ambari/server/agent/HeartbeatMonitor.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/agent/HeartbeatMonitor.java b/ambari-server/src/main/java/org/apache/ambari/server/agent/HeartbeatMonitor.java
index d245a25..efc717d 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/agent/HeartbeatMonitor.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/agent/HeartbeatMonitor.java
@@ -258,40 +258,37 @@ public class HeartbeatMonitor implements Runnable {
         continue;
       }
 
-      if (clusterConfig != null) {
-        // cluster config for 'global'
-        Map<String, String> props = new HashMap<String, String>(clusterConfig.getProperties());
+      // cluster config for 'global'
+      Map<String, String> props = new HashMap<>(clusterConfig.getProperties());
 
-        Map<String, Map<String, String>> configTags = new HashMap<String,
-                Map<String, String>>();
+      Map<String, Map<String, String>> configTags = new HashMap<>();
 
-        for (Map.Entry<String, Map<String, String>> entry : allConfigTags.entrySet()) {
-          if (entry.getKey().equals(clusterConfig.getType())) {
-            configTags.put(clusterConfig.getType(), entry.getValue());
-          }
+      for (Map.Entry<String, Map<String, String>> entry : allConfigTags.entrySet()) {
+        if (entry.getKey().equals(clusterConfig.getType())) {
+          configTags.put(clusterConfig.getType(), entry.getValue());
         }
+      }
 
-        Map<String, Map<String, String>> properties = configHelper
-                .getEffectiveConfigProperties(cluster, configTags);
+      Map<String, Map<String, String>> properties = configHelper
+              .getEffectiveConfigProperties(cluster, configTags);
 
-        if (!properties.isEmpty()) {
-          for (Map<String, String> propertyMap : properties.values()) {
-            props.putAll(propertyMap);
-          }
+      if (!properties.isEmpty()) {
+        for (Map<String, String> propertyMap : properties.values()) {
+          props.putAll(propertyMap);
         }
+      }
 
-        configurations.put(clusterConfig.getType(), props);
+      configurations.put(clusterConfig.getType(), props);
 
-        Map<String, Map<String, String>> attrs = new TreeMap<String, Map<String, String>>();
-        configHelper.cloneAttributesMap(clusterConfig.getPropertiesAttributes(), attrs);
+      Map<String, Map<String, String>> attrs = new TreeMap<>();
+      configHelper.cloneAttributesMap(clusterConfig.getPropertiesAttributes(), attrs);
 
-        Map<String, Map<String, Map<String, String>>> attributes = configHelper
-            .getEffectiveConfigAttributes(cluster, configTags);
-        for (Map<String, Map<String, String>> attributesMap : attributes.values()) {
-          configHelper.cloneAttributesMap(attributesMap, attrs);
-        }
-        configurationAttributes.put(clusterConfig.getType(), attrs);
+      Map<String, Map<String, Map<String, String>>> attributes = configHelper
+          .getEffectiveConfigAttributes(cluster, configTags);
+      for (Map<String, Map<String, String>> attributesMap : attributes.values()) {
+        configHelper.cloneAttributesMap(attributesMap, attrs);
       }
+      configurationAttributes.put(clusterConfig.getType(), attrs);
     }
 
     StatusCommand statusCmd = new StatusCommand();

http://git-wip-us.apache.org/repos/asf/ambari/blob/bb864df5/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 a8c0525..ba987aa 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
@@ -216,6 +216,14 @@ public enum CheckDescription {
           "The following config types will have values overwritten: %s");
       }}),
 
+  HARDCODED_STACK_VERSION_PROPERTIES_CHECK(PrereqCheckType.CLUSTER,
+    "Found hardcoded hdp stack version in property value.",
+    new HashMap<String, String>() {{
+      put(AbstractCheckDescriptor.DEFAULT,
+        "Some properties seem to contain hardcoded hdp version string \"%s\"." +
+          " That is a potential problem when doing stack update.");
+      }}),
+
   SERVICES_RANGER_PASSWORD_VERIFY(PrereqCheckType.SERVICE,
       "Verify Ambari and Ranger Password Synchronization",
       new HashMap<String, String>() {{

http://git-wip-us.apache.org/repos/asf/ambari/blob/bb864df5/ambari-server/src/main/java/org/apache/ambari/server/checks/HardcodedStackVersionPropertiesCheck.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/checks/HardcodedStackVersionPropertiesCheck.java b/ambari-server/src/main/java/org/apache/ambari/server/checks/HardcodedStackVersionPropertiesCheck.java
new file mode 100644
index 0000000..4dfc8e9
--- /dev/null
+++ b/ambari-server/src/main/java/org/apache/ambari/server/checks/HardcodedStackVersionPropertiesCheck.java
@@ -0,0 +1,132 @@
+/**
+ * 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.
+ */
+package org.apache.ambari.server.checks;
+
+import com.google.inject.Inject;
+import com.google.inject.Provider;
+import com.google.inject.Singleton;
+import org.apache.ambari.server.AmbariException;
+import org.apache.ambari.server.controller.PrereqCheckRequest;
+import org.apache.ambari.server.orm.entities.RepositoryVersionEntity;
+import org.apache.ambari.server.state.Cluster;
+import org.apache.ambari.server.state.Clusters;
+import org.apache.ambari.server.state.Config;
+import org.apache.ambari.server.state.ConfigHelper;
+import org.apache.ambari.server.state.ConfigMergeHelper;
+import org.apache.ambari.server.state.ConfigMergeHelper.ThreeWayValue;
+import org.apache.ambari.server.state.DesiredConfig;
+import org.apache.ambari.server.state.stack.PrereqCheckStatus;
+import org.apache.ambari.server.state.stack.PrerequisiteCheck;
+import org.apache.commons.lang.StringUtils;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.LinkedHashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.Set;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+/**
+ * Checks for properties that contain hardcoded CURRENT hdp version string.
+ * Presence of such properties usually means that some paths are hardcoded to
+ * point to concrete version of HDP, instead of pointing to current symlink.
+ * That is a potential problem when doing stack update.
+ */
+@Singleton
+@UpgradeCheck(order = 98.0f, required = true)
+public class HardcodedStackVersionPropertiesCheck extends AbstractCheckDescriptor {
+
+  @Inject
+  private Provider<Clusters> m_clusters;
+
+  @Inject
+  private Provider<ConfigHelper> m_config_helper_provider;
+
+  public HardcodedStackVersionPropertiesCheck() {
+    super(CheckDescription.HARDCODED_STACK_VERSION_PROPERTIES_CHECK);
+  }
+
+  @Override
+  public void perform(PrerequisiteCheck prerequisiteCheck, PrereqCheckRequest request)
+      throws AmbariException {
+
+    String stackName = request.getTargetStackId().getStackName();
+    RepositoryVersionEntity rve = repositoryVersionDaoProvider.get().
+      findByStackNameAndVersion(stackName, request.getRepositoryVersion());
+
+    Cluster cluster = m_clusters.get().getCluster(request.getClusterName());
+
+    String currentHdpVersion = cluster.getCurrentClusterVersion().getRepositoryVersion().getVersion();
+
+    Map<String, DesiredConfig> desiredConfigs = cluster.getDesiredConfigs();
+    Set<String> failures = new HashSet<>();
+
+    Pattern searchPattern = getHardcodeSearchPattern(currentHdpVersion);
+    for (Entry<String, DesiredConfig> configEntry : desiredConfigs.entrySet()) {
+      String configType = configEntry.getKey();
+      DesiredConfig desiredConfig = configEntry.getValue();
+      final Config config = cluster.getConfig(configType, desiredConfig.getTag());
+
+      Map<String, String> properties = config.getProperties();
+      for (Entry<String, String> property : properties.entrySet()) {
+        if (stringContainsVersionHardcode(property.getValue(), searchPattern)) {
+          failures.add(String.format(" %s/%s",
+            configType, property.getKey()));
+        }
+      }
+
+      if (failures.size() > 0) {
+        prerequisiteCheck.setStatus(PrereqCheckStatus.WARNING);
+        String failReason = getFailReason(prerequisiteCheck, request);
+
+        prerequisiteCheck.setFailReason(String.format(failReason, currentHdpVersion));
+        prerequisiteCheck.setFailedOn(new LinkedHashSet<>(failures));
+
+      } else {
+        prerequisiteCheck.setStatus(PrereqCheckStatus.PASS);
+      }
+    }
+  }
+
+  /**
+   * Returns pattern that looks for hdp version hardcoded occurences, except
+   * those that start with "-Dhdp.version=" string
+   * @param hdpVersion hdp version to search for
+   * @return compiled pattern
+   */
+  public static Pattern getHardcodeSearchPattern(String hdpVersion) {
+    // Only things like -Dhdp.version=2.3.4.0-1234 are allowed at hardcode
+    return Pattern.compile("(?<!-Dhdp\\.version=)" + hdpVersion.replace(".", "\\."));
+  }
+
+  /**
+   * Looks for search pattern in string
+   * @param string string to look into
+   * @param searchPattern compiled regex
+   * @return true if string contains pattern
+   */
+  public static boolean stringContainsVersionHardcode(String string, Pattern searchPattern) {
+    Matcher matcher = searchPattern.matcher(string);
+    return matcher.find();
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/bb864df5/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/FixLzoCodecPath.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/FixLzoCodecPath.java b/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/FixLzoCodecPath.java
new file mode 100644
index 0000000..ffa21ab
--- /dev/null
+++ b/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/FixLzoCodecPath.java
@@ -0,0 +1,103 @@
+/*
+ * 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.
+ */
+
+package org.apache.ambari.server.serveraction.upgrades;
+
+import com.google.inject.Inject;
+import org.apache.ambari.server.AmbariException;
+import org.apache.ambari.server.actionmanager.HostRoleStatus;
+import org.apache.ambari.server.agent.CommandReport;
+import org.apache.ambari.server.serveraction.AbstractServerAction;
+import org.apache.ambari.server.state.Cluster;
+import org.apache.ambari.server.state.Clusters;
+import org.apache.ambari.server.state.Config;
+import org.apache.commons.lang.StringUtils;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.concurrent.ConcurrentMap;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+/**
+ * During stack upgrade, update lzo codec path in mapreduce.application.classpath and
+ * at tez.cluster.additional.classpath.prefix to look like
+ * /usr/hdp/${hdp.version}/hadoop/lib/hadoop-lzo-0.6.0.${hdp.version}.jar
+ */
+public class FixLzoCodecPath extends AbstractServerAction {
+
+  /**
+   * Lists config types and properties that may contain lzo codec path
+   */
+  private static final HashMap<String, String []> TARGET_PROPERTIES = new HashMap<String, String []>() {{
+    put("mapred-site", new String [] {"mapreduce.application.classpath"});
+    put("tez-site", new String [] {"tez.cluster.additional.classpath.prefix"});
+  }};
+
+  @Inject
+  private Clusters clusters;
+
+  @Override
+  public CommandReport execute(ConcurrentMap<String, Object> requestSharedDataContext)
+    throws AmbariException, InterruptedException {
+    String clusterName = getExecutionCommand().getClusterName();
+    Cluster cluster = clusters.getCluster(clusterName);
+
+    ArrayList<String> modifiedProperties = new ArrayList<>();
+
+    for (Map.Entry<String, String[]> target : TARGET_PROPERTIES.entrySet()) {
+      Config config = cluster.getDesiredConfigByType(target.getKey());
+      if (config == null) {
+        continue; // Config not found, skip it
+      }
+      Map<String, String> properties = config.getProperties();
+      for (String propertyName : target.getValue()) {
+        String oldContent = properties.get(propertyName);
+        String newContent = fixLzoJarPath(oldContent);
+
+        if (! newContent.equals(oldContent)) {
+          properties.put(propertyName, newContent);
+          modifiedProperties.add(propertyName);
+        }
+      }
+      config.setProperties(properties);
+      config.persist(false);
+    }
+    if (modifiedProperties.isEmpty()) {
+      return createCommandReport(0, HostRoleStatus.COMPLETED, "{}",
+        "No properties require lzo codec path fixes", "");
+    } else {
+      return createCommandReport(0, HostRoleStatus.COMPLETED, "{}",
+        String.format("Fixed lzo codec path value at property [%s] to " +
+          "use ${hdp.version} instead of hardcoded HDP version.",
+          StringUtils.join(modifiedProperties, ", ")), "");
+    }
+
+  }
+
+  public static String fixLzoJarPath(String oldPropertyValue) {
+    // Makes sure that LZO codec path uses ${hdp.version} instead of hardcoded hdp version,
+    // so it replaces variations of /usr/hdp/2.3.4.0-3485/hadoop/lib/hadoop-lzo-0.6.0.2.3.4.0-3485.jar
+    // with /usr/hdp/${hdp.version}/hadoop/lib/hadoop-lzo-0.6.0.${hdp.version}.jar
+    return oldPropertyValue.replaceAll(
+      "(/usr/hdp/)[^\\\\:]+(/hadoop/lib/hadoop-lzo-(\\d\\.)+)(\\$\\{hdp.version\\}|(\\d\\.){3}\\d-\\d+)(\\.jar)",
+      "$1\\$\\{hdp.version\\}$2\\$\\{hdp.version\\}$6");
+  }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/bb864df5/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/OozieConfigCalculation.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/OozieConfigCalculation.java b/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/OozieConfigCalculation.java
new file mode 100644
index 0000000..4da67ca
--- /dev/null
+++ b/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/OozieConfigCalculation.java
@@ -0,0 +1,94 @@
+/*
+ * 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.
+ */
+
+package org.apache.ambari.server.serveraction.upgrades;
+
+import com.google.inject.Inject;
+import org.apache.ambari.server.AmbariException;
+import org.apache.ambari.server.actionmanager.HostRoleStatus;
+import org.apache.ambari.server.agent.CommandReport;
+import org.apache.ambari.server.serveraction.AbstractServerAction;
+import org.apache.ambari.server.state.Cluster;
+import org.apache.ambari.server.state.Clusters;
+import org.apache.ambari.server.state.Config;
+
+import java.util.Map;
+import java.util.concurrent.ConcurrentMap;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+/**
+ * Changes oozie-env during upgrade (adds -Dhdp.version to $HADOOP_OPTS variable)
+ */
+public class OozieConfigCalculation extends AbstractServerAction {
+  private static final String TARGET_CONFIG_TYPE = "oozie-env";
+  private static final String CONTENT_PROPERTY_NAME = "content";
+
+  @Inject
+  private Clusters clusters;
+
+  @Override
+  public CommandReport execute(ConcurrentMap<String, Object> requestSharedDataContext)
+    throws AmbariException, InterruptedException {
+    String clusterName = getExecutionCommand().getClusterName();
+    Cluster cluster = clusters.getCluster(clusterName);
+    Config config = cluster.getDesiredConfigByType(TARGET_CONFIG_TYPE);
+
+    if (config == null) {
+      return  createCommandReport(0, HostRoleStatus.FAILED,"{}",
+                                   String.format("Source type %s not found", TARGET_CONFIG_TYPE), "");
+    }
+
+    Map<String, String> properties = config.getProperties();
+    String oldContent = properties.get(CONTENT_PROPERTY_NAME);
+
+    String newContent = processPropertyValue(oldContent);
+
+    if (newContent.equals(oldContent)) {
+      return  createCommandReport(0, HostRoleStatus.COMPLETED, "{}",
+        "-Dhdp.version option has been already added to $HADOOP_OPTS variable", "");
+    } else {
+      properties.put(CONTENT_PROPERTY_NAME, newContent);
+    }
+
+    config.setProperties(properties);
+    config.persist(false);
+
+    return createCommandReport(0, HostRoleStatus.COMPLETED, "{}",
+                  String.format("Added -Dhdp.version to $HADOOP_OPTS variable at %s", TARGET_CONFIG_TYPE), "");
+
+  }
+
+  public static String processPropertyValue(String oldContent) {
+    // For regex simplicity, will not work with multiline export definitions that are
+    // split on few strings using \ character
+    // False negative should be a less bit of trouble (just duplicate exports/option definitions)
+    // than false positive (broken Oozie after upgrade)
+    Pattern regex = Pattern.compile("^export HADOOP_OPTS=.*-Dhdp.version=.*$", Pattern.MULTILINE);
+    Matcher regexMatcher = regex.matcher(oldContent);
+    if (regexMatcher.find()) {
+      return oldContent;
+    } else {
+      StringBuilder newContent = new StringBuilder(oldContent);
+      newContent.append("\n").append(
+        "export HADOOP_OPTS=\"-Dhdp.version=$HDP_VERSION $HADOOP_OPTS\" "
+      );
+      return newContent.toString();
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/bb864df5/ambari-server/src/main/resources/common-services/OOZIE/4.0.0.2.0/configuration/oozie-env.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/OOZIE/4.0.0.2.0/configuration/oozie-env.xml b/ambari-server/src/main/resources/common-services/OOZIE/4.0.0.2.0/configuration/oozie-env.xml
index fae449e..b39578f 100644
--- a/ambari-server/src/main/resources/common-services/OOZIE/4.0.0.2.0/configuration/oozie-env.xml
+++ b/ambari-server/src/main/resources/common-services/OOZIE/4.0.0.2.0/configuration/oozie-env.xml
@@ -178,6 +178,9 @@ export OOZIE_ADMIN_PORT={{oozie_server_admin_port}}
 # export OOZIE_BASE_URL="http://${OOZIE_HTTP_HOSTNAME}:${OOZIE_HTTP_PORT}/oozie"
 export JAVA_LIBRARY_PATH={{hadoop_lib_home}}/native/Linux-amd64-64
 
+# Set Hadoop-related properties
+export HADOOP_OPTS="-Dhdp.version=${HDP_VERSION} ${HADOOP_OPTS}"
+
    </value>
    <value-attributes>
      <type>content</type>

http://git-wip-us.apache.org/repos/asf/ambari/blob/bb864df5/ambari-server/src/main/resources/common-services/OOZIE/4.2.0.2.3/configuration/oozie-env.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/OOZIE/4.2.0.2.3/configuration/oozie-env.xml b/ambari-server/src/main/resources/common-services/OOZIE/4.2.0.2.3/configuration/oozie-env.xml
index aa860f4..3cda54a 100644
--- a/ambari-server/src/main/resources/common-services/OOZIE/4.2.0.2.3/configuration/oozie-env.xml
+++ b/ambari-server/src/main/resources/common-services/OOZIE/4.2.0.2.3/configuration/oozie-env.xml
@@ -99,6 +99,9 @@ export OOZIE_CLIENT_OPTS="${OOZIE_CLIENT_OPTS} -Doozie.connection.retry.count=5
 export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:{{jdbc_libs_dir}}"
 export JAVA_LIBRARY_PATH="$JAVA_LIBRARY_PATH:{{jdbc_libs_dir}}"
 {% endif %}
+
+# Set Hadoop-related properties
+export HADOOP_OPTS="-Dhdp.version=${HDP_VERSION} ${HADOOP_OPTS}"
     </value>
     <value-attributes>
       <type>content</type>

http://git-wip-us.apache.org/repos/asf/ambari/blob/bb864df5/ambari-server/src/main/resources/stacks/HDP/2.1/upgrades/nonrolling-upgrade-2.3.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.1/upgrades/nonrolling-upgrade-2.3.xml b/ambari-server/src/main/resources/stacks/HDP/2.1/upgrades/nonrolling-upgrade-2.3.xml
index 9f0458b..4602ad2 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.1/upgrades/nonrolling-upgrade-2.3.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.1/upgrades/nonrolling-upgrade-2.3.xml
@@ -252,6 +252,10 @@
         <task xsi:type="configure" id="hdp_2_3_0_0_mapreduce2_adjust_history_server"/>
       </execute-stage>
 
+      <execute-stage service="MAPREDUCE2" component="MAPREDUCE2_CLIENT" title="Apply config changes for Mapreduce2 client">
+        <task xsi:type="server_action" summary="Verifying LZO codec path for mapreduce" class="org.apache.ambari.server.serveraction.upgrades.FixLzoCodecPath"/>
+      </execute-stage>
+
       <execute-stage service="YARN" component="APP_TIMELINE_SERVER" title="Apply config changes for AppTimelineServer">
         <task xsi:type="configure" id="hdp_2_3_0_0_yarn_ats_enable_recovery"/>
       </execute-stage>
@@ -306,6 +310,10 @@
         <task xsi:type="configure" id="hdp_2_3_0_0_tez_keep_ats_v1"/>
       </execute-stage>
 
+      <execute-stage service="TEZ" component="TEZ_CLIENT" title="Verify LZO codec path for Tez">
+        <task xsi:type="server_action" summary="Verifying LZO codec path for Tez" class="org.apache.ambari.server.serveraction.upgrades.FixLzoCodecPath"/>
+      </execute-stage>
+
       <!--HIVE-->
       <execute-stage service="HIVE" component="HIVE_SERVER" title="Apply config changes for Hive Server">
         <task xsi:type="server_action" summary="Calculating ZooKeeper Quorum Properties for Hive" class="org.apache.ambari.server.serveraction.upgrades.HiveZKQuorumConfigAction" />
@@ -340,6 +348,10 @@
         <task xsi:type="configure" id="hdp_2_3_0_0_oozie_remove_redundant_configurations"/>
       </execute-stage>
 
+      <execute-stage service="OOZIE" component="OOZIE_SERVER" title="Apply config changes for Oozie Server">
+        <task xsi:type="server_action" summary="Adjusting Oozie properties" class="org.apache.ambari.server.serveraction.upgrades.OozieConfigCalculation"/>
+      </execute-stage>
+
       <!--FALCON-->
       <execute-stage service="FALCON" component="FALCON_SERVER" title="Apply config changes for Falcon Server">
         <task xsi:type="configure" id="hdp_2_2_0_0_falcon_application_services"/>

http://git-wip-us.apache.org/repos/asf/ambari/blob/bb864df5/ambari-server/src/main/resources/stacks/HDP/2.2/services/OOZIE/configuration/oozie-env.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.2/services/OOZIE/configuration/oozie-env.xml b/ambari-server/src/main/resources/stacks/HDP/2.2/services/OOZIE/configuration/oozie-env.xml
index 95af610..b9f2da1 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.2/services/OOZIE/configuration/oozie-env.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.2/services/OOZIE/configuration/oozie-env.xml
@@ -101,6 +101,9 @@ export CATALINA_OPTS="${CATALINA_OPTS} -Xmx2048m -XX:MaxPermSize=256m "
 export CATALINA_OPTS="${CATALINA_OPTS} -Xmx2048m"
 {% endif %}
 
+# Set Hadoop-related properties
+export HADOOP_OPTS="-Dhdp.version=${HDP_VERSION} ${HADOOP_OPTS}"
+
     </value>
     <value-attributes>
       <type>content</type>

http://git-wip-us.apache.org/repos/asf/ambari/blob/bb864df5/ambari-server/src/main/resources/stacks/HDP/2.2/upgrades/nonrolling-upgrade-2.2.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.2/upgrades/nonrolling-upgrade-2.2.xml b/ambari-server/src/main/resources/stacks/HDP/2.2/upgrades/nonrolling-upgrade-2.2.xml
index 3aaf8c7..4fd3316 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.2/upgrades/nonrolling-upgrade-2.2.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.2/upgrades/nonrolling-upgrade-2.2.xml
@@ -236,9 +236,21 @@
       <direction>UPGRADE</direction>   <!--  prevent config changes on downgrade -->
       <skippable>true</skippable>  <!-- May fix configuration problems manually -->
 
+      <execute-stage service="MAPREDUCE2" component="MAPREDUCE2_CLIENT" title="Apply config changes for Mapreduce2 client">
+        <task xsi:type="server_action" summary="Verifying LZO codec path for mapreduce" class="org.apache.ambari.server.serveraction.upgrades.FixLzoCodecPath"/>
+      </execute-stage>
+
       <execute-stage service="TEZ" component="TEZ_CLIENT" title="Apply config changes for Tez">
         <task xsi:type="configure" id="hdp_2_2_0_0_tez_client_adjust_tez_lib_uris_property"/>
       </execute-stage>
+
+      <execute-stage service="TEZ" component="TEZ_CLIENT" title="Verify LZO codec path for Tez">
+        <task xsi:type="server_action" summary="Verifying LZO codec path for Tez" class="org.apache.ambari.server.serveraction.upgrades.FixLzoCodecPath"/>
+      </execute-stage>
+
+      <execute-stage service="OOZIE" component="OOZIE_SERVER" title="Apply config changes for Oozie Server">
+        <task xsi:type="server_action" summary="Adjusting Oozie properties" class="org.apache.ambari.server.serveraction.upgrades.OozieConfigCalculation"/>
+      </execute-stage>
     </group>
 
     <!-- Now, restart all of the services. -->

http://git-wip-us.apache.org/repos/asf/ambari/blob/bb864df5/ambari-server/src/main/resources/stacks/HDP/2.2/upgrades/nonrolling-upgrade-2.3.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.2/upgrades/nonrolling-upgrade-2.3.xml b/ambari-server/src/main/resources/stacks/HDP/2.2/upgrades/nonrolling-upgrade-2.3.xml
index 55fc336..1416d10 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.2/upgrades/nonrolling-upgrade-2.3.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.2/upgrades/nonrolling-upgrade-2.3.xml
@@ -340,6 +340,10 @@
         <task xsi:type="configure" id="hdp_2_3_0_0_mapreduce2_adjust_history_server"/>
       </execute-stage>
 
+      <execute-stage service="MAPREDUCE2" component="MAPREDUCE2_CLIENT" title="Apply config changes for Mapreduce2 client">
+        <task xsi:type="server_action" summary="Verifying LZO codec path for mapreduce" class="org.apache.ambari.server.serveraction.upgrades.FixLzoCodecPath"/>
+      </execute-stage>
+
       <execute-stage service="YARN" component="APP_TIMELINE_SERVER" title="Apply config changes for AppTimelineServer">
         <task xsi:type="configure" id="hdp_2_3_0_0_yarn_ats_enable_recovery"/>
       </execute-stage>
@@ -429,6 +433,10 @@
         <task xsi:type="configure" id="hdp_2_3_0_0_tez_keep_ats_v1"/>
       </execute-stage>
 
+      <execute-stage service="TEZ" component="TEZ_CLIENT" title="Verify LZO codec path for Tez">
+        <task xsi:type="server_action" summary="Verifying LZO codec path for Tez" class="org.apache.ambari.server.serveraction.upgrades.FixLzoCodecPath"/>
+      </execute-stage>
+
       <!--HIVE-->
       <execute-stage service="HIVE" component="HIVE_SERVER" title="Apply config changes for Hive Server">
         <task xsi:type="configure" id="hdp_2_3_0_0_hive_server_replace_auth_manager"/>
@@ -471,6 +479,9 @@
         <task xsi:type="configure" id="hdp_2_3_0_0_oozie_remove_redundant_configurations"/>
       </execute-stage>
 
+      <execute-stage service="OOZIE" component="OOZIE_SERVER" title="Apply config changes for Oozie Server">
+        <task xsi:type="server_action" summary="Adjusting Oozie properties" class="org.apache.ambari.server.serveraction.upgrades.OozieConfigCalculation"/>
+      </execute-stage>
 
       <!--KNOX-->
       <execute-stage service="KNOX" component="KNOX_GATEWAY" title="Apply config changes for Knox Gateway">
@@ -1205,4 +1216,4 @@
       </component>
     </service>
   </processing>
-</upgrade>
\ No newline at end of file
+</upgrade>

http://git-wip-us.apache.org/repos/asf/ambari/blob/bb864df5/ambari-server/src/main/resources/stacks/HDP/2.2/upgrades/nonrolling-upgrade-2.4.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.2/upgrades/nonrolling-upgrade-2.4.xml b/ambari-server/src/main/resources/stacks/HDP/2.2/upgrades/nonrolling-upgrade-2.4.xml
index b756deb..d31914f 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.2/upgrades/nonrolling-upgrade-2.4.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.2/upgrades/nonrolling-upgrade-2.4.xml
@@ -371,6 +371,10 @@
         <task xsi:type="configure" id="hdp_2_3_0_0_mapreduce2_adjust_history_server"/>
       </execute-stage>
 
+      <execute-stage service="MAPREDUCE2" component="MAPREDUCE2_CLIENT" title="Apply config changes for Mapreduce2 client">
+        <task xsi:type="server_action" summary="Verifying LZO codec path for mapreduce" class="org.apache.ambari.server.serveraction.upgrades.FixLzoCodecPath"/>
+      </execute-stage>
+
       <execute-stage service="YARN" component="APP_TIMELINE_SERVER" title="Apply config changes for AppTimelineServer">
         <task xsi:type="configure" id="hdp_2_3_0_0_yarn_ats_enable_recovery"/>
       </execute-stage>
@@ -463,6 +467,10 @@
         <task xsi:type="configure" id="hdp_2_3_0_0_tez_keep_ats_v1"/>
       </execute-stage>
 
+      <execute-stage service="TEZ" component="TEZ_CLIENT" title="Verify LZO codec path for Tez">
+        <task xsi:type="server_action" summary="Verifying LZO codec path for Tez" class="org.apache.ambari.server.serveraction.upgrades.FixLzoCodecPath"/>
+      </execute-stage>
+
       <!--HIVE-->
       <execute-stage service="HIVE" component="HIVE_SERVER" title="Apply config changes for Hive Server">
         <task xsi:type="configure" id="hdp_2_3_0_0_hive_server_replace_auth_manager"/>
@@ -509,6 +517,10 @@
         <task xsi:type="configure" id="hdp_2_4_0_0_oozie_remove_service_classes" />
       </execute-stage>
 
+      <execute-stage service="OOZIE" component="OOZIE_SERVER" title="Apply config changes for Oozie Server">
+        <task xsi:type="server_action" summary="Adjusting Oozie properties" class="org.apache.ambari.server.serveraction.upgrades.OozieConfigCalculation"/>
+      </execute-stage>
+
       <!--KNOX-->
       <execute-stage service="KNOX" component="KNOX_GATEWAY" title="Apply config changes for Knox Gateway">
         <task xsi:type="configure" id="hdp_2_3_0_0_knox_configure_ranger_policy"/>

http://git-wip-us.apache.org/repos/asf/ambari/blob/bb864df5/ambari-server/src/main/resources/stacks/HDP/2.2/upgrades/upgrade-2.2.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.2/upgrades/upgrade-2.2.xml b/ambari-server/src/main/resources/stacks/HDP/2.2/upgrades/upgrade-2.2.xml
index 7855e27..38ee39b 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.2/upgrades/upgrade-2.2.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.2/upgrades/upgrade-2.2.xml
@@ -442,6 +442,10 @@
       </component>
 
       <component name="MAPREDUCE2_CLIENT">
+        <pre-upgrade>
+          <task xsi:type="server_action" summary="Verifying LZO codec path for mapreduce" class="org.apache.ambari.server.serveraction.upgrades.FixLzoCodecPath"/>
+        </pre-upgrade>
+
         <upgrade>
           <task xsi:type="restart-task"/>
         </upgrade>
@@ -497,6 +501,8 @@
       <component name="TEZ_CLIENT">
         <pre-upgrade>
           <task xsi:type="configure" id="hdp_2_2_0_0_tez_client_adjust_tez_lib_uris_property" />
+
+          <task xsi:type="server_action" summary="Verifying LZO codec path for Tez" class="org.apache.ambari.server.serveraction.upgrades.FixLzoCodecPath"/>
         </pre-upgrade>
         <upgrade>
           <task xsi:type="restart-task"/>
@@ -598,6 +604,8 @@
             <script>scripts/oozie_server.py</script>
             <function>stop</function>
           </task>
+          
+          <task xsi:type="server_action" summary="Adjusting Oozie properties" class="org.apache.ambari.server.serveraction.upgrades.OozieConfigCalculation"/>
 
           <task xsi:type="execute" hosts="any" sequential="true" summary="Upgrading the Oozie database and creating a new sharelib">
             <script>scripts/oozie_server_upgrade.py</script>

http://git-wip-us.apache.org/repos/asf/ambari/blob/bb864df5/ambari-server/src/main/resources/stacks/HDP/2.2/upgrades/upgrade-2.3.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.2/upgrades/upgrade-2.3.xml b/ambari-server/src/main/resources/stacks/HDP/2.2/upgrades/upgrade-2.3.xml
index 156c8de..d160d8c 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.2/upgrades/upgrade-2.3.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.2/upgrades/upgrade-2.3.xml
@@ -530,6 +530,10 @@
       </component>
 
       <component name="MAPREDUCE2_CLIENT">
+        <pre-upgrade>
+          <task xsi:type="server_action" summary="Verifying LZO codec path for mapreduce" class="org.apache.ambari.server.serveraction.upgrades.FixLzoCodecPath"/>
+        </pre-upgrade>
+
         <upgrade>
           <task xsi:type="restart-task"/>
         </upgrade>
@@ -632,6 +636,7 @@
           <task xsi:type="configure" id="hdp_2_2_0_0_tez_client_adjust_tez_counters_properties"/>
           <task xsi:type="configure" id="hdp_2_3_0_0_tez_client_adjust_tez_lib_uris_property"/>
           <task xsi:type="configure" id="hdp_2_3_0_0_tez_keep_ats_v1"/>
+          <task xsi:type="server_action" summary="Verifying LZO codec path for Tez" class="org.apache.ambari.server.serveraction.upgrades.FixLzoCodecPath"/>
         </pre-upgrade>
         <upgrade>
           <task xsi:type="restart-task"/>
@@ -744,6 +749,8 @@
         <pre-upgrade>
           <task xsi:type="configure" id="hdp_2_3_0_0_oozie_remove_redundant_configurations"/>
 
+          <task xsi:type="server_action" summary="Adjusting Oozie properties" class="org.apache.ambari.server.serveraction.upgrades.OozieConfigCalculation"/>
+
           <task xsi:type="execute" hosts="all" sequential="true" summary="Shut down all Oozie servers">
             <script>scripts/oozie_server.py</script>
             <function>stop</function>

http://git-wip-us.apache.org/repos/asf/ambari/blob/bb864df5/ambari-server/src/main/resources/stacks/HDP/2.2/upgrades/upgrade-2.4.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.2/upgrades/upgrade-2.4.xml b/ambari-server/src/main/resources/stacks/HDP/2.2/upgrades/upgrade-2.4.xml
index 39756d9..c9fabb2 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.2/upgrades/upgrade-2.4.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.2/upgrades/upgrade-2.4.xml
@@ -536,6 +536,10 @@
       </component>
 
       <component name="MAPREDUCE2_CLIENT">
+        <pre-upgrade>
+          <task xsi:type="server_action" summary="Verifying LZO codec path for mapreduce" class="org.apache.ambari.server.serveraction.upgrades.FixLzoCodecPath"/>
+        </pre-upgrade>
+
         <upgrade>
           <task xsi:type="restart-task"/>
         </upgrade>
@@ -643,6 +647,8 @@
           <task xsi:type="configure" id="hdp_2_4_0_0_tez_client_adjust_tez_lib_uris_property"/>
 
           <task xsi:type="configure" id="hdp_2_3_0_0_tez_keep_ats_v1"/>
+
+          <task xsi:type="server_action" summary="Verifying LZO codec path for Tez" class="org.apache.ambari.server.serveraction.upgrades.FixLzoCodecPath"/>
         </pre-upgrade>
         <upgrade>
           <task xsi:type="restart-task"/>
@@ -756,6 +762,8 @@
           <task xsi:type="configure" id="hdp_2_3_0_0_oozie_remove_redundant_configurations"/>
           <task xsi:type="configure" id="hdp_2_4_0_0_oozie_remove_service_classes" />
 
+          <task xsi:type="server_action" summary="Adjusting Oozie properties" class="org.apache.ambari.server.serveraction.upgrades.OozieConfigCalculation"/>
+
           <task xsi:type="execute" hosts="all" sequential="true" summary="Shut down all Oozie servers">
             <script>scripts/oozie_server.py</script>
             <function>stop</function>

http://git-wip-us.apache.org/repos/asf/ambari/blob/bb864df5/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 208aa52..ac84443 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
@@ -267,6 +267,16 @@
       <direction>UPGRADE</direction>   <!--  prevent config changes on downgrade -->
       <skippable>true</skippable>  <!-- May fix configuration problems manually -->
 
+      <!--YARN-->
+      <execute-stage service="MAPREDUCE2" component="MAPREDUCE2_CLIENT" title="Apply config changes for Mapreduce2 client">
+        <task xsi:type="server_action" summary="Verifying LZO codec path for mapreduce" class="org.apache.ambari.server.serveraction.upgrades.FixLzoCodecPath"/>
+      </execute-stage>
+
+      <!--TEZ-->
+      <execute-stage service="TEZ" component="TEZ_CLIENT" title="Verify LZO codec path for Tez">
+        <task xsi:type="server_action" summary="Verifying LZO codec path for Tez" class="org.apache.ambari.server.serveraction.upgrades.FixLzoCodecPath"/>
+      </execute-stage>
+
       <!-- HBASE -->
       <!-- These HBASE configs changed in HDP 2.3.4.0, but Ambari can't distinguish HDP 2.3.2.0 vs HDP 2.3.4.0, so easier to always do them. -->
       <execute-stage service="HBASE" component="HBASE_MASTER" title="Apply config changes for HBASE Master">
@@ -276,6 +286,11 @@
       <execute-stage service="TEZ" component="TEZ_CLIENT" title="Apply config changes for Tez">
         <task xsi:type="configure" id="hdp_2_3_0_0_tez_client_adjust_tez_lib_uris_property"/>
       </execute-stage>
+
+      <!--OOZIE-->
+      <execute-stage service="OOZIE" component="OOZIE_SERVER" title="Apply config changes for Oozie Server">
+        <task xsi:type="server_action" summary="Adjusting Oozie properties" class="org.apache.ambari.server.serveraction.upgrades.OozieConfigCalculation"/>
+      </execute-stage>
     </group>
 
     <!-- Now, restart all of the services. -->

http://git-wip-us.apache.org/repos/asf/ambari/blob/bb864df5/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 6154634..b3da18e 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
@@ -278,17 +278,26 @@
         <task xsi:type="server_action" summary="Calculating Yarn Properties for Spark Shuffle" class="org.apache.ambari.server.serveraction.upgrades.SparkShufflePropertyConfig" />
       </execute-stage>
 
+      <execute-stage service="MAPREDUCE2" component="MAPREDUCE2_CLIENT" title="Apply config changes for Mapreduce2 client">
+        <task xsi:type="server_action" summary="Verifying LZO codec path for mapreduce" class="org.apache.ambari.server.serveraction.upgrades.FixLzoCodecPath"/>
+      </execute-stage>
+
       <!-- HBASE -->
       <!-- These HBASE configs changed in HDP 2.3.4.0, but Ambari can't distinguish HDP 2.3.2.0 vs HDP 2.3.4.0, so easier to always do them. -->
       <execute-stage service="HBASE" component="HBASE_MASTER" title="Apply config changes for HBASE Master">
         <task xsi:type="configure" id="hdp_2_4_0_0_hbase_remove_local_indexing"/>
       </execute-stage>
 
-      <!-- HIVE, TEZ, -->
+      <!-- TEZ -->
       <execute-stage service="TEZ" component="TEZ_CLIENT" title="Apply config changes for Tez">
         <task xsi:type="configure" id="hdp_2_4_0_0_tez_client_adjust_tez_lib_uris_property"/>
       </execute-stage>
 
+      <execute-stage service="TEZ" component="TEZ_CLIENT" title="Verify LZO codec path for Tez">
+        <task xsi:type="server_action" summary="Verifying LZO codec path for Tez" class="org.apache.ambari.server.serveraction.upgrades.FixLzoCodecPath"/>
+      </execute-stage>
+
+      <!-- HIVE -->
       <execute-stage service="HIVE" component="WEBHCAT_SERVER" title="Apply config changes for WebHCat Server">
         <task xsi:type="configure" id="hdp_2_4_0_0_webhcat_server_update_configuration_paths"/>
       </execute-stage>
@@ -297,7 +306,11 @@
         <task xsi:type="configure" id="hdp_2_4_0_0_hive_server_configure_authentication"/>
       </execute-stage>
 
-      <!-- OOZIE -->
+      <!--OOZIE-->
+      <execute-stage service="OOZIE" component="OOZIE_SERVER" title="Apply config changes for Oozie Server">
+        <task xsi:type="server_action" summary="Adjusting Oozie properties" class="org.apache.ambari.server.serveraction.upgrades.OozieConfigCalculation"/>
+      </execute-stage>
+
       <execute-stage service="OOZIE" component="OOZIE_SERVER" title="Apply config changes for Oozie Server">
         <task xsi:type="configure" id="hdp_2_4_0_0_oozie_remove_service_classes" />
       </execute-stage>
@@ -308,7 +321,6 @@
         <task xsi:type="configure" id ="hdp_2_4_0_0_kafka_broker_listeners"/>
       </execute-stage>
 
-
     </group>
 
     <!-- Now, restart all of the services. -->

http://git-wip-us.apache.org/repos/asf/ambari/blob/bb864df5/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 4d26a2d..508483e 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
@@ -525,6 +525,10 @@
       </component>
 
       <component name="MAPREDUCE2_CLIENT">
+        <pre-upgrade>
+          <task xsi:type="server_action" summary="Verifying LZO codec path for mapreduce" class="org.apache.ambari.server.serveraction.upgrades.FixLzoCodecPath"/>
+        </pre-upgrade>
+
         <upgrade>
           <task xsi:type="restart-task"/>
         </upgrade>
@@ -592,6 +596,8 @@
       <component name="TEZ_CLIENT">
         <pre-upgrade>
           <task xsi:type="configure" id="hdp_2_3_0_0_tez_client_adjust_tez_lib_uris_property"/>
+
+          <task xsi:type="server_action" summary="Verifying LZO codec path for Tez" class="org.apache.ambari.server.serveraction.upgrades.FixLzoCodecPath"/>
         </pre-upgrade>
         <upgrade>
           <task xsi:type="restart-task"/>
@@ -699,6 +705,8 @@
             <function>stop</function>
           </task>
 
+          <task xsi:type="server_action" summary="Adjusting Oozie properties" class="org.apache.ambari.server.serveraction.upgrades.OozieConfigCalculation"/>
+
           <task xsi:type="execute" hosts="any" sequential="true" summary="Upgrading the Oozie database and creating a new sharelib">
             <script>scripts/oozie_server_upgrade.py</script>
             <function>upgrade_oozie_database_and_sharelib</function>

http://git-wip-us.apache.org/repos/asf/ambari/blob/bb864df5/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 660dbe2..32e3764 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
@@ -480,6 +480,10 @@
       </component>
 
       <component name="MAPREDUCE2_CLIENT">
+        <pre-upgrade>
+          <task xsi:type="server_action" summary="Verifying LZO codec path for mapreduce" class="org.apache.ambari.server.serveraction.upgrades.FixLzoCodecPath"/>
+        </pre-upgrade>
+
         <upgrade>
           <task xsi:type="restart-task" />
         </upgrade>
@@ -556,6 +560,8 @@
       <component name="TEZ_CLIENT">
         <pre-upgrade>
           <task xsi:type="configure" id="hdp_2_4_0_0_tez_client_adjust_tez_lib_uris_property"/>
+
+          <task xsi:type="server_action" summary="Verifying LZO codec path for Tez" class="org.apache.ambari.server.serveraction.upgrades.FixLzoCodecPath"/>
         </pre-upgrade>
         <upgrade>
           <task xsi:type="restart-task" />
@@ -678,6 +684,8 @@
       <component name="OOZIE_SERVER">
         <pre-upgrade>
           <task xsi:type="configure" id="hdp_2_4_0_0_oozie_remove_service_classes" />
+
+          <task xsi:type="server_action" summary="Adjusting Oozie properties" class="org.apache.ambari.server.serveraction.upgrades.OozieConfigCalculation"/>
         
           <task xsi:type="execute" hosts="all" sequential="true" summary="Shut down all Oozie servers">
             <script>scripts/oozie_server.py</script>

http://git-wip-us.apache.org/repos/asf/ambari/blob/bb864df5/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 2600eae..3863877 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
@@ -268,9 +268,24 @@
       <direction>UPGRADE</direction>   <!--  prevent config changes on downgrade -->
       <skippable>true</skippable>  <!-- May fix configuration problems manually -->
 
+      <!--YARN-->
+      <execute-stage service="MAPREDUCE2" component="MAPREDUCE2_CLIENT" title="Apply config changes for Mapreduce2 client">
+        <task xsi:type="server_action" summary="Verifying LZO codec path for mapreduce" class="org.apache.ambari.server.serveraction.upgrades.FixLzoCodecPath"/>
+      </execute-stage>
+
+      <!--TEZ-->
+      <execute-stage service="TEZ" component="TEZ_CLIENT" title="Verify LZO codec path for Tez">
+        <task xsi:type="server_action" summary="Verifying LZO codec path for Tez" class="org.apache.ambari.server.serveraction.upgrades.FixLzoCodecPath"/>
+      </execute-stage>
+
       <execute-stage service="TEZ" component="TEZ_CLIENT" title="Apply config changes for Tez">
         <task xsi:type="configure" id="hdp_2_4_0_0_tez_client_adjust_tez_lib_uris_property"/>
       </execute-stage>
+
+      <!--OOZIE-->
+      <execute-stage service="OOZIE" component="OOZIE_SERVER" title="Apply config changes for Oozie Server">
+        <task xsi:type="server_action" summary="Adjusting Oozie properties" class="org.apache.ambari.server.serveraction.upgrades.OozieConfigCalculation"/>
+      </execute-stage>
     </group>
 
     <!-- Now, restart all of the services. -->

http://git-wip-us.apache.org/repos/asf/ambari/blob/bb864df5/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 02783e9..e45e851 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
@@ -523,6 +523,10 @@
       </component>
 
       <component name="MAPREDUCE2_CLIENT">
+        <pre-upgrade>
+          <task xsi:type="server_action" summary="Verifying LZO codec path for mapreduce" class="org.apache.ambari.server.serveraction.upgrades.FixLzoCodecPath"/>
+        </pre-upgrade>
+
         <upgrade>
           <task xsi:type="restart-task" />
         </upgrade>
@@ -585,6 +589,8 @@
       <component name="TEZ_CLIENT">
         <pre-upgrade>
           <task xsi:type="configure" id="hdp_2_4_0_0_tez_client_adjust_tez_lib_uris_property"/>
+
+          <task xsi:type="server_action" summary="Verifying LZO codec path for Tez" class="org.apache.ambari.server.serveraction.upgrades.FixLzoCodecPath"/>
         </pre-upgrade>
         <upgrade>
           <task xsi:type="restart-task" />
@@ -692,6 +698,8 @@
             <function>stop</function>
           </task>
 
+          <task xsi:type="server_action" summary="Adjusting Oozie properties" class="org.apache.ambari.server.serveraction.upgrades.OozieConfigCalculation"/>
+
           <task xsi:type="execute" hosts="any" sequential="true" summary="Upgrading the Oozie database and creating a new sharelib">
             <script>scripts/oozie_server_upgrade.py</script>
             <function>upgrade_oozie_database_and_sharelib</function>

http://git-wip-us.apache.org/repos/asf/ambari/blob/bb864df5/ambari-server/src/test/java/org/apache/ambari/server/checks/HardcodedStackVersionPropertiesCheckTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/checks/HardcodedStackVersionPropertiesCheckTest.java b/ambari-server/src/test/java/org/apache/ambari/server/checks/HardcodedStackVersionPropertiesCheckTest.java
new file mode 100644
index 0000000..92d79a1
--- /dev/null
+++ b/ambari-server/src/test/java/org/apache/ambari/server/checks/HardcodedStackVersionPropertiesCheckTest.java
@@ -0,0 +1,60 @@
+/**
+ * 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.
+ */
+
+package org.apache.ambari.server.checks;
+
+import org.junit.Test;
+
+import java.util.regex.Pattern;
+
+import static org.junit.Assert.*;
+
+public class HardcodedStackVersionPropertiesCheckTest {
+
+  private static final String currentVersion = "2.3.4.0-1234";
+
+  @Test
+  public void testGetHardcodeSearchPattern() throws Exception {
+    Pattern p = HardcodedStackVersionPropertiesCheck.getHardcodeSearchPattern(currentVersion);
+    assertEquals(p.pattern(), "(?<!-Dhdp\\.version=)2\\.3\\.4\\.0-1234");
+  }
+
+  @Test
+  public void testStringContainsVersionHardcode() throws Exception {
+    Pattern pattern = HardcodedStackVersionPropertiesCheck.getHardcodeSearchPattern(currentVersion);
+
+    // Check various cases
+    String content = "";
+    assertFalse(HardcodedStackVersionPropertiesCheck.stringContainsVersionHardcode(content, pattern));
+
+    content = "2.3.4.0-1234";
+    assertTrue(HardcodedStackVersionPropertiesCheck.stringContainsVersionHardcode(content, pattern));
+
+    content = "dfsdfds fdsfds -Dhdp.version=2.3.4.0-1234 sfdfdsfds";
+    assertFalse(HardcodedStackVersionPropertiesCheck.stringContainsVersionHardcode(content, pattern));
+
+    content = "dfsdfds fdsfds -Dhdp.version=2.3.4.0-1234 \n sfdfdsfds 2.3.4.0-1234 \n fdsfds";
+    assertTrue(HardcodedStackVersionPropertiesCheck.stringContainsVersionHardcode(content, pattern));
+
+    content = "hdp.version=2.3.4.0-1234";
+    assertTrue(HardcodedStackVersionPropertiesCheck.stringContainsVersionHardcode(content, pattern));
+
+    content = "kgflkfld fdf\nld;ls;f d hdp.version=2.3.4.0-1234 \n sfdfdsfds \n fdsfds";
+    assertTrue(HardcodedStackVersionPropertiesCheck.stringContainsVersionHardcode(content, pattern));
+  }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/bb864df5/ambari-server/src/test/java/org/apache/ambari/server/serveraction/upgrades/FixLzoCodecPathTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/serveraction/upgrades/FixLzoCodecPathTest.java b/ambari-server/src/test/java/org/apache/ambari/server/serveraction/upgrades/FixLzoCodecPathTest.java
new file mode 100644
index 0000000..49f3b59
--- /dev/null
+++ b/ambari-server/src/test/java/org/apache/ambari/server/serveraction/upgrades/FixLzoCodecPathTest.java
@@ -0,0 +1,76 @@
+/**
+ * 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.
+ */
+package org.apache.ambari.server.serveraction.upgrades;
+
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+
+/**
+ * Tests FixLzoCodecPath logic
+ */
+public class FixLzoCodecPathTest {
+
+  @Test
+  public void testFixLzoJarPath() throws Exception {
+    // Test replacements in a big list of paths (typical mapreduce.application.classpath value)
+    String oldContent = "$PWD/mr-framework/hadoop/share/hadoop/mapreduce/*:" +
+      "$PWD/mr-framework/hadoop/share/hadoop/mapreduce/lib/*:" +
+      "$PWD/mr-framework/hadoop/share/hadoop/common/*:" +
+      "$PWD/mr-framework/hadoop/share/hadoop/common/lib/*:" +
+      "$PWD/mr-framework/hadoop/share/hadoop/yarn/*:/usr/hdp/2.3.4.0-3485/hadoop/lib/hadoop-lzo-0.6.0.2.3.4.0-3485.jar:" +
+      "$PWD/mr-framework/hadoop/share/hadoop/yarn/lib/*:$PWD/mr-framework/hadoop/share/hadoop/hdfs/*:" +
+      "$PWD/mr-framework/hadoop/share/hadoop/hdfs/lib/*:$PWD/mr-framework/hadoop/share/hadoop/tools/lib/*:" +
+      "/usr/hdp/${hdp.version}/hadoop/lib/hadoop-lzo-0.6.0.${hdp.version}.jar:/etc/hadoop/conf/secure";
+    String newContent = FixLzoCodecPath.fixLzoJarPath(oldContent);
+    assertEquals("$PWD/mr-framework/hadoop/share/hadoop/mapreduce/*:" +
+      "$PWD/mr-framework/hadoop/share/hadoop/mapreduce/lib/*:" +
+      "$PWD/mr-framework/hadoop/share/hadoop/common/*:$PWD/mr-framework/hadoop/share/hadoop/common/lib/*:" +
+      "$PWD/mr-framework/hadoop/share/hadoop/yarn/*:/usr/hdp/${hdp.version}/hadoop/lib/hadoop-lzo-0.6.0.${hdp.version}.jar:" +
+      "$PWD/mr-framework/hadoop/share/hadoop/yarn/lib/*:$PWD/mr-framework/hadoop/share/hadoop/hdfs/*:" +
+      "$PWD/mr-framework/hadoop/share/hadoop/hdfs/lib/*:$PWD/mr-framework/hadoop/share/hadoop/tools/lib/*:" +
+      "/usr/hdp/${hdp.version}/hadoop/lib/hadoop-lzo-0.6.0.${hdp.version}.jar:/etc/hadoop/conf/secure", newContent);
+    
+    // Test replacements in typical tez.cluster.additional.classpath.prefix value
+    oldContent = "/usr/hdp/${hdp.version}/hadoop/lib/hadoop-lzo-0.6.0.${hdp.version}.jar:/etc/hadoop/conf/secure";
+    newContent = FixLzoCodecPath.fixLzoJarPath(oldContent);
+    assertEquals("/usr/hdp/${hdp.version}/hadoop/lib/hadoop-lzo-0.6.0.${hdp.version}.jar:/etc/hadoop/conf/secure", newContent);
+
+    oldContent = "/usr/hdp/2.3.4.0-3485/hadoop/lib/hadoop-lzo-0.6.0.2.3.4.0-345.jar:/etc/hadoop/conf/secure";
+    newContent = FixLzoCodecPath.fixLzoJarPath(oldContent);
+    assertEquals("/usr/hdp/${hdp.version}/hadoop/lib/hadoop-lzo-0.6.0.${hdp.version}.jar:/etc/hadoop/conf/secure", newContent);
+
+    oldContent = "/usr/hdp/${hdp.version}/hadoop/lib/hadoop-lzo-0.6.0.2.3.4.0-345.jar:/etc/hadoop/conf/secure";
+    newContent = FixLzoCodecPath.fixLzoJarPath(oldContent);
+    assertEquals("/usr/hdp/${hdp.version}/hadoop/lib/hadoop-lzo-0.6.0.${hdp.version}.jar:/etc/hadoop/conf/secure", newContent);
+
+    oldContent = "/usr/hdp/2.3.4.0-3485/hadoop/lib/hadoop-lzo-0.6.0.${hdp.version}.jar:/etc/hadoop/conf/secure";
+    newContent = FixLzoCodecPath.fixLzoJarPath(oldContent);
+    assertEquals("/usr/hdp/${hdp.version}/hadoop/lib/hadoop-lzo-0.6.0.${hdp.version}.jar:/etc/hadoop/conf/secure", newContent);
+
+    // Other corner cases tests
+    oldContent = "/usr/hdp/2.3.4.0-3485/hadoop/lib/hadoop-lzo-0.6.0.2.3.4.0-1.jar";
+    newContent = FixLzoCodecPath.fixLzoJarPath(oldContent);
+    assertEquals("/usr/hdp/${hdp.version}/hadoop/lib/hadoop-lzo-0.6.0.${hdp.version}.jar", newContent);
+
+    oldContent = "/etc/hadoop/conf/secure";
+    newContent = FixLzoCodecPath.fixLzoJarPath(oldContent);
+    assertEquals("/etc/hadoop/conf/secure", newContent);
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/bb864df5/ambari-server/src/test/java/org/apache/ambari/server/serveraction/upgrades/OozieConfigCalculationTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/serveraction/upgrades/OozieConfigCalculationTest.java b/ambari-server/src/test/java/org/apache/ambari/server/serveraction/upgrades/OozieConfigCalculationTest.java
new file mode 100644
index 0000000..8fa6429
--- /dev/null
+++ b/ambari-server/src/test/java/org/apache/ambari/server/serveraction/upgrades/OozieConfigCalculationTest.java
@@ -0,0 +1,87 @@
+/**
+ * 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.
+ */
+package org.apache.ambari.server.serveraction.upgrades;
+
+import org.apache.commons.lang.StringUtils;
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+/**
+ * Tests OozieConfigCalculation logic
+ */
+public class OozieConfigCalculationTest {
+
+  /**
+   * Checks that -Dhdp.version is added to $HADOOP_OPTS variable at oozie-env
+   * content.
+   * Also checks that it is not added multiple times during upgrades
+   * @throws Exception
+   */
+  @Test
+  public void testOozieEnvWithMissingParam() throws Exception {
+    // Test case when old content does not contain $HADOOP_OPTS variable at all
+    String oldContent = "#!/bin/bash\n" +
+      "\n" +
+      "if [ -d \"/usr/lib/bigtop-tomcat\" ]; then\n" +
+      "  export OOZIE_CONFIG=${OOZIE_CONFIG:-/etc/oozie/conf}\n" +
+      "  export CATALINA_BASE=${CATALINA_BASE:-{{oozie_server_dir}}}\n" +
+      "  export CATALINA_TMPDIR=${CATALINA_TMPDIR:-/var/tmp/oozie}\n" +
+      "  export OOZIE_CATALINA_HOME=/usr/lib/bigtop-tomcat\n" +
+      "fi\n" +
+      "\n" +
+      "# export OOZIE_BASE_URL=\"http://${OOZIE_HTTP_HOSTNAME}:${OOZIE_HTTP_PORT}/oozie\"\n" +
+      "export JAVA_LIBRARY_PATH={{hadoop_lib_home}}/native/Linux-amd64-64";
+    String newContent = OozieConfigCalculation.processPropertyValue(oldContent);
+    assertTrue(newContent.endsWith("export HADOOP_OPTS=\"-Dhdp.version=$HDP_VERSION $HADOOP_OPTS\" "));
+    // Test case when old content contains proper $HADOOP_OPTS variable
+    oldContent = newContent;
+    newContent = OozieConfigCalculation.processPropertyValue(oldContent);
+    assertEquals(newContent, oldContent);
+    assertEquals(1, StringUtils.countMatches(newContent, "-Dhdp.version"));
+    // Test case when old content contains $HADOOP_OPTS variable with some value
+    oldContent = "#!/bin/bash\n" +
+      "\n" +
+      "if [ -d \"/usr/lib/bigtop-tomcat\" ]; then\n" +
+      "  export OOZIE_CONFIG=${OOZIE_CONFIG:-/etc/oozie/conf}\n" +
+      "  export CATALINA_BASE=${CATALINA_BASE:-{{oozie_server_dir}}}\n" +
+      "  export CATALINA_TMPDIR=${CATALINA_TMPDIR:-/var/tmp/oozie}\n" +
+      "  export OOZIE_CATALINA_HOME=/usr/lib/bigtop-tomcat\n" +
+      "  export HADOOP_OPTS=-Dsome.option1 -Dsome.option1 $HADOOP_OPTS\n" +
+      "fi\n" +
+      "\n" +
+      "# export OOZIE_BASE_URL=\"http://${OOZIE_HTTP_HOSTNAME}:${OOZIE_HTTP_PORT}/oozie\"\n" +
+      "export JAVA_LIBRARY_PATH={{hadoop_lib_home}}/native/Linux-amd64-64";
+    newContent = OozieConfigCalculation.processPropertyValue(oldContent);
+    assertEquals("#!/bin/bash\n" +
+      "\n" +
+      "if [ -d \"/usr/lib/bigtop-tomcat\" ]; then\n" +
+      "  export OOZIE_CONFIG=${OOZIE_CONFIG:-/etc/oozie/conf}\n" +
+      "  export CATALINA_BASE=${CATALINA_BASE:-{{oozie_server_dir}}}\n" +
+      "  export CATALINA_TMPDIR=${CATALINA_TMPDIR:-/var/tmp/oozie}\n" +
+      "  export OOZIE_CATALINA_HOME=/usr/lib/bigtop-tomcat\n" +
+      "  export HADOOP_OPTS=-Dsome.option1 -Dsome.option1 $HADOOP_OPTS\n" +
+      "fi\n" +
+      "\n" +
+      "# export OOZIE_BASE_URL=\"http://${OOZIE_HTTP_HOSTNAME}:${OOZIE_HTTP_PORT}/oozie\"\n" +
+      "export JAVA_LIBRARY_PATH={{hadoop_lib_home}}/native/Linux-amd64-64\n" +
+      "export HADOOP_OPTS=\"-Dhdp.version=$HDP_VERSION $HADOOP_OPTS\" ", newContent);
+  }
+
+}


[28/40] ambari git commit: AMBARI-14939. [Ambari tarballs] optionally install required packages (aonishuk)

Posted by nc...@apache.org.
AMBARI-14939. [Ambari tarballs] optionally install required packages (aonishuk)


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

Branch: refs/heads/branch-dev-patch-upgrade
Commit: ed492292cd4fedd41ebe95ba97a73e57cceb0bae
Parents: 6919586
Author: Andrew Onishuk <ao...@hortonworks.com>
Authored: Fri Feb 5 15:44:04 2016 +0200
Committer: Andrew Onishuk <ao...@hortonworks.com>
Committed: Fri Feb 5 15:44:04 2016 +0200

----------------------------------------------------------------------
 ambari-agent/pom.xml                            |  38 ++++--
 .../src/main/package/dependencies.properties    |  32 +++++
 .../src/main/repo/install_ambari_tarball.py     | 117 ++++++++++++++++++-
 ambari-server/pom.xml                           |  40 +++++--
 .../src/main/package/dependencies.properties    |  33 ++++++
 5 files changed, 239 insertions(+), 21 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/ed492292/ambari-agent/pom.xml
----------------------------------------------------------------------
diff --git a/ambari-agent/pom.xml b/ambari-agent/pom.xml
index d049a6c..c2c993f 100644
--- a/ambari-agent/pom.xml
+++ b/ambari-agent/pom.xml
@@ -43,10 +43,7 @@
     <jinja.install.dir>/usr/lib/ambari-agent/lib/ambari_jinja2</jinja.install.dir>
     <simplejson.install.dir>/usr/lib/ambari-agent/lib/ambari_simplejson</simplejson.install.dir>
     <lib.dir>/usr/lib/ambari-agent/lib</lib.dir>
-    <python.ver>python &gt;= 2.6</python.ver>
-    <deb.python.ver>python (&gt;= 2.6)</deb.python.ver>
     <deb.architecture>amd64</deb.architecture>
-    <deb.dependency.list>openssl, zlibc, ${deb.python.ver}</deb.dependency.list>
     <ambari.server.module>../ambari-server</ambari.server.module>
     <target.cache.dir>${project.build.directory}/cache/</target.cache.dir>
     <resource.keeper.script>${ambari.server.module}/src/main/python/ambari_server/resourceFilesKeeper.py</resource.keeper.script>
@@ -140,6 +137,23 @@
       </plugin>
       <plugin>
         <groupId>org.codehaus.mojo</groupId>
+        <artifactId>properties-maven-plugin</artifactId>
+        <executions>
+          <execution>
+            <phase>package</phase>
+            <goals>
+              <goal>read-project-properties</goal>
+            </goals>
+            <configuration>
+              <files>
+                <file>${basedir}/src/main/package/dependencies.properties</file>
+              </files>
+            </configuration>
+          </execution>
+        </executions>
+      </plugin>
+      <plugin>
+        <groupId>org.codehaus.mojo</groupId>
         <artifactId>rpm-maven-plugin</artifactId>
         <version>2.1.4</version>
         <executions>
@@ -156,10 +170,7 @@
           <group>Development</group>
           <description>Maven Recipe: RPM Package.</description>
           <requires>
-            <require>openssl</require>
-            <require>rpm-python</require>
-            <require>zlib</require>
-            <require>${python.ver}</require>
+            <require>${rpm.dependency.list}</require>
           </requires>
           <postinstallScriptlet>
             <scriptFile>src/main/package/rpm/postinstall.sh</scriptFile>
@@ -355,6 +366,19 @@
                 <resource>
                   <directory>${basedir}/src/main/package/deb/control</directory>
                 </resource>
+                <resource>
+                  <directory>${basedir}/src/main/package</directory>
+                  <includes>
+                    <include>dependencies.properties</include>
+                  </includes>
+                </resource>
+                <resource>
+                  <directory>${project.basedir}/../ambari-common/src/main/python/ambari_commons</directory>
+                  <includes>
+                    <include>os_check.py</include>
+                    <include>resources/os_family.json</include>
+                  </includes>
+                </resource>
               </resources>
             </configuration>
           </execution>

http://git-wip-us.apache.org/repos/asf/ambari/blob/ed492292/ambari-agent/src/main/package/dependencies.properties
----------------------------------------------------------------------
diff --git a/ambari-agent/src/main/package/dependencies.properties b/ambari-agent/src/main/package/dependencies.properties
new file mode 100644
index 0000000..07b0b68
--- /dev/null
+++ b/ambari-agent/src/main/package/dependencies.properties
@@ -0,0 +1,32 @@
+# 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 rega4rding 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.
+
+# Please make sure the format of the file is one of the following
+# rpm.dependency.list=...
+# rpm.dependency.list.[os_family_name]=...
+# rpm.dependency.list.[os_family_name][starting_from_version]=...
+# deb.dependency.list=...
+# deb.dependency.list.[os_family_name]=...
+# deb.dependency.list.[os_family_name][starting_from_version]=...
+# 
+# Examples:
+# rpm.dependency.list.suse=openssl,\nRequires: rpm-python # for all suse family os
+# rpm.dependency.list.suse11=curl # for all suse family os higher or equal to 11.
+#
+# Such a format is respected by install_ambari_tarball.py by default, 
+# however should be encouraged manually in pom.xml.
+
+rpm.dependency.list=openssl,\nRequires: rpm-python,\nRequires: zlib,\nRequires: python >= 2.6
+deb.dependency.list=openssl, zlibc, python (>= 2.6)
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/ed492292/ambari-common/src/main/repo/install_ambari_tarball.py
----------------------------------------------------------------------
diff --git a/ambari-common/src/main/repo/install_ambari_tarball.py b/ambari-common/src/main/repo/install_ambari_tarball.py
index aa33ede..5c65b60 100644
--- a/ambari-common/src/main/repo/install_ambari_tarball.py
+++ b/ambari-common/src/main/repo/install_ambari_tarball.py
@@ -17,11 +17,13 @@ See the License for the specific language governing permissions and
 limitations under the License.
 '''
 
+import re
 import os
 import sys
 import logging
 import subprocess
 from optparse import OptionParser
+import ConfigParser
 
 USAGE = "Usage: %prog [OPTION]... URL"
 DESCRIPTION = "URL should point to full tar.gz location e.g.: https://public-repo-1.hortonworks.com/something/ambari-server.tar.gz"
@@ -32,9 +34,16 @@ PREINST_SCRIPT = "preinst"
 PRERM_SCRIPT = "prerm"
 POSTINST_SCRIPT = "postinst"
 POSTRM_SCRIPT = "postrm"
+OS_CHECK = "os_check.py"
+OS_PACKAGE_DEPENDENCIES = "dependencies.properties"
+OS_FAMILY_DESCRIPTION = "resources/os_family.json"
+RPM_DEPENDENCIES_PROPERTY =  "rpm.dependency.list"
+DEB_DEPENDENCIES_PROPERTY =  "deb.dependency.list"
 
-ROOT_FOLDER_ENV_VARIABLE = "AMBARI_ROOT_FOLDER"
+FILES_TO_DOWNLOAD = [PREINST_SCRIPT, PRERM_SCRIPT, POSTINST_SCRIPT, POSTRM_SCRIPT, OS_CHECK, OS_FAMILY_DESCRIPTION, OS_PACKAGE_DEPENDENCIES]
 
+ROOT_FOLDER_ENV_VARIABLE = "AMBARI_ROOT_FOLDER"
+          
 class Utils:
   verbose = False
   @staticmethod
@@ -65,26 +74,72 @@ class Utils:
       
     return out
   
+  @staticmethod
+  def install_package(name):
+    from os_check import OSCheck
+    
+    logger.info("Checking for existance of {0} dependency package".format(name))
+    is_rpm = not OSCheck.is_ubuntu_family()
+    
+    if is_rpm:
+      is_installed_cmd = ['rpm', '-q'] + [name]
+      install_cmd = ['sudo', 'yum', '-y', 'install'] + [name]
+    else:
+      is_installed_cmd = ['dpkg', '-s'] + [name]
+      install_cmd = ['sudo', 'apt-get', '-y', 'install'] + [name]
+      
+    try:
+      Utils.os_call(is_installed_cmd, logoutput=False)
+      logger.info("Package {0} is already installed. Skipping installation.".format(name))
+    except OsCallFailure:
+      logger.info("Package {0} is not installed. Installing it...".format(name))
+      Utils.os_call(install_cmd)
+    
+  
+class FakePropertiesHeader(object):
+  """
+  Hacky class to parse properties file without sections.
+  see http://stackoverflow.com/questions/2819696/module-to-use-when-parsing-properties-file-in-python/2819788#2819788
+  """
+  FAKE_SECTION_NAME = 'section'
+  def __init__(self, fp):
+    self.fp = fp
+    self.sechead = '[{0}]\n'.format(FakePropertiesHeader.FAKE_SECTION_NAME)
+  def readline(self):
+    if self.sechead:
+      try: 
+        return self.sechead
+      finally: 
+        self.sechead = None
+    else: 
+      return self.fp.readline()
+  
 class OsCallFailure(RuntimeError):
   pass
 
 class Installer:
-  def __init__(self, archive_url, root_folder, verbose):
+  def __init__(self, archive_url, root_folder, verbose, skip_dependencies):
     splited_url = archive_url.split('/')
     self.archive_name = splited_url[-1]
     self.base_url = '/'.join(splited_url[0:-1])
     self.root_folder = root_folder
     self.verbose = verbose
+    self.skip_dependencies = skip_dependencies
     
-  def download_files(self):
-    for name in [ self.archive_name, PREINST_SCRIPT, PRERM_SCRIPT, POSTINST_SCRIPT, POSTRM_SCRIPT]: 
+  def download_files(self, files_list):
+    for name in files_list:
+      dirname = os.path.dirname(name)
+      if dirname:
+        Utils.os_call(["mkdir", "-p", dirname])
+        
       url = "{0}/{1}".format(self.base_url, name)
       logger.info("Downloading {0}".format(url))
       Utils.os_call(["wget", "-O", name, url])
     
   def run(self):
-    self.download_files()
+    self.download_files([self.archive_name] +FILES_TO_DOWNLOAD) # [self.archive_name] +
     
+    self.check_dependencies()
     self.run_script(PRERM_SCRIPT, ["remove"]) # in case we are upgrading
     self.run_script(POSTRM_SCRIPT, ["remove"]) # in case we are upgrading
     
@@ -92,6 +147,54 @@ class Installer:
     self.extract_archive()
     self.run_script(POSTINST_SCRIPT, ["configure"])
     
+  def check_dependencies(self):
+    from os_check import OSCheck
+    
+    os_family = OSCheck.get_os_family()
+    os_version = OSCheck.get_os_major_version()
+    
+    is_rpm = not OSCheck.is_ubuntu_family()
+    property_prefix = RPM_DEPENDENCIES_PROPERTY if is_rpm else DEB_DEPENDENCIES_PROPERTY
+    
+    cp = ConfigParser.SafeConfigParser()
+    with open(OS_PACKAGE_DEPENDENCIES) as fp:
+      cp.readfp(FakePropertiesHeader(fp))
+      
+    properties = dict(cp.items(FakePropertiesHeader.FAKE_SECTION_NAME))
+    
+    packages_string = None
+    postfixes = [os_family+str(ver) for ver in range(int(os_version),0,-1)+['']]+['']
+    for postfix in postfixes:
+      property_name = property_prefix + postfix
+      if property_name in properties:
+        packages_string = properties[property_name]
+        break
+      
+    if packages_string is None:
+      err_msg = "No os dependencies found. "
+      if self.skip_dependencies:
+        logger.warn(err_msg)
+      else:
+        raise Exception(err_msg)
+    
+    packages_string = re.sub('Requires\s*:','',packages_string)
+    packages_string = re.sub('\\\\n','',packages_string)
+    packages_string = re.sub('\s','',packages_string)
+    packages_string = re.sub('[()]','',packages_string)
+    
+    if self.skip_dependencies:
+      var = raw_input("Please confirm you have the following packages installed {0} (y/n): ".format(packages_string))
+      if var.lower() != "y" and var.lower() != "yes":
+        raise Exception("User canceled the installation.")
+      return
+    
+    pacakges = packages_string.split(',')
+    
+    for package in pacakges:
+      split_parts = re.split('[><=]', package)
+      package_name = split_parts[0]
+      Utils.install_package(package_name)
+    
   def run_script(self, script_name, args):
     bash_args = []
     if self.verbose:
@@ -112,6 +215,8 @@ class Runner:
                       help="sets output level to more detailed")
     parser.add_option("-r", "--root-folder", dest="root_folder", default="/",
                       help="root folder to install Ambari to. E.g.: /opt")
+    parser.add_option("-d", "--dependencies-skip", dest="skip_dependencies", action="store_true",
+                  help="the script won't install the package dependencies. Please make sure to install them manually.")
     
     (self.options, args) = parser.parse_args()
     
@@ -138,7 +243,7 @@ class Runner:
     Utils.verbose = self.options.verbose
     
     # TODO: check if ends with tar.gz?
-    targz_installer = TargzInstaller(self.url, self.options.root_folder, self.options.verbose)
+    targz_installer = TargzInstaller(self.url, self.options.root_folder, self.options.verbose, self.options.skip_dependencies)
     targz_installer.run()
       
 if __name__ == '__main__':

http://git-wip-us.apache.org/repos/asf/ambari/blob/ed492292/ambari-server/pom.xml
----------------------------------------------------------------------
diff --git a/ambari-server/pom.xml b/ambari-server/pom.xml
index 623ddca..b500fb2 100644
--- a/ambari-server/pom.xml
+++ b/ambari-server/pom.xml
@@ -26,10 +26,7 @@
     <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
     <python.ver>python &gt;= 2.6</python.ver>
     <!-- On centos the python xml's are inside python package -->
-    <python.xml.package>${python.ver}</python.xml.package>
-    <deb.python.ver>python (&gt;= 2.6)</deb.python.ver>
     <deb.architecture>amd64</deb.architecture>
-    <deb.dependency.list>openssl, postgresql (&gt;= 8.1), ${deb.python.ver}, curl</deb.dependency.list>
     <custom.tests>false</custom.tests>
     <hdpUrlForCentos6>http://public-repo-1.hortonworks.com/HDP/centos6/2.x/updates/2.1.1.0</hdpUrlForCentos6>
     <hdpLatestUrl>http://public-repo-1.hortonworks.com/HDP/hdp_urlinfo.json</hdpLatestUrl>
@@ -195,6 +192,19 @@
                 <resource>
                   <directory>${basedir}/src/main/package/deb/control</directory>
                 </resource>
+                <resource>
+                  <directory>${basedir}/src/main/package</directory>
+                  <includes>
+                    <include>dependencies.properties</include>
+                  </includes>
+                </resource>
+                <resource>
+                  <directory>${project.basedir}/../ambari-common/src/main/python/ambari_commons</directory>
+                  <includes>
+                    <include>os_check.py</include>
+                    <include>resources/os_family.json</include>
+                  </includes>
+                </resource>
               </resources>
             </configuration>
           </execution>
@@ -309,6 +319,23 @@
       </plugin>
       <plugin>
         <groupId>org.codehaus.mojo</groupId>
+        <artifactId>properties-maven-plugin</artifactId>
+        <executions>
+          <execution>
+            <phase>package</phase>
+            <goals>
+              <goal>read-project-properties</goal>
+            </goals>
+            <configuration>
+              <files>
+                <file>${basedir}/src/main/package/dependencies.properties</file>
+              </files>
+            </configuration>
+          </execution>
+        </executions>
+      </plugin>
+      <plugin>
+        <groupId>org.codehaus.mojo</groupId>
         <artifactId>rpm-maven-plugin</artifactId>
         <version>2.1.4</version>
         <executions>
@@ -326,10 +353,7 @@
           <description>Maven Recipe: RPM Package.</description>
           <autoRequires>no</autoRequires>
           <requires>
-            <require>postgresql-server &gt;= 8.1</require>
-            <require>openssl</require>
-            <require>${python.ver}</require>
-            <require>${python.xml.package}</require>
+            <require>${rpm.dependency.list}</require>
           </requires>
           <postinstallScriptlet>
             <scriptFile>src/main/package/rpm/postinstall.sh</scriptFile>
@@ -738,7 +762,7 @@
     <profile>
       <id>suse11</id>
       <properties>
-        <python.xml.package>python-xml</python.xml.package>
+        <rpm.dependency.list>${rpm.dependency.list.suse}</rpm.dependency.list>
       </properties>
     </profile>
     <profile>

http://git-wip-us.apache.org/repos/asf/ambari/blob/ed492292/ambari-server/src/main/package/dependencies.properties
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/package/dependencies.properties b/ambari-server/src/main/package/dependencies.properties
new file mode 100644
index 0000000..01244a8
--- /dev/null
+++ b/ambari-server/src/main/package/dependencies.properties
@@ -0,0 +1,33 @@
+# 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 rega4rding 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.
+
+# Please make sure the format of the file is one of the following
+# rpm.dependency.list=...
+# rpm.dependency.list.[os_family_name]=...
+# rpm.dependency.list.[os_family_name][starting_from_version]=...
+# deb.dependency.list=...
+# deb.dependency.list.[os_family_name]=...
+# deb.dependency.list.[os_family_name][starting_from_version]=...
+# 
+# Examples:
+# rpm.dependency.list.suse=openssl,\nRequires: rpm-python # for all suse family os
+# rpm.dependency.list.suse11=curl # for all suse family os higher or equal to 11.
+#
+# Such a format is respected by install_ambari_tarball.py by default, 
+# however should be encouraged manually in pom.xml.
+
+rpm.dependency.list=postgresql-server >= 8.1,\nRequires: openssl,\nRequires: python >= 2.6
+rpm.dependency.list.suse=postgresql-server >= 8.1,\nRequires: openssl,\nRequires: python-xml,\nRequires: python >= 2.6
+deb.dependency.list=openssl, postgresql (>= 8.1), python (>= 2.6), curl
\ No newline at end of file


[26/40] ambari git commit: AMBARI-14935 UpgradeCatalog222Test fails (dsen)

Posted by nc...@apache.org.
AMBARI-14935 UpgradeCatalog222Test fails (dsen)


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

Branch: refs/heads/branch-dev-patch-upgrade
Commit: c62233236dffe0eb4b4664fc685fc663db1feb70
Parents: 315f502
Author: Dmytro Sen <ds...@apache.org>
Authored: Fri Feb 5 13:38:38 2016 +0200
Committer: Dmytro Sen <ds...@apache.org>
Committed: Fri Feb 5 13:38:38 2016 +0200

----------------------------------------------------------------------
 .../org/apache/ambari/server/upgrade/UpgradeCatalog222Test.java    | 2 ++
 1 file changed, 2 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/c6223323/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog222Test.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog222Test.java b/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog222Test.java
index b701d78..67b9da5 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog222Test.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog222Test.java
@@ -100,12 +100,14 @@ public class UpgradeCatalog222Test {
     Method addNewConfigurationsFromXml = AbstractUpgradeCatalog.class.getDeclaredMethod("addNewConfigurationsFromXml");
     Method updateAlerts = UpgradeCatalog222.class.getDeclaredMethod("updateAlerts");
     Method updateStormConfigs = UpgradeCatalog222.class.getDeclaredMethod("updateStormConfigs");
+    Method updateAMSConfigs = UpgradeCatalog222.class.getDeclaredMethod("updateAMSConfigs");
 
 
     UpgradeCatalog222 upgradeCatalog222 = createMockBuilder(UpgradeCatalog222.class)
             .addMockedMethod(addNewConfigurationsFromXml)
             .addMockedMethod(updateAlerts)
             .addMockedMethod(updateStormConfigs)
+            .addMockedMethod(updateAMSConfigs)
             .createMock();
 
     upgradeCatalog222.addNewConfigurationsFromXml();


[29/40] ambari git commit: AMBARI-14928 Ambari throws NPE in kerberos mode U14/S11 (dsen)

Posted by nc...@apache.org.
AMBARI-14928 Ambari throws NPE in kerberos mode U14/S11 (dsen)


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

Branch: refs/heads/branch-dev-patch-upgrade
Commit: 83bef413c47c76cbf54bc64847620769168389ac
Parents: ed49229
Author: Dmytro Sen <ds...@apache.org>
Authored: Fri Feb 5 16:30:18 2016 +0200
Committer: Dmytro Sen <ds...@apache.org>
Committed: Fri Feb 5 16:30:18 2016 +0200

----------------------------------------------------------------------
 .../apache/ambari/server/controller/AmbariServer.java   | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/83bef413/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariServer.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariServer.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariServer.java
index c7e7880..b416129 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariServer.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariServer.java
@@ -794,10 +794,14 @@ public class AmbariServer {
   }
 
   public void stop() throws Exception {
-    try {
-      server.stop();
-    } catch (Exception e) {
-      LOG.error("Error stopping the server", e);
+    if (server == null) {
+      throw new AmbariException("Error stopping the server");
+    } else {
+      try {
+        server.stop();
+      } catch (Exception e) {
+        LOG.error("Error stopping the server", e);
+      }
     }
   }
 


[11/40] ambari git commit: AMBARI-14833 : Add role command order Start/Stop dependency between Metrics Collector and Zookeeper Server (avijayan)

Posted by nc...@apache.org.
AMBARI-14833 : Add role command order Start/Stop dependency between Metrics Collector and Zookeeper Server (avijayan)


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

Branch: refs/heads/branch-dev-patch-upgrade
Commit: 7d2191c9d89570de6394e71d02ccfd7564c36e40
Parents: 4078225
Author: Aravindan Vijayan <av...@hortonworks.com>
Authored: Thu Feb 4 10:07:18 2016 -0800
Committer: Aravindan Vijayan <av...@hortonworks.com>
Committed: Thu Feb 4 10:07:18 2016 -0800

----------------------------------------------------------------------
 .../src/main/resources/stacks/HDP/2.0.6/role_command_order.json  | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/7d2191c9/ambari-server/src/main/resources/stacks/HDP/2.0.6/role_command_order.json
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.0.6/role_command_order.json b/ambari-server/src/main/resources/stacks/HDP/2.0.6/role_command_order.json
index 6ed1537..a480e2a 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.0.6/role_command_order.json
+++ b/ambari-server/src/main/resources/stacks/HDP/2.0.6/role_command_order.json
@@ -22,7 +22,7 @@
     "SQOOP_SERVICE_CHECK-SERVICE_CHECK": ["NODEMANAGER-START", "RESOURCEMANAGER-START"],
     "ZOOKEEPER_SERVICE_CHECK-SERVICE_CHECK": ["ZOOKEEPER_SERVER-START"],
     "ZOOKEEPER_QUORUM_SERVICE_CHECK-SERVICE_CHECK": ["ZOOKEEPER_SERVER-START"],
-    "ZOOKEEPER_SERVER-STOP" : ["HBASE_MASTER-STOP", "HBASE_REGIONSERVER-STOP"],
+    "ZOOKEEPER_SERVER-STOP" : ["HBASE_MASTER-STOP", "HBASE_REGIONSERVER-STOP", "METRICS_COLLECTOR-STOP"],
     "HBASE_MASTER-STOP": ["HBASE_REGIONSERVER-STOP"]
   },
   "_comment" : "GLUSTERFS-specific dependencies",
@@ -32,7 +32,7 @@
   },
   "_comment" : "Dependencies that are used when GLUSTERFS is not present in cluster",
   "optional_no_glusterfs": {
-    "METRICS_COLLECTOR-START": ["NAMENODE-START", "DATANODE-START", "SECONDARY_NAMENODE-START"],
+    "METRICS_COLLECTOR-START": ["NAMENODE-START", "DATANODE-START", "SECONDARY_NAMENODE-START", "ZOOKEEPER_SERVER-START"],
     "AMBARI_METRICS_SERVICE_CHECK-SERVICE_CHECK": ["METRICS_COLLECTOR-START", "HDFS_SERVICE_CHECK-SERVICE_CHECK"],
     "SECONDARY_NAMENODE-START": ["NAMENODE-START"],
     "RESOURCEMANAGER-START": ["NAMENODE-START", "DATANODE-START"],


[09/40] ambari git commit: AMBARI-14918 enabling ranger caused proxy settings for user hive in hdfs to get updated (dsen)

Posted by nc...@apache.org.
AMBARI-14918 enabling ranger caused proxy settings for user hive in hdfs to get updated (dsen)


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

Branch: refs/heads/branch-dev-patch-upgrade
Commit: 549ee24c38746f2073969e4838a78f87d4c49860
Parents: 81b46da
Author: Dmytro Sen <ds...@apache.org>
Authored: Thu Feb 4 19:08:07 2016 +0200
Committer: Dmytro Sen <ds...@apache.org>
Committed: Thu Feb 4 19:08:07 2016 +0200

----------------------------------------------------------------------
 .../stacks/HDP/2.0.6/services/stack_advisor.py  | 32 ++++++++----
 .../stacks/2.0.6/common/test_stack_advisor.py   | 54 ++++++++++++++++----
 2 files changed, 67 insertions(+), 19 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/549ee24c/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/stack_advisor.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/stack_advisor.py b/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/stack_advisor.py
index 9a21b71..a53dd8b 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/stack_advisor.py
+++ b/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/stack_advisor.py
@@ -173,11 +173,14 @@ class HDP206StackAdvisor(DefaultStackAdvisor):
       oozie_user = None
       if "oozie-env" in services["configurations"] and "oozie_user" in services["configurations"]["oozie-env"]["properties"]:
         oozie_user = services["configurations"]["oozie-env"]["properties"]["oozie_user"]
-        oozieServerrHost = self.getHostWithComponent("OOZIE", "OOZIE_SERVER", services, hosts)
-        if oozieServerrHost is not None:
-          oozieServerHostName = oozieServerrHost["Hosts"]["public_host_name"]
+        oozieServerrHosts = self.getHostsWithComponent("OOZIE", "OOZIE_SERVER", services, hosts)
+        if oozieServerrHosts is not None:
+          oozieServerHostsNameList = []
+          for oozieServerHost in oozieServerrHosts:
+            oozieServerHostsNameList.append(oozieServerHost["Hosts"]["public_host_name"])
+          oozieServerHostsNames = ",".join(oozieServerHostsNameList)
           if not oozie_user in users and oozie_user is not None:
-            users[oozie_user] = {"propertyHosts" : oozieServerHostName,"propertyGroups" : "*", "config" : "oozie-env", "propertyName" : "oozie_user"}
+            users[oozie_user] = {"propertyHosts" : oozieServerHostsNames,"propertyGroups" : "*", "config" : "oozie-env", "propertyName" : "oozie_user"}
 
     if "HIVE" in servicesList:
       hive_user = None
@@ -186,13 +189,24 @@ class HDP206StackAdvisor(DefaultStackAdvisor):
               and "webhcat_user" in services["configurations"]["hive-env"]["properties"]:
         hive_user = services["configurations"]["hive-env"]["properties"]["hive_user"]
         webhcat_user = services["configurations"]["hive-env"]["properties"]["webhcat_user"]
-        hiveServerrHost = self.getHostWithComponent("HIVE", "HIVE_SERVER", services, hosts)
-        if hiveServerrHost is not None:
-          hiveServerHostName = hiveServerrHost["Hosts"]["public_host_name"]
+        hiveServerHosts = self.getHostsWithComponent("HIVE", "HIVE_SERVER", services, hosts)
+        webHcatServerHosts = self.getHostsWithComponent("HIVE", "WEBHCAT_SERVER", services, hosts)
+
+        if hiveServerHosts is not None:
+          hiveServerHostsNameList = []
+          for hiveServerHost in hiveServerHosts:
+            hiveServerHostsNameList.append(hiveServerHost["Hosts"]["public_host_name"])
+          hiveServerHostsNames = ",".join(hiveServerHostsNameList)
           if not hive_user in users and hive_user is not None:
-            users[hive_user] = {"propertyHosts" : hiveServerHostName,"propertyGroups" : "*", "config" : "hive-env", "propertyName" : "hive_user"}
+            users[hive_user] = {"propertyHosts" : hiveServerHostsNames,"propertyGroups" : "*", "config" : "hive-env", "propertyName" : "hive_user"}
+
+        if webHcatServerHosts is not None:
+          webHcatServerHostsNameList = []
+          for webHcatServerHost in webHcatServerHosts:
+            webHcatServerHostsNameList.append(webHcatServerHost["Hosts"]["public_host_name"])
+          webHcatServerHostsNames = ",".join(webHcatServerHostsNameList)
           if not webhcat_user in users and webhcat_user is not None:
-            users[webhcat_user] = {"propertyHosts" : hiveServerHostName,"propertyGroups" : "*", "config" : "hive-env", "propertyName" : "webhcat_user"}
+            users[webhcat_user] = {"propertyHosts" : webHcatServerHostsNames,"propertyGroups" : "*", "config" : "hive-env", "propertyName" : "webhcat_user"}
 
     if "FALCON" in servicesList:
       falconUser = None

http://git-wip-us.apache.org/repos/asf/ambari/blob/549ee24c/ambari-server/src/test/python/stacks/2.0.6/common/test_stack_advisor.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/stacks/2.0.6/common/test_stack_advisor.py b/ambari-server/src/test/python/stacks/2.0.6/common/test_stack_advisor.py
index a584a48..22b16bb 100644
--- a/ambari-server/src/test/python/stacks/2.0.6/common/test_stack_advisor.py
+++ b/ambari-server/src/test/python/stacks/2.0.6/common/test_stack_advisor.py
@@ -967,7 +967,25 @@ class TestHDP206StackAdvisor(TestCase):
               "mountpoint": "/"
             }]
           }
-        }]}
+        },
+        {
+          "href": "/api/v1/hosts/host2",
+          "Hosts": {
+            "cpu_count": 1,
+            "host_name": "c6402.ambari.apache.org",
+            "os_arch": "x86_64",
+            "os_type": "centos6",
+            "ph_cpu_count": 1,
+            "public_host_name": "c6402.ambari.apache.org",
+            "rack_info": "/default-rack",
+            "total_mem": 1048576,
+            "disk_info": [{
+              "size": '8',
+              "mountpoint": "/"
+            }]
+          }
+        },
+      ]}
 
     services = {
       "services": [
@@ -998,8 +1016,24 @@ class TestHDP206StackAdvisor(TestCase):
             "service_name": "HIVE",
             "stack_name": "HDP",
             "stack_version": "2.0.6",
-            "hostnames": ["c6401.ambari.apache.org"]
-          }, }]
+            "hostnames": ["c6401.ambari.apache.org","c6402.ambari.apache.org"]
+          }},
+          {
+          "href": "/api/v1/stacks/HDP/versions/2.0.6/services/HIVE/components/WEBHCAT_SERVER",
+          "StackServiceComponents": {
+            "advertise_version": "true",
+            "cardinality": "1",
+            "component_category": "MASTER",
+            "component_name": "WEBHCAT_SERVER",
+            "custom_commands": [],
+            "display_name": "WebHCat Server",
+            "is_client": "false",
+            "is_master": "true",
+            "service_name": "HIVE",
+            "stack_name": "HDP",
+            "stack_version": "2.0.6",
+            "hostnames": ["c6401.ambari.apache.org", "c6402.ambari.apache.org"]
+          }}]
         },
         {
           "StackServices": {
@@ -1018,7 +1052,7 @@ class TestHDP206StackAdvisor(TestCase):
             "service_name": "HIVE",
             "stack_name": "HDP",
             "stack_version": "2.0.6",
-            "hostnames": ["c6401.ambari.apache.org"]
+            "hostnames": ["c6401.ambari.apache.org", "c6402.ambari.apache.org"]
           }, }]
         }],
       "configurations": configurations
@@ -1034,13 +1068,13 @@ class TestHDP206StackAdvisor(TestCase):
                   {'properties':
                      {'hadoop.proxyuser.oozie.groups': '*',
                       'hadoop.proxyuser.hive.groups': '*',
-                      'hadoop.proxyuser.webhcat.hosts': 'c6401.ambari.apache.org',
+                      'hadoop.proxyuser.webhcat.hosts': 'c6401.ambari.apache.org,c6402.ambari.apache.org',
                       'hadoop.proxyuser.falcon.hosts': '*',
                       'hadoop.proxyuser.webhcat.groups': '*',
                       'hadoop.proxyuser.hdfs.groups': '*',
                       'hadoop.proxyuser.hdfs.hosts': '*',
-                      'hadoop.proxyuser.hive.hosts': 'c6401.ambari.apache.org',
-                      'hadoop.proxyuser.oozie.hosts': 'c6401.ambari.apache.org',
+                      'hadoop.proxyuser.hive.hosts': 'c6401.ambari.apache.org,c6402.ambari.apache.org',
+                      'hadoop.proxyuser.oozie.hosts': 'c6401.ambari.apache.org,c6402.ambari.apache.org',
                       'hadoop.proxyuser.falcon.groups': '*'}},
                 'falcon-env':
                   {'properties':
@@ -1081,13 +1115,13 @@ class TestHDP206StackAdvisor(TestCase):
                                  'hadoop.proxyuser.hive.groups': '*',
                                  'hadoop.proxyuser.hdfs1.groups': '*',
                                  'hadoop.proxyuser.hdfs1.hosts': '*',
-                                 'hadoop.proxyuser.webhcat.hosts': 'c6401.ambari.apache.org',
+                                 'hadoop.proxyuser.webhcat.hosts': 'c6401.ambari.apache.org,c6402.ambari.apache.org',
                                  'hadoop.proxyuser.falcon.hosts': '*',
                                  'hadoop.proxyuser.webhcat.groups': '*',
                                  'hadoop.proxyuser.hdfs.groups': '*',
                                  'hadoop.proxyuser.hdfs.hosts': '*',
-                                 'hadoop.proxyuser.hive.hosts': 'c6401.ambari.apache.org',
-                                 'hadoop.proxyuser.oozie.hosts': 'c6401.ambari.apache.org',
+                                 'hadoop.proxyuser.hive.hosts': 'c6401.ambari.apache.org,c6402.ambari.apache.org',
+                                 'hadoop.proxyuser.oozie.hosts': 'c6401.ambari.apache.org,c6402.ambari.apache.org',
                                  'hadoop.proxyuser.falcon.groups': '*'},
                               'property_attributes':
                                 {'hadoop.proxyuser.hdfs.groups': {'delete': 'true'},


[21/40] ambari git commit: AMBARI-14913: Show HAWQ default_segment_num parameter in General section (mithmatt via jaoki)

Posted by nc...@apache.org.
AMBARI-14913: Show HAWQ default_segment_num parameter in General section (mithmatt via jaoki)


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

Branch: refs/heads/branch-dev-patch-upgrade
Commit: 3d7643b41c214dfc2bca4af2ab5dc37f27b8e652
Parents: 080991d
Author: Jun Aoki <ja...@apache.org>
Authored: Thu Feb 4 14:52:27 2016 -0800
Committer: Jun Aoki <ja...@apache.org>
Committed: Thu Feb 4 14:52:27 2016 -0800

----------------------------------------------------------------------
 ambari-web/app/data/HDP2.3/site_properties.js | 7 +++++++
 1 file changed, 7 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/3d7643b4/ambari-web/app/data/HDP2.3/site_properties.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/data/HDP2.3/site_properties.js b/ambari-web/app/data/HDP2.3/site_properties.js
index fb79cd3..61cbe88 100644
--- a/ambari-web/app/data/HDP2.3/site_properties.js
+++ b/ambari-web/app/data/HDP2.3/site_properties.js
@@ -333,6 +333,13 @@ hdp23properties.push({
     "index": 8
   },
   {
+    "name": "default_segment_num",
+    "filename": "hawq-site.xml",
+    "category": "General",
+    "serviceName": "HAWQ",
+    "index": 9
+  },
+  {
     "name": "content",
     "serviceName": "HAWQ",
     "filename": "gpcheck-env.xml",


[27/40] ambari git commit: AMBARI-14902 Make AMS Grafana component available as a repo package (additional patch) (dsen)

Posted by nc...@apache.org.
AMBARI-14902 Make AMS Grafana component available as a repo package (additional patch) (dsen)


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

Branch: refs/heads/branch-dev-patch-upgrade
Commit: 691958665eb13e58c302a5cf392f4e587853e551
Parents: c622332
Author: Dmytro Sen <ds...@apache.org>
Authored: Fri Feb 5 14:27:25 2016 +0200
Committer: Dmytro Sen <ds...@apache.org>
Committed: Fri Feb 5 14:27:25 2016 +0200

----------------------------------------------------------------------
 ambari-metrics/ambari-metrics-assembly/pom.xml | 204 +++++++++++++++++++-
 1 file changed, 203 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/69195866/ambari-metrics/ambari-metrics-assembly/pom.xml
----------------------------------------------------------------------
diff --git a/ambari-metrics/ambari-metrics-assembly/pom.xml b/ambari-metrics/ambari-metrics-assembly/pom.xml
index 511dc1f..130097d 100644
--- a/ambari-metrics/ambari-metrics-assembly/pom.xml
+++ b/ambari-metrics/ambari-metrics-assembly/pom.xml
@@ -130,7 +130,7 @@
               <finalName>ambari-metrics-grafana-${project.version}</finalName>
               <appendAssemblyId>false</appendAssemblyId>
               <descriptors>
-                <descriptor>src/main/assembly/grafana.xml</descriptor>
+                <descriptor>${assemblydescriptor.grafana}</descriptor>
               </descriptors>
               <tarLongFileMode>gnu</tarLongFileMode>
             </configuration>
@@ -208,6 +208,208 @@
               <defaultGroupname>root</defaultGroupname>
             </configuration>
             <executions>
+
+              <!--ambari-metrics-collector-->
+              <execution>
+                <id>ambari-metrics-collector</id>
+                <phase>package</phase>
+                <goals>
+                  <goal>rpm</goal>
+                </goals>
+                <configuration>
+                  <name>ambari-metrics-collector</name>
+                  <copyright>2012, Apache Software Foundation</copyright>
+                  <group>Development</group>
+                  <description>Maven Recipe: RPM Package.</description>
+                  <autoRequires>false</autoRequires>
+                  <requires>
+                    <require>${python.ver}</require>
+                  </requires>
+
+                  <defaultFilemode>644</defaultFilemode>
+                  <defaultDirmode>755</defaultDirmode>
+                  <defaultUsername>root</defaultUsername>
+                  <defaultGroupname>root</defaultGroupname>
+
+                  <mappings>
+                    <mapping>
+                      <!--jars-->
+                      <directory>/usr/lib/ambari-metrics-collector/</directory>
+                      <sources>
+                        <source>
+                          <location>${collector.dir}/target/lib</location>
+                        </source>
+                        <source>
+                          <location>
+                            ${collector.dir}/target/ambari-metrics-timelineservice-${project.version}.jar
+                          </location>
+                        </source>
+                      </sources>
+                    </mapping>
+                    <mapping>
+                      <!--embedded applications-->
+                      <directory>/usr/lib/ams-hbase/</directory>
+                      <sources>
+                        <source>
+                          <location>${collector.dir}/target/embedded/${hbase.folder}</location>
+                          <excludes>
+                            <exclude>bin/**</exclude>
+                            <exclude>bin/*</exclude>
+                          </excludes>
+                        </source>
+                      </sources>
+                    </mapping>
+                    <mapping>
+                      <directory>/usr/lib/ams-hbase/bin</directory>
+                      <filemode>755</filemode>
+                      <sources>
+                        <source>
+                          <location>${collector.dir}/target/embedded/${hbase.folder}/bin</location>
+                        </source>
+                      </sources>
+                    </mapping>
+                    <mapping>
+                      <directory>/usr/lib/ams-hbase/lib/</directory>
+                      <sources>
+                        <source>
+                          <location>${collector.dir}/target/lib</location>
+                          <includes>
+                            <include>phoenix*.jar</include>
+                            <include>antlr*.jar</include>
+                          </includes>
+                        </source>
+                      </sources>
+                    </mapping>
+                    <mapping>
+                      <directory>/usr/lib/ams-hbase/lib/hadoop-native/</directory>
+                      <sources>
+                        <source>
+                          <location>${project.build.directory}/ambari-metrics-collector-${project.version}/ambari-metrics-collector-${project.version}/hbase/lib/hadoop-native</location>
+                        </source>
+                      </sources>
+                    </mapping>
+                    <mapping>
+                      <directory>/usr/sbin</directory>
+                      <filemode>755</filemode>
+                      <username>root</username>
+                      <groupname>root</groupname>
+                      <directoryIncluded>false</directoryIncluded>
+                      <sources>
+                        <source>
+                          <location>${collector.dir}/conf/unix/ambari-metrics-collector</location>
+                          <filter>false</filter>
+                        </source>
+                      </sources>
+                    </mapping>
+                    <mapping>
+                      <directory>/etc/ambari-metrics-collector/conf</directory>
+                      <configuration>true</configuration>
+                      <sources>
+                        <source>
+                          <location>${collector.dir}/conf/unix/ams-env.sh</location>
+                        </source>
+                        <source>
+                          <location>${collector.dir}/conf/unix/ams-site.xml</location>
+                        </source>
+                        <source>
+                          <location>${collector.dir}/conf/unix/log4j.properties</location>
+                        </source>
+                        <source>
+                          <location>${collector.dir}/target/embedded/${hbase.folder}/conf/hbase-site.xml</location>
+                        </source>
+                      </sources>
+                    </mapping>
+                    <mapping>
+                      <directory>/etc/ams-hbase/conf</directory>
+                      <configuration>true</configuration>
+                      <sources>
+                        <source>
+                          <location>${collector.dir}/target/embedded/${hbase.folder}/conf</location>
+                          <includes>
+                            <include>*.*</include>
+                          </includes>
+                        </source>
+                      </sources>
+                    </mapping>
+                    <mapping>
+                      <directory>/var/run/ams-hbase</directory>
+                    </mapping>
+                    <mapping>
+                      <directory>/var/lib/ambari-metrics-collector</directory>
+                    </mapping>
+                  </mappings>
+                </configuration>
+              </execution>
+
+              <!--hadoop-sink-->
+              <execution>
+                <id>ambari-metrics-hadoop-sink</id>
+                <phase>package</phase>
+                <goals>
+                  <goal>rpm</goal>
+                </goals>
+
+                <configuration>
+                  <name>ambari-metrics-hadoop-sink</name>
+                  <copyright>2012, Apache Software Foundation</copyright>
+                  <group>Development</group>
+                  <description>Maven Recipe: RPM Package.</description>
+
+                  <defaultDirmode>755</defaultDirmode>
+                  <defaultFilemode>644</defaultFilemode>
+                  <defaultUsername>root</defaultUsername>
+                  <defaultGroupname>root</defaultGroupname>
+
+                  <postinstallScriptlet>
+                    <scriptFile>${project.build.directory}/resources/rpm/sink/postinstall.sh</scriptFile>
+                    <fileEncoding>utf-8</fileEncoding>
+                  </postinstallScriptlet>
+
+                  <mappings>
+                    <mapping>
+                      <directory>/usr/lib/ambari-metrics-hadoop-sink</directory>
+                      <sources>
+                        <source>
+                          <location>${hadoop-sink.dir}/target/ambari-metrics-hadoop-sink-with-common-${project.version}.jar</location>
+                        </source>
+                      </sources>
+                    </mapping>
+                    <mapping>
+                      <directory>/usr/lib/flume/lib</directory>
+                      <sources>
+                        <source>
+                          <location>${flume-sink.dir}/target/ambari-metrics-flume-sink-with-common-${project.version}.jar</location>
+                        </source>
+                      </sources>
+                    </mapping>
+                    <mapping>
+                      <directory>/usr/lib/storm/lib</directory>
+                      <sources>
+                        <source>
+                          <location>${storm-sink.dir}/target/ambari-metrics-storm-sink-with-common-${project.version}.jar</location>
+                        </source>
+                      </sources>
+                    </mapping>
+                    <mapping>
+                      <directory>/usr/lib/ambari-metrics-kafka-sink</directory>
+                      <sources>
+                        <source>
+                          <location>${kafka-sink.dir}/target/${kafka.sink.jar}</location>
+                        </source>
+                      </sources>
+                    </mapping>
+                    <mapping>
+                      <directory>/usr/lib/ambari-metrics-kafka-sink/lib</directory>
+                      <sources>
+                        <source>
+                          <location>${kafka-sink.dir}/target/lib</location>
+                        </source>
+                      </sources>
+                    </mapping>
+                  </mappings>
+                </configuration>
+              </execution>
+
               <!--ambari-metrics-grafana-->
               <execution>
                 <id>ambari-metrics-grafana</id>


[20/40] ambari git commit: AMBARI-14901. NPE when configuring Kerberos at provisioning secure cluster with Blueprint. (Sandor Magyari via rnettleton)

Posted by nc...@apache.org.
AMBARI-14901. NPE when configuring Kerberos at provisioning secure cluster with Blueprint. (Sandor Magyari via rnettleton)


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

Branch: refs/heads/branch-dev-patch-upgrade
Commit: 080991d131768ece5e0d7065df2bb8443e14053f
Parents: f026acc
Author: Bob Nettleton <rn...@hortonworks.com>
Authored: Thu Feb 4 17:41:16 2016 -0500
Committer: Bob Nettleton <rn...@hortonworks.com>
Committed: Thu Feb 4 17:41:16 2016 -0500

----------------------------------------------------------------------
 .../topology/ClusterConfigurationRequest.java   |  35 ++++++-
 .../ClusterConfigurationRequestTest.java        | 101 +++++++++++++++++--
 2 files changed, 125 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/080991d1/ambari-server/src/main/java/org/apache/ambari/server/topology/ClusterConfigurationRequest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/topology/ClusterConfigurationRequest.java b/ambari-server/src/main/java/org/apache/ambari/server/topology/ClusterConfigurationRequest.java
index 0aae007..70fa880 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/topology/ClusterConfigurationRequest.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/topology/ClusterConfigurationRequest.java
@@ -161,9 +161,8 @@ public class ClusterConfigurationRequest {
         Map<String, String> clusterConfigProperties = existingConfigurations.get(configType);
         Map<String, String> stackDefaultConfigProperties = stackDefaultProps.get(configType);
         for (String property : propertyMap.keySet()) {
-          if (clusterConfigProperties == null || !clusterConfigProperties.containsKey(property)
-                 || (clusterConfigProperties.get(property) == null && stackDefaultConfigProperties.get(property) == null)
-                 || (clusterConfigProperties.get(property) != null && clusterConfigProperties.get(property).equals(stackDefaultConfigProperties.get(property)))) {
+          // update value only if property value configured in Blueprint /ClusterTemplate is not a custom one
+          if (!propertyHasCustomValue(clusterConfigProperties, stackDefaultConfigProperties, property)) {
             LOG.debug("Update Kerberos related config property: {} {} {}", configType, property, propertyMap.get
               (property));
             clusterConfiguration.setProperty(configType, property, propertyMap.get(property));
@@ -179,6 +178,36 @@ public class ClusterConfigurationRequest {
     return updatedConfigTypes;
   }
 
+  /**
+   * Returns true if the property exists in clusterConfigProperties and has a custom user defined value. Property has
+   * custom value in case we there's no stack default value for it or it's not equal to stack default value.
+   * @param clusterConfigProperties
+   * @param stackDefaultConfigProperties
+   * @param property
+   * @return
+   */
+  private boolean propertyHasCustomValue(Map<String, String> clusterConfigProperties, Map<String, String>
+    stackDefaultConfigProperties, String property) {
+
+    boolean propertyHasCustomValue = false;
+    if (clusterConfigProperties != null) {
+      String propertyValue = clusterConfigProperties.get(property);
+      if (propertyValue != null) {
+        if (stackDefaultConfigProperties != null) {
+          String stackDefaultValue = stackDefaultConfigProperties.get(property);
+          if (stackDefaultValue != null) {
+            propertyHasCustomValue = !propertyValue.equals(stackDefaultValue);
+          } else {
+            propertyHasCustomValue = true;
+          }
+        } else {
+          propertyHasCustomValue = true;
+        }
+      }
+    }
+    return propertyHasCustomValue;
+  }
+
   private Map<String, String> createComponentHostMap(Blueprint blueprint) {
     Map<String, String> componentHostsMap = new HashMap<String, String>();
     for (String service : blueprint.getServices()) {

http://git-wip-us.apache.org/repos/asf/ambari/blob/080991d1/ambari-server/src/test/java/org/apache/ambari/server/topology/ClusterConfigurationRequestTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/topology/ClusterConfigurationRequestTest.java b/ambari-server/src/test/java/org/apache/ambari/server/topology/ClusterConfigurationRequestTest.java
index 7309d5b..2e7bd3b 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/topology/ClusterConfigurationRequestTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/topology/ClusterConfigurationRequestTest.java
@@ -18,13 +18,18 @@
 
 package org.apache.ambari.server.topology;
 
+import org.apache.ambari.server.AmbariException;
 import org.apache.ambari.server.api.services.stackadvisor.StackAdvisorBlueprintProcessor;
 import org.apache.ambari.server.controller.AmbariManagementController;
 import org.apache.ambari.server.controller.ConfigurationRequest;
 import org.apache.ambari.server.controller.KerberosHelper;
+import org.apache.ambari.server.controller.internal.ConfigurationTopologyException;
 import org.apache.ambari.server.controller.internal.Stack;
+import org.apache.ambari.server.serveraction.kerberos.KerberosInvalidConfigurationException;
 import org.apache.ambari.server.state.Cluster;
 import org.apache.ambari.server.state.Clusters;
+import org.easymock.Capture;
+import org.easymock.CaptureType;
 import org.easymock.EasyMockRule;
 import org.easymock.Mock;
 import org.easymock.MockType;
@@ -49,7 +54,10 @@ import static org.easymock.EasyMock.anyString;
 import static org.easymock.EasyMock.expect;
 import static org.easymock.EasyMock.expectLastCall;
 import static org.easymock.EasyMock.eq;
+import static org.easymock.EasyMock.newCapture;
 import static org.easymock.EasyMock.verify;
+import static org.easymock.EasyMock.capture;
+import static org.junit.Assert.assertEquals;
 
 /**
  * ClusterConfigurationRequest unit tests
@@ -89,12 +97,82 @@ public class ClusterConfigurationRequestTest {
   @Mock(type = MockType.NICE)
   private KerberosHelper kerberosHelper;
 
+  /**
+   * testConfigType config type should be in updatedConfigTypes, as no custom property in Blueprint
+   * ==> Kerberos config property should be updated
+   * @throws Exception
+   */
   @Test
-  public void testProcessClusterConfigRequestIncludeKererosConfigs() throws Exception {
+  public void testProcessWithKerberos_UpdateKererosConfigProperty_WithNoCustomValue() throws Exception {
+
+    Capture<? extends Set<String>> captureUpdatedConfigTypes = testProcessWithKerberos(null, "defaultTestValue");
+
+    Set<String> updatedConfigTypes = captureUpdatedConfigTypes.getValue();
+    assertEquals(2, updatedConfigTypes.size());
+  }
+
+  /**
+   * testConfigType config type should be in updatedConfigTypes, as testProperty in Blueprint is equal to stack
+   * default ==> Kerberos config property should be updated
+   * @throws Exception
+   */
+  @Test
+  public void testProcessWithKerberos_UpdateKererosConfigProperty_WithCustomValueEqualToStackDefault() throws
+    Exception {
+
+    Capture<? extends Set<String>> captureUpdatedConfigTypes = testProcessWithKerberos("defaultTestValue", "defaultTestValue");
+
+    Set<String> updatedConfigTypes = captureUpdatedConfigTypes.getValue();
+    assertEquals(2, updatedConfigTypes.size());
+
+  }
+
+  /**
+   * testConfigType config type shouldn't be in updatedConfigTypes, as testProperty in Blueprint is different that
+   * stack default (custom value) ==> Kerberos config property shouldn't be updated
+   * @throws Exception
+   */
+  @Test
+  public void testProcessWithKerberos_DontUpdateKererosConfigProperty_WithCustomValueDifferentThanStackDefault() throws
+    Exception {
+
+    Capture<? extends Set<String>> captureUpdatedConfigTypes = testProcessWithKerberos("testPropertyValue", "defaultTestValue");
+
+    Set<String> updatedConfigTypes = captureUpdatedConfigTypes.getValue();
+    assertEquals(1, updatedConfigTypes.size());
+  }
+
+  /**
+   * testConfigType config type shouldn't be in updatedConfigTypes, as testProperty in Blueprint is a custom value
+   * (no default value in stack for testProperty)
+   * ==> Kerberos config property shouldn't be updated
+   * @throws Exception
+   */
+  @Test
+  public void testProcessWithKerberos_DontUpdateKererosConfigProperty_WithCustomValueNoStackDefault() throws Exception {
+
+    Capture<? extends Set<String>> captureUpdatedConfigTypes = testProcessWithKerberos("testPropertyValue", null);
+
+    Set<String> updatedConfigTypes = captureUpdatedConfigTypes.getValue();
+    assertEquals(1, updatedConfigTypes.size());
+  }
+
+  private Capture<? extends Set<String>> testProcessWithKerberos(String blueprintPropertyValue, String
+    stackPropertyValue) throws AmbariException, KerberosInvalidConfigurationException, ConfigurationTopologyException {
+
 
     Map<String, Map<String, String>> existingConfig = new HashMap<String, Map<String, String>>();
-    Configuration stackConfig = new Configuration(existingConfig,
+    Configuration stackDefaultConfig = new Configuration(existingConfig,
       new HashMap<String, Map<String, Map<String, String>>>());
+    if (stackPropertyValue != null) {
+      stackDefaultConfig.setProperty("testConfigType", "testProperty", stackPropertyValue);
+    }
+
+    Configuration blueprintConfig = new Configuration(stackDefaultConfig.getFullProperties(),
+      new HashMap<String, Map<String, Map<String, String>>>());
+    if (blueprintPropertyValue != null) {
+      blueprintConfig.setProperty("testConfigType", "testProperty", blueprintPropertyValue);
+    }
 
     PowerMock.mockStatic(AmbariContext.class);
     AmbariContext.getController();
@@ -117,7 +195,7 @@ public class ClusterConfigurationRequestTest {
     services.add("KERBEROS");
     services.add("ZOOKEPER");
     expect(blueprint.getServices()).andReturn(services).anyTimes();
-    expect(stack.getConfiguration(services)).andReturn(stackConfig).once();
+    expect(stack.getConfiguration(services)).andReturn(stackDefaultConfig).once();
 
     List<String> hdfsComponents = new ArrayList<>();
     hdfsComponents.add("NAMENODE");
@@ -132,7 +210,7 @@ public class ClusterConfigurationRequestTest {
 
     expect(topology.getConfigRecommendationStrategy()).andReturn(ConfigRecommendationStrategy.NEVER_APPLY).anyTimes();
     expect(topology.getBlueprint()).andReturn(blueprint).anyTimes();
-    expect(topology.getConfiguration()).andReturn(stackConfig).anyTimes();
+    expect(topology.getConfiguration()).andReturn(blueprintConfig).anyTimes();
     expect(topology.getHostGroupInfo()).andReturn(Collections.<String, HostGroupInfo>emptyMap());
     expect(topology.getClusterId()).andReturn(Long.valueOf(1)).anyTimes();
     expect(ambariContext.getClusterName(Long.valueOf(1))).andReturn("testCluster").anyTimes();
@@ -141,17 +219,22 @@ public class ClusterConfigurationRequestTest {
 
     Map<String, Map<String, String>> kerberosConfig = new HashMap<String, Map<String, String>>();
     Map<String, String> properties = new HashMap<>();
-    properties.put("testPorperty", "testValue");
+    properties.put("testProperty", "KERBEROStestValue");
     kerberosConfig.put("testConfigType", properties);
     expect(kerberosHelper.ensureHeadlessIdentities(anyObject(Cluster.class), anyObject(Map.class), anyObject
       (Set.class))).andReturn(true).once();
     expect(kerberosHelper.getServiceConfigurationUpdates(anyObject(Cluster.class), anyObject(Map.class), anyObject
       (Set.class), anyBoolean(), anyBoolean(), eq(false))).andReturn(kerberosConfig).once();
 
+    Capture<? extends String> captureClusterName = newCapture(CaptureType.ALL);
+    Capture<? extends Set<String>> captureUpdatedConfigTypes = newCapture(CaptureType.ALL);
+    ambariContext.waitForConfigurationResolution(capture(captureClusterName), capture
+      (captureUpdatedConfigTypes));
+    expectLastCall();
 
     PowerMock.replay(stack, blueprint, topology, controller, clusters, kerberosHelper, ambariContext,
       AmbariContext
-      .class);
+        .class);
 
     ClusterConfigurationRequest clusterConfigurationRequest = new ClusterConfigurationRequest(
       ambariContext, topology, false, stackAdvisorBlueprintProcessor, true);
@@ -159,6 +242,10 @@ public class ClusterConfigurationRequestTest {
 
     verify(blueprint, topology, ambariContext, controller, kerberosHelper);
 
+
+    String clusterName = captureClusterName.getValue();
+    assertEquals("testCluster", clusterName);
+    return captureUpdatedConfigTypes;
   }
 
   @Test
@@ -221,6 +308,4 @@ public class ClusterConfigurationRequestTest {
 
   }
 
-
-
 }


[12/40] ambari git commit: AMBARI-14889. Auto-start services: Create cluster level toggle switch (Zhe (Joe) Wang via srimanth)

Posted by nc...@apache.org.
AMBARI-14889. Auto-start services: Create cluster level toggle switch (Zhe (Joe) Wang via srimanth)


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

Branch: refs/heads/branch-dev-patch-upgrade
Commit: 8c6c13da3ffbf9349232dfcaa7b7504c48156fcf
Parents: 7d2191c
Author: Srimanth Gunturi <sg...@hortonworks.com>
Authored: Thu Feb 4 10:15:19 2016 -0800
Committer: Srimanth Gunturi <sg...@hortonworks.com>
Committed: Thu Feb 4 10:15:25 2016 -0800

----------------------------------------------------------------------
 ambari-web/app/config.js                        |  3 +-
 .../nameNode/rollback_controller.js             | 10 +--
 .../main/admin/service_auto_start.js            | 21 +++++-
 ambari-web/app/messages.js                      |  2 +-
 ambari-web/app/styles/application.less          |  4 ++
 ambari-web/app/styles/widgets.less              | 71 +++++++++++---------
 .../templates/main/admin/service_auto_start.hbs | 11 ++-
 ambari-web/app/utils/ajax/ajax.js               |  6 +-
 ambari-web/app/views/main/admin.js              | 12 ++--
 .../app/views/main/admin/service_auto_start.js  | 64 +++++++++++++++++-
 ambari-web/app/views/main/menu.js               | 12 ++--
 ambari-web/config.coffee                        |  2 +
 ambari-web/karma.conf.js                        |  1 +
 13 files changed, 160 insertions(+), 59 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/8c6c13da/ambari-web/app/config.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/config.js b/ambari-web/app/config.js
index f2b7938..0beafb3 100644
--- a/ambari-web/app/config.js
+++ b/ambari-web/app/config.js
@@ -79,7 +79,8 @@ App.supports = {
   skipComponentStartAfterInstall: false,
   storeKDCCredentials: true,
   preInstallChecks: false,
-  hostComboSearchBox: false
+  hostComboSearchBox: false,
+  serviceAutoStart: false
 };
 
 if (App.enableExperimental) {

http://git-wip-us.apache.org/repos/asf/ambari/blob/8c6c13da/ambari-web/app/controllers/main/admin/highAvailability/nameNode/rollback_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/admin/highAvailability/nameNode/rollback_controller.js b/ambari-web/app/controllers/main/admin/highAvailability/nameNode/rollback_controller.js
index aa3d3b0..465a1d2 100644
--- a/ambari-web/app/controllers/main/admin/highAvailability/nameNode/rollback_controller.js
+++ b/ambari-web/app/controllers/main/admin/highAvailability/nameNode/rollback_controller.js
@@ -351,7 +351,7 @@ App.HighAvailabilityRollbackController = App.HighAvailabilityProgressPageControl
   onLoadHbaseConfigs: function (data) {
     var hbaseSiteProperties = data.items.findProperty('type', 'hbase-site').properties;
     App.ajax.send({
-      name: 'admin.high_availability.save_configs',
+      name: 'admin.save_configs',
       sender: this,
       data: {
         siteName: 'hbase-site',
@@ -364,7 +364,7 @@ App.HighAvailabilityRollbackController = App.HighAvailabilityProgressPageControl
   onLoadAccumuloConfigs: function (data) {
     var accumuloSiteProperties = data.items.findProperty('type', 'accumulo-site').properties;
     App.ajax.send({
-      name: 'admin.high_availability.save_configs',
+      name: 'admin.save_configs',
       sender: this,
       data: {
         siteName: 'accumulo-site',
@@ -378,7 +378,7 @@ App.HighAvailabilityRollbackController = App.HighAvailabilityProgressPageControl
   onLoadHawqConfigs: function (data) {
     var hawqSiteProperties = data.items.findProperty('type', 'hawq-site').properties;
     App.ajax.send({
-      name: 'admin.high_availability.save_configs',
+      name: 'admin.save_configs',
       sender: this,
       data: {
         siteName: 'hawq-site',
@@ -415,7 +415,7 @@ App.HighAvailabilityRollbackController = App.HighAvailabilityProgressPageControl
   onLoadConfigs: function (data) {
     this.set('configsSaved', false);
     App.ajax.send({
-      name: 'admin.high_availability.save_configs',
+      name: 'admin.save_configs',
       sender: this,
       data: {
         siteName: 'hdfs-site',
@@ -425,7 +425,7 @@ App.HighAvailabilityRollbackController = App.HighAvailabilityProgressPageControl
       error: 'onTaskError'
     });
     App.ajax.send({
-      name: 'admin.high_availability.save_configs',
+      name: 'admin.save_configs',
       sender: this,
       data: {
         siteName: 'core-site',

http://git-wip-us.apache.org/repos/asf/ambari/blob/8c6c13da/ambari-web/app/controllers/main/admin/service_auto_start.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/admin/service_auto_start.js b/ambari-web/app/controllers/main/admin/service_auto_start.js
index 1af7299..fd288ed 100644
--- a/ambari-web/app/controllers/main/admin/service_auto_start.js
+++ b/ambari-web/app/controllers/main/admin/service_auto_start.js
@@ -21,10 +21,25 @@ var App = require('app');
 App.MainAdminServiceAutoStartController = Em.Controller.extend({
   name: 'mainAdminServiceAutoStartController',
 
-  overallEnabled: true,
+  loadClusterConfig: function () {
+    return App.ajax.send({
+      name: 'config.tags.site',
+      sender: this,
+      data: {
+        site: 'cluster-env'
+      }
+    });
+  },
 
-  toggleOverallEnabled : function () {
-    this.toggleProperty('overallEnabled');
+  saveClusterConfigs: function (clusterConfigs) {
+    return App.ajax.send({
+      name: 'admin.save_configs',
+      sender: this,
+      data: {
+        siteName: 'cluster-env',
+        properties: clusterConfigs
+      }
+    });
   }
 
 });

http://git-wip-us.apache.org/repos/asf/ambari/blob/8c6c13da/ambari-web/app/messages.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/messages.js b/ambari-web/app/messages.js
index a5421ea..e341de4 100644
--- a/ambari-web/app/messages.js
+++ b/ambari-web/app/messages.js
@@ -1459,7 +1459,7 @@ Em.I18n.translations = {
   'admin.serviceAutoStart.title': "Service Auto Start",
   'admin.serviceAutoStart.header': "Service Auto Start Configuration",
   'admin.serviceAutoStart.header.text': "Ambari services can be configured to start automatically on system boot. Each service can be configured to start all components, masters and workers, or selectively.",
-  'admin.serviceAutoStart.button.text': "Ambari services can be configured to start automatically on system boot. Each service can be configured to start all components, masters and workers, or selectively.",
+  'admin.serviceAutoStart.body.text': "Auto-Start Services Enabled",
 
   'admin.stackVersions.filter.notInstalled': "Not Installed ({0})",
   'admin.stackVersions.filter.all': "All ({0})",

http://git-wip-us.apache.org/repos/asf/ambari/blob/8c6c13da/ambari-web/app/styles/application.less
----------------------------------------------------------------------
diff --git a/ambari-web/app/styles/application.less b/ambari-web/app/styles/application.less
index 731903d..ce10a98 100644
--- a/ambari-web/app/styles/application.less
+++ b/ambari-web/app/styles/application.less
@@ -3802,6 +3802,10 @@ table.graphs {
   .span6 {
     margin-left: 0 !important;
   }
+
+  .bootstrap-switch {
+    margin-left: 20px;
+  }
 }
 
 .admin-user-settings {

http://git-wip-us.apache.org/repos/asf/ambari/blob/8c6c13da/ambari-web/app/styles/widgets.less
----------------------------------------------------------------------
diff --git a/ambari-web/app/styles/widgets.less b/ambari-web/app/styles/widgets.less
index 2196445..f385449 100644
--- a/ambari-web/app/styles/widgets.less
+++ b/ambari-web/app/styles/widgets.less
@@ -362,46 +362,53 @@
   .undo-button {
     margin-left: @undo-btn-margin;
   }
+}
 
-  .bootstrap-switch {
-    &,
-    &.bootstrap-switch-focused {
-      border-color: transparent;
-      box-shadow: none;
-    }
+.bootstrap-switch {
+  &,
+  &.bootstrap-switch-focused {
+    border-color: transparent;
+    box-shadow: none;
+  }
 
-    .bootstrap-switch-label {
-      background-color: @toggle-widget-handle-background-color;
-      background-image: none;
+  .bootstrap-switch-label {
+    background-color: @toggle-widget-handle-background-color;
+    background-image: none;
+    text-shadow: none;
+    border-width: 0;
+    padding: 2px 8px;
+    border-left: 1px solid transparent;
+    border-right: 1px solid transparent;
+    border-bottom: 1px solid @toggle-widget-handle-background-color;
+  }
+
+  .bootstrap-switch-handle-on,
+  .bootstrap-switch-handle-off {
+    color: @toggle-widget-text-color;
+    font-size: @toggle-widget-text-size;
+    background-image: none;
+    text-shadow: none;
+    border: none;
+    padding: 2px 0;
+
+    &:hover {
       text-shadow: none;
-      border-width: 0;
-      padding: 2px 8px;
-      border-left: 1px solid transparent;
-      border-right: 1px solid transparent;
-      border-bottom: 1px solid @toggle-widget-handle-background-color;
+      color: @toggle-widget-text-color;
     }
 
-    .bootstrap-switch-handle-on,
-    .bootstrap-switch-handle-off {
+    &.bootstrap-switch-default {
+      background-color: @toggle-widget-on-background-color;
+    }
+
+    &.bootstrap-switch-success {
+      background-color: @toggle-widget-off-background-color;
+    }
+
+    &.bootstrap-switch-default,
+    &.bootstrap-switch-success {
       color: @toggle-widget-text-color;
-      font-size: @toggle-widget-text-size;
       background-image: none;
       text-shadow: none;
-      border: none;
-      padding: 2px 0;
-
-      &:hover {
-        text-shadow: none;
-        color: @toggle-widget-text-color;
-      }
-
-      &.bootstrap-switch-default {
-        background-color: @toggle-widget-on-background-color;
-      }
-
-      &.bootstrap-switch-success {
-        background-color: @toggle-widget-off-background-color;
-      }
     }
   }
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/8c6c13da/ambari-web/app/templates/main/admin/service_auto_start.hbs
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates/main/admin/service_auto_start.hbs b/ambari-web/app/templates/main/admin/service_auto_start.hbs
index 3ebdb7e..b5c1032 100644
--- a/ambari-web/app/templates/main/admin/service_auto_start.hbs
+++ b/ambari-web/app/templates/main/admin/service_auto_start.hbs
@@ -24,9 +24,14 @@
     {{t admin.serviceAutoStart.header.text}}
   </div>
   <br/>
-  <div>
-    <p>{{t admin.serviceAutoStart.title}}
-        <button class="btn btn-padding btn-success" {{bindAttr class="controller.overallEnabled:btn-success::btn-warning"}} {{action toggleOverallEnabled target="controller"}}>{{view.buttonText}}</button>
+  <div class="cluster-switcher">
+    <p>{{t admin.serviceAutoStart.body.text}}
+        {{view Ember.Checkbox checkedBinding="view.switcherValue"}}
     </p>
   </div>
+    {{#if view.switcherValue}}
+        <div>
+            <hr>
+        </div>
+    {{/if}}
 </div>

http://git-wip-us.apache.org/repos/asf/ambari/blob/8c6c13da/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 5ec03d4..423941f 100644
--- a/ambari-web/app/utils/ajax/ajax.js
+++ b/ambari-web/app/utils/ajax/ajax.js
@@ -768,6 +768,10 @@ var urls = {
     'real': '/clusters/{clusterName}?fields=Clusters/desired_configs',
     'mock': '/data/clusters/cluster.json'
   },
+  'config.tags.site': {
+    'real': '/clusters/{clusterName}?fields=Clusters/desired_configs/{site}',
+    'mock': ''
+  },
   'config.tags_and_groups': {
     'real': '/clusters/{clusterName}?fields=Clusters/desired_configs,config_groups/*{urlParams}',
     'mock': '/data/clusters/tags_and_groups.json'
@@ -1390,7 +1394,7 @@ var urls = {
     'real': '/clusters/{clusterName}/configurations?(type=core-site&tag={coreSiteTag})|(type=hdfs-site&tag={hdfsSiteTag})',
     'mock': ''
   },
-  'admin.high_availability.save_configs': {
+  'admin.save_configs': {
     'real': '/clusters/{clusterName}',
     'mock': '',
     'type': 'PUT',

http://git-wip-us.apache.org/repos/asf/ambari/blob/8c6c13da/ambari-web/app/views/main/admin.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/admin.js b/ambari-web/app/views/main/admin.js
index fa1ce7d..8b9ec03 100644
--- a/ambari-web/app/views/main/admin.js
+++ b/ambari-web/app/views/main/admin.js
@@ -45,11 +45,13 @@ App.MainAdminView = Em.View.extend({
       });
     }
     if (App.isAuthorized('SERVICE.START_STOP')) {
-      items.push({
-        name: 'serviceAutoStart',
-        url: 'adminServiceAutoStart',
-        label: Em.I18n.t('admin.serviceAutoStart.title')
-      });
+      if (App.supports.serviceAutoStart) {
+        items.push({
+          name: 'serviceAutoStart',
+          url: 'adminServiceAutoStart',
+          label: Em.I18n.t('admin.serviceAutoStart.title')
+        });
+      }
     }
     return items;
   }.property(''),

http://git-wip-us.apache.org/repos/asf/ambari/blob/8c6c13da/ambari-web/app/views/main/admin/service_auto_start.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/admin/service_auto_start.js b/ambari-web/app/views/main/admin/service_auto_start.js
index 15f7148..2d3ae16 100644
--- a/ambari-web/app/views/main/admin/service_auto_start.js
+++ b/ambari-web/app/views/main/admin/service_auto_start.js
@@ -20,9 +20,67 @@ var App = require('app');
 
 App.MainAdminServiceAutoStartView = Em.View.extend({
   templateName: require('templates/main/admin/service_auto_start'),
+  /**
+   * Value used in the checkbox.
+   *
+   * @property switcherValue
+   * @type {boolean}
+   */
+  switcherValue: false,
 
-  buttonText: function () {
-    return this.get('controller.overallEnabled') ? Em.I18n.t('common.enabled') : Em.I18n.t('common.disabled');
-  }.property('controller.overallEnabled')
+  clusterConfigs: null,
+
+  didInsertElement: function () {
+    var self = this;
+    this.get('controller').loadClusterConfig().done(function (data) {
+      var tag = [
+        {
+          siteName: 'cluster-env',
+          tagName: data.Clusters.desired_configs['cluster-env'].tag,
+          newTagName: null
+        }
+      ];
+      App.router.get('configurationController').getConfigsByTags(tag).done(function (data) {
+        self.set('clusterConfigs', data[0].properties);
+        self.set('switcherValue', self.get('clusterConfigs.recovery_enabled') === 'true');
+        // plugin should be initiated after applying binding for switcherValue
+        Em.run.later('sync', function() {
+          self.initSwitcher();
+        }.bind(self), 10);
+      });
+    });
+  },
+
+  /**
+   * Init switcher plugin.
+   *
+   * @method initSwitcher
+   */
+  updateClusterConfigs: function (state){
+    this.set('switcherValue', state);
+    this.set('clusterConfigs.recovery_enabled', '' + state);
+    this.get('controller').saveClusterConfigs(this.get('clusterConfigs'));
+  },
+
+  /**
+   * Init switcher plugin.
+   *
+   * @method initSwitcher
+   */
+  initSwitcher: function () {
+    var self = this;
+    if (this.$()) {
+      var switcher = this.$("input:eq(0)").bootstrapSwitch({
+        onText: Em.I18n.t('common.enabled'),
+        offText: Em.I18n.t('common.disabled'),
+        offColor: 'default',
+        onColor: 'success',
+        handleWidth: Math.max(Em.I18n.t('common.enabled').length, Em.I18n.t('common.disabled').length) * 8,
+        onSwitchChange: function (event, state) {
+          self.updateClusterConfigs(state);
+        }
+      });
+    }
+  }
 });
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/8c6c13da/ambari-web/app/views/main/menu.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/menu.js b/ambari-web/app/views/main/menu.js
index 5df5d73..697c85d 100644
--- a/ambari-web/app/views/main/menu.js
+++ b/ambari-web/app/views/main/menu.js
@@ -132,11 +132,13 @@ App.MainMenuView = Em.CollectionView.extend({
           });
         }
         if (App.isAuthorized('SERVICE.START_STOP')) {
-          categories.push({
-            name: 'serviceAutoStart',
-            url: 'serviceAutoStart',
-            label: Em.I18n.t('admin.serviceAutoStart.title')
-          });
+          if (App.supports.serviceAutoStart) {
+            categories.push({
+              name: 'serviceAutoStart',
+              url: 'serviceAutoStart',
+              label: Em.I18n.t('admin.serviceAutoStart.title')
+            });
+          }
         }
       }
       return categories;

http://git-wip-us.apache.org/repos/asf/ambari/blob/8c6c13da/ambari-web/config.coffee
----------------------------------------------------------------------
diff --git a/ambari-web/config.coffee b/ambari-web/config.coffee
index de8566a..6ed0915 100644
--- a/ambari-web/config.coffee
+++ b/ambari-web/config.coffee
@@ -42,6 +42,7 @@ exports.config =
           'vendor/scripts/bootstrap-combobox.js',
           'vendor/scripts/bootstrap-checkbox.js',
           'vendor/scripts/bootstrap-slider.min.js',
+          'vendor/scripts/bootstrap-switch.min.js',
           'vendor/scripts/d3.v2.js',
           'vendor/scripts/cubism.v1.js',
           'vendor/scripts/jquery.ui.core.js',
@@ -86,6 +87,7 @@ exports.config =
           'vendor/styles/bootstrap-combobox.css',
           'vendor/styles/bootstrap-checkbox.css',
           'vendor/styles/bootstrap-slider.min.css',
+          'vendor/styles/bootstrap-switch.min.css',
           'vendor/styles/visualsearch-datauri.css'
         ],
         after: ['app/styles/custom-ui.css']

http://git-wip-us.apache.org/repos/asf/ambari/blob/8c6c13da/ambari-web/karma.conf.js
----------------------------------------------------------------------
diff --git a/ambari-web/karma.conf.js b/ambari-web/karma.conf.js
index 14af760..1a03381 100644
--- a/ambari-web/karma.conf.js
+++ b/ambari-web/karma.conf.js
@@ -54,6 +54,7 @@ module.exports = function(config) {
       'vendor/scripts/ember-i18n-1.4.1.js',
       'vendor/scripts/bootstrap.js',
       'vendor/scripts/bootstrap-combobox.js',
+      'vendor/scripts/bootstrap-switch.min.js',
       'vendor/scripts/d3.v2.js',
       'vendor/scripts/cubism.v1.js',
       'vendor/scripts/jquery.ui.core.js',


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

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


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

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

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


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

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

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


[34/40] ambari git commit: AMBARI-14927. Log Search: Add Host Components Logs tab to Host Details page (alexantonenko)

Posted by nc...@apache.org.
AMBARI-14927. Log Search: Add Host Components Logs tab to Host Details page
 (alexantonenko)


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

Branch: refs/heads/branch-dev-patch-upgrade
Commit: b567ca441c213c816019dc5a45884f69a286f54c
Parents: 3a2add5
Author: Alex Antonenko <hi...@gmail.com>
Authored: Fri Feb 5 18:30:24 2016 +0200
Committer: Alex Antonenko <hi...@gmail.com>
Committed: Fri Feb 5 18:30:24 2016 +0200

----------------------------------------------------------------------
 .../app/controllers/global/update_controller.js |   4 +-
 ambari-web/app/messages.js                      |   3 +
 ambari-web/app/routes/main.js                   |  11 ++
 ambari-web/app/styles/application.less          |   3 +-
 ambari-web/app/templates/main/host/logs.hbs     |  62 ++++++++
 ambari-web/app/views.js                         |   1 +
 ambari-web/app/views/main/host/logs_view.js     | 147 +++++++++++++++++++
 ambari-web/app/views/main/host/menu.js          |  11 +-
 ambari-web/test/views/main/host/menu_test.js    |  20 ++-
 9 files changed, 257 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/b567ca44/ambari-web/app/controllers/global/update_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/global/update_controller.js b/ambari-web/app/controllers/global/update_controller.js
index 0a5d913..0168398 100644
--- a/ambari-web/app/controllers/global/update_controller.js
+++ b/ambari-web/app/controllers/global/update_controller.js
@@ -223,7 +223,7 @@ App.UpdateController = Em.Controller.extend({
     }
     else {
       if (App.router.get('currentState.parentState.name') == 'hostDetails') {
-        hostDetailsFilter = App.router.get('location.lastSetURL').match(/\/hosts\/(.*)\/(summary|configs|alerts|stackVersions)/)[1];
+        hostDetailsFilter = App.router.get('location.lastSetURL').match(/\/hosts\/(.*)\/(summary|configs|alerts|stackVersions|logs)/)[1];
         App.updater.updateInterval('updateHost', App.get('componentsUpdateInterval'));
         //if host details page opened then request info only of one displayed host
         this.get('queryParams').set('Hosts', [
@@ -579,7 +579,7 @@ App.UpdateController = Em.Controller.extend({
       complete: callback
     });
   },
-  
+
   updateUpgradeState: function (callback) {
     var currentStateName = App.get('router.currentState.name'),
       parentStateName = App.get('router.currentState.parentState.name'),

http://git-wip-us.apache.org/repos/asf/ambari/blob/b567ca44/ambari-web/app/messages.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/messages.js b/ambari-web/app/messages.js
index 8d1f6f1..a8b5db6 100644
--- a/ambari-web/app/messages.js
+++ b/ambari-web/app/messages.js
@@ -312,6 +312,7 @@ Em.I18n.translations = {
   'common.filters': 'Filters',
   'common.keywords': 'Keywods',
   'common.levels': 'Levels',
+  'common.extension': 'Extension',
 
   'models.alert_instance.tiggered.verbose': "Occurred on {0} <br> Checked on {1}",
   'models.alert_definition.triggered.verbose': "Occurred on {0}",
@@ -2280,6 +2281,8 @@ Em.I18n.translations = {
 
   'hosts.host.serviceNotAvailable': 'Service not available on this host',
 
+  'hosts.host.menu.logs': 'Logs',
+
   'hosts.host.menu.stackVersions': 'Versions',
   'hosts.host.stackVersions.table.allVersions': 'All Versions',
   'hosts.host.stackVersions.table.allNames': 'All Names',

http://git-wip-us.apache.org/repos/asf/ambari/blob/b567ca44/ambari-web/app/routes/main.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/routes/main.js b/ambari-web/app/routes/main.js
index bd66945..cbaf34d 100644
--- a/ambari-web/app/routes/main.js
+++ b/ambari-web/app/routes/main.js
@@ -264,6 +264,17 @@ module.exports = Em.Route.extend(App.RouterRedirections, {
         }
       }),
 
+      logs: Em.Route.extend({
+        route: '/logs',
+        connectOutlets: function (router, context) {
+          if (App.get('supports.logSearch')) {
+            router.get('mainHostDetailsController').connectOutlet('mainHostLogs')
+          } else {
+            router.transitionTo('summary');
+          }
+        }
+      }),
+
       hostNavigate: function (router, event) {
         var parent = event.view._parentView;
         parent.deactivateChildViews();

http://git-wip-us.apache.org/repos/asf/ambari/blob/b567ca44/ambari-web/app/styles/application.less
----------------------------------------------------------------------
diff --git a/ambari-web/app/styles/application.less b/ambari-web/app/styles/application.less
index ce10a98..a1969db 100644
--- a/ambari-web/app/styles/application.less
+++ b/ambari-web/app/styles/application.less
@@ -3700,7 +3700,8 @@ table.graphs {
       }
     }
   }
-  .host-tab-content {
+  .host-tab-content,
+  .logs-tab-content {
     margin-top: 20px;
     .table thead {
       background: none repeat scroll 0 0 #F8F8F8;

http://git-wip-us.apache.org/repos/asf/ambari/blob/b567ca44/ambari-web/app/templates/main/host/logs.hbs
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates/main/host/logs.hbs b/ambari-web/app/templates/main/host/logs.hbs
new file mode 100644
index 0000000..000b4aa
--- /dev/null
+++ b/ambari-web/app/templates/main/host/logs.hbs
@@ -0,0 +1,62 @@
+{{!
+* 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.
+}}
+
+<table class="table advanced-header-table table-bordered table-striped">
+  <thead>
+    {{#view view.sortView classNames="label-row" contentBinding="view.filteredContent"}}
+      {{view view.parentView.serviceNameSort classNames="first"}}
+      {{view view.parentView.componentNameSort}}
+      {{view view.parentView.fileExtensionsSort}}
+    {{/view}}
+    <tr class="filter-row">
+      <th class="first service-name-filter">{{view view.serviceNameFilterView}}</th>
+      <th class="component-name-filter">{{view view.componentNameFilterView}}</th>
+      <th class="file-extension-filter">{{view view.fileExtensionsFilter}}</th>
+    </tr>
+  </thead>
+  <tbody>
+    {{#if view.pageContent}}
+      {{#each row in view.pageContent}}
+      <tr>
+        <td>{{row.serviceName}}</td>
+        <td>{{row.componentName}}</td>
+        <td>
+          <a {{action openLogFile row target="view"}} href="#">{{row.fileName}}</a>
+        </td>
+      </tr>
+      {{/each}}
+    {{/if}}
+  </tbody>
+</table>
+
+<div class="page-bar">
+  <div class="filtered-info span4">
+    {{#if view.showFilteredContent}}
+      <label>{{view.filteredContentInfo}} - <a {{action clearFilters target="view"}}
+        href="#">{{t tableView.filters.clearAllFilters}}</a></label>
+    {{/if}}
+  </div>
+  <div class="items-on-page">
+    <label>{{t common.show}}: {{view view.rowsPerPageSelectView selectionBinding="view.parentView.displayLength"}}</label>
+  </div>
+  <div class="info">{{view.paginationInfo}}</div>
+  <div class="paging_two_button">
+    {{view view.paginationLeft}}
+    {{view view.paginationRight}}
+  </div>
+</div>

http://git-wip-us.apache.org/repos/asf/ambari/blob/b567ca44/ambari-web/app/views.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views.js b/ambari-web/app/views.js
index 4404a2a..2224393 100644
--- a/ambari-web/app/views.js
+++ b/ambari-web/app/views.js
@@ -122,6 +122,7 @@ require('views/main/host/details/host_component_views/datanode_view');
 require('views/main/host/details/host_component_views/nodemanager_view');
 require('views/main/host/details/host_component_views/regionserver_view');
 require('views/main/host/details/host_component_views/tasktracker_view');
+require('views/main/host/logs_view');
 require('views/main/host/menu');
 require('views/main/host/summary');
 require('views/main/host/configs');

http://git-wip-us.apache.org/repos/asf/ambari/blob/b567ca44/ambari-web/app/views/main/host/logs_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/host/logs_view.js b/ambari-web/app/views/main/host/logs_view.js
new file mode 100644
index 0000000..dfe00e4
--- /dev/null
+++ b/ambari-web/app/views/main/host/logs_view.js
@@ -0,0 +1,147 @@
+/**
+ * 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 filters = require('views/common/filter_view');
+var sort = require('views/common/sort_view');
+
+App.MainHostLogsView = App.TableView.extend({
+  templateName: require('templates/main/host/logs'),
+
+  classNames: ['logs-tab-content'],
+
+  /**
+   * @type {Ember.Object}
+   */
+  host: Em.computed.alias('App.router.mainHostDetailsController.content'),
+
+  content: function() {
+    return [
+      Em.Object.create({
+        serviceName: 'HDFS',
+        componentName: 'DATANODE',
+        fileExtension: '.log',
+        fileName: 'HDFS_DATANODE.log'
+      })
+    ];
+  }.property(),
+  /**
+   * @type {Ember.View}
+   */
+  sortView: sort.wrapperView,
+
+  serviceNameSort: sort.fieldView.extend({
+    column: 1,
+    name: 'serviceName',
+    displayName: Em.I18n.t('common.service')
+  }),
+
+  componentNameSort: sort.fieldView.extend({
+    column: 2,
+    name: 'componentName',
+    displayName: Em.I18n.t('common.component')
+  }),
+
+  fileExtensionsSort: sort.fieldView.extend({
+    column: 3,
+    name: 'extension',
+    displayName: Em.I18n.t('common.extension')
+  }),
+
+  serviceNameFilterView: filters.createSelectView({
+    column: 1,
+    fieldType: 'filter-input-width',
+    content: function() {
+      return [{
+        value: '',
+        label: Em.I18n.t('common.all')
+      }].concat(App.Service.find().mapProperty('serviceName').uniq().map(function(item) {
+        return {
+          value: item,
+          label: item
+        }
+      }));
+    }.property('App.router.clusterController.isLoaded'),
+    onChangeValue: function() {
+      this.get('parentView').updateFilter(this.get('column'), this.get('value'), 'select');
+    }
+  }),
+
+  componentNameFilterView: filters.createSelectView({
+    column: 2,
+    fieldType: 'filter-input-width',
+    content: function() {
+      var hostName = this.get('parentView').get('host.hostName'),
+        hostComponents = App.HostComponent.find().filterProperty('hostName', hostName),
+        componentsMap = hostComponents.map(function(item) {
+          return {
+            value: item.get('componentName'),
+            label: item.get('displayName')
+          }
+        });
+      return [{
+        value: '',
+        label: Em.I18n.t('common.all')
+      }].concat(componentsMap);
+    }.property('App.router.clusterController.isLoaded'),
+    onChangeValue: function() {
+      this.get('parentView').updateFilter(this.get('column'), this.get('value'), 'select');
+    }
+  }),
+
+  fileExtensionsFilter: filters.createSelectView({
+    column: 3,
+    fieldType: 'filter-input-width',
+    content: function() {
+      return [{
+        value: '',
+        label: Em.I18n.t('common.all')
+      }].concat([
+        '.out',
+         '.log'
+       ].map(function(item) {
+        return {
+          value: item,
+          label: item
+        }
+      }))
+    }.property('App.router.clusterController.isLoaded'),
+    onChangeValue: function() {
+      this.get('parentView').updateFilter(this.get('column'), this.get('value'), 'select');
+    }
+  }),
+
+  /**
+   * @type {string[]}
+   */
+  colPropAssoc: function () {
+    var ret = [];
+    ret[1] = 'serviceName';
+    ret[2] = 'componentName';
+    ret[3] = 'fileExtension';
+    return ret;
+  }.property(),
+
+  openLogFile: function(e) {
+    var fileData = e.context;
+    if (e.context) {
+      App.LogFileSearchPopup(fileData.fileName);
+    }
+  }
+});

http://git-wip-us.apache.org/repos/asf/ambari/blob/b567ca44/ambari-web/app/views/main/host/menu.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/host/menu.js b/ambari-web/app/views/main/host/menu.js
index 15608d1..a53c21a 100644
--- a/ambari-web/app/views/main/host/menu.js
+++ b/ambari-web/app/views/main/host/menu.js
@@ -53,6 +53,15 @@ App.MainHostMenuView = Em.CollectionView.extend({
           return !App.get('supports.stackUpgrade') || !App.get('stackVersionsAvailable')
         }.property('App.supports.stackUpgrade'),
         id: 'host-details-summary-version'
+      }),
+      Em.Object.create({
+        name: 'logs',
+        label: Em.I18n.t('hosts.host.menu.logs'),
+        routing: 'logs',
+        hidden: function () {
+          return !App.get('supports.logSearch');
+        }.property('App.supports.logSearch'),
+        id: 'host-details-summary-logs'
       })
     ];
   }.property('App.stackVersionsAvailable'),
@@ -104,4 +113,4 @@ App.MainHostMenuView = Em.CollectionView.extend({
     '{{view.content.badgeText}}' +
     '</span>  {{/if}}</a>{{/unless}}')
   })
-});
\ No newline at end of file
+});

http://git-wip-us.apache.org/repos/asf/ambari/blob/b567ca44/ambari-web/test/views/main/host/menu_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/views/main/host/menu_test.js b/ambari-web/test/views/main/host/menu_test.js
index 4540486..59facf1 100644
--- a/ambari-web/test/views/main/host/menu_test.js
+++ b/ambari-web/test/views/main/host/menu_test.js
@@ -69,6 +69,24 @@ describe('App.MainHostMenuView', function () {
         });
       });
 
+    Em.A([
+      {
+        logSearch: false,
+        m: '`logs` tab is invisible',
+        e: true
+      },
+      {
+        logSearch: true,
+        m: '`logs` tab is visible',
+        e: false
+      }
+    ]).forEach(function(test) {
+      it(test.m, function() {
+          this.mock.withArgs('supports.logSearch').returns(test.logSearch);
+          view.propertyDidChange('content');
+          expect(view.get('content').findProperty('name', 'logs').get('hidden')).to.equal(test.e);
+      });
+    });
   });
 
-});
\ No newline at end of file
+});