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

[1/8] ambari git commit: AMBARI-21640 : Certain templated Grafana dashboards not showing data. (avijayan)

Repository: ambari
Updated Branches:
  refs/heads/branch-2.6 328735d6e -> 7efb9de2b


AMBARI-21640 : Certain templated Grafana dashboards not showing data. (avijayan)


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

Branch: refs/heads/branch-2.6
Commit: b167d3b2fa7b0786107e9ae8ff86d20aa0ffb823
Parents: 14da3ca
Author: Aravindan Vijayan <av...@hortonworks.com>
Authored: Thu Aug 3 09:43:21 2017 -0700
Committer: Aravindan Vijayan <av...@hortonworks.com>
Committed: Thu Aug 3 09:43:21 2017 -0700

----------------------------------------------------------------------
 .../ambari-metrics/datasource.js                | 35 ++++++++++++++------
 .../HDF/grafana-nifi-hosts.json                 | 17 +++++++++-
 2 files changed, 41 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/b167d3b2/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
index b4a339e..07e76af 100644
--- a/ambari-metrics/ambari-metrics-grafana/ambari-metrics/datasource.js
+++ b/ambari-metrics/ambari-metrics-grafana/ambari-metrics/datasource.js
@@ -216,11 +216,12 @@ define([
           var getHostAppIdData = function(target) {
             var precision = target.precision === 'default' || typeof target.precision == 'undefined'  ? '' : '&precision=' 
             + target.precision;
+            var instanceId = typeof target.cluster == 'undefined'  ? '' : '&instanceId=' + target.cluster;
             var metricAggregator = target.aggregator === "none" ? '' : '._' + target.aggregator;
             var metricTransform = !target.transform || target.transform === "none" ? '' : '._' + target.transform;
             var seriesAggregator = !target.seriesAggregator || target.seriesAggregator === "none" ? '' : '&seriesAggregateFunction=' + target.seriesAggregator;
             return self.doAmbariRequest({ url: '/ws/v1/timeline/metrics?metricNames=' + target.metric + metricTransform +
-            metricAggregator + "&hostname=" + target.hosts + '&appId=' + target.app + '&instanceId=' + target.cluster + '&startTime=' + from +
+            metricAggregator + "&hostname=" + target.hosts + '&appId=' + target.app + instanceId + '&startTime=' + from +
             '&endTime=' + to + precision + seriesAggregator }).then(
               getMetricsData(target)
             );
@@ -240,6 +241,7 @@ define([
 
           var getServiceAppIdData = function(target) {
             var tCluster = (_.isEmpty(templateSrv.variables))? templatedCluster : '';
+            var instanceId = typeof tCluster == 'undefined'  ? '' : '&instanceId=' + tCluster;
             var tHost = (_.isEmpty(templateSrv.variables)) ? templatedHost : target.templatedHost;
             var precision = target.precision === 'default' || typeof target.precision == 'undefined'  ? '' : '&precision='
             + target.precision;
@@ -247,13 +249,14 @@ define([
             var metricTransform = !target.transform || target.transform === "none" ? '' : '._' + target.transform;
             var seriesAggregator = !target.seriesAggregator || target.seriesAggregator === "none" ? '' : '&seriesAggregateFunction=' + target.seriesAggregator;
             return self.doAmbariRequest({ url: '/ws/v1/timeline/metrics?metricNames=' + target.metric + metricTransform
-              + metricAggregator + '&hostname=' + tHost + '&appId=' + target.app + '&instanceId=' + tCluster + '&startTime=' + from +
+              + metricAggregator + '&hostname=' + tHost + '&appId=' + target.app + instanceId + '&startTime=' + from +
               '&endTime=' + to + precision + seriesAggregator }).then(
               getMetricsData(target)
             );
           };
           // To speed up querying on templatized dashboards.
           var getAllHostData = function(target) {
+            var instanceId = typeof target.templatedCluster == 'undefined'  ? '' : '&instanceId=' + target.templatedCluster;
             var precision = target.precision === 'default' || typeof target.precision == 'undefined'  ? '' : '&precision='
             + target.precision;
             var metricAggregator = target.aggregator === "none" ? '' : '._' + target.aggregator;
@@ -269,7 +272,7 @@ define([
             var seriesAggregator = !target.seriesAggregator || target.seriesAggregator === "none" ? '' : '&seriesAggregateFunction=' + target.seriesAggregator;
             var templatedComponent = (_.isEmpty(tComponent)) ? target.app : tComponent;
             return self.doAmbariRequest({ url: '/ws/v1/timeline/metrics?metricNames=' + target.metric + metricTransform
-              + metricAggregator + '&hostname=' + target.templatedHost + '&appId=' + templatedComponent + '&instanceId=' + target.templatedCluster
+              + metricAggregator + '&hostname=' + target.templatedHost + '&appId=' + templatedComponent + instanceId
               + '&startTime=' + from + '&endTime=' + to + precision + topN + seriesAggregator }).then(
               allHostMetricsData(target)
             );
@@ -288,10 +291,11 @@ define([
             );
           };
           var getHbaseAppIdData = function(target) {
-            var precision = target.precision === 'default' || typeof target.precision == 'undefined'  ? '' : '&precision='
+              var instanceId = typeof target.templatedCluster == 'undefined'  ? '' : '&instanceId=' + target.templatedCluster;
+              var precision = target.precision === 'default' || typeof target.precision == 'undefined'  ? '' : '&precision='
             + target.precision;
             var seriesAggregator = !target.seriesAggregator || target.seriesAggregator === "none" ? '' : '&seriesAggregateFunction=' + target.seriesAggregator;
-            return self.doAmbariRequest({ url: '/ws/v1/timeline/metrics?metricNames=' + target.hbMetric + + '&instanceId=' + target.templatedCluster + '&appId=hbase&startTime='
+            return self.doAmbariRequest({ url: '/ws/v1/timeline/metrics?metricNames=' + target.hbMetric + instanceId + '&appId=hbase&startTime='
             + from + '&endTime=' + to + precision + seriesAggregator }).then(
               allHostMetricsData(target)
             );
@@ -300,22 +304,25 @@ define([
           var getKafkaAppIdData = function(target) {
             var precision = target.precision === 'default' || typeof target.precision == 'undefined'  ? '' : '&precision='
             + target.precision;
+            var instanceId = typeof target.templatedCluster == 'undefined'  ? '' : '&instanceId=' + target.templatedCluster;
             var metricAggregator = target.aggregator === "none" ? '' : '._' + target.aggregator;
             var metricTransform = !target.transform || target.transform === "none" ? '' : '._' + target.transform;
             var seriesAggregator = !target.seriesAggregator || target.seriesAggregator === "none" ? '' : '&seriesAggregateFunction=' + target.seriesAggregator;
-            return self.doAmbariRequest({ url: '/ws/v1/timeline/metrics?metricNames=' + target.kbMetric + metricTransform + + '&instanceId=' + target.templatedCluster
+            return self.doAmbariRequest({ url: '/ws/v1/timeline/metrics?metricNames=' + target.kbMetric + metricTransform + instanceId
               + metricAggregator + '&appId=kafka_broker&startTime=' + from +
               '&endTime=' + to + precision + seriesAggregator }).then(
               getMetricsData(target)
             );
           };
           var getNnAppIdData = function(target) {
+
             var precision = target.precision === 'default' || typeof target.precision == 'undefined'  ? '' : '&precision='
             + target.precision;
+            var instanceId = typeof target.templatedCluster == 'undefined'  ? '' : '&instanceId=' + target.templatedCluster;
             var metricAggregator = target.aggregator === "none" ? '' : '._' + target.aggregator;
             var metricTransform = !target.transform || target.transform === "none" ? '' : '._' + target.transform;
             var seriesAggregator = !target.seriesAggregator || target.seriesAggregator === "none" ? '' : '&seriesAggregateFunction=' + target.seriesAggregator;
-            return self.doAmbariRequest({ url: '/ws/v1/timeline/metrics?metricNames=' + target.nnMetric + metricTransform + '&instanceId=' + target.templatedCluster
+            return self.doAmbariRequest({ url: '/ws/v1/timeline/metrics?metricNames=' + target.nnMetric + metricTransform + instanceId
             + metricAggregator + '&appId=namenode&startTime=' + from + '&endTime=' + to + precision + seriesAggregator }).then(
               allHostMetricsData(target)
             );
@@ -323,12 +330,13 @@ define([
 
           // Storm Topology calls.
           var getStormData = function(target) {
+            var instanceId = typeof target.templatedCluster == 'undefined'  ? '' : '&instanceId=' + target.templatedCluster;
             var precision = target.precision === 'default' || typeof target.precision == 'undefined'  ? '' : '&precision='
             + target.precision;
             var metricAggregator = target.aggregator === "none" ? '' : '._' + target.aggregator;
             var metricTransform = !target.transform || target.transform === "none" ? '' : '._' + target.transform;
             var seriesAggregator = !target.seriesAggregator || target.seriesAggregator === "none" ? '' : '&seriesAggregateFunction=' + target.seriesAggregator;
-            return self.doAmbariRequest({ url: '/ws/v1/timeline/metrics?metricNames=' + target.sTopoMetric + metricTransform + '&instanceId=' + target.templatedCluster
+            return self.doAmbariRequest({ url: '/ws/v1/timeline/metrics?metricNames=' + target.sTopoMetric + metricTransform + instanceId
                 + metricAggregator + '&appId=nimbus&startTime=' + from + '&endTime=' + to + precision + seriesAggregator }).then(
                 allHostMetricsData(target)
             );
@@ -336,12 +344,13 @@ define([
 
           // Druid calls.
           var getDruidData = function(target) {
+            var instanceId = typeof target.templatedCluster == 'undefined'  ? '' : '&instanceId=' + target.templatedCluster;
             var precision = target.precision === 'default' || typeof target.precision == 'undefined'  ? '' : '&precision='
             + target.precision;
             var metricAggregator = target.aggregator === "none" ? '' : '._' + target.aggregator;
             var metricTransform = !target.transform || target.transform === "none" ? '' : '._' + target.transform;
             var seriesAggregator = !target.seriesAggregator || target.seriesAggregator === "none" ? '' : '&seriesAggregateFunction=' + target.seriesAggregator;
-            return self.doAmbariRequest({ url: '/ws/v1/timeline/metrics?metricNames=' + target.sDataSourceMetric + metricTransform + '&instanceId=' + target.templatedCluster
+            return self.doAmbariRequest({ url: '/ws/v1/timeline/metrics?metricNames=' + target.sDataSourceMetric + metricTransform + instanceId
                           + metricAggregator + '&appId=druid&startTime=' + from + '&endTime=' + to + precision + seriesAggregator }).then(
                           allHostMetricsData(target)
             );
@@ -512,7 +521,13 @@ define([
               });
             }
             // To speed up querying on templatized dashboards.
-            if (templateSrv.variables[2] && templateSrv.variables[2].name === "hosts") {
+              var indexOfHosts = -1;
+              for (var i = 0; i < templateSrv.variables.length; i++) {
+                  if (templateSrv.variables[i].name == 'hosts') {
+                      indexOfHosts = i;
+                  }
+              }
+              if (indexOfHosts >= 0) {
               var allHosts = templateSrv._values.hosts.lastIndexOf('}') > 0 ? templateSrv._values.hosts.slice(1,-1) :
               templateSrv._values.hosts;
               allHosts = templateSrv._texts.hosts === "All" ? '%' : allHosts;

http://git-wip-us.apache.org/repos/asf/ambari/blob/b167d3b2/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/package/files/grafana-dashboards/HDF/grafana-nifi-hosts.json
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/package/files/grafana-dashboards/HDF/grafana-nifi-hosts.json b/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/package/files/grafana-dashboards/HDF/grafana-nifi-hosts.json
index 94aa285..e491a38 100644
--- a/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/package/files/grafana-dashboards/HDF/grafana-nifi-hosts.json
+++ b/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/package/files/grafana-dashboards/HDF/grafana-nifi-hosts.json
@@ -965,7 +965,7 @@
         "includeAll": false,
         "multi": false,
         "multiFormat": "glob",
-        "name": "component",
+        "name": "components",
         "options": [
           {
             "selected": true,
@@ -979,6 +979,21 @@
       },
       {
         "allFormat": "glob",
+        "current": null,
+        "datasource": null,
+        "includeAll": false,
+        "label": "Cluster",
+        "multi": false,
+        "multiFormat": "glob",
+        "name": "cluster",
+        "options": [],
+        "query": "cluster",
+        "refresh": true,
+        "regex": "",
+        "type": "query"
+      },
+      {
+        "allFormat": "glob",
         "current": {
           "text": "All",
           "value": ""


[3/8] ambari git commit: AMBARI-21658. Check for config group host mapping left behind after host delete. (swagle)

Posted by jo...@apache.org.
AMBARI-21658. Check for config group host mapping left behind after host delete. (swagle)


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

Branch: refs/heads/branch-2.6
Commit: 30bea532c6e80d635ba8fb7b12422e8d936e058e
Parents: d72f329
Author: Siddharth Wagle <sw...@hortonworks.com>
Authored: Thu Aug 3 21:04:30 2017 -0700
Committer: Siddharth Wagle <sw...@hortonworks.com>
Committed: Thu Aug 3 21:04:30 2017 -0700

----------------------------------------------------------------------
 .../checks/DatabaseConsistencyCheckHelper.java  | 113 +++++++
 .../controller/utilities/DatabaseChecker.java   | 305 -------------------
 .../state/configgroup/ConfigGroupImpl.java      |   6 +-
 .../DatabaseConsistencyCheckHelperTest.java     |  77 +++++
 .../utilities/DatabaseCheckerTest.java          | 105 -------
 5 files changed, 195 insertions(+), 411 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/30bea532/ambari-server/src/main/java/org/apache/ambari/server/checks/DatabaseConsistencyCheckHelper.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/checks/DatabaseConsistencyCheckHelper.java b/ambari-server/src/main/java/org/apache/ambari/server/checks/DatabaseConsistencyCheckHelper.java
index c6239d8..d546169 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/checks/DatabaseConsistencyCheckHelper.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/checks/DatabaseConsistencyCheckHelper.java
@@ -51,16 +51,23 @@ import org.apache.ambari.server.orm.dao.HostComponentDesiredStateDAO;
 import org.apache.ambari.server.orm.dao.HostComponentStateDAO;
 import org.apache.ambari.server.orm.dao.MetainfoDAO;
 import org.apache.ambari.server.orm.entities.ClusterConfigEntity;
+import org.apache.ambari.server.orm.entities.ConfigGroupConfigMappingEntity;
 import org.apache.ambari.server.orm.entities.HostComponentDesiredStateEntity;
 import org.apache.ambari.server.orm.entities.HostComponentStateEntity;
 import org.apache.ambari.server.orm.entities.MetainfoEntity;
 import org.apache.ambari.server.state.ClientConfigFileDefinition;
+import org.apache.ambari.server.state.Cluster;
+import org.apache.ambari.server.state.Clusters;
 import org.apache.ambari.server.state.ComponentInfo;
+import org.apache.ambari.server.state.Host;
 import org.apache.ambari.server.state.SecurityState;
 import org.apache.ambari.server.state.ServiceInfo;
 import org.apache.ambari.server.state.State;
 import org.apache.ambari.server.state.UpgradeState;
+import org.apache.ambari.server.state.configgroup.ConfigGroup;
 import org.apache.ambari.server.utils.VersionUtils;
+import org.apache.commons.collections.CollectionUtils;
+import org.apache.commons.collections.MapUtils;
 import org.apache.commons.lang.StringUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -170,6 +177,7 @@ public class DatabaseConsistencyCheckHelper {
       if (fixIssues) {
         fixHostComponentStatesCountEqualsHostComponentsDesiredStates();
         fixClusterConfigsNotMappedToAnyService();
+        fixConfigGroupHostMappings();
       }
       checkSchemaName();
       checkMySQLEngine();
@@ -181,6 +189,7 @@ public class DatabaseConsistencyCheckHelper {
       checkServiceConfigs();
       checkTopologyTables();
       checkForLargeTables();
+      checkConfigGroupHostMapping(true);
       LOG.info("******************************* Check database completed *******************************");
       return checkResult;
     }
@@ -1130,6 +1139,110 @@ public class DatabaseConsistencyCheckHelper {
 
   }
 
+  /**
+   * This method checks if there are any ConfigGroup host mappings with hosts
+   * that are not longer a part of the cluster.
+   */
+  static Map<Long, Set<Long>> checkConfigGroupHostMapping(boolean warnIfFound) {
+    LOG.info("Checking config group host mappings");
+    Map<Long, Set<Long>> nonMappedHostIds = new HashMap<>();
+    Clusters clusters = injector.getInstance(Clusters.class);
+    Map<String, Cluster> clusterMap = clusters.getClusters();
+    StringBuilder output = new StringBuilder("[( ConfigGroup, Service, HostCount) => ");
+
+    if (!MapUtils.isEmpty(clusterMap)) {
+      for (Cluster cluster : clusterMap.values()) {
+        Map<Long, ConfigGroup> configGroups = cluster.getConfigGroups();
+        Map<String, Host> clusterHosts;
+        try {
+          clusterHosts = clusters.getHostsForCluster(cluster.getClusterName());
+        } catch (AmbariException e) {
+          // Why would this ever happen?
+          continue;
+        }
+
+        if (!MapUtils.isEmpty(configGroups) && !MapUtils.isEmpty(clusterHosts)) {
+          for (ConfigGroup configGroup : configGroups.values()) {
+            // Based on current implementation of ConfigGroupImpl the
+            // host mapping would be loaded only if the host actually exists
+            // in the host table
+            Map<Long, Host> hosts = configGroup.getHosts();
+            boolean addToOutput = false;
+            if (!MapUtils.isEmpty(hosts)) {
+              for (Host host : hosts.values()) {
+                // Lookup by hostname - It does have a unique constraint
+                if (!clusterHosts.containsKey(host.getHostName())) {
+                  Set<Long> hostIds = nonMappedHostIds.get(configGroup.getId());
+                  if (CollectionUtils.isEmpty(hostIds)) {
+                    hostIds = new HashSet<>();
+                    nonMappedHostIds.put(configGroup.getId(), hostIds);
+                  }
+                  hostIds.add(host.getHostId());
+                  addToOutput = true;
+                }
+              }
+            }
+            if (addToOutput) {
+              output.append("( ");
+              output.append(configGroup.getName());
+              output.append(", ");
+              output.append(configGroup.getTag());
+              output.append(", ");
+              output.append(nonMappedHostIds.get(configGroup.getId()).size());
+              output.append(" ), ");
+            }
+          }
+        }
+      }
+    }
+    if (!MapUtils.isEmpty(nonMappedHostIds) && warnIfFound) {
+      output.replace(output.lastIndexOf(","), output.length(), "]");
+      warning("You have config group host mappings with hosts that are no " +
+        "longer associated with the cluster, {}. Run --auto-fix-database to " +
+        "fix this automatically. Alternatively, you can remove this mapping " +
+        "from the UI.", output.toString());
+    }
+
+    return nonMappedHostIds;
+  }
+
+  /**
+   * Fix inconsistencies found by @checkConfigGroupHostMapping
+   */
+  @Transactional
+  static void fixConfigGroupHostMappings() {
+    Map<Long, Set<Long>> nonMappedHostIds = checkConfigGroupHostMapping(false);
+    Clusters clusters = injector.getInstance(Clusters.class);
+
+    if (!MapUtils.isEmpty(nonMappedHostIds)) {
+      LOG.info("Fixing {} config groups with inconsistent host mappings", nonMappedHostIds.size());
+
+      for (Map.Entry<Long, Set<Long>> nonMappedHostEntry : nonMappedHostIds.entrySet()) {
+        if (!MapUtils.isEmpty(clusters.getClusters())) {
+          for (Cluster cluster : clusters.getClusters().values()) {
+            Map<Long, ConfigGroup> configGroups = cluster.getConfigGroups();
+            if (!MapUtils.isEmpty(configGroups)) {
+              ConfigGroup configGroup = configGroups.get(nonMappedHostEntry.getKey());
+              if (configGroup != null) {
+                for (Long hostId : nonMappedHostEntry.getValue()) {
+                  try {
+                    configGroup.removeHost(hostId);
+                  } catch (AmbariException e) {
+                    LOG.warn("Unable to fix inconsistency by removing host " +
+                      "mapping for config group: {}, service: {}, hostId = {}",
+                      configGroup.getName(), configGroup.getTag(), hostId);
+                  }
+                }
+              } else {
+                LOG.warn("Unable to find config group with id = {}", nonMappedHostEntry.getKey());
+              }
+            }
+          }
+        }
+      }
+    }
+  }
+
   private static void ensureConnection() {
     if (connection == null) {
       if (dbAccessor == null) {

http://git-wip-us.apache.org/repos/asf/ambari/blob/30bea532/ambari-server/src/main/java/org/apache/ambari/server/controller/utilities/DatabaseChecker.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/utilities/DatabaseChecker.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/utilities/DatabaseChecker.java
deleted file mode 100644
index d35fc1a..0000000
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/utilities/DatabaseChecker.java
+++ /dev/null
@@ -1,305 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ambari.server.controller.utilities;
-
-import java.io.File;
-import java.io.IOException;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Scanner;
-
-import org.apache.ambari.server.AmbariException;
-import org.apache.ambari.server.api.services.AmbariMetaInfo;
-import org.apache.ambari.server.configuration.Configuration;
-import org.apache.ambari.server.orm.dao.ClusterDAO;
-import org.apache.ambari.server.orm.dao.MetainfoDAO;
-import org.apache.ambari.server.orm.entities.ClusterConfigEntity;
-import org.apache.ambari.server.orm.entities.ClusterConfigMappingEntity;
-import org.apache.ambari.server.orm.entities.ClusterEntity;
-import org.apache.ambari.server.orm.entities.ClusterServiceEntity;
-import org.apache.ambari.server.orm.entities.ClusterStateEntity;
-import org.apache.ambari.server.orm.entities.HostComponentDesiredStateEntity;
-import org.apache.ambari.server.orm.entities.HostComponentStateEntity;
-import org.apache.ambari.server.orm.entities.MetainfoEntity;
-import org.apache.ambari.server.orm.entities.ServiceComponentDesiredStateEntity;
-import org.apache.ambari.server.orm.entities.ServiceDesiredStateEntity;
-import org.apache.ambari.server.orm.entities.StackEntity;
-import org.apache.ambari.server.state.ComponentInfo;
-import org.apache.ambari.server.state.ServiceInfo;
-import org.apache.ambari.server.state.StackId;
-import org.apache.ambari.server.state.StackInfo;
-import org.apache.ambari.server.state.State;
-import org.apache.ambari.server.utils.VersionUtils;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import com.google.inject.Inject;
-import com.google.inject.Injector;
-
-
-/*This class should not be used anymore
-* now we will use DatabaseConsistencyChecker*/
-public class DatabaseChecker {
-
-  static Logger LOG = LoggerFactory.getLogger(DatabaseChecker.class);
-
-  @Inject
-  static Injector injector;
-  static AmbariMetaInfo ambariMetaInfo;
-  static MetainfoDAO metainfoDAO;
-
-  public static void checkDBConsistency() throws AmbariException {
-    LOG.info("Checking DB consistency");
-
-    boolean checkPassed = true;
-    if (ambariMetaInfo == null) {
-      ambariMetaInfo = injector.getInstance(AmbariMetaInfo.class);
-    }
-
-    ClusterDAO clusterDAO = injector.getInstance(ClusterDAO.class);
-    List<ClusterEntity> clusters = clusterDAO.findAll();
-    for (ClusterEntity clusterEntity: clusters) {
-      StackId stackId = new StackId(clusterEntity.getDesiredStack());
-
-      Collection<ClusterServiceEntity> serviceEntities =
-        clusterEntity.getClusterServiceEntities();
-      for (ClusterServiceEntity clusterServiceEntity : serviceEntities) {
-
-        ServiceDesiredStateEntity serviceDesiredStateEntity =
-          clusterServiceEntity.getServiceDesiredStateEntity();
-        if (serviceDesiredStateEntity == null) {
-          checkPassed = false;
-          LOG.error(String.format("ServiceDesiredStateEntity is null for " +
-              "ServiceComponentDesiredStateEntity, clusterName=%s, serviceName=%s ",
-            clusterEntity.getClusterName(), clusterServiceEntity.getServiceName()));
-        }
-        Collection<ServiceComponentDesiredStateEntity> scDesiredStateEntities =
-          clusterServiceEntity.getServiceComponentDesiredStateEntities();
-        if (scDesiredStateEntities == null ||
-          scDesiredStateEntities.isEmpty()) {
-          checkPassed = false;
-          LOG.error(String.format("serviceComponentDesiredStateEntities is null or empty for " +
-              "ServiceComponentDesiredStateEntity, clusterName=%s, serviceName=%s ",
-            clusterEntity.getClusterName(), clusterServiceEntity.getServiceName()));
-        } else {
-          for (ServiceComponentDesiredStateEntity scDesiredStateEnity : scDesiredStateEntities) {
-
-            Collection<HostComponentDesiredStateEntity> schDesiredStateEntities =
-              scDesiredStateEnity.getHostComponentDesiredStateEntities();
-            Collection<HostComponentStateEntity> schStateEntities =
-              scDesiredStateEnity.getHostComponentStateEntities();
-
-            ComponentInfo componentInfo = ambariMetaInfo.getComponent(
-              stackId.getStackName(), stackId.getStackVersion(),
-              scDesiredStateEnity.getServiceName(), scDesiredStateEnity.getComponentName());
-
-            boolean zeroCardinality = componentInfo.getCardinality() == null
-              || componentInfo.getCardinality().startsWith("0")
-              || scDesiredStateEnity.getComponentName().equals("SECONDARY_NAMENODE"); // cardinality 0 for NameNode HA
-
-            boolean componentCheckFailed = false;
-
-            if (schDesiredStateEntities == null) {
-              componentCheckFailed = true;
-              LOG.error(String.format("hostComponentDesiredStateEntities is null for " +
-                  "ServiceComponentDesiredStateEntity, clusterName=%s, serviceName=%s, componentName=%s ",
-                clusterEntity.getClusterName(), scDesiredStateEnity.getServiceName(), scDesiredStateEnity.getComponentName()));
-            } else if (!zeroCardinality && schDesiredStateEntities.isEmpty()) {
-              componentCheckFailed = true;
-              LOG.error(String.format("hostComponentDesiredStateEntities is empty for " +
-                  "ServiceComponentDesiredStateEntity, clusterName=%s, serviceName=%s, componentName=%s ",
-                clusterEntity.getClusterName(), scDesiredStateEnity.getServiceName(), scDesiredStateEnity.getComponentName()));
-            }
-
-            if (schStateEntities == null) {
-              componentCheckFailed = true;
-              LOG.error(String.format("hostComponentStateEntities is null for " +
-                  "ServiceComponentDesiredStateEntity, clusterName=%s, serviceName=%s, componentName=%s ",
-                clusterEntity.getClusterName(), scDesiredStateEnity.getServiceName(), scDesiredStateEnity.getComponentName()));
-            } else if (!zeroCardinality && schStateEntities.isEmpty()) {
-              componentCheckFailed = true;
-              LOG.error(String.format("hostComponentStateEntities is empty for " +
-                  "ServiceComponentDesiredStateEntity, clusterName=%s, serviceName=%s, componentName=%s ",
-                clusterEntity.getClusterName(), scDesiredStateEnity.getServiceName(), scDesiredStateEnity.getComponentName()));
-            }
-
-            if (!componentCheckFailed &&
-              schDesiredStateEntities.size() != schStateEntities.size()) {
-              checkPassed = false;
-              LOG.error(String.format("HostComponentStateEntities and HostComponentDesiredStateEntities " +
-                  "tables must contain equal number of rows mapped to ServiceComponentDesiredStateEntity, " +
-                  "(clusterName=%s, serviceName=%s, componentName=%s) ", clusterEntity.getClusterName(),
-                scDesiredStateEnity.getServiceName(), scDesiredStateEnity.getComponentName()));
-            }
-            checkPassed = checkPassed && !componentCheckFailed;
-          }
-        }
-      }
-    }
-    if (checkPassed) {
-      LOG.info("DB consistency check passed.");
-    } else {
-      String errorMessage = "DB consistency check failed. Run \"ambari-server start --skip-database-validation\" to skip validation.";
-      LOG.error(errorMessage);
-      throw new AmbariException(errorMessage);
-    }
-  }
-
-  private static boolean clusterConfigsContainTypeAndTag(Collection<ClusterConfigEntity> clusterConfigEntities,
-                                                         String typeName, String tag) {
-    for (ClusterConfigEntity clusterConfigEntity : clusterConfigEntities) {
-      if (typeName.equals(clusterConfigEntity.getType()) && tag.equals(clusterConfigEntity.getTag())) {
-        return true;
-      }
-    }
-    return false;
-  }
-
-  /**
-   * Validates configuration consistency. Checks that every config type from stack is presented in
-   * ClusterConfigMapping. Checks that for each config type exactly one is selected. Checks that ClusterConfig
-   * contains type_names and tags from ClusterConfigMapping.
-   *
-   * @throws AmbariException if check failed
-   */
-  public static void checkDBConfigsConsistency() throws AmbariException {
-    LOG.info("Checking DB configs consistency");
-
-    boolean checkPassed = true;
-
-    if (ambariMetaInfo == null) {
-      ambariMetaInfo = injector.getInstance(AmbariMetaInfo.class);
-    }
-
-    ClusterDAO clusterDAO = injector.getInstance(ClusterDAO.class);
-    List<ClusterEntity> clusters = clusterDAO.findAll();
-    if (clusters != null) {
-      for (ClusterEntity clusterEntity : clusters) {
-        Collection<ClusterConfigMappingEntity> configMappingEntities = clusterEntity.getConfigMappingEntities();
-        Collection<ClusterConfigEntity> clusterConfigEntities = clusterEntity.getClusterConfigEntities();
-
-        if (configMappingEntities != null) {
-          Map<String, Integer> selectedCountForType = new HashMap<>();
-          for (ClusterConfigMappingEntity clusterConfigMappingEntity : configMappingEntities) {
-            String typeName = clusterConfigMappingEntity.getType();
-            if (clusterConfigMappingEntity.isSelected() > 0) {
-              int selectedCount = selectedCountForType.get(typeName) != null ? selectedCountForType.get(typeName) : 0;
-              selectedCountForType.put(typeName, selectedCount + 1);
-
-              // Check that ClusterConfig contains type_name and tag from ClusterConfigMapping
-              if (!clusterConfigsContainTypeAndTag(clusterConfigEntities, typeName, clusterConfigMappingEntity.getTag())) {
-                checkPassed = false;
-                LOG.error("ClusterConfig does not contain mapping for type_name=" + typeName + " tag="
-                    + clusterConfigMappingEntity.getTag());
-              }
-            } else {
-              if (!selectedCountForType.containsKey(typeName)) {
-                selectedCountForType.put(typeName, 0);
-              }
-            }
-          }
-
-          // Check that every config type from stack is presented in ClusterConfigMapping
-          Collection<ClusterServiceEntity> clusterServiceEntities = clusterEntity.getClusterServiceEntities();
-          ClusterStateEntity clusterStateEntity = clusterEntity.getClusterStateEntity();
-          if (clusterStateEntity != null) {
-            StackEntity currentStack = clusterStateEntity.getCurrentStack();
-            StackInfo stack = ambariMetaInfo.getStack(currentStack.getStackName(), currentStack.getStackVersion());
-
-            for (ClusterServiceEntity clusterServiceEntity : clusterServiceEntities) {
-              if (!State.INIT.equals(clusterServiceEntity.getServiceDesiredStateEntity().getDesiredState())) {
-                String serviceName = clusterServiceEntity.getServiceName();
-                ServiceInfo serviceInfo = ambariMetaInfo.getService(stack.getName(), stack.getVersion(), serviceName);
-                for (String configTypeName : serviceInfo.getConfigTypeAttributes().keySet()) {
-                  if (selectedCountForType.get(configTypeName) == null) {
-                    checkPassed = false;
-                    LOG.error("ClusterConfigMapping does not contain mapping for service=" + serviceName + " type_name="
-                        + configTypeName);
-                  } else {
-                    // Check that for each config type exactly one is selected
-                    if (selectedCountForType.get(configTypeName) == 0) {
-                      checkPassed = false;
-                      LOG.error("ClusterConfigMapping selected count is 0 for service=" + serviceName + " type_name="
-                          + configTypeName);
-                    } else if (selectedCountForType.get(configTypeName) > 1) {
-                      checkPassed = false;
-                      LOG.error("ClusterConfigMapping selected count is more than 1 for service=" + serviceName
-                          + " type_name=" + configTypeName);
-                    }
-                  }
-                }
-              }
-            }
-          }
-        }
-      }
-    }
-
-    if (checkPassed) {
-      LOG.info("DB configs consistency check passed.");
-    } else {
-      String errorMessage = "DB configs consistency check failed. Run \"ambari-server start --skip-database-validation\" to skip validation.";
-      LOG.error(errorMessage);
-      throw new AmbariException(errorMessage);
-    }
-  }
-
-  public static void checkDBVersion() throws AmbariException {
-
-    LOG.info("Checking DB store version");
-    if (metainfoDAO == null) {
-      metainfoDAO = injector.getInstance(MetainfoDAO.class);
-    }
-
-    MetainfoEntity schemaVersionEntity = metainfoDAO.findByKey(Configuration.SERVER_VERSION_KEY);
-    String schemaVersion = null;
-
-    if (schemaVersionEntity != null) {
-      schemaVersion = schemaVersionEntity.getMetainfoValue();
-    }
-
-    Configuration conf = injector.getInstance(Configuration.class);
-    File versionFile = new File(conf.getServerVersionFilePath());
-    if (!versionFile.exists()) {
-      throw new AmbariException("Server version file does not exist.");
-    }
-    String serverVersion = null;
-    try (Scanner scanner = new Scanner(versionFile)) {
-      serverVersion = scanner.useDelimiter("\\Z").next();
-
-    } catch (IOException ioe) {
-      throw new AmbariException("Unable to read server version file.");
-    }
-
-    if (schemaVersionEntity==null || VersionUtils.compareVersions(schemaVersion, serverVersion, 3) != 0) {
-      String error = "Current database store version is not compatible with " +
-        "current server version"
-        + ", serverVersion=" + serverVersion
-        + ", schemaVersion=" + schemaVersion;
-      LOG.warn(error);
-      throw new AmbariException(error);
-    }
-
-    LOG.info("DB store version is compatible");
-  }
-
-
-}

http://git-wip-us.apache.org/repos/asf/ambari/blob/30bea532/ambari-server/src/main/java/org/apache/ambari/server/state/configgroup/ConfigGroupImpl.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/state/configgroup/ConfigGroupImpl.java b/ambari-server/src/main/java/org/apache/ambari/server/state/configgroup/ConfigGroupImpl.java
index 03edcf8..9058a63 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/state/configgroup/ConfigGroupImpl.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/state/configgroup/ConfigGroupImpl.java
@@ -30,6 +30,7 @@ import java.util.concurrent.locks.ReadWriteLock;
 
 import org.apache.ambari.server.AmbariException;
 import org.apache.ambari.server.DuplicateResourceException;
+import org.apache.ambari.server.HostNotFoundException;
 import org.apache.ambari.server.controller.ConfigGroupResponse;
 import org.apache.ambari.server.controller.internal.ConfigurationResourceProvider;
 import org.apache.ambari.server.logging.LockFactory;
@@ -172,10 +173,13 @@ public class ConfigGroupImpl implements ConfigGroup {
         if (host != null && hostEntity != null) {
           m_hosts.put(hostEntity.getHostId(), host);
         }
-      } catch (Exception e) {
+      } catch (HostNotFoundException e) {
         LOG.warn("Host {} seems to be deleted but Config group {} mapping " +
           "still exists !", hostMappingEntity.getHostname(), configGroupName);
         LOG.debug("Host seems to be deleted but Config group mapping still exists !", e);
+      } catch (Exception ae) {
+        LOG.error("Exception retrieving host mapping for config group {} " +
+          "with id = {}", configGroupEntity.getGroupName(), configGroupEntity.getGroupId());
       }
     }
   }

http://git-wip-us.apache.org/repos/asf/ambari/blob/30bea532/ambari-server/src/test/java/org/apache/ambari/server/checks/DatabaseConsistencyCheckHelperTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/checks/DatabaseConsistencyCheckHelperTest.java b/ambari-server/src/test/java/org/apache/ambari/server/checks/DatabaseConsistencyCheckHelperTest.java
index 9c8eb74..9e85fa2 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/checks/DatabaseConsistencyCheckHelperTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/checks/DatabaseConsistencyCheckHelperTest.java
@@ -36,6 +36,7 @@ import java.sql.Statement;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
+import java.util.Set;
 
 import javax.persistence.EntityManager;
 
@@ -43,8 +44,11 @@ import org.apache.ambari.server.api.services.AmbariMetaInfo;
 import org.apache.ambari.server.configuration.Configuration;
 import org.apache.ambari.server.orm.DBAccessor;
 import org.apache.ambari.server.stack.StackManagerFactory;
+import org.apache.ambari.server.state.Cluster;
 import org.apache.ambari.server.state.Clusters;
+import org.apache.ambari.server.state.Host;
 import org.apache.ambari.server.state.ServiceInfo;
+import org.apache.ambari.server.state.configgroup.ConfigGroup;
 import org.apache.ambari.server.state.stack.OsFamily;
 import org.easymock.EasyMockSupport;
 import org.junit.Assert;
@@ -646,4 +650,77 @@ public class DatabaseConsistencyCheckHelperTest {
 
     easyMockSupport.verifyAll();
   }
+
+  @Test
+  public void testConfigGroupHostMappings() throws Exception {
+    EasyMockSupport easyMockSupport = new EasyMockSupport();
+
+    final DBAccessor mockDBDbAccessor = easyMockSupport.createNiceMock(DBAccessor.class);
+
+    final StackManagerFactory mockStackManagerFactory = easyMockSupport.createNiceMock(StackManagerFactory.class);
+    final EntityManager mockEntityManager = easyMockSupport.createNiceMock(EntityManager.class);
+    final Clusters mockClusters = easyMockSupport.createNiceMock(Clusters.class);
+    final OsFamily mockOSFamily = easyMockSupport.createNiceMock(OsFamily.class);
+    final Injector mockInjector = Guice.createInjector(new AbstractModule() {
+      @Override
+      protected void configure() {
+
+        bind(StackManagerFactory.class).toInstance(mockStackManagerFactory);
+        bind(EntityManager.class).toInstance(mockEntityManager);
+        bind(DBAccessor.class).toInstance(mockDBDbAccessor);
+        bind(Clusters.class).toInstance(mockClusters);
+        bind(OsFamily.class).toInstance(mockOSFamily);
+      }
+    });
+
+    Map<String, Cluster> clusters = new HashMap<>();
+    Cluster cluster = easyMockSupport.createNiceMock(Cluster.class);
+    clusters.put("c1", cluster);
+    expect(mockClusters.getClusters()).andReturn(clusters).anyTimes();
+
+    Map<Long, ConfigGroup> configGroupMap = new HashMap<>();
+    ConfigGroup cg1 = easyMockSupport.createNiceMock(ConfigGroup.class);
+    ConfigGroup cg2 = easyMockSupport.createNiceMock(ConfigGroup.class);
+    configGroupMap.put(1L, cg1);
+    configGroupMap.put(2L, cg2);
+
+    expect(cluster.getConfigGroups()).andReturn(configGroupMap).anyTimes();
+
+    expect(cluster.getClusterName()).andReturn("c1").anyTimes();
+
+    Map<String, Host> hosts = new HashMap<>();
+    Host h1 = easyMockSupport.createNiceMock(Host.class);
+    Host h2 = easyMockSupport.createNiceMock(Host.class);
+    hosts.put("h1", h1);
+    expect(mockClusters.getHostsForCluster("c1")).andReturn(hosts);
+
+    Map<Long, Host> cgHosts = new HashMap<>();
+    cgHosts.put(1L, h1);
+    cgHosts.put(2L, h2);
+
+    expect(cg1.getHosts()).andReturn(cgHosts);
+
+    expect(h1.getHostName()).andReturn("h1").anyTimes();
+    expect(h2.getHostName()).andReturn("h2").anyTimes() ;
+    expect(h1.getHostId()).andReturn(1L).anyTimes();
+    expect(h2.getHostId()).andReturn(2L).anyTimes();
+
+    expect(cg1.getId()).andReturn(1L).anyTimes();
+    expect(cg2.getId()).andReturn(2L).anyTimes();
+    expect(cg1.getName()).andReturn("cg1").anyTimes();
+    expect(cg2.getName()).andReturn("cg2").anyTimes();
+
+    DatabaseConsistencyCheckHelper.setInjector(mockInjector);
+
+    easyMockSupport.replayAll();
+
+    Map<Long, Set<Long>> hostIds = DatabaseConsistencyCheckHelper.checkConfigGroupHostMapping(true);
+
+    easyMockSupport.verifyAll();
+
+    Assert.assertNotNull(hostIds);
+    Assert.assertEquals(1, hostIds.size());
+    Assert.assertEquals(1L, hostIds.keySet().iterator().next().longValue());
+    Assert.assertEquals(2L, hostIds.get(1L).iterator().next().longValue());
+  }
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/30bea532/ambari-server/src/test/java/org/apache/ambari/server/controller/utilities/DatabaseCheckerTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/controller/utilities/DatabaseCheckerTest.java b/ambari-server/src/test/java/org/apache/ambari/server/controller/utilities/DatabaseCheckerTest.java
deleted file mode 100644
index 3f73657..0000000
--- a/ambari-server/src/test/java/org/apache/ambari/server/controller/utilities/DatabaseCheckerTest.java
+++ /dev/null
@@ -1,105 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ambari.server.controller.utilities;
-
-import static org.easymock.EasyMock.createMock;
-import static org.easymock.EasyMock.expect;
-import static org.easymock.EasyMock.replay;
-import static org.junit.Assert.fail;
-
-import java.sql.SQLException;
-
-import org.apache.ambari.server.AmbariException;
-import org.apache.ambari.server.H2DatabaseCleaner;
-import org.apache.ambari.server.api.services.AmbariMetaInfo;
-import org.apache.ambari.server.configuration.Configuration;
-import org.apache.ambari.server.orm.GuiceJpaInitializer;
-import org.apache.ambari.server.orm.InMemoryDefaultTestModule;
-import org.apache.ambari.server.orm.dao.MetainfoDAO;
-import org.apache.ambari.server.orm.entities.MetainfoEntity;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.Ignore;
-import org.junit.Test;
-
-import com.google.inject.Guice;
-import com.google.inject.Inject;
-import com.google.inject.Injector;
-
-/*Ignore this test because DatabaseChecker is not used anymore and it will be removed soon*/
-
-public class DatabaseCheckerTest {
-  private static Injector injector;
-
-  @Inject
-  private AmbariMetaInfo ambariMetaInfo;
-
-  @BeforeClass
-  public static void setupClass() throws Exception {
-    injector = Guice.createInjector(new InMemoryDefaultTestModule());
-    injector.getInstance(GuiceJpaInitializer.class);
-  }
-
-  @Before
-  public void setup() throws Exception {
-    injector.injectMembers(this);
-  }
-
-  @After
-  public void teardown() throws AmbariException, SQLException {
-    H2DatabaseCleaner.clearDatabaseAndStopPersistenceService(injector);
-  }
-
-  @Ignore
-  @Test
-  public void testCheckDBVersion_Valid() throws Exception {
-    MetainfoDAO metainfoDAO =  createMock(MetainfoDAO.class);
-    MetainfoEntity metainfoEntity = new MetainfoEntity();
-    String serverVersion = ambariMetaInfo.getServerVersion();
-    metainfoEntity.setMetainfoName(Configuration.SERVER_VERSION_KEY);
-    metainfoEntity.setMetainfoValue(serverVersion);
-    expect(metainfoDAO.findByKey(Configuration.SERVER_VERSION_KEY)).
-      andReturn(metainfoEntity);
-    replay(metainfoDAO);
-    DatabaseChecker.metainfoDAO = metainfoDAO;
-    DatabaseChecker.ambariMetaInfo = ambariMetaInfo;
-    try {
-      DatabaseChecker.checkDBVersion();
-    } catch (AmbariException ae) {
-      fail("DB versions check failed.");
-    }
-  }
-
-  @Ignore
-  @Test(expected = AmbariException.class)
-  public void testCheckDBVersionInvalid() throws Exception {
-    MetainfoDAO metainfoDAO =  createMock(MetainfoDAO.class);
-    MetainfoEntity metainfoEntity = new MetainfoEntity();
-    metainfoEntity.setMetainfoName(Configuration.SERVER_VERSION_KEY);
-    metainfoEntity.setMetainfoValue("0.0.0"); // Incompatible version
-    expect(metainfoDAO.findByKey(Configuration.SERVER_VERSION_KEY)).
-      andReturn(metainfoEntity);
-    replay(metainfoDAO);
-    DatabaseChecker.metainfoDAO = metainfoDAO;
-    DatabaseChecker.ambariMetaInfo = ambariMetaInfo;
-
-    DatabaseChecker.checkDBVersion();
-  }
-}


[4/8] ambari git commit: AMBARI-21658. Check for config group host mapping left behind after host delete. Addendum to output message. (swagle)

Posted by jo...@apache.org.
AMBARI-21658. Check for config group host mapping left behind after host delete. Addendum to output message. (swagle)


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

Branch: refs/heads/branch-2.6
Commit: a43a9564ca0b7874a32e981f647d3c26bb9a6dc3
Parents: 30bea53
Author: Siddharth Wagle <sw...@hortonworks.com>
Authored: Thu Aug 3 22:29:14 2017 -0700
Committer: Siddharth Wagle <sw...@hortonworks.com>
Committed: Thu Aug 3 22:29:14 2017 -0700

----------------------------------------------------------------------
 .../ambari/server/checks/DatabaseConsistencyCheckHelper.java     | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/a43a9564/ambari-server/src/main/java/org/apache/ambari/server/checks/DatabaseConsistencyCheckHelper.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/checks/DatabaseConsistencyCheckHelper.java b/ambari-server/src/main/java/org/apache/ambari/server/checks/DatabaseConsistencyCheckHelper.java
index d546169..533fad7 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/checks/DatabaseConsistencyCheckHelper.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/checks/DatabaseConsistencyCheckHelper.java
@@ -1168,6 +1168,7 @@ public class DatabaseConsistencyCheckHelper {
             // in the host table
             Map<Long, Host> hosts = configGroup.getHosts();
             boolean addToOutput = false;
+            Set<String> hostnames = new HashSet<>();
             if (!MapUtils.isEmpty(hosts)) {
               for (Host host : hosts.values()) {
                 // Lookup by hostname - It does have a unique constraint
@@ -1178,6 +1179,7 @@ public class DatabaseConsistencyCheckHelper {
                     nonMappedHostIds.put(configGroup.getId(), hostIds);
                   }
                   hostIds.add(host.getHostId());
+                  hostnames.add(host.getHostName());
                   addToOutput = true;
                 }
               }
@@ -1188,7 +1190,7 @@ public class DatabaseConsistencyCheckHelper {
               output.append(", ");
               output.append(configGroup.getTag());
               output.append(", ");
-              output.append(nonMappedHostIds.get(configGroup.getId()).size());
+              output.append(hostnames);
               output.append(" ), ");
             }
           }


[8/8] ambari git commit: Merge branch 'branch-2.5' into branch-2.6

Posted by jo...@apache.org.
Merge branch 'branch-2.5' into branch-2.6


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

Branch: refs/heads/branch-2.6
Commit: 7efb9de2bdc85d1d5cef422ea3186bc31798f1e6
Parents: 328735d b9e16b9
Author: Jonathan Hurley <jh...@hortonworks.com>
Authored: Fri Aug 4 09:10:45 2017 -0400
Committer: Jonathan Hurley <jh...@hortonworks.com>
Committed: Fri Aug 4 09:10:45 2017 -0400

----------------------------------------------------------------------
 .../libraries/functions/version.py              |   6 +
 .../ambari-metrics/datasource.js                |  35 +-
 .../checks/DatabaseConsistencyCheckHelper.java  | 115 +++++++
 .../controller/utilities/DatabaseChecker.java   | 305 -----------------
 .../state/configgroup/ConfigGroupImpl.java      |   6 +-
 .../HDF/grafana-nifi-hosts.json                 |  17 +-
 .../src/main/resources/scripts/stack_advisor.py |   7 +
 .../DatabaseConsistencyCheckHelperTest.java     |  77 +++++
 .../utilities/DatabaseCheckerTest.java          | 105 ------
 .../app/controllers/wizard/step1_controller.js  |   2 +
 ambari-web/app/routes/installer.js              |   4 +-
 ambari-web/app/templates/wizard/step1.hbs       | 342 ++++++++++---------
 ambari-web/app/views/wizard/step1_view.js       |   2 +-
 .../test/controllers/wizard/step1_test.js       |   2 +
 ambari-web/test/views/wizard/step1_view_test.js |   2 +-
 15 files changed, 437 insertions(+), 590 deletions(-)
----------------------------------------------------------------------



[6/8] ambari git commit: AMBARI-21660 Stack selection page does not load the HDP stacks. (ababiichuk)

Posted by jo...@apache.org.
AMBARI-21660 Stack selection page does not load the HDP stacks. (ababiichuk)


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

Branch: refs/heads/branch-2.6
Commit: cb327a005d77694433b5b8bea824804ec1fd2bd0
Parents: 2003967
Author: ababiichuk <ab...@hortonworks.com>
Authored: Fri Aug 4 15:07:13 2017 +0300
Committer: ababiichuk <ab...@hortonworks.com>
Committed: Fri Aug 4 15:07:13 2017 +0300

----------------------------------------------------------------------
 .../app/controllers/wizard/step1_controller.js  |   2 +
 ambari-web/app/routes/installer.js              |   4 +-
 ambari-web/app/templates/wizard/step1.hbs       | 342 ++++++++++---------
 ambari-web/app/views/wizard/step1_view.js       |   2 +-
 .../test/controllers/wizard/step1_test.js       |   2 +
 ambari-web/test/views/wizard/step1_view_test.js |   2 +-
 6 files changed, 186 insertions(+), 168 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/cb327a00/ambari-web/app/controllers/wizard/step1_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/wizard/step1_controller.js b/ambari-web/app/controllers/wizard/step1_controller.js
index a1ebad8..5e72e72 100644
--- a/ambari-web/app/controllers/wizard/step1_controller.js
+++ b/ambari-web/app/controllers/wizard/step1_controller.js
@@ -129,6 +129,8 @@ App.WizardStep1Controller = Em.Controller.extend({
    */
   selectedStackType: Em.computed.findBy('availableStackTypes', 'isSelected', true),
 
+  isLoadingComplete: Em.computed.equal('wizardController.loadStacksRequestsCounter', 0),
+
   /**
    * Load selected file to current page content
    */

http://git-wip-us.apache.org/repos/asf/ambari/blob/cb327a00/ambari-web/app/routes/installer.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/routes/installer.js b/ambari-web/app/routes/installer.js
index 10141e4..a320539 100644
--- a/ambari-web/app/routes/installer.js
+++ b/ambari-web/app/routes/installer.js
@@ -146,9 +146,11 @@ module.exports = Em.Route.extend(App.RouterRedirections, {
     route: '/step1',
     connectOutlets: function (router) {
       console.time('step1 connectOutlets');
-      var controller = router.get('installerController');
+      var controller = router.get('installerController'),
+        wizardStep1Controller = router.get('wizardStep1Controller');
       controller.setCurrentStep('1');
       controller.loadAllPriorSteps().done(function () {
+        wizardStep1Controller.set('wizardController', controller);
         controller.connectOutlet('wizardStep1', controller.get('content'));
         console.timeEnd('step1 connectOutlets');
       });

http://git-wip-us.apache.org/repos/asf/ambari/blob/cb327a00/ambari-web/app/templates/wizard/step1.hbs
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates/wizard/step1.hbs b/ambari-web/app/templates/wizard/step1.hbs
index 7c5bc21..485bd5d 100644
--- a/ambari-web/app/templates/wizard/step1.hbs
+++ b/ambari-web/app/templates/wizard/step1.hbs
@@ -19,196 +19,208 @@
   <h2>{{t installer.step1.header}}</h2>
   <p class="alert alert-info">{{t installer.step1.body}}</p>
 
-  {{! left tabs }}
-  <div class="row-fluid">
-    <div class="span2">
-      <ul class="nav nav-tabs tabs-left">
-        {{#each stack in availableStackTypes}}
-          <li {{bindAttr class="stack.isSelected:active"}}><a {{action "selectRepoInList" stack target="controller"}} href="#">{{stack.stackName}}</a></li>
-        {{/each}}
-      </ul>
-    </div>
+  {{#if isLoadingComplete}}
+    {{! left tabs }}
+    <div class="row-fluid">
+      <div class="span2">
+        <ul class="nav nav-tabs tabs-left">
+          {{#each stack in availableStackTypes}}
+            <li {{bindAttr class="stack.isSelected:active"}}><a {{action "selectRepoInList" stack target="controller"}}
+              href="#">{{stack.stackName}}</a></li>
+          {{/each}}
+        </ul>
+      </div>
 
-    <div class="span10">
-      <div class="tab-content">
-        <div class="accordion-group details-panel">
-          <div class="accordion-body">
-            <div class="accordion-inner">
-              <div class="row-fluid">
-                <div class="version-info">
-                  <div class="btn-group">
-                    <button type="button" data-toggle="dropdown" class="btn dropdown-toggle btn-info">{{controller.selectedStack.displayName}} <span class="caret"></span></button>
-                    <ul class="dropdown-menu">
-                      {{#each stack in selectedStackType.stacks}}
-                        <li>
-                          {{!view view.stackRadioButton stackBinding="stack"}}
-                          <a href="#" {{action "changeVersion" stack target="controller"}}>{{stack.displayName}}
-                            {{#if stack.stackDefault}}
-                              ({{t installer.step1.changeVersion.defaultVersion}})
-                            {{/if}}
-                          </a>
-                        </li>
+      <div class="span10">
+        <div class="tab-content">
+          <div class="accordion-group details-panel">
+            <div class="accordion-body">
+              <div class="accordion-inner">
+                <div class="row-fluid">
+                  <div class="version-info">
+                    <div class="btn-group">
+                      <button type="button" data-toggle="dropdown"
+                              class="btn dropdown-toggle btn-info">{{controller.selectedStack.displayName}} <span
+                        class="caret"></span></button>
+                      <ul class="dropdown-menu">
+                        {{#each stack in selectedStackType.stacks}}
+                          <li>
+                            {{!view view.stackRadioButton stackBinding="stack"}}
+                            <a href="#" {{action "changeVersion" stack target="controller"}}>{{stack.displayName}}
+                              {{#if stack.stackDefault}}
+                                ({{t installer.step1.changeVersion.defaultVersion}})
+                              {{/if}}
+                            </a>
+                          </li>
+                        {{/each}}
+                        <li><a href="#" {{action "uploadVdf" target="controller"}}>{{t installer.step1.addVersion}}
+                          ...</a></li>
+                      </ul>
+                    </div>
+                  </div>
+                  <div class="version-contents-section">
+                    {{#unless servicesForSelectedStack}}
+                      <div class="alert alert-info"
+                           role="alert">{{t installer.step1.useLocalRepo.infoForm.content.empty}}</div>
+                    {{/unless}}
+                    <table class="table table-striped table-condensed">
+                      {{#each service in servicesForSelectedStack}}
+                        <tr>
+                          <td class="span4">{{service.displayName}}</td>
+                          <td class="span8">{{service.latestVersion}}</td>
+                        </tr>
                       {{/each}}
-                      <li><a href="#" {{action "uploadVdf" target="controller"}}>{{t installer.step1.addVersion}} ...</a></li>
-                    </ul>
+                    </table>
                   </div>
                 </div>
-                <div class="version-contents-section">
-                  {{#unless servicesForSelectedStack}}
-                    <div class="alert alert-info" role="alert">{{t installer.step1.useLocalRepo.infoForm.content.empty}}</div>
-                  {{/unless}}
-                  <table class="table table-striped table-condensed">
-                  {{#each service in servicesForSelectedStack}}
-                    <tr>
-                      <td class="span4">{{service.displayName}}</td>
-                      <td class="span8">{{service.latestVersion}}</td>
-                    </tr>
-                  {{/each}}
-                  </table>
-                </div>
               </div>
             </div>
           </div>
         </div>
       </div>
     </div>
-  </div>
-  {{! left tabs end }}
+    {{! left tabs end }}
 
-  {{! Public Repository radio }}
-  <label {{bindAttr class=":radio :big-radio :public-radio"}}>
-    {{view view.usePublicRepoRadioButton}} {{t installer.step1.selectUseRepoOptions.public}}
-    {{#if networkIssuesExist}}
-      <a id="public-disabled-link" {{action "openPublicOptionDisabledWindow" target="view"}}>{{t installer.step1.selectUseRepoOptions.public.networkLost}}</a>
-    {{/if}}
-  </label>
-  {{! Public Repository radio END }}
+    {{! Public Repository radio }}
+    <label {{bindAttr class=":radio :big-radio :public-radio"}}>
+      {{view view.usePublicRepoRadioButton}} {{t installer.step1.selectUseRepoOptions.public}}
+      {{#if networkIssuesExist}}
+        <a
+          id="public-disabled-link" {{action "openPublicOptionDisabledWindow" target="view"}}>{{t installer.step1.selectUseRepoOptions.public.networkLost}}</a>
+      {{/if}}
+    </label>
+    {{! Public Repository radio END }}
 
-  {{!--Local repo loaded info below--}}
-  <label class="radio big-radio">{{view view.useLocalRepoRadioButton}} {{t installer.step1.selectUseRepoOptions.local}}</label>
+    {{!--Local repo loaded info below--}}
+    <label
+      class="radio big-radio">{{view view.useLocalRepoRadioButton}} {{t installer.step1.selectUseRepoOptions.local}}</label>
 
-  {{#if App.router.nextBtnClickInProgress}}
-    {{view App.SpinnerView}}
-  {{else}}
-  <form id="repoVersionInfoForm" class="form-horizontal" role="form" name="localVersionInfoForm" novalidate>
-
-    <div class="accordion-group repos-panel">
-      <div class="accordion-heading">
-        <p>{{t common.repositories}}</p>
-      </div>
-      <div class="accordion-body version-contents-body">
-        <div class="accordion-inner">
-          <div class="alert alert-info" role="alert">{{t installer.step1.useLocalRepo.infoForm.alert.baseUrl}}</div>
-          {{#if view.showWarning}}
-            <div class="alert">{{t installer.step1.attentionNeeded}}</div>
-          {{/if}}
+    {{#if App.router.nextBtnClickInProgress}}
+      {{view App.SpinnerView}}
+    {{else}}
+      <form id="repoVersionInfoForm" class="form-horizontal" role="form" name="localVersionInfoForm" novalidate>
 
-          {{! OSes and Repositories }}
-          <div class="clearfix repo-table-title row-fluid">
-            <div class="span2"><label>{{t common.os}}</label></div>
-            <div class="span9">
-              <div class="span3"><label>{{t common.name}}</label></div>
-              <div class="span1"></div>
-              <div class="span8"><label>{{t installer.step1.advancedRepo.localRepo.column.baseUrl}}</label></div>
-            </div>
-            <div class="span1">
-              {{! Add OS }}
-              <div class="add-os-button btn-group pull-right">
-                <button
-                  type="button" {{bindAttr data-original-title="view.addOsButtonTooltip"  class=":btn :dropdown-toggle :add-os-button view.isAddOsButtonDisabled:disabled"}}
-                  data-toggle="dropdown">
-                  <i class="icon-plus"></i> {{t common.add}} &nbsp;<span class="caret"></span>
-                </button>
-                <ul class="dropdown-menu">
-                  {{#each operatingSystem in selectedStack.operatingSystems}}
-                    {{#unless operatingSystem.isSelected}}
-                      <li><a {{action "addOS" operatingSystem target="controller"}}>{{operatingSystem.osType}}</a></li>
-                    {{/unless}}
-                  {{/each}}
-                </ul>
-              </div>
-              {{! Add OS END}}
-            </div>
+        <div class="accordion-group repos-panel">
+          <div class="accordion-heading">
+            <p>{{t common.repositories}}</p>
           </div>
+          <div class="accordion-body version-contents-body">
+            <div class="accordion-inner">
+              <div class="alert alert-info" role="alert">{{t installer.step1.useLocalRepo.infoForm.alert.baseUrl}}</div>
+              {{#if view.showWarning}}
+                <div class="alert">{{t installer.step1.attentionNeeded}}</div>
+              {{/if}}
 
-          {{#each operatingSystem in selectedStack.operatingSystems}}
-            {{#if operatingSystem.isSelected}}
-              <div {{bindAttr class=":clearfix :row-fluid :border-bottom operatingSystem.osType"}}>
-                <div class="span2 os-type-label">
-                  <label>{{operatingSystem.osType}}</label>
+              {{! OSes and Repositories }}
+              <div class="clearfix repo-table-title row-fluid">
+                <div class="span2"><label>{{t common.os}}</label></div>
+                <div class="span9">
+                  <div class="span3"><label>{{t common.name}}</label></div>
+                  <div class="span1"></div>
+                  <div class="span8"><label>{{t installer.step1.advancedRepo.localRepo.column.baseUrl}}</label></div>
+                </div>
+                <div class="span1">
+                  {{! Add OS }}
+                  <div class="add-os-button btn-group pull-right">
+                    <button
+                      type="button" {{bindAttr data-original-title="view.addOsButtonTooltip"  class=":btn :dropdown-toggle :add-os-button view.isAddOsButtonDisabled:disabled"}}
+                      data-toggle="dropdown">
+                      <i class="icon-plus"></i> {{t common.add}} &nbsp;<span class="caret"></span>
+                    </button>
+                    <ul class="dropdown-menu">
+                      {{#each operatingSystem in selectedStack.operatingSystems}}
+                        {{#unless operatingSystem.isSelected}}
+                          <li><a {{action "addOS" operatingSystem target="controller"}}>{{operatingSystem.osType}}</a>
+                          </li>
+                        {{/unless}}
+                      {{/each}}
+                    </ul>
+                  </div>
+                  {{! Add OS END}}
                 </div>
-                <div class="span9 repo-name-url">
-                  {{#each repository in operatingSystem.repositories}}
-                    <div {{bindAttr class=":clearfix :repo-name-url-inner repository.repoName"}}>
-                      <div class="span3">
-                        <label class="repo-name-label control-label">{{repository.repoId}}</label>
-                      </div>
-                      <div class="validation-td span1">
-                        {{#if repository.validation}}
-                          {{view view.popoverView repositoryBinding="repository"}}
-                        {{/if}}
-                      </div>
-                      <div {{bindAttr class=":span8 :repo-url repository.invalidFormatError:textfield-error repository.invalidError:textfield-error"}}>
-                        {{view Ember.TextField placeholderBinding="repository.placeholder" valueBinding="repository.baseUrl" disabledBinding="controller.selectedStack.useRedhatSatellite"}}
-                          {{#if controller.selectedStack.usePublicRepo}}
-                            {{#if repository.undo}}
-                              <i class="icon-undo" data-toggle="tooltip"
-                                {{action "doRestoreDefaultValue" repository target="controller"}}
-                                {{translateAttr title="common.undo"}}>
-                              </i>
+              </div>
+
+              {{#each operatingSystem in selectedStack.operatingSystems}}
+                {{#if operatingSystem.isSelected}}
+                  <div {{bindAttr class=":clearfix :row-fluid :border-bottom operatingSystem.osType"}}>
+                    <div class="span2 os-type-label">
+                      <label>{{operatingSystem.osType}}</label>
+                    </div>
+                    <div class="span9 repo-name-url">
+                      {{#each repository in operatingSystem.repositories}}
+                        <div {{bindAttr class=":clearfix :repo-name-url-inner repository.repoName"}}>
+                          <div class="span3">
+                            <label class="repo-name-label control-label">{{repository.repoId}}</label>
+                          </div>
+                          <div class="validation-td span1">
+                            {{#if repository.validation}}
+                              {{view view.popoverView repositoryBinding="repository"}}
                             {{/if}}
-                          {{else}}
-                            {{#if repository.notEmpty}}
-                              <i class="icon-undo" data-toggle="tooltip"
-                                {{action "doRestoreToEmpty" repository target="controller"}}
-                                {{translateAttr title="common.undo"}}>
-                              </i>
+                          </div>
+                          <div {{bindAttr class=":span8 :repo-url repository.invalidFormatError:textfield-error repository.invalidError:textfield-error"}}>
+                            {{view Ember.TextField placeholderBinding="repository.placeholder" valueBinding="repository.baseUrl" disabledBinding="controller.selectedStack.useRedhatSatellite"}}
+                            {{#if controller.selectedStack.usePublicRepo}}
+                              {{#if repository.undo}}
+                                <i class="icon-undo" data-toggle="tooltip"
+                                  {{action "doRestoreDefaultValue" repository target="controller"}}
+                                  {{translateAttr title="common.undo"}}>
+                                </i>
+                              {{/if}}
+                            {{else}}
+                              {{#if repository.notEmpty}}
+                                <i class="icon-undo" data-toggle="tooltip"
+                                  {{action "doRestoreToEmpty" repository target="controller"}}
+                                  {{translateAttr title="common.undo"}}>
+                                </i>
+                              {{/if}}
                             {{/if}}
-                          {{/if}}
-                      </div>
+                          </div>
+                        </div>
+                      {{/each}}
                     </div>
-                  {{/each}}
-                </div>
-                <div {{bindAttr class=":span1 :remove-icon controller.selectedStack.useRedhatSatellite:disabled"}} {{action "removeOS" operatingSystem target="controller"}}>
-                  <i class="icon-minus"></i>{{t common.remove}}</div>
-              </div>
-            {{/if}}
-          {{/each}}
-          {{! OSes and Repositories END }}
+                    <div {{bindAttr class=":span1 :remove-icon controller.selectedStack.useRedhatSatellite:disabled"}} {{action "removeOS" operatingSystem target="controller"}}>
+                      <i class="icon-minus"></i>{{t common.remove}}</div>
+                  </div>
+                {{/if}}
+              {{/each}}
+              {{! OSes and Repositories END }}
 
-          {{! Skip Repository Base URL validation }}
-          <div id="skip-validation" {{bindAttr class="controller.selectedStack.useRedhatSatellite:disabled"}}>
-            <label>
-              {{view Ember.Checkbox checkedBinding="skipValidationChecked" disabledBinding="controller.selectedStack.useRedhatSatellite" class="checkbox"}}
-              <span {{bindAttr class="controller.selectedStack.useRedhatSatellite:disabled"}}>{{t installer.step1.advancedRepo.skipValidation.message}}</span>
-              <i class="icon-question-sign" rel="skip-validation-tooltip"
-                 data-toggle="tooltip" {{translateAttr title="installer.step1.advancedRepo.skipValidation.tooltip"}}>
-              </i>
-            </label>
-          </div>
-          {{! Skip Repository Base URL validation END }}
+              {{! Skip Repository Base URL validation }}
+              <div id="skip-validation" {{bindAttr class="controller.selectedStack.useRedhatSatellite:disabled"}}>
+                <label>
+                  {{view Ember.Checkbox checkedBinding="skipValidationChecked" disabledBinding="controller.selectedStack.useRedhatSatellite" class="checkbox"}}
+                  <span {{bindAttr class="controller.selectedStack.useRedhatSatellite:disabled"}}>{{t installer.step1.advancedRepo.skipValidation.message}}</span>
+                  <i class="icon-question-sign" rel="skip-validation-tooltip"
+                     data-toggle="tooltip" {{translateAttr title="installer.step1.advancedRepo.skipValidation.tooltip"}}>
+                  </i>
+                </label>
+              </div>
+              {{! Skip Repository Base URL validation END }}
 
-          {{! Use RedHat Satellite/Spacewalk }}
-          <div id="use-redhat">
-            <label>
-              {{view view.redhatCheckBoxView}}
-              <span {{bindAttr class=":redhat-label controller.selectedStack.usePublicRepo:disabled" data-original-title="view.redhatDisabledTooltip"}}>{{t installer.step1.advancedRepo.useRedhatSatellite.message}}</span>
-              <i class="icon-question-sign" rel="use-redhat-tooltip"
-                 data-toggle="tooltip" {{translateAttr title="installer.step1.advancedRepo.useRedhatSatellite.tooltip"}}>
-              </i>
-            </label>
+              {{! Use RedHat Satellite/Spacewalk }}
+              <div id="use-redhat">
+                <label>
+                  {{view view.redhatCheckBoxView}}
+                  <span {{bindAttr class=":redhat-label controller.selectedStack.usePublicRepo:disabled" data-original-title="view.redhatDisabledTooltip"}}>{{t installer.step1.advancedRepo.useRedhatSatellite.message}}</span>
+                  <i class="icon-question-sign" rel="use-redhat-tooltip"
+                     data-toggle="tooltip" {{translateAttr title="installer.step1.advancedRepo.useRedhatSatellite.tooltip"}}>
+                  </i>
+                </label>
+              </div>
+              {{! Use RedHat Satellite/Spacewalk END }}
+            </div>
           </div>
-          {{! Use RedHat Satellite/Spacewalk END }}
         </div>
+      </form>
+    {{/if}}
+    {{#if view.invalidUrlExist}}
+      <div class="alert">
+        {{t installer.step1.invalidURLAttention}}
+        <a href="javascript:void(null)" {{action "retryRepoUrls" target="view"}}>{{t installer.step1.retryRepoUrls}}</a>
       </div>
-    </div>
-  </form>
-  {{/if}}
-  {{#if view.invalidUrlExist}}
-    <div class="alert">
-      {{t installer.step1.invalidURLAttention}}
-      <a href="javascript:void(null)" {{action "retryRepoUrls" target="view"}}>{{t installer.step1.retryRepoUrls}}</a>
-    </div>
+    {{/if}}
+  {{else}}
+    {{view App.SpinnerView}}
   {{/if}}
   <button type="button" class="btn pull-left installer-back-btn" {{bindAttr disabled="App.router.btnClickInProgress"}} {{action back}}>
     &larr; {{t common.back}}

http://git-wip-us.apache.org/repos/asf/ambari/blob/cb327a00/ambari-web/app/views/wizard/step1_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/wizard/step1_view.js b/ambari-web/app/views/wizard/step1_view.js
index 3e74f23..ccbc844 100644
--- a/ambari-web/app/views/wizard/step1_view.js
+++ b/ambari-web/app/views/wizard/step1_view.js
@@ -69,7 +69,7 @@ App.WizardStep1View = Em.View.extend({
    *
    * @type {bool}
    */
-  isSubmitDisabled: Em.computed.or('invalidFormatUrlExist', 'isNoOsChecked', 'isNoOsFilled', 'controller.content.isCheckInProgress', 'App.router.btnClickInProgress'),
+  isSubmitDisabled: Em.computed.or('invalidFormatUrlExist', 'isNoOsChecked', 'isNoOsFilled', 'controller.content.isCheckInProgress', 'App.router.btnClickInProgress', '!controller.isLoadingComplete'),
 
   /**
    * Show warning message flag

http://git-wip-us.apache.org/repos/asf/ambari/blob/cb327a00/ambari-web/test/controllers/wizard/step1_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/wizard/step1_test.js b/ambari-web/test/controllers/wizard/step1_test.js
index 296fe50..88cb231 100644
--- a/ambari-web/test/controllers/wizard/step1_test.js
+++ b/ambari-web/test/controllers/wizard/step1_test.js
@@ -76,6 +76,8 @@ describe('App.WizardStep1Controller', function () {
 
   App.TestAliases.testAsComputedEveryBy(getController(), 'networkIssuesExist', 'content.stacks', 'stackDefault', true);
 
+  App.TestAliases.testAsComputedEqual(getController(), 'isLoadingComplete', 'wizardController.loadStacksRequestsCounter', 0);
+
   describe('#usePublicRepo', function () {
 
     beforeEach(function () {

http://git-wip-us.apache.org/repos/asf/ambari/blob/cb327a00/ambari-web/test/views/wizard/step1_view_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/views/wizard/step1_view_test.js b/ambari-web/test/views/wizard/step1_view_test.js
index 84957a9..66db304 100644
--- a/ambari-web/test/views/wizard/step1_view_test.js
+++ b/ambari-web/test/views/wizard/step1_view_test.js
@@ -35,7 +35,7 @@ describe('App.WizardStep1View', function () {
 
   App.TestAliases.testAsComputedEveryBy(getView(), 'isNoOsChecked', 'controller.selectedStack.operatingSystems', 'isSelected', false);
 
-  App.TestAliases.testAsComputedOr(getView(), 'isSubmitDisabled', ['invalidFormatUrlExist', 'isNoOsChecked', 'isNoOsFilled', 'controller.content.isCheckInProgress', 'App.router.btnClickInProgress']);
+  App.TestAliases.testAsComputedOr(getView(), 'isSubmitDisabled', ['invalidFormatUrlExist', 'isNoOsChecked', 'isNoOsFilled', 'controller.content.isCheckInProgress', 'App.router.btnClickInProgress', '!controller.isLoadingComplete']);
 
   App.TestAliases.testAsComputedSomeBy(getView(), 'invalidUrlExist', 'allRepositories', 'validation', App.Repository.validation.INVALID);
 


[7/8] ambari git commit: AMBARI-21654 Post Ambari upgrade, BI value add 4.2 services should still be able to restart (dili)

Posted by jo...@apache.org.
AMBARI-21654 Post Ambari upgrade, BI value add 4.2 services should still be able to restart (dili)


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

Branch: refs/heads/branch-2.6
Commit: b9e16b97a6941a30dd33e2d4c4a1734e20a714a3
Parents: cb327a0
Author: Di Li <di...@apache.org>
Authored: Fri Aug 4 08:57:45 2017 -0400
Committer: Di Li <di...@apache.org>
Committed: Fri Aug 4 08:57:45 2017 -0400

----------------------------------------------------------------------
 .../python/resource_management/libraries/functions/version.py  | 6 ++++++
 1 file changed, 6 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/b9e16b97/ambari-common/src/main/python/resource_management/libraries/functions/version.py
----------------------------------------------------------------------
diff --git a/ambari-common/src/main/python/resource_management/libraries/functions/version.py b/ambari-common/src/main/python/resource_management/libraries/functions/version.py
index 7dfa6b8..311f622 100644
--- a/ambari-common/src/main/python/resource_management/libraries/functions/version.py
+++ b/ambari-common/src/main/python/resource_management/libraries/functions/version.py
@@ -33,6 +33,12 @@ def _normalize(v, desired_segments=0):
     v_list = v_list + ((desired_segments - len(v_list)) * ["0", ])
   return [int(x) for x in v_list]
 
+"""
+Ensure backword compatibility for older IOP services.
+These services do not get updated service definitions so their Python API references are old.
+"""
+def format_hdp_stack_version(input):
+  return format_stack_version(input)
 
 def format_stack_version(input):
   """


[2/8] ambari git commit: AMBARI-21554. Regenerating keytabs fails in Stack Advisor after upgrading Ambari

Posted by jo...@apache.org.
AMBARI-21554. Regenerating keytabs fails in Stack Advisor after upgrading Ambari


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

Branch: refs/heads/branch-2.6
Commit: d72f32936c502d6420f4e0623c2adab1b0646247
Parents: b167d3b
Author: Attila Doroszlai <ad...@hortonworks.com>
Authored: Thu Aug 3 14:37:44 2017 +0200
Committer: Attila Doroszlai <ad...@hortonworks.com>
Committed: Thu Aug 3 23:06:22 2017 +0200

----------------------------------------------------------------------
 ambari-server/src/main/resources/scripts/stack_advisor.py | 7 +++++++
 1 file changed, 7 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/d72f3293/ambari-server/src/main/resources/scripts/stack_advisor.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/scripts/stack_advisor.py b/ambari-server/src/main/resources/scripts/stack_advisor.py
index 66ab248..8e314ff 100755
--- a/ambari-server/src/main/resources/scripts/stack_advisor.py
+++ b/ambari-server/src/main/resources/scripts/stack_advisor.py
@@ -42,6 +42,11 @@ STACK_ADVISOR_DEFAULT_IMPL_CLASS = 'DefaultStackAdvisor'
 STACK_ADVISOR_IMPL_PATH_TEMPLATE = os.path.join(SCRIPT_DIRECTORY, './../stacks/{0}/{1}/services/stack_advisor.py')
 STACK_ADVISOR_IMPL_CLASS_TEMPLATE = '{0}{1}StackAdvisor'
 
+# Stack advisor may have deeper inheritance than the stack,
+# eg. BigInsights 4.0 is top-level, but its stack advisor inherits from HDP 2.5.
+# The extra classes are defined in the following directory:
+STACK_ADVISOR_BASE_MODULES = os.path.join(SCRIPT_DIRECTORY, '../stacks/{0}/{1}/stack-advisor')
+
 ADVISOR_CONTEXT = "advisor_context"
 CALL_TYPE = "call_type"
 
@@ -139,6 +144,8 @@ def instantiateStackAdvisor(stackName, stackVersion, parentVersions):
   versions = [stackVersion]
   versions.extend(parentVersions)
 
+  sys.path.append(STACK_ADVISOR_BASE_MODULES.format(stackName, versions[-1]))
+
   for version in reversed(versions):
     try:
       path = STACK_ADVISOR_IMPL_PATH_TEMPLATE.format(stackName, version)


[5/8] ambari git commit: AMBARI-21650: Ranger Usersync process starts with older stack script during cross stack upgrade (mugdha)

Posted by jo...@apache.org.
AMBARI-21650: Ranger Usersync process starts with older stack script during cross stack upgrade (mugdha)


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

Branch: refs/heads/branch-2.6
Commit: 20039679dfb027c95d92407f6528a88bd2571488
Parents: a43a956
Author: Mugdha Varadkar <mu...@apache.org>
Authored: Thu Aug 3 17:23:33 2017 +0530
Committer: Mugdha Varadkar <mu...@apache.org>
Committed: Fri Aug 4 11:38:22 2017 +0530

----------------------------------------------------------------------
 .../RANGER/0.4.0/package/scripts/setup_ranger_xml.py           | 6 ++++++
 1 file changed, 6 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/20039679/ambari-server/src/main/resources/common-services/RANGER/0.4.0/package/scripts/setup_ranger_xml.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/RANGER/0.4.0/package/scripts/setup_ranger_xml.py b/ambari-server/src/main/resources/common-services/RANGER/0.4.0/package/scripts/setup_ranger_xml.py
index 2fa7b2f..35a0363 100644
--- a/ambari-server/src/main/resources/common-services/RANGER/0.4.0/package/scripts/setup_ranger_xml.py
+++ b/ambari-server/src/main/resources/common-services/RANGER/0.4.0/package/scripts/setup_ranger_xml.py
@@ -527,6 +527,12 @@ def setup_usersync(upgrade_type=None):
     mode = 0755,
   )
 
+  if upgrade_type is not None and params.stack_supports_config_versioning:
+    if os.path.islink('/usr/bin/ranger-usersync'):
+      Link('/usr/bin/ranger-usersync', action="delete")
+
+    Link('/usr/bin/ranger-usersync', to=params.usersync_services_file)
+
   Execute(('ln','-sf', format('{usersync_services_file}'),'/usr/bin/ranger-usersync'),
     not_if=format("ls /usr/bin/ranger-usersync"),
     only_if=format("ls {usersync_services_file}"),