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 2016/10/18 19:32:53 UTC

[01/12] ambari git commit: AMBARI-18588 Ambari server should not crash with NPE when parsing HTTP response for YARN RM properties (dili)

Repository: ambari
Updated Branches:
  refs/heads/branch-feature-AMBARI-18456 2c6008293 -> 532caef33


AMBARI-18588 Ambari server should not crash with NPE when parsing HTTP response for YARN RM properties (dili)


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

Branch: refs/heads/branch-feature-AMBARI-18456
Commit: 73f1dea9674359ecbfd723917c83913b20986906
Parents: 41c49e1
Author: Di Li <di...@apache.org>
Authored: Mon Oct 17 10:35:25 2016 -0400
Committer: Di Li <di...@apache.org>
Committed: Mon Oct 17 10:35:25 2016 -0400

----------------------------------------------------------------------
 .../server/controller/internal/JsonHttpPropertyRequest.java    | 6 ++++--
 .../ambari/server/controller/internal/URLStreamProvider.java   | 3 +++
 2 files changed, 7 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/73f1dea9/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/JsonHttpPropertyRequest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/JsonHttpPropertyRequest.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/JsonHttpPropertyRequest.java
index 6a93b4b..16a7ae7 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/JsonHttpPropertyRequest.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/JsonHttpPropertyRequest.java
@@ -62,7 +62,9 @@ public abstract class JsonHttpPropertyRequest extends HttpPropertyProvider.HttpP
 
     try {
       Map<String, Object> responseMap = GSON.fromJson(IOUtils.toString(inputStream, "UTF-8"), MAP_TYPE);
-
+      if (responseMap == null){
+        LOG.error("Properties map from HTTP response is null");
+      }
       for (Map.Entry<String, String> entry : getPropertyMappings().entrySet()) {
         Object propertyValueToSet = getPropertyValue(responseMap, entry.getKey());
         resource.setProperty(entry.getValue(), propertyValueToSet);
@@ -77,7 +79,7 @@ public abstract class JsonHttpPropertyRequest extends HttpPropertyProvider.HttpP
 
   // get the property value from the response map for the given property name
   private Object getPropertyValue(Map<String, Object> responseMap, String property) throws SystemException {
-    if (property == null) {
+    if (property == null || responseMap == null) {
       return null;
     }
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/73f1dea9/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/URLStreamProvider.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/URLStreamProvider.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/URLStreamProvider.java
index c176ceb..501aa04 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/URLStreamProvider.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/URLStreamProvider.java
@@ -241,6 +241,9 @@ public class URLStreamProvider implements StreamProvider {
     } else {
         // not a 401 Unauthorized status code
         // we would let the original response propagate
+        if (statusCode == HttpStatus.SC_NOT_FOUND || statusCode == HttpStatus.SC_FORBIDDEN){
+          LOG.error(String.format("Received HTTP %s response from URL: %s", statusCode, spec));
+        }
         return connection;
     }
   }


[06/12] ambari git commit: AMBARI-18626 UI doesn't show validation errors for removed properties. (ababiichuk)

Posted by jo...@apache.org.
AMBARI-18626 UI doesn't show validation errors for removed properties. (ababiichuk)


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

Branch: refs/heads/branch-feature-AMBARI-18456
Commit: 61cc3a9e6100216ccb114d07a64619d9191f17cd
Parents: a93c0f4
Author: ababiichuk <ab...@hortonworks.com>
Authored: Tue Oct 18 15:43:13 2016 +0300
Committer: ababiichuk <ab...@hortonworks.com>
Committed: Tue Oct 18 15:43:13 2016 +0300

----------------------------------------------------------------------
 ambari-web/app/mixins/common/serverValidator.js | 22 ++++++++++++++++++--
 .../test/mixins/common/serverValidator_test.js  | 18 +++++++++++++---
 2 files changed, 35 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/61cc3a9e/ambari-web/app/mixins/common/serverValidator.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/mixins/common/serverValidator.js b/ambari-web/app/mixins/common/serverValidator.js
index d8747d3..b251d84 100644
--- a/ambari-web/app/mixins/common/serverValidator.js
+++ b/ambari-web/app/mixins/common/serverValidator.js
@@ -183,7 +183,8 @@ App.ServerValidatorMixin = Em.Mixin.create({
 
     Em.assert('Unknown config error type ' + type, error.isError || error.isWarn || error.isGeneral);
     if (property) {
-      error.serviceName = App.StackService.find(Em.get(property, 'serviceName')).get('displayName');
+      error.id = Em.get(property, 'id');
+      error.serviceName = Em.get(property, 'serviceDisplayName') || App.StackService.find(Em.get(property, 'serviceName')).get('displayName');
       error.propertyName = Em.get(property, 'name');
       error.filename = Em.get(property, 'filename');
       error.value = Em.get(property, 'value');
@@ -214,7 +215,9 @@ App.ServerValidatorMixin = Em.Mixin.create({
             } else {
               configErrorsMap[configId] = {
                 type: item.level,
-                messages: [item.message]
+                messages: [item.message],
+                name: item['config-name'],
+                filename: item['config-type']
               }
             }
           } else {
@@ -261,6 +264,21 @@ App.ServerValidatorMixin = Em.Mixin.create({
       configErrorList.push(this.createErrorMessage(errorTypes.GENERAL, null, serverIssue.messages));
     }, this);
 
+    Em.keys(configErrorsMap).forEach(function (id) {
+      if (!configErrorList.someProperty('id', id)) {
+        var serverIssue = configErrorsMap[id],
+          filename = Em.get(serverIssue, 'filename'),
+          service = App.config.get('serviceByConfigTypeMap')[filename],
+          property = {
+            id: id,
+            name: Em.get(serverIssue, 'name'),
+            filename: App.config.getOriginalFileName(filename),
+            serviceDisplayName: service && Em.get(service, 'displayName')
+          };
+        configErrorList.push(this.createErrorMessage(serverIssue.type, property, serverIssue.messages));
+      }
+    }, this);
+
     return configErrorList;
   },
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/61cc3a9e/ambari-web/test/mixins/common/serverValidator_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/mixins/common/serverValidator_test.js b/ambari-web/test/mixins/common/serverValidator_test.js
index 943eb57..cdd69fb 100644
--- a/ambari-web/test/mixins/common/serverValidator_test.js
+++ b/ambari-web/test/mixins/common/serverValidator_test.js
@@ -76,6 +76,10 @@ describe('App.ServerValidatorMixin', function () {
         'c4_f4': {
           type: 'ERROR',
           messages: ['error4']
+        },
+        'c5_f5': {
+          type: 'ERROR',
+          messages: ['error5']
         }
       },
       generalErrors: [{
@@ -116,10 +120,16 @@ describe('App.ServerValidatorMixin', function () {
       var error = result.find(function(r) { return r.propertyName === 'c4' && r.filename === 'f4'; });
       expect(error).to.be.undefined;
     });
+
+    it('should add issues for deleted properties', function () {
+      var error = result.find(function(r) { return r.id === 'c5_f5'; });
+      expect(error.messages).to.eql(['error5']);
+    });
   });
 
   describe('#createErrorMessage', function() {
     var property = {
+      id: 'p1_f1',
       name: 'p1',
       filename: 'f1',
       value: 'v1',
@@ -148,12 +158,13 @@ describe('App.ServerValidatorMixin', function () {
         filename: 'f1',
         value: 'v1',
         description: 'd1',
-        serviceName: 'sName'
+        serviceName: 'sName',
+        id: 'p1_f1'
       });
     });
 
     it('creates error object', function() {
-      expect(instanceObject.createErrorMessage('ERROR', property, ['msg2'])).to.eql({
+      expect(instanceObject.createErrorMessage('ERROR', $.extend({}, property, {serviceDisplayName: 'S Name'}), ['msg2'])).to.eql({
         type: 'ERROR',
         isError: true,
         isWarn: false,
@@ -163,7 +174,8 @@ describe('App.ServerValidatorMixin', function () {
         filename: 'f1',
         value: 'v1',
         description: 'd1',
-        serviceName: 'sName'
+        serviceName: 'S Name',
+        id: 'p1_f1'
       });
     });
 


[02/12] ambari git commit: AMBARI-18613: Minor fixes for HDF mpack (jluniya)

Posted by jo...@apache.org.
AMBARI-18613: Minor fixes for HDF mpack (jluniya)


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

Branch: refs/heads/branch-feature-AMBARI-18456
Commit: d132ca17354b867cb167f8800e868a27f0b6252d
Parents: 73f1dea
Author: Jayush Luniya <jl...@hortonworks.com>
Authored: Mon Oct 17 13:06:51 2016 -0700
Committer: Jayush Luniya <jl...@hortonworks.com>
Committed: Mon Oct 17 13:06:51 2016 -0700

----------------------------------------------------------------------
 .../NIFI/1.0.0/package/scripts/params.py        |  2 +-
 .../resources/stacks/HDF/2.0/repos/repoinfo.xml | 20 ++++++++++----------
 2 files changed, 11 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/d132ca17/contrib/management-packs/hdf-ambari-mpack/src/main/resources/common-services/NIFI/1.0.0/package/scripts/params.py
----------------------------------------------------------------------
diff --git a/contrib/management-packs/hdf-ambari-mpack/src/main/resources/common-services/NIFI/1.0.0/package/scripts/params.py b/contrib/management-packs/hdf-ambari-mpack/src/main/resources/common-services/NIFI/1.0.0/package/scripts/params.py
index 087cef4..def8f45 100644
--- a/contrib/management-packs/hdf-ambari-mpack/src/main/resources/common-services/NIFI/1.0.0/package/scripts/params.py
+++ b/contrib/management-packs/hdf-ambari-mpack/src/main/resources/common-services/NIFI/1.0.0/package/scripts/params.py
@@ -350,7 +350,7 @@ if has_ranger_admin:
   nifi_authentication = config['configurations']['ranger-nifi-plugin-properties']['nifi.authentication']
   ranger_id_owner_for_certificate = config['configurations']['ranger-nifi-plugin-properties']['owner.for.certificate']
   nifi_id_owner_for_certificate = config['configurations']['ranger-nifi-policymgr-ssl']['owner.for.certificate']
-  regex = r"(CN)=([a-zA-Z0-9\.\-\* ]*)"
+  regex = r"(CN)=([a-zA-Z0-9\.\-\*\[\]\|\:]*)"
   match = re.search(regex, nifi_id_owner_for_certificate)
   common_name_for_certificate = match.group(2) if match else 'NONE'
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/d132ca17/contrib/management-packs/hdf-ambari-mpack/src/main/resources/stacks/HDF/2.0/repos/repoinfo.xml
----------------------------------------------------------------------
diff --git a/contrib/management-packs/hdf-ambari-mpack/src/main/resources/stacks/HDF/2.0/repos/repoinfo.xml b/contrib/management-packs/hdf-ambari-mpack/src/main/resources/stacks/HDF/2.0/repos/repoinfo.xml
index 3f8fd9e..27cf047 100644
--- a/contrib/management-packs/hdf-ambari-mpack/src/main/resources/stacks/HDF/2.0/repos/repoinfo.xml
+++ b/contrib/management-packs/hdf-ambari-mpack/src/main/resources/stacks/HDF/2.0/repos/repoinfo.xml
@@ -16,10 +16,10 @@
    limitations under the License.
 -->
 <reposinfo>
-  <latest>http://s3.amazonaws.com/dev.hortonworks.com/HDF/hdf_urlinfo.json</latest>
+  <latest>http://public-repo-1.hortonworks.com/HDF/hdf_urlinfo.json</latest>
   <os family="redhat6">
     <repo>
-      <baseurl>http://s3.amazonaws.com/dev.hortonworks.com/HDF/centos6/2.x/updates/2.0.0.0</baseurl>
+      <baseurl>http://public-repo-1.hortonworks.com/HDF/centos6/2.x/updates/2.0.0.0</baseurl>
       <repoid>HDF-2.0</repoid>
       <reponame>HDF</reponame>
     </repo>
@@ -31,7 +31,7 @@
   </os>
   <os family="redhat7">
     <repo>
-      <baseurl>http://s3.amazonaws.com/dev.hortonworks.com/HDF/centos7/2.x/updates/2.0.0.0</baseurl>
+      <baseurl>http://public-repo-1.hortonworks.com/HDF/centos7/2.x/updates/2.0.0.0</baseurl>
       <repoid>HDF-2.0</repoid>
       <reponame>HDF</reponame>
     </repo>
@@ -43,7 +43,7 @@
   </os>
   <os family="suse11">
     <repo>
-      <baseurl>http://s3.amazonaws.com/dev.hortonworks.com/HDF/suse11sp3/2.x/updates/2.0.0.0</baseurl>
+      <baseurl>http://public-repo-1.hortonworks.com/HDF/suse11sp3/2.x/updates/2.0.0.0</baseurl>
       <repoid>HDF-2.0</repoid>
       <reponame>HDF</reponame>
     </repo>
@@ -55,7 +55,7 @@
   </os>
   <os family="suse12">
     <repo>
-      <baseurl>http://s3.amazonaws.com/dev.hortonworks.com/HDF/suse11sp3/2.x/updates/2.0.0.0</baseurl>
+      <baseurl>http://public-repo-1.hortonworks.com/HDF/suse11sp3/2.x/updates/2.0.0.0</baseurl>
       <repoid>HDF-2.0</repoid>
       <reponame>HDF</reponame>
     </repo>
@@ -67,7 +67,7 @@
   </os>
   <os family="ubuntu12">
     <repo>
-      <baseurl>http://s3.amazonaws.com/dev.hortonworks.com/HDF/ubuntu12/2.x/updates/2.0.0.0</baseurl>
+      <baseurl>http://public-repo-1.hortonworks.com/HDF/ubuntu12/2.x/updates/2.0.0.0</baseurl>
       <repoid>HDF-2.0</repoid>
       <reponame>HDF</reponame>
     </repo>
@@ -79,24 +79,24 @@
   </os>
   <os family="debian7">
     <repo>
-      <baseurl>http://s3.amazonaws.com/dev.hortonworks.com/HDF/debian7/2.x/updates/2.0.0.0</baseurl>
+      <baseurl>http://public-repo-1.hortonworks.com/HDF/debian7/2.x/updates/2.0.0.0</baseurl>
       <repoid>HDF-2.0</repoid>
       <reponame>HDF</reponame>
     </repo>
     <repo>
-      <baseurl>http://public-repo-1.hortonworks.com/HDP-UTILS-1.1.0.21/repos/debian6</baseurl>
+      <baseurl>http://public-repo-1.hortonworks.com/HDP-UTILS-1.1.0.21/repos/debian7</baseurl>
       <repoid>HDP-UTILS-1.1.0.21</repoid>
       <reponame>HDP-UTILS</reponame>
     </repo>
   </os>
   <os family="ubuntu14">
     <repo>
-      <baseurl>http://s3.amazonaws.com/dev.hortonworks.com/HDF/ubuntu14/2.x/updates/2.0.0.0</baseurl>
+      <baseurl>http://public-repo-1.hortonworks.com/HDF/ubuntu14/2.x/updates/2.0.0.0</baseurl>
       <repoid>HDF-2.0</repoid>
       <reponame>HDF</reponame>
     </repo>
     <repo>
-      <baseurl>http://public-repo-1.hortonworks.com/HDP-UTILS-1.1.0.21/repos/ubuntu12</baseurl>
+      <baseurl>http://public-repo-1.hortonworks.com/HDP-UTILS-1.1.0.21/repos/ubuntu14</baseurl>
       <repoid>HDP-UTILS-1.1.0.21</repoid>
       <reponame>HDP-UTILS</reponame>
     </repo>


[09/12] ambari git commit: AMBARI-18629. HDFS goes down after installing cluster (aonishuk)

Posted by jo...@apache.org.
AMBARI-18629. HDFS goes down after installing cluster (aonishuk)


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

Branch: refs/heads/branch-feature-AMBARI-18456
Commit: e68cc10dd9e0c0c012aa684a69f743fee41310d5
Parents: ee2a125
Author: Andrew Onishuk <ao...@hortonworks.com>
Authored: Tue Oct 18 18:35:15 2016 +0300
Committer: Andrew Onishuk <ao...@hortonworks.com>
Committed: Tue Oct 18 18:35:15 2016 +0300

----------------------------------------------------------------------
 .../src/main/python/ambari_agent/ActionQueue.py | 26 +++++-------
 .../main/python/ambari_commons/thread_utils.py  | 43 ++++++++++++++++++++
 2 files changed, 53 insertions(+), 16 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/e68cc10d/ambari-agent/src/main/python/ambari_agent/ActionQueue.py
----------------------------------------------------------------------
diff --git a/ambari-agent/src/main/python/ambari_agent/ActionQueue.py b/ambari-agent/src/main/python/ambari_agent/ActionQueue.py
index c03ee4f..5962d94 100644
--- a/ambari-agent/src/main/python/ambari_agent/ActionQueue.py
+++ b/ambari-agent/src/main/python/ambari_agent/ActionQueue.py
@@ -36,6 +36,7 @@ from CommandStatusDict import CommandStatusDict
 from CustomServiceOrchestrator import CustomServiceOrchestrator
 from ambari_agent.BackgroundCommandExecutionHandle import BackgroundCommandExecutionHandle
 from ambari_commons.str_utils import split_on_chunks
+from ambari_commons.thread_utils import terminate_thread
 
 
 logger = logging.getLogger()
@@ -83,7 +84,6 @@ class ActionQueue(threading.Thread):
     self.controller = controller
     self.configTags = {}
     self._stop = threading.Event()
-    self.hangingStatusCommands = {}
     self.tmpdir = config.get('agent', 'prefix')
     self.customServiceOrchestrator = CustomServiceOrchestrator(config, controller)
     self.parallel_execution = config.get_parallel_exec_option()
@@ -230,22 +230,16 @@ class ActionQueue(threading.Thread):
       elif commandType == self.STATUS_COMMAND:
         component_name = command['componentName']
 
-        if component_name in self.hangingStatusCommands and not self.hangingStatusCommands[component_name].isAlive():
-          del self.hangingStatusCommands[component_name]
+        thread = threading.Thread(target = self.execute_status_command, args = (command,))
+        thread.daemon = True # hanging status commands should not be prevent ambari-agent from stopping
+        thread.start()
+        thread.join(timeout=self.status_command_timeout)
 
-        if not component_name in self.hangingStatusCommands:
-          thread = threading.Thread(target = self.execute_status_command, args = (command,))
-          thread.daemon = True # hanging status commands should not be prevent ambari-agent from stopping
-          thread.start()
-          thread.join(timeout=self.status_command_timeout)
-
-          if thread.isAlive():
-            # Force context to reset to normal. By context we mean sys.path, imports, logger setting, etc. They are set by specific status command, and are not relevant to ambari-agent.
-            PythonReflectiveExecutor.last_context.revert()
-            logger.warn("Command {0} for {1} is running for more than {2} seconds. Skipping it for current pack of status commands.".format(commandType, component_name, self.status_command_timeout))
-            self.hangingStatusCommands[component_name] = thread
-        else:
-          logger.info("Not running {0} for {1}, because previous one is still running.".format(commandType, component_name))
+        if thread.isAlive():
+          terminate_thread(thread)
+          # Force context to reset to normal. By context we mean sys.path, imports, logger setting, etc. They are set by specific status command, and are not relevant to ambari-agent.
+          PythonReflectiveExecutor.last_context.revert()
+          logger.warn("Command {0} for {1} was running for more than {2} seconds. Terminated due to timeout.".format(commandType, component_name, self.status_command_timeout))
       else:
         logger.error("Unrecognized command " + pprint.pformat(command))
     except Exception:

http://git-wip-us.apache.org/repos/asf/ambari/blob/e68cc10d/ambari-common/src/main/python/ambari_commons/thread_utils.py
----------------------------------------------------------------------
diff --git a/ambari-common/src/main/python/ambari_commons/thread_utils.py b/ambari-common/src/main/python/ambari_commons/thread_utils.py
new file mode 100644
index 0000000..952022c
--- /dev/null
+++ b/ambari-common/src/main/python/ambari_commons/thread_utils.py
@@ -0,0 +1,43 @@
+#!/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.
+'''
+
+def terminate_thread(thread):
+  """Terminates a python thread abruptly from another thread.
+  
+  This is consider a bad pattern to do this. 
+  If possible, please consider handling stopping of the thread from inside of it
+  or creating thread as a separate process (multiprocessing module).
+
+  :param thread: a threading.Thread instance
+  """
+  import ctypes
+  if not thread.isAlive():
+      return
+
+  exc = ctypes.py_object(SystemExit)
+  res = ctypes.pythonapi.PyThreadState_SetAsyncExc(
+      ctypes.c_long(thread.ident), exc)
+  if res == 0:
+      raise ValueError("nonexistent thread id")
+  elif res > 1:
+      # """if it returns a number greater than one, you're in trouble,
+      # and you should call it again with exc=NULL to revert the effect"""
+      ctypes.pythonapi.PyThreadState_SetAsyncExc(thread.ident, None)
+      raise SystemError("PyThreadState_SetAsyncExc failed")
\ No newline at end of file


[03/12] ambari git commit: AMBARI-17636 Service Configs page: can't see all config versions in dropdown (Vivek Ratnavel Subramanian via zhewang)

Posted by jo...@apache.org.
AMBARI-17636 Service Configs page: can't see all config versions in dropdown (Vivek Ratnavel Subramanian via zhewang)


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

Branch: refs/heads/branch-feature-AMBARI-18456
Commit: 89d964e0e0e5b6285d82074207222220cd54888c
Parents: d132ca1
Author: Zhe (Joe) Wang <zh...@apache.org>
Authored: Mon Oct 17 14:53:16 2016 -0700
Committer: Zhe (Joe) Wang <zh...@apache.org>
Committed: Mon Oct 17 14:53:16 2016 -0700

----------------------------------------------------------------------
 ambari-web/app/styles/config_history_flow.less  | 31 ++++++++++++++-----
 .../common/configs/config_history_flow.hbs      | 32 ++++++++++++--------
 .../views/common/configs/config_history_flow.js |  3 +-
 3 files changed, 44 insertions(+), 22 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/89d964e0/ambari-web/app/styles/config_history_flow.less
----------------------------------------------------------------------
diff --git a/ambari-web/app/styles/config_history_flow.less b/ambari-web/app/styles/config_history_flow.less
index e2806ea..e4bb599 100644
--- a/ambari-web/app/styles/config_history_flow.less
+++ b/ambari-web/app/styles/config_history_flow.less
@@ -230,21 +230,38 @@
 
     ul#dropdown_menu {
       position: absolute;
-      top: 0;
       left: 0;
       z-index: 1000;
-      float: left;
       min-width: 400px;
-      overflow: hidden;
-      overflow-y: scroll;
       padding: 5px 0;
-      margin: 5px 0;
+      margin: 0;
     }
 
     #dropdown_content {
+      overflow: hidden;
+      &::-webkit-scrollbar {
+        display: none;
+      }
+    }
+
+    #dropdown_outer_container, #dropdown_menu_container {
+      min-width: 400px;
       height: 300px;
+    }
+
+    #dropdown_outer_container {
+      position: relative;
       overflow: hidden;
+    }
+
+    #dropdown_inner_container {
+      position: absolute;
+      left: 0;
+      overflow-x: hidden;
       overflow-y: scroll;
+      &::-webkit-scrollbar {
+        display: none;
+      }
     }
 
     .dropdown-menu {
@@ -392,12 +409,12 @@
 }
 
 // Firefox specific styles
-body:not(:-moz-handler-blocked) {
+@-moz-document url-prefix() {
   #config_history_flow {
     .version-info-bar {
       .dropdown-menu {
         li {
-          line-height: 30px;
+          line-height: 30px !important;
         }
       }
     }

http://git-wip-us.apache.org/repos/asf/ambari/blob/89d964e0/ambari-web/app/templates/common/configs/config_history_flow.hbs
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates/common/configs/config_history_flow.hbs b/ambari-web/app/templates/common/configs/config_history_flow.hbs
index 59d6491..99a65a2 100644
--- a/ambari-web/app/templates/common/configs/config_history_flow.hbs
+++ b/ambari-web/app/templates/common/configs/config_history_flow.hbs
@@ -82,20 +82,26 @@
             <span class="caret"></span>
           </button>
           <div id="dropdown_content" class="dropdown-menu">
-            <ul id="dropdown_menu">
-              {{#each serviceVersion in view.dropDownList}}
-                {{view App.ConfigHistoryDropdownRowView serviceVersionBinding="serviceVersion"}}
-              {{/each}}
+            <div id="dropdown_outer_container">
+              <div id="dropdown_inner_container">
+                <div id="dropdown_menu_container">
+                  <ul id="dropdown_menu">
+                    {{#each serviceVersion in view.dropDownList}}
+                      {{view App.ConfigHistoryDropdownRowView serviceVersionBinding="serviceVersion"}}
+                    {{/each}}
 
-              {{#unless view.showFullList}}
-                <li class="align-center pointer" id="show_more">
-                  <a {{action openFullList target="view"}}>
-                    {{t dashboard.configHistory.info-bar.showMore}}&nbsp;{{view.displayName}}
-                    &nbsp;<span class="lowercase ellipsis">{{t dashboard.configHistory.title}}</span>
-                  </a>
-                </li>
-              {{/unless}}
-            </ul>
+                    {{#unless view.showFullList}}
+                      <li class="align-center pointer" id="show_more">
+                        <a {{action openFullList target="view"}}>
+                          {{t dashboard.configHistory.info-bar.showMore}}&nbsp;{{view.displayName}}
+                          &nbsp;<span class="lowercase ellipsis">{{t dashboard.configHistory.title}}</span>
+                        </a>
+                      </li>
+                    {{/unless}}
+                  </ul>
+                </div>
+              </div>
+            </div>
           </div>
         </div>
         <div class="label-wrapper col-md-8" data-toggle="tooltip" {{bindAttr data-original-title="view.displayedServiceVersion.fullNotes"}}>

http://git-wip-us.apache.org/repos/asf/ambari/blob/89d964e0/ambari-web/app/views/common/configs/config_history_flow.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/common/configs/config_history_flow.js b/ambari-web/app/views/common/configs/config_history_flow.js
index 0674231..58de1e6 100644
--- a/ambari-web/app/views/common/configs/config_history_flow.js
+++ b/ambari-web/app/views/common/configs/config_history_flow.js
@@ -591,6 +591,7 @@ App.ConfigHistoryDropdownRowView = Em.View.extend({
       var $el = $('#config_version_popup');
       var $currentTarget = $(event.currentTarget);
       var parentView = view.get('parentView');
+      parentView.set('hoveredServiceVersion', null);
       if (!serviceVersion.get("isDisplayed"))  {
         parentView.set('hoveredServiceVersion', serviceVersion);
         parentView.set('isHovered', true);
@@ -616,7 +617,6 @@ App.ConfigHistoryDropdownRowView = Em.View.extend({
       parentView.set('isHovered', false);
       Em.run.later(function() {
         if(!parentView.get('displaySubMenuFlag') && !parentView.get('isHovered')) {
-          parentView.set('hoveredServiceVersion', null);
           $('#config_version_popup').removeAttr('style');
         }
       }, 200);
@@ -637,7 +637,6 @@ App.ConfigHistoryDropdownSubMenuView = Em.View.extend({
     mouseLeave: function(event, view) {
       var parentView = view.get('parentView');
       parentView.set('displaySubMenuFlag', false);
-      parentView.set('hoveredServiceVersion', null);
       $("#config_version_popup").removeAttr('style');
     }
   })


[05/12] ambari git commit: AMBARI-18621. Service Summary screen does not show hostname in tooltip pop-up for all services. (jaimin)

Posted by jo...@apache.org.
AMBARI-18621. Service Summary screen does not show hostname in tooltip pop-up for all services. (jaimin)


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

Branch: refs/heads/branch-feature-AMBARI-18456
Commit: a93c0f4004a02b02c95e2057115c961c192662b8
Parents: fdda172
Author: Jaimin Jetly <ja...@hortonworks.com>
Authored: Mon Oct 17 19:04:01 2016 -0700
Committer: Jaimin Jetly <ja...@hortonworks.com>
Committed: Mon Oct 17 19:08:31 2016 -0700

----------------------------------------------------------------------
 .../controller/ServiceComponentHostRequest.java | 10 ++++++++
 .../ServiceComponentHostResponse.java           | 19 +++++++++++++-
 .../internal/HostComponentResourceProvider.java |  9 +++++++
 .../server/state/ServiceComponentHost.java      |  6 +++++
 .../svccomphost/ServiceComponentHostImpl.java   |  9 ++++++-
 .../src/main/resources/properties.json          |  1 +
 .../ClientConfigResourceProviderTest.java       |  6 +++--
 .../HostComponentResourceProviderTest.java      | 10 ++++----
 .../internal/HostResourceProviderTest.java      | 26 ++++++++++----------
 .../app/controllers/global/update_controller.js |  3 ++-
 .../app/mappers/component_config_mapper.js      |  1 +
 ambari-web/app/mappers/hosts_mapper.js          |  2 ++
 .../app/mappers/service_metrics_mapper.js       |  1 +
 ambari-web/app/models/host_component.js         |  1 +
 .../service/info/summary/master_components.hbs  |  2 +-
 15 files changed, 82 insertions(+), 24 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/a93c0f40/ambari-server/src/main/java/org/apache/ambari/server/controller/ServiceComponentHostRequest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/ServiceComponentHostRequest.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/ServiceComponentHostRequest.java
index 4a07804..5b6c739 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/ServiceComponentHostRequest.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/ServiceComponentHostRequest.java
@@ -26,6 +26,7 @@ public class ServiceComponentHostRequest {
   private String serviceName;
   private String componentName;
   private String hostname;
+  private String publicHostname;
   private String state;
   private String desiredState; // CREATE/UPDATE
   private String desiredStackId; // UPDATE
@@ -178,6 +179,7 @@ public class ServiceComponentHostRequest {
       .append(", serviceName=").append(serviceName)
       .append(", componentName=").append(componentName)
       .append(", hostname=").append(hostname)
+      .append(", publicHostname=").append(publicHostname)
       .append(", desiredState=").append(desiredState)
       .append(", state=").append(state)
       .append(", desiredStackId=").append(desiredStackId)
@@ -201,4 +203,12 @@ public class ServiceComponentHostRequest {
   public String getMaintenanceState() {
     return maintenanceState;
   }
+
+  public String getPublicHostname() {
+    return publicHostname;
+  }
+
+  public void setPublicHostname(String publicHostname) {
+    this.publicHostname = publicHostname;
+  }
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/a93c0f40/ambari-server/src/main/java/org/apache/ambari/server/controller/ServiceComponentHostResponse.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/ServiceComponentHostResponse.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/ServiceComponentHostResponse.java
index 85b2b46..f6993f8 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/ServiceComponentHostResponse.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/ServiceComponentHostResponse.java
@@ -30,6 +30,7 @@ public class ServiceComponentHostResponse {
   private String serviceName;
   private String componentName;
   private String displayName;
+  private String publicHostname;
   private String hostname;
   // type -> desired config
   private Map<String, HostConfig> actualConfigs;
@@ -44,7 +45,8 @@ public class ServiceComponentHostResponse {
 
 
   public ServiceComponentHostResponse(String clusterName, String serviceName,
-                                      String componentName, String displayName, String hostname,
+                                      String componentName, String displayName,
+                                      String hostname, String publicHostname,
                                       String liveState, String stackVersion,
                                       String desiredState, String desiredStackVersion,
                                       HostComponentAdminState adminState) {
@@ -53,6 +55,7 @@ public class ServiceComponentHostResponse {
     this.componentName = componentName;
     this.displayName = displayName;
     this.hostname = hostname;
+    this.publicHostname = publicHostname;
     this.liveState = liveState;
     this.stackVersion = stackVersion;
     this.desiredState = desiredState;
@@ -112,6 +115,20 @@ public class ServiceComponentHostResponse {
   }
 
   /**
+   * @return the public hostname
+   */
+  public String getPublicHostname() {
+    return publicHostname;
+  }
+
+  /**
+   * @param publicHostname the public hostname to set
+   */
+  public void setPublicHostname(String publicHostname) {
+    this.publicHostname = publicHostname;
+  }
+
+  /**
    * @return the liveState
    */
   public String getLiveState() {

http://git-wip-us.apache.org/repos/asf/ambari/blob/a93c0f40/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/HostComponentResourceProvider.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/HostComponentResourceProvider.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/HostComponentResourceProvider.java
index 4f279c8..87eb266 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/HostComponentResourceProvider.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/HostComponentResourceProvider.java
@@ -91,6 +91,8 @@ public class HostComponentResourceProvider extends AbstractControllerResourcePro
       = PropertyHelper.getPropertyId("HostRoles", "display_name");
   public static final String HOST_COMPONENT_HOST_NAME_PROPERTY_ID
       = PropertyHelper.getPropertyId("HostRoles", "host_name");
+  public static final String HOST_COMPONENT_PUBLIC_HOST_NAME_PROPERTY_ID
+      = PropertyHelper.getPropertyId("HostRoles", "public_host_name");
   public static final String HOST_COMPONENT_STATE_PROPERTY_ID
       = PropertyHelper.getPropertyId("HostRoles", "state");
   public static final String HOST_COMPONENT_DESIRED_STATE_PROPERTY_ID
@@ -229,6 +231,8 @@ public class HostComponentResourceProvider extends AbstractControllerResourcePro
               response.getDisplayName(), requestedIds);
       setResourceProperty(resource, HOST_COMPONENT_HOST_NAME_PROPERTY_ID,
               response.getHostname(), requestedIds);
+      setResourceProperty(resource, HOST_COMPONENT_PUBLIC_HOST_NAME_PROPERTY_ID,
+          response.getPublicHostname(), requestedIds);
       setResourceProperty(resource, HOST_COMPONENT_STATE_PROPERTY_ID,
               response.getLiveState(), requestedIds);
       setResourceProperty(resource, HOST_COMPONENT_DESIRED_STATE_PROPERTY_ID,
@@ -690,6 +694,11 @@ public class HostComponentResourceProvider extends AbstractControllerResourcePro
       serviceComponentHostRequest.setAdminState(
           properties.get(HOST_COMPONENT_DESIRED_ADMIN_STATE_PROPERTY_ID).toString());
     }
+    if (properties.get(HOST_COMPONENT_PUBLIC_HOST_NAME_PROPERTY_ID) != null) {
+      serviceComponentHostRequest.setPublicHostname(
+          properties.get(HOST_COMPONENT_PUBLIC_HOST_NAME_PROPERTY_ID).toString());
+    }
+
 
     Object o = properties.get(HOST_COMPONENT_MAINTENANCE_STATE_PROPERTY_ID);
     if (null != o) {

http://git-wip-us.apache.org/repos/asf/ambari/blob/a93c0f40/ambari-server/src/main/java/org/apache/ambari/server/state/ServiceComponentHost.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/state/ServiceComponentHost.java b/ambari-server/src/main/java/org/apache/ambari/server/state/ServiceComponentHost.java
index 586134c..cd7f826 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/state/ServiceComponentHost.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/state/ServiceComponentHost.java
@@ -60,6 +60,12 @@ public interface ServiceComponentHost {
   String getHostName();
 
   /**
+   * Get the public host name this object maps to
+   * @return Host's public hostname
+   */
+  String getPublicHostName();
+
+  /**
    * Get the Host this object maps to
    * @return Host Object
    */

http://git-wip-us.apache.org/repos/asf/ambari/blob/a93c0f40/ambari-server/src/main/java/org/apache/ambari/server/state/svccomphost/ServiceComponentHostImpl.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/state/svccomphost/ServiceComponentHostImpl.java b/ambari-server/src/main/java/org/apache/ambari/server/state/svccomphost/ServiceComponentHostImpl.java
index 3b5ed28..74eaa62 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/state/svccomphost/ServiceComponentHostImpl.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/state/svccomphost/ServiceComponentHostImpl.java
@@ -1092,6 +1092,11 @@ public class ServiceComponentHostImpl implements ServiceComponentHost {
   }
 
   @Override
+  public String getPublicHostName() {
+    return host.getPublicHostName();
+  }
+
+  @Override
   public Host getHost() {
     return host;
   }
@@ -1364,6 +1369,7 @@ public class ServiceComponentHostImpl implements ServiceComponentHost {
         String serviceName = serviceComponent.getServiceName();
         String serviceComponentName = serviceComponent.getName();
         String hostName = getHostName();
+        String publicHostName = getPublicHostName();
         String state = getState().toString();
         String stackId = getStackVersion().getStackId();
         String desiredState = getDesiredState().toString();
@@ -1382,7 +1388,8 @@ public class ServiceComponentHostImpl implements ServiceComponentHost {
 
         ServiceComponentHostResponse r = new ServiceComponentHostResponse(
             clusterName, serviceName,
-            serviceComponentName, displayName, hostName, state,
+            serviceComponentName, displayName, hostName,
+            publicHostName, state,
             stackId, desiredState,
             desiredStackId, componentAdminState);
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/a93c0f40/ambari-server/src/main/resources/properties.json
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/properties.json b/ambari-server/src/main/resources/properties.json
index 30d83bd..34d4641 100644
--- a/ambari-server/src/main/resources/properties.json
+++ b/ambari-server/src/main/resources/properties.json
@@ -74,6 +74,7 @@
         "HostRoles/role_id",
         "HostRoles/cluster_name",
         "HostRoles/host_name",
+        "HostRoles/public_host_name",
         "HostRoles/component_name",
         "HostRoles/display_name",
         "HostRoles/state",

http://git-wip-us.apache.org/repos/asf/ambari/blob/a93c0f40/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/ClientConfigResourceProviderTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/ClientConfigResourceProviderTest.java b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/ClientConfigResourceProviderTest.java
index 5359f69..4be5013 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/ClientConfigResourceProviderTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/ClientConfigResourceProviderTest.java
@@ -225,6 +225,7 @@ public class ClientConfigResourceProviderTest {
     String componentName = "PIG";
     String displayName = "Pig Client";
     String hostName = "Host100";
+    String publicHostname = "Host100";
     String desiredState = "INSTALLED";
 
     String stackName = "S1";
@@ -249,7 +250,7 @@ public class ClientConfigResourceProviderTest {
     HashMap<String, ServiceOsSpecific> serviceOsSpecificHashMap = new HashMap<String, ServiceOsSpecific>();
     serviceOsSpecificHashMap.put("key",serviceOsSpecific);
 
-    ServiceComponentHostResponse shr1 = new ServiceComponentHostResponse(clusterName, serviceName, componentName, displayName, hostName, desiredState, "", null, null, null);
+    ServiceComponentHostResponse shr1 = new ServiceComponentHostResponse(clusterName, serviceName, componentName, displayName, hostName, publicHostname,desiredState, "", null, null, null);
 
     Set<ServiceComponentHostResponse> responses = new LinkedHashSet<ServiceComponentHostResponse>();
     responses.add(shr1);
@@ -425,6 +426,7 @@ public class ClientConfigResourceProviderTest {
     String componentName = "PIG";
     String displayName = "Pig Client";
     String hostName = "Host100";
+    String publicHostName = "Host100";
     String desiredState = "INSTALLED";
 
     String stackName = "S1";
@@ -450,7 +452,7 @@ public class ClientConfigResourceProviderTest {
     HashMap<String, ServiceOsSpecific> serviceOsSpecificHashMap = new HashMap<String, ServiceOsSpecific>();
     serviceOsSpecificHashMap.put("key",serviceOsSpecific);
 
-    ServiceComponentHostResponse shr1 = new ServiceComponentHostResponse(clusterName, serviceName, componentName, displayName, hostName, desiredState, "", null, null, null);
+    ServiceComponentHostResponse shr1 = new ServiceComponentHostResponse(clusterName, serviceName, componentName, displayName, hostName, publicHostName, desiredState, "", null, null, null);
 
     Set<ServiceComponentHostResponse> responses = new LinkedHashSet<ServiceComponentHostResponse>();
     responses.add(shr1);

http://git-wip-us.apache.org/repos/asf/ambari/blob/a93c0f40/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/HostComponentResourceProviderTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/HostComponentResourceProviderTest.java b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/HostComponentResourceProviderTest.java
index 5dc69e9..ec9da09 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/HostComponentResourceProviderTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/HostComponentResourceProviderTest.java
@@ -184,14 +184,14 @@ public class HostComponentResourceProviderTest {
     StackId stackId = new StackId("HDP-0.1");
     StackId stackId2 = new StackId("HDP-0.2");
     allResponse.add(new ServiceComponentHostResponse(
-        "Cluster100", "Service100", "Component100", "Component 100", "Host100", State.INSTALLED.toString(), stackId.getStackId(), State.STARTED.toString(),
+        "Cluster100", "Service100", "Component100", "Component 100", "Host100", "Host100", State.INSTALLED.toString(), stackId.getStackId(), State.STARTED.toString(),
         stackId2.getStackId(), null));
     allResponse.add(new ServiceComponentHostResponse(
-        "Cluster100", "Service100", "Component101", "Component 101", "Host100", State.INSTALLED.toString(), stackId.getStackId(), State.STARTED.toString(),
+        "Cluster100", "Service100", "Component101", "Component 101", "Host100", "Host100", State.INSTALLED.toString(), stackId.getStackId(), State.STARTED.toString(),
         stackId2.getStackId(), null));
 
     allResponse.add(new ServiceComponentHostResponse(
-        "Cluster100", "Service100", "Component102", "Component 102", "Host100", State.INSTALLED.toString(), stackId.getStackId(), State.STARTED.toString(),
+        "Cluster100", "Service100", "Component102", "Component 102", "Host100","Host100", State.INSTALLED.toString(), stackId.getStackId(), State.STARTED.toString(),
         stackId2.getStackId(), null));
     Map<String, String> expectedNameValues = new HashMap<String, String>();
     expectedNameValues.put(
@@ -337,7 +337,7 @@ public class HostComponentResourceProviderTest {
 
     Set<ServiceComponentHostResponse> nameResponse = new HashSet<ServiceComponentHostResponse>();
     nameResponse.add(new ServiceComponentHostResponse(
-        "Cluster102", "Service100", "Component100", "Component 100", "Host100", "INSTALLED", "", "", "", null));
+        "Cluster102", "Service100", "Component100", "Component 100", "Host100", "Host100","INSTALLED", "", "", "", null));
 
     // set expectations
     expect(managementController.getClusters()).andReturn(clusters).anyTimes();
@@ -538,7 +538,7 @@ public class HostComponentResourceProviderTest {
 
     Set<ServiceComponentHostResponse> nameResponse = new HashSet<ServiceComponentHostResponse>();
     nameResponse.add(new ServiceComponentHostResponse(
-        "Cluster102", "Service100", "Component100", "Component 100", "Host100", "INSTALLED", "", "", "", null));
+        "Cluster102", "Service100", "Component100", "Component 100", "Host100", "Host100","INSTALLED", "", "", "", null));
 
     // set expectations
     expect(managementController.getClusters()).andReturn(clusters).anyTimes();

http://git-wip-us.apache.org/repos/asf/ambari/blob/a93c0f40/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/HostResourceProviderTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/HostResourceProviderTest.java b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/HostResourceProviderTest.java
index 08dd591..377d160 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/HostResourceProviderTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/HostResourceProviderTest.java
@@ -299,11 +299,11 @@ public class HostResourceProviderTest extends EasyMockSupport {
     clusterSet.add(cluster);
 
     ServiceComponentHostResponse shr1 = new ServiceComponentHostResponse("Cluster100", "Service100", "Component100", "Component 100",
-        "Host100", "STARTED", "", null, null, null);
+        "Host100", "Host100", "STARTED", "", null, null, null);
     ServiceComponentHostResponse shr2 = new ServiceComponentHostResponse("Cluster100", "Service100", "Component102", "Component 102",
-        "Host100", "STARTED", "", null, null, null);
+        "Host100", "Host100", "STARTED", "", null, null, null);
     ServiceComponentHostResponse shr3 = new ServiceComponentHostResponse("Cluster100", "Service100", "Component103", "Component 103",
-        "Host100", "STARTED", "", null, null, null);
+        "Host100", "Host100", "STARTED", "", null, null, null);
 
     Set<ServiceComponentHostResponse> responses = new HashSet<ServiceComponentHostResponse>();
     responses.add(shr1);
@@ -400,11 +400,11 @@ public class HostResourceProviderTest extends EasyMockSupport {
     clusterSet.add(cluster);
 
     ServiceComponentHostResponse shr1 = new ServiceComponentHostResponse("Cluster100", "Service100", "Component100", "Component 100",
-        "Host100", "STARTED", "", null, null, null);
+        "Host100", "Host100", "STARTED", "", null, null, null);
     ServiceComponentHostResponse shr2 = new ServiceComponentHostResponse("Cluster100", "Service100", "Component102", "Component 102",
-        "Host100", "STARTED", "", null, null, null);
+        "Host100", "Host100", "STARTED", "", null, null, null);
     ServiceComponentHostResponse shr3 = new ServiceComponentHostResponse("Cluster100", "Service100", "Component103", "Component 103",
-        "Host100", "STARTED", "", null, null, null);
+        "Host100", "Host100", "STARTED", "", null, null, null);
 
     Set<ServiceComponentHostResponse> responses = new HashSet<ServiceComponentHostResponse>();
     responses.add(shr1);
@@ -496,11 +496,11 @@ public class HostResourceProviderTest extends EasyMockSupport {
     clusterSet.add(cluster);
 
     ServiceComponentHostResponse shr1 = new ServiceComponentHostResponse("Cluster100", "Service100", "Component100", "Component 100",
-        "Host100", "STARTED", "", null, null, null);
+        "Host100", "Host100", "STARTED", "", null, null, null);
     ServiceComponentHostResponse shr2 = new ServiceComponentHostResponse("Cluster100", "Service100", "Component102", "Component 102",
-        "Host100", "INSTALLED", "", null, null, null);
+        "Host100", "Host100", "INSTALLED", "", null, null, null);
     ServiceComponentHostResponse shr3 = new ServiceComponentHostResponse("Cluster100", "Service100", "Component103", "Component 103",
-        "Host100", "STARTED", "", null, null, null);
+        "Host100", "Host100", "STARTED", "", null, null, null);
 
     Set<ServiceComponentHostResponse> responses = new HashSet<ServiceComponentHostResponse>();
     responses.add(shr1);
@@ -696,7 +696,7 @@ public class HostResourceProviderTest extends EasyMockSupport {
     clusterSet.add(cluster);
 
     ServiceComponentHostResponse shr1 = new ServiceComponentHostResponse("Cluster100", "Service100", "Component100", "Component 100",
-        "Host100", "STARTED", "", null, null, null);
+        "Host100", "Host100", "STARTED", "", null, null, null);
 
     Set<ServiceComponentHostResponse> responses = new HashSet<ServiceComponentHostResponse>();
     responses.add(shr1);
@@ -783,11 +783,11 @@ public class HostResourceProviderTest extends EasyMockSupport {
     clusterSet.add(cluster);
 
     ServiceComponentHostResponse shr1 = new ServiceComponentHostResponse("Cluster100", "Service100", "Component100", "Component 100",
-        "Host100", "STARTED", "", null, null, null);
+        "Host100", "Host100", "STARTED", "", null, null, null);
     ServiceComponentHostResponse shr2 = new ServiceComponentHostResponse("Cluster100", "Service100", "Component102", "Component 102",
-        "Host100", "INSTALLED", "", null, null, null);
+        "Host100", "Host100", "INSTALLED", "", null, null, null);
     ServiceComponentHostResponse shr3 = new ServiceComponentHostResponse("Cluster100", "Service100", "Component103", "Component 103",
-        "Host100", "STARTED", "", null, null, null);
+        "Host100", "Host100", "STARTED", "", null, null, null);
 
     Set<ServiceComponentHostResponse> responses = new HashSet<ServiceComponentHostResponse>();
     responses.add(shr1);

http://git-wip-us.apache.org/repos/asf/ambari/blob/a93c0f40/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 68e6ba3..da10e00 100644
--- a/ambari-web/app/controllers/global/update_controller.js
+++ b/ambari-web/app/controllers/global/update_controller.js
@@ -466,6 +466,7 @@ App.UpdateController = Em.Controller.extend({
         'ServiceComponentInfo/service_name,' +
         'host_components/HostRoles/display_name,' +
         'host_components/HostRoles/host_name,' +
+        'host_components/HostRoles/public_host_name,' +
         'host_components/HostRoles/state,' +
         'host_components/HostRoles/maintenance_state,' +
         'host_components/HostRoles/stale_configs,' +
@@ -533,7 +534,7 @@ App.UpdateController = Em.Controller.extend({
   },
   updateComponentConfig: function (callback) {
     var testUrl = '/data/services/host_component_stale_configs.json';
-    var componentConfigUrl = this.getUrl(testUrl, '/components?host_components/HostRoles/stale_configs=true&fields=host_components/HostRoles/display_name,host_components/HostRoles/service_name,host_components/HostRoles/state,host_components/HostRoles/maintenance_state,host_components/HostRoles/host_name,host_components/HostRoles/stale_configs,host_components/HostRoles/desired_admin_state&minimal_response=true');
+    var componentConfigUrl = this.getUrl(testUrl, '/components?host_components/HostRoles/stale_configs=true&fields=host_components/HostRoles/display_name,host_components/HostRoles/service_name,host_components/HostRoles/state,host_components/HostRoles/maintenance_state,host_components/HostRoles/host_name,host_components/HostRoles/public_host_name,host_components/HostRoles/stale_configs,host_components/HostRoles/desired_admin_state&minimal_response=true');
     App.HttpClient.get(componentConfigUrl, App.componentConfigMapper, {
       complete: callback
     });

http://git-wip-us.apache.org/repos/asf/ambari/blob/a93c0f40/ambari-web/app/mappers/component_config_mapper.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/mappers/component_config_mapper.js b/ambari-web/app/mappers/component_config_mapper.js
index 860730e..866f811 100644
--- a/ambari-web/app/mappers/component_config_mapper.js
+++ b/ambari-web/app/mappers/component_config_mapper.js
@@ -26,6 +26,7 @@ App.componentConfigMapper = App.QuickDataMapper.create({
     component_name: 'HostRoles.component_name',
     display_name: 'HostRoles.display_name',
     host_name: 'HostRoles.host_name',
+    public_host_name: 'HostRoles.public_host_name',
     $ha_status: '',
     $display_name_advanced: '',
     stale_configs: 'HostRoles.stale_configs',

http://git-wip-us.apache.org/repos/asf/ambari/blob/a93c0f40/ambari-web/app/mappers/hosts_mapper.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/mappers/hosts_mapper.js b/ambari-web/app/mappers/hosts_mapper.js
index 6850242..3c7dd70 100644
--- a/ambari-web/app/mappers/hosts_mapper.js
+++ b/ambari-web/app/mappers/hosts_mapper.js
@@ -65,6 +65,7 @@ App.hostsMapper = App.QuickDataMapper.create({
     work_status: 'HostRoles.state',
     stale_configs: 'HostRoles.stale_configs',
     host_name: 'host_name',
+    public_host_name: 'public_host_name',
     admin_state: 'HostRoles.desired_admin_state'
   },
   stackVersionConfig: {
@@ -131,6 +132,7 @@ App.hostsMapper = App.QuickDataMapper.create({
           component.id = id;
           component.host_id = item.Hosts.host_name;
           component.host_name = item.Hosts.host_name;
+          component.public_host_name = item.Hosts.public_host_name;
           components.push(component);
           componentsIdMap[id] = component;
           if (!newHostComponentsMap[serviceName]) {

http://git-wip-us.apache.org/repos/asf/ambari/blob/a93c0f40/ambari-web/app/mappers/service_metrics_mapper.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/mappers/service_metrics_mapper.js b/ambari-web/app/mappers/service_metrics_mapper.js
index bf4fc91..c4f37df 100644
--- a/ambari-web/app/mappers/service_metrics_mapper.js
+++ b/ambari-web/app/mappers/service_metrics_mapper.js
@@ -159,6 +159,7 @@ App.serviceMetricsMapper = App.QuickDataMapper.create({
     component_name: 'HostRoles.component_name',
     host_id: 'HostRoles.host_name',
     host_name: 'HostRoles.host_name',
+    public_host_name: 'HostRoles.public_host_name',
     stale_configs: 'HostRoles.stale_configs',
     ha_status: 'HostRoles.ha_state',
     display_name_advanced: 'display_name_advanced',

http://git-wip-us.apache.org/repos/asf/ambari/blob/a93c0f40/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 8f2774e..21c13d3 100644
--- a/ambari-web/app/models/host_component.js
+++ b/ambari-web/app/models/host_component.js
@@ -29,6 +29,7 @@ App.HostComponent = DS.Model.extend({
   host: DS.belongsTo('App.Host'),
   componentLogs: DS.belongsTo('App.HostComponentLog'),
   hostName: DS.attr('string'),
+  publicHostName: DS.attr('string'),
   service: DS.belongsTo('App.Service'),
   adminState: DS.attr('string'),
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/a93c0f40/ambari-web/app/templates/main/service/info/summary/master_components.hbs
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates/main/service/info/summary/master_components.hbs b/ambari-web/app/templates/main/service/info/summary/master_components.hbs
index 460b048..8da6f5a 100644
--- a/ambari-web/app/templates/main/service/info/summary/master_components.hbs
+++ b/ambari-web/app/templates/main/service/info/summary/master_components.hbs
@@ -19,7 +19,7 @@
 {{#each comp in view.mastersComp}}
   <tr {{bindAttr class="comp.isSubComponent:component-small :component comp.componentName"}}>
     <td {{bindAttr class=":summary-label comp.summaryLabelClassName"}}>
-      <a href="#" {{action showDetails comp.host}} title="{{unbound comp.host.publicHostName}}" rel="UsageTooltip">
+      <a href="#" {{action showDetails comp.host}} title="{{unbound comp.publicHostName}}" rel="UsageTooltip">
         {{#if comp.displayNameAdvanced}}
           {{comp.displayNameAdvanced}}
         {{else}}


[11/12] ambari git commit: Analyze and Optimize Ambari Server Unit Tests - Group 4 (Commit 2) (avijayan)

Posted by jo...@apache.org.
Analyze and Optimize Ambari Server Unit Tests -  Group 4 (Commit 2) (avijayan)


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

Branch: refs/heads/branch-feature-AMBARI-18456
Commit: 7ed5259d46ce0a0ace7b9d44d13fabe79b737346
Parents: 83aebda
Author: Aravindan Vijayan <av...@hortonworks.com>
Authored: Tue Oct 18 09:44:11 2016 -0700
Committer: Aravindan Vijayan <av...@hortonworks.com>
Committed: Tue Oct 18 09:44:18 2016 -0700

----------------------------------------------------------------------
 .../ambari/server/state/ConfigHelperTest.java   | 211 +++++++++++++------
 1 file changed, 143 insertions(+), 68 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/7ed5259d/ambari-server/src/test/java/org/apache/ambari/server/state/ConfigHelperTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/state/ConfigHelperTest.java b/ambari-server/src/test/java/org/apache/ambari/server/state/ConfigHelperTest.java
index fd6ce1e..d014bde 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/state/ConfigHelperTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/state/ConfigHelperTest.java
@@ -43,6 +43,7 @@ import javax.persistence.EntityManager;
 import org.apache.ambari.server.AmbariException;
 import org.apache.ambari.server.actionmanager.RequestFactory;
 import org.apache.ambari.server.api.services.AmbariMetaInfo;
+import org.apache.ambari.server.configuration.Configuration;
 import org.apache.ambari.server.controller.AmbariCustomCommandExecutionHelper;
 import org.apache.ambari.server.controller.AmbariManagementController;
 import org.apache.ambari.server.controller.ClusterRequest;
@@ -115,10 +116,13 @@ public class ConfigHelperTest {
       Assert.assertNotNull(cluster);
       clusters.addHost("h1");
       clusters.addHost("h2");
+      clusters.addHost("h3");
       Assert.assertNotNull(clusters.getHost("h1"));
       Assert.assertNotNull(clusters.getHost("h2"));
+      Assert.assertNotNull(clusters.getHost("h3"));
       clusters.getHost("h1").persist();
       clusters.getHost("h2").persist();
+      clusters.getHost("h3").persist();
 
       // core-site
       ConfigurationRequest cr = new ConfigurationRequest();
@@ -185,57 +189,6 @@ public class ConfigHelperTest {
         add(clusterRequest3);
       }}, null);
 
-
-      //Another version of core-site & global.
-      // core-site2
-      ConfigurationRequest crr = new ConfigurationRequest();
-      crr.setClusterName(clusterName);
-      crr.setType("core-site2");
-      crr.setVersionTag("version1");
-      crr.setProperties(new HashMap<String, String>() {{
-        put("ipc.client.connect.max.retries", "30");
-        put("fs.trash.interval", "30");
-      }});
-      crr.setPropertiesAttributes(new HashMap<String, Map<String, String>>() {{
-        Map<String, String> attrs = new HashMap<String, String>();
-        attrs.put("ipc.client.connect.max.retries", "1");
-        attrs.put("fs.trash.interval", "2");
-        put("attribute1", attrs);
-      }});
-
-      final ClusterRequest clusterRequestDup =
-        new ClusterRequest(cluster.getClusterId(), clusterName,
-          cluster.getDesiredStackVersion().getStackVersion(), null);
-
-      clusterRequestDup.setDesiredConfig(Collections.singletonList(crr));
-      managementController.updateClusters(new HashSet<ClusterRequest>() {{
-        add(clusterRequestDup);
-      }}, null);
-
-      // global
-      crr.setType("global2");
-      crr.setVersionTag("version1");
-      crr.setProperties(new HashMap<String, String>() {{
-        put("dfs_namenode_name_dir", "/hadoop/hdfs/namenode");
-        put("namenode_heapsize", "1024");
-      }});
-      crr.setPropertiesAttributes(new HashMap<String, Map<String, String>>() {{
-        Map<String, String> attrs = new HashMap<String, String>();
-        attrs.put("dfs_namenode_name_dir", "3");
-        attrs.put("namenode_heapsize", "4");
-        put("attribute2", attrs);
-      }});
-
-      final ClusterRequest clusterRequestGlobalDup =
-        new ClusterRequest(cluster.getClusterId(), clusterName,
-          cluster.getDesiredStackVersion().getStackVersion(), null);
-
-      clusterRequestGlobalDup.setDesiredConfig(Collections.singletonList(crr));
-      managementController.updateClusters(new HashSet<ClusterRequest>() {{
-        add(clusterRequestGlobalDup);
-      }}, null);
-
-
       // oozie-site
       ConfigurationRequest cr4 = new ConfigurationRequest();
       cr4.setClusterName(clusterName);
@@ -265,7 +218,7 @@ public class ConfigHelperTest {
         put("timeline.service.operating.mode", "embedded");
         put("timeline.service.fifo.enabled", "false");
       }});
-      cr4.setPropertiesAttributes(null);
+      cr5.setPropertiesAttributes(null);
 
       final ClusterRequest clusterRequest5 =
         new ClusterRequest(cluster.getClusterId(), clusterName,
@@ -375,7 +328,28 @@ public class ConfigHelperTest {
 
     @Test
     public void testEffectiveTagsForHost() throws Exception {
-      final Config config = new ConfigImpl("core-site");
+
+      //Setup
+      ConfigurationRequest cr5 = new ConfigurationRequest();
+      cr5.setClusterName(clusterName);
+      cr5.setType("ams-env");
+      cr5.setVersionTag("version1");
+      cr5.setProperties(new HashMap<String, String>() {{
+        put("metrics_collector_log_dir", "/var/log/ambari-metrics-collector");
+        put("metrics_collector_pid_dir", "/var/run/ambari-metrics-collector");
+      }});
+      cr5.setPropertiesAttributes(null);
+
+      final ClusterRequest clusterRequest6 =
+        new ClusterRequest(cluster.getClusterId(), clusterName,
+          cluster.getDesiredStackVersion().getStackVersion(), null);
+
+      clusterRequest6.setDesiredConfig(Collections.singletonList(cr5));
+      managementController.updateClusters(new HashSet<ClusterRequest>() {{
+        add(clusterRequest6);
+      }}, null);
+
+      final Config config = new ConfigImpl("ams-env");
       config.setTag("version122");
 
       Map<String, String> properties = new HashMap<String, String>();
@@ -395,7 +369,7 @@ public class ConfigHelperTest {
           .getEffectiveDesiredTags(cluster, "h1");
 
       Assert.assertNotNull(configTags);
-      Map<String, String> tagsWithOverrides = configTags.get("core-site");
+      Map<String, String> tagsWithOverrides = configTags.get("ams-env");
       Assert.assertNotNull(tagsWithOverrides);
       Assert.assertTrue(tagsWithOverrides.containsKey(ConfigHelper.CLUSTER_DEFAULT_TAG));
       Assert.assertEquals("version1", tagsWithOverrides.get(ConfigHelper.CLUSTER_DEFAULT_TAG));
@@ -405,7 +379,57 @@ public class ConfigHelperTest {
 
     @Test
     public void testEffectivePropertiesWithOverrides() throws Exception {
-      final Config config1 = new ConfigImpl("core-site");
+
+      //Setup
+      // core-site
+      ConfigurationRequest cr = new ConfigurationRequest();
+      cr.setClusterName(clusterName);
+      cr.setType("core-site2");
+      cr.setVersionTag("version1");
+      cr.setProperties(new HashMap<String, String>() {{
+        put("ipc.client.connect.max.retries", "30");
+        put("fs.trash.interval", "30");
+      }});
+      cr.setPropertiesAttributes(new HashMap<String, Map<String, String>>() {{
+        Map<String, String> attrs = new HashMap<String, String>();
+        attrs.put("ipc.client.connect.max.retries", "1");
+        attrs.put("fs.trash.interval", "2");
+        put("attribute1", attrs);
+      }});
+
+      final ClusterRequest clusterRequest1 =
+        new ClusterRequest(cluster.getClusterId(), clusterName,
+          cluster.getDesiredStackVersion().getStackVersion(), null);
+
+      clusterRequest1.setDesiredConfig(Collections.singletonList(cr));
+      managementController.updateClusters(new HashSet<ClusterRequest>() {{
+        add(clusterRequest1);
+      }}, null);
+
+      // global
+      cr.setType("global2");
+      cr.setVersionTag("version1");
+      cr.setProperties(new HashMap<String, String>() {{
+        put("dfs_namenode_name_dir", "/hadoop/hdfs/namenode");
+        put("namenode_heapsize", "1024");
+      }});
+      cr.setPropertiesAttributes(new HashMap<String, Map<String, String>>() {{
+        Map<String, String> attrs = new HashMap<String, String>();
+        attrs.put("dfs_namenode_name_dir", "3");
+        attrs.put("namenode_heapsize", "4");
+        put("attribute2", attrs);
+      }});
+
+      final ClusterRequest clusterRequest3 =
+        new ClusterRequest(cluster.getClusterId(), clusterName,
+          cluster.getDesiredStackVersion().getStackVersion(), null);
+
+      clusterRequest3.setDesiredConfig(Collections.singletonList(cr));
+      managementController.updateClusters(new HashSet<ClusterRequest>() {{
+        add(clusterRequest3);
+      }}, null);
+
+      final Config config1 = new ConfigImpl("core-site2");
       config1.setTag("version122");
 
       Map<String, String> properties = new HashMap<String, String>();
@@ -413,7 +437,7 @@ public class ConfigHelperTest {
       properties.put("c", "d");
       config1.setProperties(properties);
 
-      final Config config2 = new ConfigImpl("global");
+      final Config config2 = new ConfigImpl("global2");
       config2.setTag("version122");
       Map<String, String> properties2 = new HashMap<String, String>();
       properties2.put("namenode_heapsize", "1111");
@@ -433,12 +457,12 @@ public class ConfigHelperTest {
               configHelper.getEffectiveDesiredTags(cluster, "h1"));
 
       Assert.assertNotNull(propertyMap);
-      Assert.assertTrue(propertyMap.containsKey("global"));
-      Map<String, String> globalProps = propertyMap.get("global");
+      Assert.assertTrue(propertyMap.containsKey("global2"));
+      Map<String, String> globalProps = propertyMap.get("global2");
       Assert.assertEquals("1111", globalProps.get("namenode_heapsize"));
       Assert.assertEquals("/hadoop/hdfs/namenode", globalProps.get("dfs_namenode_name_dir"));
       Assert.assertTrue(propertyMap.containsKey("core-site"));
-      Map<String, String> coreProps = propertyMap.get("core-site");
+      Map<String, String> coreProps = propertyMap.get("core-site2");
       Assert.assertTrue(coreProps.containsKey("a"));
       Assert.assertTrue(coreProps.containsKey("c"));
       Assert.assertEquals("30", coreProps.get("ipc.client.connect.max.retries"));
@@ -446,7 +470,58 @@ public class ConfigHelperTest {
 
     @Test
     public void testEffectivePropertiesAttributesWithOverrides() throws Exception {
-      final Config config1 = new ConfigImpl("core-site2");
+
+      //Another version of core-site & global.
+      // core-site3
+      ConfigurationRequest crr = new ConfigurationRequest();
+      crr.setClusterName(clusterName);
+      crr.setType("core-site3");
+      crr.setVersionTag("version1");
+      crr.setProperties(new HashMap<String, String>() {{
+        put("ipc.client.connect.max.retries", "30");
+        put("fs.trash.interval", "30");
+      }});
+      crr.setPropertiesAttributes(new HashMap<String, Map<String, String>>() {{
+        Map<String, String> attrs = new HashMap<String, String>();
+        attrs.put("ipc.client.connect.max.retries", "1");
+        attrs.put("fs.trash.interval", "2");
+        put("attribute1", attrs);
+      }});
+
+      final ClusterRequest clusterRequestDup =
+        new ClusterRequest(cluster.getClusterId(), clusterName,
+          cluster.getDesiredStackVersion().getStackVersion(), null);
+
+      clusterRequestDup.setDesiredConfig(Collections.singletonList(crr));
+      managementController.updateClusters(new HashSet<ClusterRequest>() {{
+        add(clusterRequestDup);
+      }}, null);
+
+      // global3
+      crr.setType("global3");
+      crr.setVersionTag("version1");
+      crr.setProperties(new HashMap<String, String>() {{
+        put("dfs_namenode_name_dir", "/hadoop/hdfs/namenode");
+        put("namenode_heapsize", "1024");
+      }});
+      crr.setPropertiesAttributes(new HashMap<String, Map<String, String>>() {{
+        Map<String, String> attrs = new HashMap<String, String>();
+        attrs.put("dfs_namenode_name_dir", "3");
+        attrs.put("namenode_heapsize", "4");
+        put("attribute2", attrs);
+      }});
+
+      final ClusterRequest clusterRequestGlobalDup =
+        new ClusterRequest(cluster.getClusterId(), clusterName,
+          cluster.getDesiredStackVersion().getStackVersion(), null);
+
+      clusterRequestGlobalDup.setDesiredConfig(Collections.singletonList(crr));
+      managementController.updateClusters(new HashSet<ClusterRequest>() {{
+        add(clusterRequestGlobalDup);
+      }}, null);
+
+
+      final Config config1 = new ConfigImpl("core-site3");
       config1.setTag("version122");
 
       Map<String, String> attributes = new HashMap<String, String>();
@@ -456,7 +531,7 @@ public class ConfigHelperTest {
       config1Attributes.put("attribute1", attributes);
       config1.setPropertiesAttributes(config1Attributes);
 
-      final Config config2 = new ConfigImpl("global2");
+      final Config config2 = new ConfigImpl("global3");
       config2.setTag("version122");
       attributes = new HashMap<String, String>();
       attributes.put("namenode_heapsize", "z");
@@ -466,7 +541,7 @@ public class ConfigHelperTest {
       config2.setPropertiesAttributes(config2Attributes);
 
       Long groupId = addConfigGroup("g3", "t1", new ArrayList<String>() {{
-        add("h2");
+        add("h3");
       }}, new ArrayList<Config>() {{
         add(config1);
         add(config2);
@@ -476,13 +551,13 @@ public class ConfigHelperTest {
 
       Map<String, Map<String, Map<String, String>>> effectiveAttributes = configHelper
           .getEffectiveConfigAttributes(cluster,
-              configHelper.getEffectiveDesiredTags(cluster, "h2"));
+              configHelper.getEffectiveDesiredTags(cluster, "h3"));
 
       Assert.assertNotNull(effectiveAttributes);
-      Assert.assertEquals(7, effectiveAttributes.size());
+      Assert.assertEquals(10, effectiveAttributes.size());
 
-      Assert.assertTrue(effectiveAttributes.containsKey("global2"));
-      Map<String, Map<String, String>> globalAttrs = effectiveAttributes.get("global2");
+      Assert.assertTrue(effectiveAttributes.containsKey("global3"));
+      Map<String, Map<String, String>> globalAttrs = effectiveAttributes.get("global3");
       Assert.assertEquals(1, globalAttrs.size());
       Assert.assertTrue(globalAttrs.containsKey("attribute2"));
       Map<String, String> attribute2Occurances = globalAttrs.get("attribute2");
@@ -494,8 +569,8 @@ public class ConfigHelperTest {
       Assert.assertTrue(attribute2Occurances.containsKey("c"));
       Assert.assertEquals("q", attribute2Occurances.get("c"));
 
-      Assert.assertTrue(effectiveAttributes.containsKey("core-site2"));
-      Map<String, Map<String, String>> coreAttrs = effectiveAttributes.get("core-site2");
+      Assert.assertTrue(effectiveAttributes.containsKey("core-site3"));
+      Map<String, Map<String, String>> coreAttrs = effectiveAttributes.get("core-site3");
       Assert.assertEquals(1, coreAttrs.size());
       Assert.assertTrue(coreAttrs.containsKey("attribute1"));
       Map<String, String> attribute1Occurances = coreAttrs.get("attribute1");


[07/12] ambari git commit: AMBARI-18609. Implement a way to configure Stack Upgrade Merger to skip particular properties to be merged from stack defaults (aonishuk)

Posted by jo...@apache.org.
AMBARI-18609. Implement a way to configure Stack Upgrade Merger to skip particular properties to be merged from stack defaults (aonishuk)


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

Branch: refs/heads/branch-feature-AMBARI-18456
Commit: 3fc0b3e66b605bc628e9994be1c96c2c46396388
Parents: 61cc3a9
Author: Andrew Onishuk <ao...@hortonworks.com>
Authored: Tue Oct 18 17:54:51 2016 +0300
Committer: Andrew Onishuk <ao...@hortonworks.com>
Committed: Tue Oct 18 17:54:51 2016 +0300

----------------------------------------------------------------------
 .../internal/UpgradeResourceProvider.java       |  4 +-
 .../ambari/server/state/ConfigHelper.java       | 17 +++---
 .../ambari/server/state/PropertyInfo.java       | 11 ++++
 .../state/PropertyStackUpgradeBehavior.java     | 57 ++++++++++++++++++++
 .../src/main/resources/configuration-schema.xsd |  5 ++
 .../services/STORM/configuration/storm-site.xml |  1 +
 .../StackUpgradeConfigurationMergeTest.java     |  4 +-
 .../internal/UpgradeResourceProviderTest.java   |  6 +--
 8 files changed, 91 insertions(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/3fc0b3e6/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/UpgradeResourceProvider.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/UpgradeResourceProvider.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/UpgradeResourceProvider.java
index d37e32b..7b7a7a3 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/UpgradeResourceProvider.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/UpgradeResourceProvider.java
@@ -1111,10 +1111,10 @@ public class UpgradeResourceProvider extends AbstractControllerResourceProvider
       // used when determining if a property has been customized and should be
       // overriden with the new stack value)
       Map<String, Map<String, String>> oldStackDefaultConfigurationsByType = configHelper.getDefaultProperties(
-          currentStackId, cluster);
+          currentStackId, cluster, true);
 
       // populate a map with default configurations from the new stack
-      newConfigurationsByType = configHelper.getDefaultProperties(targetStackId, cluster);
+      newConfigurationsByType = configHelper.getDefaultProperties(targetStackId, cluster, true);
 
       // We want to skip updating config-types of services that are not in the upgrade pack.
       // Care should be taken as some config-types could be in services that are in and out

http://git-wip-us.apache.org/repos/asf/ambari/blob/3fc0b3e6/ambari-server/src/main/java/org/apache/ambari/server/state/ConfigHelper.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/state/ConfigHelper.java b/ambari-server/src/main/java/org/apache/ambari/server/state/ConfigHelper.java
index 70c24f9..197ffdd 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/state/ConfigHelper.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/state/ConfigHelper.java
@@ -944,11 +944,12 @@ public class ConfigHelper {
    * @param cluster
    *          the cluster to use when determining which services default
    *          configurations to include (not {@code null}).
+   * @param onStackUpgradeFilter if true skip {@code <on-stack-upgrade merge="false"/>} properties
    * @return a mapping of configuration type to map of key/value pairs for the
    *         default configurations.
    * @throws AmbariException
    */
-  public Map<String, Map<String, String>> getDefaultProperties(StackId stack, Cluster cluster)
+  public Map<String, Map<String, String>> getDefaultProperties(StackId stack, Cluster cluster, boolean onStackUpgradeFilter)
       throws AmbariException {
     Map<String, Map<String, String>> defaultPropertiesByType = new HashMap<String, Map<String, String>>();
 
@@ -962,9 +963,10 @@ public class ConfigHelper {
       if (!defaultPropertiesByType.containsKey(type)) {
         defaultPropertiesByType.put(type, new HashMap<String, String>());
       }
-
-      defaultPropertiesByType.get(type).put(stackDefaultProperty.getName(),
-          stackDefaultProperty.getValue());
+      if (!onStackUpgradeFilter || stackDefaultProperty.getPropertyStackUpgradeBehavior().isMerge()) {
+        defaultPropertiesByType.get(type).put(stackDefaultProperty.getName(),
+            stackDefaultProperty.getValue());
+      }
     }
 
     // for every installed service, populate the default service properties
@@ -979,9 +981,10 @@ public class ConfigHelper {
         if (!defaultPropertiesByType.containsKey(type)) {
           defaultPropertiesByType.put(type, new HashMap<String, String>());
         }
-
-        defaultPropertiesByType.get(type).put(serviceDefaultProperty.getName(),
-            serviceDefaultProperty.getValue());
+        if (!onStackUpgradeFilter || serviceDefaultProperty.getPropertyStackUpgradeBehavior().isMerge()) {
+          defaultPropertiesByType.get(type).put(serviceDefaultProperty.getName(),
+              serviceDefaultProperty.getValue());
+        }
       }
     }
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/3fc0b3e6/ambari-server/src/main/java/org/apache/ambari/server/state/PropertyInfo.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/state/PropertyInfo.java b/ambari-server/src/main/java/org/apache/ambari/server/state/PropertyInfo.java
index f89be4d..81de76c 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/state/PropertyInfo.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/state/PropertyInfo.java
@@ -53,6 +53,9 @@ public class PropertyInfo {
   @XmlElement(name="on-ambari-upgrade", required = true)
   private PropertyUpgradeBehavior propertyAmbariUpgradeBehavior;
 
+  @XmlElement(name="on-stack-upgrade")
+  private PropertyStackUpgradeBehavior propertyStackUpgradeBehavior = new PropertyStackUpgradeBehavior();
+
   @XmlAttribute(name = "require-input")
   private boolean requireInput;
 
@@ -248,6 +251,14 @@ public class PropertyInfo {
       '}';
   }
 
+  public PropertyStackUpgradeBehavior getPropertyStackUpgradeBehavior() {
+    return propertyStackUpgradeBehavior;
+  }
+
+  public void setPropertyStackUpgradeBehavior(PropertyStackUpgradeBehavior propertyStackUpgradeBehavior) {
+    this.propertyStackUpgradeBehavior = propertyStackUpgradeBehavior;
+  }
+
   public enum PropertyType {
     PASSWORD,
     USER,

http://git-wip-us.apache.org/repos/asf/ambari/blob/3fc0b3e6/ambari-server/src/main/java/org/apache/ambari/server/state/PropertyStackUpgradeBehavior.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/state/PropertyStackUpgradeBehavior.java b/ambari-server/src/main/java/org/apache/ambari/server/state/PropertyStackUpgradeBehavior.java
new file mode 100644
index 0000000..5e11601
--- /dev/null
+++ b/ambari-server/src/main/java/org/apache/ambari/server/state/PropertyStackUpgradeBehavior.java
@@ -0,0 +1,57 @@
+/**
+ * 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.state;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlAttribute;
+
+/**
+ * Represents a behavior used during ambari upgrade for property
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+public class PropertyStackUpgradeBehavior {
+
+  /**
+   * If true, then merge this property during stack-upgrade
+   */
+  @XmlAttribute(name="merge", required = false)
+  private boolean merge = true;
+
+  public PropertyStackUpgradeBehavior() {
+  }
+
+  public PropertyStackUpgradeBehavior(boolean merge) {
+    this.merge = merge;
+  }
+
+  /**
+   * @return policy of merging this property during stack-upgrade
+   */
+  public boolean isMerge() {
+    return merge;
+  }
+
+  /**
+   * set policy of merging this property during stack-upgrade
+   * @param merge if true, then merge this property during stack-upgrade
+   */
+  public void setMerge(boolean merge) {
+    this.merge = merge;
+  }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/3fc0b3e6/ambari-server/src/main/resources/configuration-schema.xsd
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/configuration-schema.xsd b/ambari-server/src/main/resources/configuration-schema.xsd
index 41d4e51..daba29f 100644
--- a/ambari-server/src/main/resources/configuration-schema.xsd
+++ b/ambari-server/src/main/resources/configuration-schema.xsd
@@ -41,6 +41,7 @@
       <xs:element name="deleted" type="xs:boolean" minOccurs="0"/>
       <xs:element name="final" type="xs:boolean" minOccurs="0"/>
       <xs:element name="on-ambari-upgrade" type="propertyUpgradeBehavior" minOccurs="1"/>
+      <xs:element name="on-stack-upgrade" type="propertyStackUpgradeBehavior" minOccurs="0"/>
       <xs:element name="property-type" minOccurs="0">
         <xs:simpleType>
           <xs:list itemType="propertyType"/>
@@ -72,6 +73,10 @@
     <xs:attribute name="update" type="xs:boolean" use="optional"/>
   </xs:complexType>
 
+  <xs:complexType name="propertyStackUpgradeBehavior">
+    <xs:attribute name="merge" type="xs:boolean" use="optional" default="true"/>
+  </xs:complexType>
+
   <xs:complexType name="valueAttributesInfo">
     <xs:all>
       <xs:element name="type" type="xs:string" minOccurs="0"/>

http://git-wip-us.apache.org/repos/asf/ambari/blob/3fc0b3e6/ambari-server/src/main/resources/stacks/HDP/2.3/services/STORM/configuration/storm-site.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.3/services/STORM/configuration/storm-site.xml b/ambari-server/src/main/resources/stacks/HDP/2.3/services/STORM/configuration/storm-site.xml
index b71f4a9..2392079 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.3/services/STORM/configuration/storm-site.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.3/services/STORM/configuration/storm-site.xml
@@ -69,5 +69,6 @@
       </property>
     </depends-on>
     <on-ambari-upgrade add="false"/>
+    <on-stack-upgrade merge="false"/>
   </property>
 </configuration>

http://git-wip-us.apache.org/repos/asf/ambari/blob/3fc0b3e6/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/StackUpgradeConfigurationMergeTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/StackUpgradeConfigurationMergeTest.java b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/StackUpgradeConfigurationMergeTest.java
index 4f2580a..a49fc09 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/StackUpgradeConfigurationMergeTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/StackUpgradeConfigurationMergeTest.java
@@ -193,11 +193,11 @@ public class StackUpgradeConfigurationMergeTest extends EasyMockSupport {
 
     // HDP 2.4 configs
     EasyMock.expect(configHelper.getDefaultProperties(EasyMock.eq(s_currentStackId),
-        EasyMock.anyObject(Cluster.class))).andReturn(oldStackDefaultConfigurationsByType);
+        EasyMock.anyObject(Cluster.class), EasyMock.anyBoolean())).andReturn(oldStackDefaultConfigurationsByType);
 
     // HDP 2.5 configs
     EasyMock.expect(configHelper.getDefaultProperties(EasyMock.eq(s_targetStackId),
-        EasyMock.anyObject(Cluster.class))).andReturn(newConfigurationsByType);
+        EasyMock.anyObject(Cluster.class), EasyMock.anyBoolean())).andReturn(newConfigurationsByType);
 
     // CURRENT HDP 2.4 configs
     Config currentClusterConfigFoo = createNiceMock(Config.class);

http://git-wip-us.apache.org/repos/asf/ambari/blob/3fc0b3e6/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/UpgradeResourceProviderTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/UpgradeResourceProviderTest.java b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/UpgradeResourceProviderTest.java
index 63892cf..c8325e0 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/UpgradeResourceProviderTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/UpgradeResourceProviderTest.java
@@ -154,7 +154,7 @@ public class UpgradeResourceProviderTest {
 
     expect(
         configHelper.getDefaultProperties(EasyMock.anyObject(StackId.class),
-            EasyMock.anyObject(Cluster.class))).andReturn(
+            EasyMock.anyObject(Cluster.class), EasyMock.anyBoolean())).andReturn(
         new HashMap<String, Map<String, String>>()).anyTimes();
 
 
@@ -1168,11 +1168,11 @@ public class UpgradeResourceProviderTest {
     EasyMock.reset(configHelper);
 
     expect(
-        configHelper.getDefaultProperties(EasyMock.eq(stack211), EasyMock.anyObject(Cluster.class))).andReturn(
+        configHelper.getDefaultProperties(EasyMock.eq(stack211), EasyMock.anyObject(Cluster.class), EasyMock.anyBoolean())).andReturn(
         stack211Configs).anyTimes();
 
     expect(
-        configHelper.getDefaultProperties(EasyMock.eq(stack220), EasyMock.anyObject(Cluster.class))).andReturn(
+        configHelper.getDefaultProperties(EasyMock.eq(stack220), EasyMock.anyObject(Cluster.class), EasyMock.anyBoolean())).andReturn(
         stack220Configs).anyTimes();
 
     Capture<Map<String, Map<String, String>>> expectedConfigurationsCapture = new Capture<Map<String, Map<String, String>>>();


[08/12] ambari git commit: AMBARI-18627. Add service wizard hung at Choose services page as no ClusterStackVersion is available with state=CURRENT (alexantonenko)

Posted by jo...@apache.org.
AMBARI-18627. Add service wizard hung at Choose services page as no ClusterStackVersion is available with state=CURRENT (alexantonenko)


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

Branch: refs/heads/branch-feature-AMBARI-18456
Commit: ee2a12527864dd1238b18366badfec89465444b3
Parents: 3fc0b3e
Author: Alex Antonenko <hi...@gmail.com>
Authored: Tue Oct 18 17:00:16 2016 +0300
Committer: Alex Antonenko <hi...@gmail.com>
Committed: Tue Oct 18 18:03:24 2016 +0300

----------------------------------------------------------------------
 .../main/admin/stack_and_upgrade_controller.js  |  22 ++-
 ambari-web/app/controllers/wizard.js            |  12 +-
 ambari-web/app/utils/ajax/ajax.js               |   2 +-
 .../admin/stack_and_upgrade_controller_test.js  | 154 ++++++++++++++++---
 4 files changed, 156 insertions(+), 34 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/ee2a1252/ambari-web/app/controllers/main/admin/stack_and_upgrade_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/admin/stack_and_upgrade_controller.js b/ambari-web/app/controllers/main/admin/stack_and_upgrade_controller.js
index 01feb14..58344b2 100644
--- a/ambari-web/app/controllers/main/admin/stack_and_upgrade_controller.js
+++ b/ambari-web/app/controllers/main/admin/stack_and_upgrade_controller.js
@@ -678,7 +678,7 @@ App.MainAdminStackAndUpgradeController = Em.Controller.extend(App.LocalStorage,
       },
       error: errorCallback
     });
-  },  
+  },
 
   /**
    * error callback of <code>abortUpgrade()</code>
@@ -1430,7 +1430,7 @@ App.MainAdminStackAndUpgradeController = Em.Controller.extend(App.LocalStorage,
       stackVersionNumber = App.get('currentStackVersion');
     return stackVersionNumber;
   },
-  
+
   /**
    * perform validation if <code>skip<code> is  false and run save if
    * validation successfull or run save without validation is <code>skip<code> is true
@@ -1447,7 +1447,7 @@ App.MainAdminStackAndUpgradeController = Em.Controller.extend(App.LocalStorage,
       } else {
         var repoVersion = self.prepareRepoForSaving(repo);
         var stackVersionNumber = self.getStackVersionNumber(repo);
-        
+
         App.ajax.send({
           name: 'admin.stack_versions.edit.repo',
           sender: this,
@@ -1464,7 +1464,7 @@ App.MainAdminStackAndUpgradeController = Em.Controller.extend(App.LocalStorage,
     });
     return deferred.promise();
   },
-  
+
   /**
    * send request for validation for each repository
    * @param {Em.Object} repo
@@ -1475,7 +1475,7 @@ App.MainAdminStackAndUpgradeController = Em.Controller.extend(App.LocalStorage,
     var deferred = $.Deferred(),
       totalCalls = 0,
       invalidUrls = [];
-    
+
     if (skip) {
       deferred.resolve(invalidUrls);
     } else {
@@ -1903,10 +1903,16 @@ App.MainAdminStackAndUpgradeController = Em.Controller.extend(App.LocalStorage,
    * @param {object|null} jsonData
    */
   loadServiceVersionFromVersionDefinitionsSuccessCallback: function (jsonData) {
-    var rv = jsonData.items[0].repository_versions[0].RepositoryVersions;
+    var versions = Em.getWithDefault(jsonData, 'items', []);
+    var currentVersion = versions.filterProperty('ClusterStackVersions.state', 'CURRENT')[0];
+    var rv = currentVersion || versions.filter(function(i) {
+      return i.ClusterStackVersions.stack === App.get('currentStackName') &&
+       i.ClusterStackVersions.version === App.get('currentStackVersionNumber');
+    })[0];
     var map = this.get('serviceVersionsMap');
-    if (rv) {
-      rv.stack_services.forEach(function (item) {
+    var stackServices = Em.getWithDefault(rv || {}, 'repository_versions.0.RepositoryVersions.stack_services', false);
+    if (stackServices) {
+      stackServices.forEach(function (item) {
         map[item.name] = item.versions[0];
       });
     }

http://git-wip-us.apache.org/repos/asf/ambari/blob/ee2a1252/ambari-web/app/controllers/wizard.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/wizard.js b/ambari-web/app/controllers/wizard.js
index e0df4fa..05cd35c 100644
--- a/ambari-web/app/controllers/wizard.js
+++ b/ambari-web/app/controllers/wizard.js
@@ -696,10 +696,16 @@ App.WizardController = Em.Controller.extend(App.LocalStorage, App.ThemesMappingM
 
   serviceVersionsMap: {},
   loadServiceVersionFromVersionDefinitionsSuccessCallback: function (jsonData) {
-    var rv = jsonData.items[0].repository_versions[0].RepositoryVersions;
+    var versions = Em.getWithDefault(jsonData, 'items', []);
+    var currentVersion = versions.filterProperty('ClusterStackVersions.state', 'CURRENT')[0];
+    var rv = currentVersion || versions.filter(function(i) {
+      return i.ClusterStackVersions.stack === App.get('currentStackName') &&
+       i.ClusterStackVersions.version === App.get('currentStackVersionNumber');
+    })[0];
     var map = this.get('serviceVersionsMap');
-    if (rv) {
-      rv.stack_services.forEach(function (item) {
+    var stackServices = Em.getWithDefault(rv || {}, 'repository_versions.0.RepositoryVersions.stack_services', false);
+    if (stackServices) {
+      stackServices.forEach(function (item) {
         map[item.name] = item.versions[0];
       });
     }

http://git-wip-us.apache.org/repos/asf/ambari/blob/ee2a1252/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 a5eafef..b761a14 100644
--- a/ambari-web/app/utils/ajax/ajax.js
+++ b/ambari-web/app/utils/ajax/ajax.js
@@ -1387,7 +1387,7 @@ var urls = {
     'mock': '/data/stack_versions/stack_version_all.json'
   },
   'cluster.load_current_repo_stack_services': {
-    'real': '/clusters/{clusterName}/stack_versions?ClusterStackVersions/state=CURRENT&fields=repository_versions/RepositoryVersions/stack_services',
+    'real': '/clusters/{clusterName}/stack_versions?fields=repository_versions/RepositoryVersions/stack_services,ClusterStackVersions/state',
     'mock': '/data/stack_versions/stack_version_all.json'
   },
   'cluster.save_provisioning_state': {

http://git-wip-us.apache.org/repos/asf/ambari/blob/ee2a1252/ambari-web/test/controllers/main/admin/stack_and_upgrade_controller_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/main/admin/stack_and_upgrade_controller_test.js b/ambari-web/test/controllers/main/admin/stack_and_upgrade_controller_test.js
index ecf861d..21942d4 100644
--- a/ambari-web/test/controllers/main/admin/stack_and_upgrade_controller_test.js
+++ b/ambari-web/test/controllers/main/admin/stack_and_upgrade_controller_test.js
@@ -3121,31 +3121,141 @@ describe('App.MainAdminStackAndUpgradeController', function() {
   });
 
   describe("#loadServiceVersionFromVersionDefinitionsSuccessCallback()", function () {
+    var cases;
+    beforeEach(function() {
+      this.appGetStub = sinon.stub(App, 'get');
+    });
 
-    it("serviceVersionsMap should be set", function() {
+    afterEach(function() {
+      App.get.restore();
       controller.set('serviceVersionsMap', {});
-      var data = {
-        items: [
-          {
-            repository_versions: [
-              {
-                RepositoryVersions: {
-                  stack_services: [
-                    {
-                      name: 'S1',
-                      versions: ['v1']
-                    }
-                  ]
+    });
+    cases = [
+      {
+        jsonData: {
+          items: [
+            {
+              ClusterStackVersions: {
+                state: 'CURRENT'
+              },
+              repository_versions: [
+                {
+                  RepositoryVersions: {
+                    stack_services: [
+                      { name: 'S1', versions: ['v1']}
+                    ]
+                  }
                 }
-              }
-            ]
-          }
-        ]
-      };
-      controller.loadServiceVersionFromVersionDefinitionsSuccessCallback(data);
-      expect(controller.get('serviceVersionsMap')).to.be.eql({
-        "S1": "v1"
-      });
+              ]
+            }
+          ]
+        },
+        currentStackData: {
+          currentStackVersionNumber: '2.2',
+          currentStackName: 'HDP'
+        },
+        m: 'should add stack services from stack version with state CURRENT',
+        e: { "S1": "v1"}
+      },
+      {
+        jsonData: {
+          items: [
+            {
+              ClusterStackVersions: {
+                version: '2.3',
+                stack: 'HDP',
+                state: 'INIT'
+              },
+              repository_versions: [
+                {
+                  RepositoryVersions: {
+                    stack_services: [
+                      { name: 'S3', versions: ['v3']}
+                    ]
+                  }
+                }
+              ]
+            },
+            {
+              ClusterStackVersions: {
+                version: '2.2',
+                stack: 'HDP',
+                state: 'INIT'
+              },
+              repository_versions: [
+                {
+                  RepositoryVersions: {
+                    stack_services: [
+                      { name: 'S2', versions: ['v2']}
+                    ]
+                  }
+                }
+              ]
+            }
+          ]
+        },
+        currentStackData: {
+          currentStackVersionNumber: '2.2',
+          currentStackName: 'HDP'
+        },
+        m: 'should add stack services from stack version by current stack name and version number' +
+           'when CURRENT version not available',
+        e: { "S2": "v2"}
+      },
+      {
+        jsonData: {
+          items: [
+            {
+              ClusterStackVersions: {
+                version: '2.3',
+                stack: 'HDP',
+                state: 'CURRENT'
+              },
+              repository_versions: [
+                {
+                  RepositoryVersions: {
+                    stack_services: [
+                      { name: 'S3', versions: ['v3']}
+                    ]
+                  }
+                }
+              ]
+            },
+            {
+              ClusterStackVersions: {
+                version: '2.2',
+                stack: 'HDP',
+                state: 'INIT'
+              },
+              repository_versions: [
+                {
+                  RepositoryVersions: {
+                    stack_services: [
+                      { name: 'S2', versions: ['v2']}
+                    ]
+                  }
+                }
+              ]
+            }
+          ]
+        },
+        currentStackData: {
+          currentStackVersionNumber: '2.2',
+          currentStackName: 'HDP'
+        },
+        m: 'should add stack services by state CURRENT even when there is stack version with ' +
+           'current stack name and version number',
+        e: { "S3": "v3"}
+      }
+    ];
+
+    cases.forEach(function(test) {
+      it(test.m, function() {
+        this.appGetStub.withArgs('currentStackName').returns(test.currentStackData.currentStackName)
+          .withArgs('currentStackVersionNumber').returns(test.currentStackData.currentStackVersionNumber);
+        controller.loadServiceVersionFromVersionDefinitionsSuccessCallback(test.jsonData);
+        expect(controller.get('serviceVersionsMap')).to.be.eql(test.e);
+      })
     });
   });
 


[10/12] ambari git commit: AMBARI-18611 Ambari MIB Should Be Included with Installation Bits (dsen)

Posted by jo...@apache.org.
AMBARI-18611 Ambari MIB Should Be Included with Installation Bits (dsen)


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

Branch: refs/heads/branch-feature-AMBARI-18456
Commit: 83aebdaa577b526a8e123cfda53cea27d1138a1e
Parents: e68cc10
Author: Dmytro Sen <ds...@apache.org>
Authored: Tue Oct 18 18:57:47 2016 +0300
Committer: Dmytro Sen <ds...@apache.org>
Committed: Tue Oct 18 18:57:47 2016 +0300

----------------------------------------------------------------------
 ambari-server/src/main/assemblies/server.xml    |   4 +
 .../src/main/resources/APACHE-AMBARI-MIB.txt    | 206 +++++++++++++++++++
 contrib/alert-snmp-mib/APACHE-AMBARI-MIB.txt    | 206 -------------------
 contrib/alert-snmp-mib/README.md                |   2 +-
 4 files changed, 211 insertions(+), 207 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/83aebdaa/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 9252c56..11f940a 100644
--- a/ambari-server/src/main/assemblies/server.xml
+++ b/ambari-server/src/main/assemblies/server.xml
@@ -295,6 +295,10 @@
       <outputDirectory>/var/lib/ambari-server/resources</outputDirectory>
     </file>
     <file>
+      <source>src/main/resources/APACHE-AMBARI-MIB.txt</source>
+      <outputDirectory>/var/lib/ambari-server/resources</outputDirectory>
+    </file>
+    <file>
       <source>src/main/resources/slider_resources/README.txt</source>
       <outputDirectory>/var/lib/ambari-server/resources/apps</outputDirectory>
     </file>

http://git-wip-us.apache.org/repos/asf/ambari/blob/83aebdaa/ambari-server/src/main/resources/APACHE-AMBARI-MIB.txt
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/APACHE-AMBARI-MIB.txt b/ambari-server/src/main/resources/APACHE-AMBARI-MIB.txt
new file mode 100644
index 0000000..85ec3cd
--- /dev/null
+++ b/ambari-server/src/main/resources/APACHE-AMBARI-MIB.txt
@@ -0,0 +1,206 @@
+-- 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.
+
+
+APACHE-AMBARI-MIB DEFINITIONS ::= BEGIN
+
+IMPORTS
+    MODULE-IDENTITY, OBJECT-TYPE, NOTIFICATION-TYPE, Integer32, enterprises
+                                                        FROM SNMPv2-SMI
+    MODULE-COMPLIANCE, OBJECT-GROUP, NOTIFICATION-GROUP
+                                                        FROM SNMPv2-CONF
+    TEXTUAL-CONVENTION
+                                                        FROM SNMPv2-TC
+    ;
+
+apacheAmbari MODULE-IDENTITY
+    LAST-UPDATED "201508310000Z"
+    ORGANIZATION "ambari.apache.org"
+    CONTACT-INFO
+        "email: user@ambari.apache.org"
+    DESCRIPTION
+        "Apache Ambari MIB Module"
+    -- Revisions
+    REVISION "201508310000Z"
+    DESCRIPTION
+        "First Apache Ambari MIB"
+    ::= { apache 16 }
+
+apache OBJECT IDENTIFIER ::= { enterprises 18060 }
+apacheAmbariTraps OBJECT IDENTIFIER ::= { apacheAmbari 0 }
+apacheAmbariAlerts OBJECT IDENTIFIER ::= { apacheAmbari 1 }
+
+AlertStateType ::= TEXTUAL-CONVENTION
+  STATUS current
+  DESCRIPTION
+    "A string indicating the state of the Alert."
+  SYNTAX INTEGER {
+    ok(0),
+    unknown(1),
+    warning(2),
+    critical(3)
+  }
+
+apacheAmbariAlertTable OBJECT-TYPE 
+  SYNTAX      SEQUENCE OF AlertEntry
+  MAX-ACCESS  not-accessible
+  STATUS      current
+  DESCRIPTION
+    "Table of Apache Ambari Alerts"
+  ::= { apacheAmbariAlerts 1 }
+
+AlertEntry ::= SEQUENCE {
+  alertDefinitionId    Integer32,
+  alertDefinitionName  OCTET STRING,
+  alertDefinitionHash  OCTET STRING,
+  alertName            OCTET STRING,
+  alertText            OCTET STRING,
+  alertState           AlertStateType,
+  alertHost            OCTET STRING,
+  alertService         OCTET STRING,
+  alertComponent       OCTET STRING  
+  }
+  
+apacheAmbariAlertEntry  OBJECT-TYPE
+  SYNTAX      AlertEntry
+  MAX-ACCESS  not-accessible
+  STATUS      current
+  DESCRIPTION
+    "Each Alert Event"
+  INDEX { alertDefinitionId }
+  ::= { apacheAmbariAlertTable 1 }
+
+alertDefinitionId         OBJECT-TYPE
+    SYNTAX      Integer32 (-2147483648..2147483647)
+    MAX-ACCESS  not-accessible
+    STATUS      current
+    DESCRIPTION
+        "ID of the Alert"
+    ::= { apacheAmbariAlertEntry 1 }
+    
+alertDefinitionName         OBJECT-TYPE
+    SYNTAX      OCTET STRING
+    MAX-ACCESS  accessible-for-notify
+    STATUS      current
+    DESCRIPTION
+        "Alert Definition Name"
+    ::= { apacheAmbariAlertEntry 2 }    
+    
+alertDefinitionHash         OBJECT-TYPE
+    SYNTAX      OCTET STRING
+    MAX-ACCESS  accessible-for-notify
+    STATUS      current
+    DESCRIPTION
+        "Alert Definition Hash"
+    ::= { apacheAmbariAlertEntry 3 }    
+
+alertName         OBJECT-TYPE
+    SYNTAX      OCTET STRING
+    MAX-ACCESS  accessible-for-notify
+    STATUS      current
+    DESCRIPTION
+        "Name of the Alert"
+    ::= { apacheAmbariAlertEntry 4 }    
+
+alertText         OBJECT-TYPE
+    SYNTAX      OCTET STRING
+    MAX-ACCESS  accessible-for-notify
+    STATUS      current
+    DESCRIPTION
+        "Text output of the Alert"
+    ::= { apacheAmbariAlertEntry 5 }
+
+alertState         OBJECT-TYPE
+    SYNTAX      AlertStateType
+    MAX-ACCESS  accessible-for-notify
+    STATUS      current
+    DESCRIPTION
+        "Severity of the Alert"
+    ::= { apacheAmbariAlertEntry 6 }
+
+alertHost    OBJECT-TYPE
+    SYNTAX      OCTET STRING
+    MAX-ACCESS  accessible-for-notify
+    STATUS      current
+    DESCRIPTION
+        "Affected Host"
+    ::= { apacheAmbariAlertEntry 7 }
+    
+alertService    OBJECT-TYPE
+    SYNTAX      OCTET STRING
+    MAX-ACCESS  accessible-for-notify
+    STATUS      current
+    DESCRIPTION
+        "Affected Service"
+    ::= { apacheAmbariAlertEntry 8 }
+    
+alertComponent    OBJECT-TYPE
+    SYNTAX      OCTET STRING
+    MAX-ACCESS  accessible-for-notify
+    STATUS      current
+    DESCRIPTION
+        "Affected Component"
+    ::= { apacheAmbariAlertEntry 9 }    
+    
+apacheAmbariAlert  NOTIFICATION-TYPE
+  OBJECTS {
+    alertDefinitionName, alertDefinitionHash,
+    alertName, alertText, alertState, alertHost, alertService,
+    alertComponent
+  }
+  STATUS  current
+  DESCRIPTION
+    "The SNMP trap that is generated as a result of an alert."
+  ::= { apacheAmbariTraps 1 }    
+
+apacheAmbariConformance   OBJECT IDENTIFIER ::=
+    { apacheAmbariAlerts 3 }
+apacheAmbariCompliances OBJECT IDENTIFIER ::=
+    { apacheAmbariConformance 1 }
+apacheAmbariConformanceGroups      OBJECT IDENTIFIER ::=
+    { apacheAmbariConformance 2 }
+
+apacheAmbariMIBCompliance MODULE-COMPLIANCE
+    STATUS current
+    DESCRIPTION
+        "Compliance statement for entities which implement this MIB."
+    MODULE
+        MANDATORY-GROUPS {
+            apacheAmbariAlertGroup,
+            apacheAmbariAlertObjectGroup
+        }
+    ::= { apacheAmbariCompliances 2 }
+
+apacheAmbariAlertGroup NOTIFICATION-GROUP
+    NOTIFICATIONS {
+        apacheAmbariAlert
+    }
+    STATUS current
+    DESCRIPTION
+        "Notification objects."
+    ::= { apacheAmbariConformanceGroups 2 }
+
+apacheAmbariAlertObjectGroup OBJECT-GROUP
+    OBJECTS {
+      alertDefinitionName, alertDefinitionHash,
+      alertName, alertText, alertState, alertHost, alertService,
+      alertComponent
+    }
+    STATUS current
+    DESCRIPTION
+            "Event Objects"
+    ::= { apacheAmbariConformanceGroups 3 }
+END

http://git-wip-us.apache.org/repos/asf/ambari/blob/83aebdaa/contrib/alert-snmp-mib/APACHE-AMBARI-MIB.txt
----------------------------------------------------------------------
diff --git a/contrib/alert-snmp-mib/APACHE-AMBARI-MIB.txt b/contrib/alert-snmp-mib/APACHE-AMBARI-MIB.txt
deleted file mode 100644
index 85ec3cd..0000000
--- a/contrib/alert-snmp-mib/APACHE-AMBARI-MIB.txt
+++ /dev/null
@@ -1,206 +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.
-
-
-APACHE-AMBARI-MIB DEFINITIONS ::= BEGIN
-
-IMPORTS
-    MODULE-IDENTITY, OBJECT-TYPE, NOTIFICATION-TYPE, Integer32, enterprises
-                                                        FROM SNMPv2-SMI
-    MODULE-COMPLIANCE, OBJECT-GROUP, NOTIFICATION-GROUP
-                                                        FROM SNMPv2-CONF
-    TEXTUAL-CONVENTION
-                                                        FROM SNMPv2-TC
-    ;
-
-apacheAmbari MODULE-IDENTITY
-    LAST-UPDATED "201508310000Z"
-    ORGANIZATION "ambari.apache.org"
-    CONTACT-INFO
-        "email: user@ambari.apache.org"
-    DESCRIPTION
-        "Apache Ambari MIB Module"
-    -- Revisions
-    REVISION "201508310000Z"
-    DESCRIPTION
-        "First Apache Ambari MIB"
-    ::= { apache 16 }
-
-apache OBJECT IDENTIFIER ::= { enterprises 18060 }
-apacheAmbariTraps OBJECT IDENTIFIER ::= { apacheAmbari 0 }
-apacheAmbariAlerts OBJECT IDENTIFIER ::= { apacheAmbari 1 }
-
-AlertStateType ::= TEXTUAL-CONVENTION
-  STATUS current
-  DESCRIPTION
-    "A string indicating the state of the Alert."
-  SYNTAX INTEGER {
-    ok(0),
-    unknown(1),
-    warning(2),
-    critical(3)
-  }
-
-apacheAmbariAlertTable OBJECT-TYPE 
-  SYNTAX      SEQUENCE OF AlertEntry
-  MAX-ACCESS  not-accessible
-  STATUS      current
-  DESCRIPTION
-    "Table of Apache Ambari Alerts"
-  ::= { apacheAmbariAlerts 1 }
-
-AlertEntry ::= SEQUENCE {
-  alertDefinitionId    Integer32,
-  alertDefinitionName  OCTET STRING,
-  alertDefinitionHash  OCTET STRING,
-  alertName            OCTET STRING,
-  alertText            OCTET STRING,
-  alertState           AlertStateType,
-  alertHost            OCTET STRING,
-  alertService         OCTET STRING,
-  alertComponent       OCTET STRING  
-  }
-  
-apacheAmbariAlertEntry  OBJECT-TYPE
-  SYNTAX      AlertEntry
-  MAX-ACCESS  not-accessible
-  STATUS      current
-  DESCRIPTION
-    "Each Alert Event"
-  INDEX { alertDefinitionId }
-  ::= { apacheAmbariAlertTable 1 }
-
-alertDefinitionId         OBJECT-TYPE
-    SYNTAX      Integer32 (-2147483648..2147483647)
-    MAX-ACCESS  not-accessible
-    STATUS      current
-    DESCRIPTION
-        "ID of the Alert"
-    ::= { apacheAmbariAlertEntry 1 }
-    
-alertDefinitionName         OBJECT-TYPE
-    SYNTAX      OCTET STRING
-    MAX-ACCESS  accessible-for-notify
-    STATUS      current
-    DESCRIPTION
-        "Alert Definition Name"
-    ::= { apacheAmbariAlertEntry 2 }    
-    
-alertDefinitionHash         OBJECT-TYPE
-    SYNTAX      OCTET STRING
-    MAX-ACCESS  accessible-for-notify
-    STATUS      current
-    DESCRIPTION
-        "Alert Definition Hash"
-    ::= { apacheAmbariAlertEntry 3 }    
-
-alertName         OBJECT-TYPE
-    SYNTAX      OCTET STRING
-    MAX-ACCESS  accessible-for-notify
-    STATUS      current
-    DESCRIPTION
-        "Name of the Alert"
-    ::= { apacheAmbariAlertEntry 4 }    
-
-alertText         OBJECT-TYPE
-    SYNTAX      OCTET STRING
-    MAX-ACCESS  accessible-for-notify
-    STATUS      current
-    DESCRIPTION
-        "Text output of the Alert"
-    ::= { apacheAmbariAlertEntry 5 }
-
-alertState         OBJECT-TYPE
-    SYNTAX      AlertStateType
-    MAX-ACCESS  accessible-for-notify
-    STATUS      current
-    DESCRIPTION
-        "Severity of the Alert"
-    ::= { apacheAmbariAlertEntry 6 }
-
-alertHost    OBJECT-TYPE
-    SYNTAX      OCTET STRING
-    MAX-ACCESS  accessible-for-notify
-    STATUS      current
-    DESCRIPTION
-        "Affected Host"
-    ::= { apacheAmbariAlertEntry 7 }
-    
-alertService    OBJECT-TYPE
-    SYNTAX      OCTET STRING
-    MAX-ACCESS  accessible-for-notify
-    STATUS      current
-    DESCRIPTION
-        "Affected Service"
-    ::= { apacheAmbariAlertEntry 8 }
-    
-alertComponent    OBJECT-TYPE
-    SYNTAX      OCTET STRING
-    MAX-ACCESS  accessible-for-notify
-    STATUS      current
-    DESCRIPTION
-        "Affected Component"
-    ::= { apacheAmbariAlertEntry 9 }    
-    
-apacheAmbariAlert  NOTIFICATION-TYPE
-  OBJECTS {
-    alertDefinitionName, alertDefinitionHash,
-    alertName, alertText, alertState, alertHost, alertService,
-    alertComponent
-  }
-  STATUS  current
-  DESCRIPTION
-    "The SNMP trap that is generated as a result of an alert."
-  ::= { apacheAmbariTraps 1 }    
-
-apacheAmbariConformance   OBJECT IDENTIFIER ::=
-    { apacheAmbariAlerts 3 }
-apacheAmbariCompliances OBJECT IDENTIFIER ::=
-    { apacheAmbariConformance 1 }
-apacheAmbariConformanceGroups      OBJECT IDENTIFIER ::=
-    { apacheAmbariConformance 2 }
-
-apacheAmbariMIBCompliance MODULE-COMPLIANCE
-    STATUS current
-    DESCRIPTION
-        "Compliance statement for entities which implement this MIB."
-    MODULE
-        MANDATORY-GROUPS {
-            apacheAmbariAlertGroup,
-            apacheAmbariAlertObjectGroup
-        }
-    ::= { apacheAmbariCompliances 2 }
-
-apacheAmbariAlertGroup NOTIFICATION-GROUP
-    NOTIFICATIONS {
-        apacheAmbariAlert
-    }
-    STATUS current
-    DESCRIPTION
-        "Notification objects."
-    ::= { apacheAmbariConformanceGroups 2 }
-
-apacheAmbariAlertObjectGroup OBJECT-GROUP
-    OBJECTS {
-      alertDefinitionName, alertDefinitionHash,
-      alertName, alertText, alertState, alertHost, alertService,
-      alertComponent
-    }
-    STATUS current
-    DESCRIPTION
-            "Event Objects"
-    ::= { apacheAmbariConformanceGroups 3 }
-END

http://git-wip-us.apache.org/repos/asf/ambari/blob/83aebdaa/contrib/alert-snmp-mib/README.md
----------------------------------------------------------------------
diff --git a/contrib/alert-snmp-mib/README.md b/contrib/alert-snmp-mib/README.md
index 37fbc0a..1d08e8e 100644
--- a/contrib/alert-snmp-mib/README.md
+++ b/contrib/alert-snmp-mib/README.md
@@ -29,7 +29,7 @@ Install SNMP Utils
 
 Make SNMP Utils aware of the Apache Ambari MIB
 
-    cp APACHE-AMBARI-MIB.txt /usr/share/snmp/mibs
+    cp /var/lib/ambari-server/resources/APACHE-AMBARI-MIB.txt /usr/share/snmp/mibs
 
 Startup a simple SNMP trap daemon to log all traps to the `/tmp/traps.log` file for testing purposes.
 


[04/12] ambari git commit: AMBARI-18595 Icons don't display in Windows 10 Microsoft Edge or Internet Explorer 11 (Vivek Ratnavel Subramanian via zhewang)

Posted by jo...@apache.org.
AMBARI-18595 Icons don't display in Windows 10 Microsoft Edge or Internet Explorer 11 (Vivek Ratnavel Subramanian via zhewang)


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

Branch: refs/heads/branch-feature-AMBARI-18456
Commit: fdda172fed36ae3e156dc2757a09f85d0a379175
Parents: 89d964e
Author: Zhe (Joe) Wang <zh...@apache.org>
Authored: Mon Oct 17 15:02:41 2016 -0700
Committer: Zhe (Joe) Wang <zh...@apache.org>
Committed: Mon Oct 17 15:02:41 2016 -0700

----------------------------------------------------------------------
 ambari-web/pom.xml | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/fdda172f/ambari-web/pom.xml
----------------------------------------------------------------------
diff --git a/ambari-web/pom.xml b/ambari-web/pom.xml
index 759b63e..d3de055 100644
--- a/ambari-web/pom.xml
+++ b/ambari-web/pom.xml
@@ -205,7 +205,7 @@
         <version>1.7</version>
         <executions>
           <execution>
-            <id>gzip ambari-web images</id>
+            <id>gzip ambari-web images and fontawesome fonts</id>
             <phase>prepare-package</phase>
             <goals>
               <goal>run</goal>
@@ -220,6 +220,14 @@
                     </patternset>
                   </fileset>
                 </apply>
+                <apply executable="${executable.gzip}">
+                  <arg value="-f"/>
+                  <fileset dir="${basedir}/public/font/">
+                    <patternset>
+                      <include name="**/*"/>
+                    </patternset>
+                  </fileset>
+                </apply>
               </tasks>
             </configuration>
           </execution>


[12/12] ambari git commit: Merge branch 'trunk' into branch-feature-AMBARI-18456

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


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

Branch: refs/heads/branch-feature-AMBARI-18456
Commit: 532caef33fe65d6933e9797d3db12065555bd69b
Parents: 2c60082 7ed5259
Author: Jonathan Hurley <jh...@hortonworks.com>
Authored: Tue Oct 18 15:32:08 2016 -0400
Committer: Jonathan Hurley <jh...@hortonworks.com>
Committed: Tue Oct 18 15:32:08 2016 -0400

----------------------------------------------------------------------
 .../src/main/python/ambari_agent/ActionQueue.py |  26 +--
 .../main/python/ambari_commons/thread_utils.py  |  43 ++++
 ambari-server/src/main/assemblies/server.xml    |   4 +
 .../controller/ServiceComponentHostRequest.java |  10 +
 .../ServiceComponentHostResponse.java           |  19 +-
 .../internal/HostComponentResourceProvider.java |   9 +
 .../internal/JsonHttpPropertyRequest.java       |   6 +-
 .../controller/internal/URLStreamProvider.java  |   3 +
 .../internal/UpgradeResourceProvider.java       |   4 +-
 .../ambari/server/state/ConfigHelper.java       |  17 +-
 .../ambari/server/state/PropertyInfo.java       |  11 +
 .../state/PropertyStackUpgradeBehavior.java     |  57 +++++
 .../server/state/ServiceComponentHost.java      |   6 +
 .../svccomphost/ServiceComponentHostImpl.java   |  10 +-
 .../src/main/resources/APACHE-AMBARI-MIB.txt    | 206 ++++++++++++++++++
 .../src/main/resources/configuration-schema.xsd |   5 +
 .../src/main/resources/properties.json          |   1 +
 .../services/STORM/configuration/storm-site.xml |   1 +
 .../ClientConfigResourceProviderTest.java       |   6 +-
 .../HostComponentResourceProviderTest.java      |  10 +-
 .../internal/HostResourceProviderTest.java      |  26 +--
 .../StackUpgradeConfigurationMergeTest.java     |   4 +-
 .../internal/UpgradeResourceProviderTest.java   |   6 +-
 .../ambari/server/state/ConfigHelperTest.java   | 210 +++++++++++++------
 .../app/controllers/global/update_controller.js |   3 +-
 .../main/admin/stack_and_upgrade_controller.js  |  22 +-
 ambari-web/app/controllers/wizard.js            |  12 +-
 .../app/mappers/component_config_mapper.js      |   1 +
 ambari-web/app/mappers/hosts_mapper.js          |   2 +
 .../app/mappers/service_metrics_mapper.js       |   1 +
 ambari-web/app/mixins/common/serverValidator.js |  22 +-
 ambari-web/app/models/host_component.js         |   1 +
 ambari-web/app/styles/config_history_flow.less  |  31 ++-
 .../common/configs/config_history_flow.hbs      |  32 +--
 .../service/info/summary/master_components.hbs  |   2 +-
 ambari-web/app/utils/ajax/ajax.js               |   2 +-
 .../views/common/configs/config_history_flow.js |   3 +-
 ambari-web/pom.xml                              |  10 +-
 .../admin/stack_and_upgrade_controller_test.js  | 154 ++++++++++++--
 .../test/mixins/common/serverValidator_test.js  |  18 +-
 contrib/alert-snmp-mib/APACHE-AMBARI-MIB.txt    | 206 ------------------
 contrib/alert-snmp-mib/README.md                |   2 +-
 .../NIFI/1.0.0/package/scripts/params.py        |   2 +-
 .../resources/stacks/HDF/2.0/repos/repoinfo.xml |  20 +-
 44 files changed, 841 insertions(+), 405 deletions(-)
----------------------------------------------------------------------


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

http://git-wip-us.apache.org/repos/asf/ambari/blob/532caef3/ambari-server/src/main/java/org/apache/ambari/server/state/ServiceComponentHost.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/ambari/blob/532caef3/ambari-server/src/main/java/org/apache/ambari/server/state/svccomphost/ServiceComponentHostImpl.java
----------------------------------------------------------------------
diff --cc ambari-server/src/main/java/org/apache/ambari/server/state/svccomphost/ServiceComponentHostImpl.java
index 485329b,74eaa62..c1655aa
--- a/ambari-server/src/main/java/org/apache/ambari/server/state/svccomphost/ServiceComponentHostImpl.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/state/svccomphost/ServiceComponentHostImpl.java
@@@ -1233,48 -1355,60 +1238,49 @@@ public class ServiceComponentHostImpl i
  
    @Override
    public ServiceComponentHostResponse convertToResponse(Map<String, DesiredConfig> desiredConfigs) {
 -    clusterGlobalLock.readLock().lock();
 -    try {
 -      readLock.lock();
 -      try {
 -        HostComponentStateEntity hostComponentStateEntity = getStateEntity();
 -        if (null == hostComponentStateEntity) {
 -          LOG.warn("Could not convert ServiceComponentHostResponse to a response. It's possible that Host " + getHostName() + " was deleted.");
 -          return null;
 -        }
 +    HostComponentStateEntity hostComponentStateEntity = getStateEntity();
 +    if (null == hostComponentStateEntity) {
 +      LOG.warn(
 +          "Could not convert ServiceComponentHostResponse to a response. It's possible that Host {} was deleted.",
 +          getHostName());
 +      return null;
 +    }
  
 -        String clusterName = serviceComponent.getClusterName();
 -        String serviceName = serviceComponent.getServiceName();
 -        String serviceComponentName = serviceComponent.getName();
 -        String hostName = getHostName();
 -        String publicHostName = getPublicHostName();
 -        String state = getState().toString();
 -        String stackId = getStackVersion().getStackId();
 -        String desiredState = getDesiredState().toString();
 -        String desiredStackId = getDesiredStackVersion().getStackId();
 -        HostComponentAdminState componentAdminState = getComponentAdminState();
 -        UpgradeState upgradeState = hostComponentStateEntity.getUpgradeState();
 -
 -        String displayName = null;
 -        try {
 -          ComponentInfo compInfo = ambariMetaInfo.getComponent(getStackVersion().getStackName(),
 -            getStackVersion().getStackVersion(), serviceName, serviceComponentName);
 -          displayName = compInfo.getDisplayName();
 -        } catch (AmbariException e) {
 -          displayName = serviceComponentName;
 -        }
 +    String clusterName = serviceComponent.getClusterName();
 +    String serviceName = serviceComponent.getServiceName();
 +    String serviceComponentName = serviceComponent.getName();
 +    String hostName = getHostName();
++    String publicHostName = getPublicHostName();
 +    String state = getState().toString();
 +    String stackId = getStackVersion().getStackId();
 +    String desiredState = getDesiredState().toString();
 +    String desiredStackId = getDesiredStackVersion().getStackId();
 +    HostComponentAdminState componentAdminState = getComponentAdminState();
 +    UpgradeState upgradeState = hostComponentStateEntity.getUpgradeState();
  
 -        ServiceComponentHostResponse r = new ServiceComponentHostResponse(
 -            clusterName, serviceName,
 -            serviceComponentName, displayName, hostName,
 -            publicHostName, state,
 -            stackId, desiredState,
 -            desiredStackId, componentAdminState);
 +    String displayName = null;
 +    try {
 +      ComponentInfo compInfo = ambariMetaInfo.getComponent(getStackVersion().getStackName(),
 +          getStackVersion().getStackVersion(), serviceName, serviceComponentName);
 +      displayName = compInfo.getDisplayName();
 +    } catch (AmbariException e) {
 +      displayName = serviceComponentName;
 +    }
  
 -        r.setActualConfigs(actualConfigs);
 -        r.setUpgradeState(upgradeState);
 +    ServiceComponentHostResponse r = new ServiceComponentHostResponse(clusterName, serviceName,
-         serviceComponentName, displayName, hostName, state, stackId, desiredState, desiredStackId,
-         componentAdminState);
++        serviceComponentName, displayName, hostName, publicHostName, state, stackId, 
++        desiredState, desiredStackId, componentAdminState);
  
 -        try {
 -          r.setStaleConfig(helper.isStaleConfigs(this, desiredConfigs));
 -        } catch (Exception e) {
 -          LOG.error("Could not determine stale config", e);
 -        }
 +    r.setActualConfigs(actualConfigs);
 +    r.setUpgradeState(upgradeState);
  
 -        return r;
 -      } finally {
 -        readLock.unlock();
 -      }
 -    } finally {
 -      clusterGlobalLock.readLock().unlock();
 +    try {
 +      r.setStaleConfig(helper.isStaleConfigs(this, desiredConfigs));
 +    } catch (Exception e) {
 +      LOG.error("Could not determine stale config", e);
      }
 +
 +    return r;
    }
  
    @Override

http://git-wip-us.apache.org/repos/asf/ambari/blob/532caef3/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/UpgradeResourceProviderTest.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/ambari/blob/532caef3/ambari-server/src/test/java/org/apache/ambari/server/state/ConfigHelperTest.java
----------------------------------------------------------------------
diff --cc ambari-server/src/test/java/org/apache/ambari/server/state/ConfigHelperTest.java
index a802a83,d014bde..d50c92d
--- a/ambari-server/src/test/java/org/apache/ambari/server/state/ConfigHelperTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/state/ConfigHelperTest.java
@@@ -108,8 -116,13 +109,10 @@@ public class ConfigHelperTest 
        Assert.assertNotNull(cluster);
        clusters.addHost("h1");
        clusters.addHost("h2");
+       clusters.addHost("h3");
        Assert.assertNotNull(clusters.getHost("h1"));
        Assert.assertNotNull(clusters.getHost("h2"));
+       Assert.assertNotNull(clusters.getHost("h3"));
 -      clusters.getHost("h1").persist();
 -      clusters.getHost("h2").persist();
 -      clusters.getHost("h3").persist();
  
        // core-site
        ConfigurationRequest cr = new ConfigurationRequest();