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

[01/50] [abbrv] ambari git commit: AMBARI-19027. Manage JournalNode tweaks (onechiporenko)

Repository: ambari
Updated Branches:
  refs/heads/branch-dev-patch-upgrade f70591b13 -> 06327e65e


AMBARI-19027. Manage JournalNode tweaks (onechiporenko)


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

Branch: refs/heads/branch-dev-patch-upgrade
Commit: d369809c96377fc06d33e1ef7bb1f53819e3f275
Parents: d8ba7f1
Author: Oleg Nechiporenko <on...@apache.org>
Authored: Wed Nov 30 13:19:43 2016 +0200
Committer: Oleg Nechiporenko <on...@apache.org>
Committed: Wed Nov 30 13:58:05 2016 +0200

----------------------------------------------------------------------
 ambari-web/app/messages.js                              | 12 +++++-------
 .../main/admin/highAvailability/journalNode/step2.hbs   |  2 ++
 2 files changed, 7 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/d369809c/ambari-web/app/messages.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/messages.js b/ambari-web/app/messages.js
index aa43687..a16d0ea 100644
--- a/ambari-web/app/messages.js
+++ b/ambari-web/app/messages.js
@@ -1292,7 +1292,7 @@ Em.I18n.translations = {
   'admin.kerberos.disable.notice.completed': 'Services have been successfully tested without kerberos environment.',
   'admin.kerberos.wizard.step1.notice.inProgress': 'Please wait while cluster is being unkerberized',
 
-  'admin.manageJournalNode.label': 'Manage JournalNode',
+  'admin.manageJournalNode.label': 'Manage JournalNodes',
   'admin.manageJournalNode.wizard.header': 'Manage JournalNodes Wizard',
   'admin.manageJournalNode.wizard.step1.header': 'Assign JournalNodes',
   'admin.manageJournalNode.wizard.step2.header': 'Review',
@@ -1300,14 +1300,12 @@ Em.I18n.translations = {
   'admin.manageJournalNode.wizard.step4.header': 'Add/Remove JournalNodes',
   'admin.manageJournalNode.wizard.step5.header': 'Format JournalNodes',
   'admin.manageJournalNode.wizard.step6.header': 'Start Active NameNode',
-  'admin.manageJournalNode.wizard.step7.header': 'BootStrap StandBy NameNode',
+  'admin.manageJournalNode.wizard.step7.header': 'BootStrap Standby NameNode',
   'admin.manageJournalNode.wizard.step8.header': 'Start All Services',
 
   'admin.manageJournalNode.wizard.step1.body': 'Add, or Remove JournalNodes',
-  'admin.manageJournalNode.wizard.step3.confirm.config.body':'<div class="alert alert-info">' +
-  '<b>Review Configuration Changes.</b></br>' +
-  'The following lists the configuration changes that will be made by the Wizard to manage JournalNode. This information is for <b> review only </b>.' +
-  '</div>',
+  'admin.manageJournalNode.wizard.step3.confirm.config.body': '<b>Configuration Change Review.</b></br>' +
+  'As part of this process, configuration changes are required. Please review the changes below, and note that they are for <b>review only</b>.  Future steps in this wizard will update this configuration, and restart <b>all</b> services automatically.',
 
   'admin.manageJournalNode.wizard.step4.task0.title' : 'Stop Standby NameNode',
   'admin.manageJournalNode.wizard.step4.task1.title': 'Stop Services',
@@ -1331,7 +1329,7 @@ Em.I18n.translations = {
   'admin.manageJournalNode.wizard.progressPage.notice.inProgress': 'Please wait while JournalNodes are being deployed',
   'admin.manageJournalNode.wizard.step6.notice.inProgress': 'Please wait for related services to be started',
   'admin.manageJournalNode.wizard.step4.notice.inProgress': 'Please wait while JournalNodes are being deployed',
-  'admin.manageJournalNode.wizard.step8.notice.completed':'JournalNodes has been processed successfully.',
+  'admin.manageJournalNode.wizard.step8.notice.completed':'Completed update to JournalNodes.',
 
   'admin.manageJournalNode.wizard.step3.body':
   '<ol>' +

http://git-wip-us.apache.org/repos/asf/ambari/blob/d369809c/ambari-web/app/templates/main/admin/highAvailability/journalNode/step2.hbs
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates/main/admin/highAvailability/journalNode/step2.hbs b/ambari-web/app/templates/main/admin/highAvailability/journalNode/step2.hbs
index 547d364..0cd177d 100644
--- a/ambari-web/app/templates/main/admin/highAvailability/journalNode/step2.hbs
+++ b/ambari-web/app/templates/main/admin/highAvailability/journalNode/step2.hbs
@@ -69,7 +69,9 @@
     </div>
       <div id="serviceConfig">
         {{#if controller.isLoaded}}
+          <div class="alert alert-info">
             {{{t admin.manageJournalNode.wizard.step3.confirm.config.body}}}
+          </div>
             {{view App.ServiceConfigView isNotEditableBinding="controller.isNotEditable"}}
         {{else}}
             {{view App.SpinnerView}}


[05/50] [abbrv] ambari git commit: AMBARI-18949 Extend current quick link JSON with properties

Posted by nc...@apache.org.
AMBARI-18949 Extend current quick link JSON with properties

Change-Id: I209e594e74964b2bab71a454c2b77f785bb02a82


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

Branch: refs/heads/branch-dev-patch-upgrade
Commit: 9559a1626ac5e6dd3f6ddf65b1fd450171bc4f26
Parents: e3b9a9f
Author: Balazs Bence Sari <bs...@hortonworks.com>
Authored: Wed Nov 30 16:24:04 2016 +0100
Committer: Miklos Gergely <mg...@hortonworks.com>
Committed: Wed Nov 30 16:24:04 2016 +0100

----------------------------------------------------------------------
 .../ambari/server/state/quicklinks/Link.java    | 21 +++++++
 .../QuickLinksConfigurationModuleTest.java      | 36 +++++++++++
 .../child_quicklinks_with_properties.json       | 64 +++++++++++++++++++
 .../parent_quicklinks_with_properties.json      | 65 ++++++++++++++++++++
 4 files changed, 186 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/9559a162/ambari-server/src/main/java/org/apache/ambari/server/state/quicklinks/Link.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/state/quicklinks/Link.java b/ambari-server/src/main/java/org/apache/ambari/server/state/quicklinks/Link.java
index 091926f..f7c14f3 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/state/quicklinks/Link.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/state/quicklinks/Link.java
@@ -18,6 +18,11 @@
 
 package org.apache.ambari.server.state.quicklinks;
 
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.annotation.Nullable;
+
 import org.codehaus.jackson.annotate.JsonIgnoreProperties;
 import org.codehaus.jackson.annotate.JsonProperty;
 import org.codehaus.jackson.map.annotate.JsonSerialize;
@@ -46,6 +51,9 @@ public class Link{
   @JsonProperty("protocol")
   private Protocol protocol;
 
+  @JsonProperty("properties")
+  private List<String> properties;
+
   public String getName() {
     return name;
   }
@@ -102,6 +110,14 @@ public class Link{
     this.protocol = protocol;
   }
 
+  @Nullable
+  public List<String> getProperties() {
+    return properties;
+  }
+
+  public void setProperties(List<String> properties) {
+    this.properties = properties;
+  }
 
   public boolean isRemoved(){
     //treat a link as removed if the section only contains a name
@@ -132,5 +148,10 @@ public class Link{
     } else {
       port.mergetWithParent(parentLink.getPort());
     }
+
+    if (null == properties && null != parentLink.properties) {
+      properties = parentLink.properties;
+    }
   }
+
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/9559a162/ambari-server/src/test/java/org/apache/ambari/server/stack/QuickLinksConfigurationModuleTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/stack/QuickLinksConfigurationModuleTest.java b/ambari-server/src/test/java/org/apache/ambari/server/stack/QuickLinksConfigurationModuleTest.java
index 38176aa..f44f741 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/stack/QuickLinksConfigurationModuleTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/stack/QuickLinksConfigurationModuleTest.java
@@ -18,6 +18,7 @@
 
 package org.apache.ambari.server.stack;
 
+import com.google.common.collect.Lists;
 import org.apache.ambari.server.AmbariException;
 import org.apache.ambari.server.state.quicklinks.Check;
 import org.apache.ambari.server.state.quicklinks.Link;
@@ -28,7 +29,10 @@ import org.apache.ambari.server.state.quicklinks.QuickLinksConfiguration;
 import org.junit.Test;
 
 import java.io.File;
+import java.util.ArrayList;
+import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
 
 import static org.junit.Assert.*;
 
@@ -111,6 +115,38 @@ public class QuickLinksConfigurationModuleTest {
     }
   }
 
+  @Test
+  public void testResolveOverrideProperties() throws Exception{
+    QuickLinks[] results = resolveQuickLinks("parent_quicklinks_with_properties.json",
+        "child_quicklinks_with_properties.json");
+    QuickLinks parentQuickLinks = results[0];
+    QuickLinks childQuickLinks = results[1];
+
+    //resolved quicklinks configuration
+    QuickLinksConfiguration childQuickLinksConfig = childQuickLinks.getQuickLinksConfiguration();
+    assertNotNull(childQuickLinksConfig);
+
+    //links
+    List<Link> links = childQuickLinksConfig.getLinks();
+    assertNotNull(links);
+    assertEquals(3, links.size());
+    Map<String, Link> linksByName = new HashMap<>();
+    for (Link link: links) {
+      linksByName.put(link.getName(), link);
+    }
+    assertEquals("Links are not properly overridden for foo_ui",
+        Lists.newArrayList("authenticated", "sso"),
+        linksByName.get("foo_ui").getProperties());
+    assertEquals("Parent links for foo_jmx are not inherited.",
+        Lists.newArrayList("authenticated"),
+        linksByName.get("foo_jmx").getProperties());
+    assertEquals("Links are not properly overridden for foo_logs",
+        new ArrayList<>(),
+        linksByName.get("foo_logs").getProperties());
+
+  }
+
+
   private QuickLinks[] resolveQuickLinks(String parentJson, String childJson) throws AmbariException{
     File parentQuiclinksFile = new File(this.getClass().getClassLoader().getResource(parentJson).getFile());
     File childQuickLinksFile = new File(this.getClass().getClassLoader().getResource(childJson).getFile());

http://git-wip-us.apache.org/repos/asf/ambari/blob/9559a162/ambari-server/src/test/resources/child_quicklinks_with_properties.json
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/resources/child_quicklinks_with_properties.json b/ambari-server/src/test/resources/child_quicklinks_with_properties.json
new file mode 100644
index 0000000..36cd4f3
--- /dev/null
+++ b/ambari-server/src/test/resources/child_quicklinks_with_properties.json
@@ -0,0 +1,64 @@
+{
+  "name": "default",
+  "description": "default quick links configuration",
+  "configuration": {
+    "protocol":
+    {
+      "type":"http",
+      "checks":[
+        {
+          "property":"foo.http.policy",
+          "desired":"HTTP_ONLY",
+          "site":"foo-site"
+        }
+      ]
+    },
+
+    "links": [
+      {
+        "name": "foo_ui",
+        "label": "Foo UI",
+        "requires_user_name": "false",
+        "url": "%@://%@:%@",
+        "properties": ["authenticated", "sso"],
+        "port":{
+          "http_property": "foo.ui.webapp.address",
+          "http_default_port": "19888",
+          "https_property": "foo.ui.webapp.https.address",
+          "https_default_port": "8090",
+          "regex": "\\w*:(\\d+)",
+          "site": "foo-site"
+        }
+      },
+      {
+        "name":"foo_jmx",
+        "label":"Foo JMX",
+        "requires_user_name":"false",
+        "url":"%@://%@:%@/jmx",
+        "port":{
+          "http_property": "foo.jmx.webapp.address",
+          "http_default_port": "19888",
+          "https_property": "foo.jmx.webapp.https.address",
+          "https_default_port": "8090",
+          "regex": "\\w*:(\\d+)",
+          "site": "foo-site"
+        }
+      },
+      {
+        "name": "foo_logs",
+        "label": "Foo logs",
+        "requires_user_name": "false",
+        "url": "%@://%@:%@/logs",
+        "properties": [],
+        "port":{
+          "http_property": "foo.logs.webapp.address",
+          "http_default_port": "19888",
+          "https_property": "foo.webapp.https.address",
+          "https_default_port": "8090",
+          "regex": "\\w*:(\\d+)",
+          "site": "foo-site"
+        }
+      }
+    ]
+  }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/9559a162/ambari-server/src/test/resources/parent_quicklinks_with_properties.json
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/resources/parent_quicklinks_with_properties.json b/ambari-server/src/test/resources/parent_quicklinks_with_properties.json
new file mode 100644
index 0000000..a315f3f
--- /dev/null
+++ b/ambari-server/src/test/resources/parent_quicklinks_with_properties.json
@@ -0,0 +1,65 @@
+{
+  "name": "default",
+  "description": "default quick links configuration",
+  "configuration": {
+    "protocol":
+    {
+      "type":"http",
+      "checks":[
+        {
+          "property":"foo.http.policy",
+          "desired":"HTTP_ONLY",
+          "site":"foo-site"
+        }
+      ]
+    },
+
+    "links": [
+      {
+        "name": "foo_ui",
+        "label": "Foo UI",
+        "requires_user_name": "false",
+        "url": "%@://%@:%@",
+        "properties": ["authenticated"],
+        "port":{
+          "http_property": "foo.ui.webapp.address",
+          "http_default_port": "19888",
+          "https_property": "foo.ui.webapp.https.address",
+          "https_default_port": "8090",
+          "regex": "\\w*:(\\d+)",
+          "site": "foo-site"
+        }
+      },
+      {
+        "name":"foo_jmx",
+        "label":"Foo JMX",
+        "requires_user_name":"false",
+        "url":"%@://%@:%@/jmx",
+        "properties": ["authenticated"],
+        "port":{
+          "http_property": "foo.jmx.webapp.address",
+          "http_default_port": "19888",
+          "https_property": "foo.jmx.webapp.https.address",
+          "https_default_port": "8090",
+          "regex": "\\w*:(\\d+)",
+          "site": "foo-site"
+        }
+      },
+      {
+        "name": "foo_logs",
+        "label": "Foo logs",
+        "requires_user_name": "false",
+        "url": "%@://%@:%@/logs",
+        "properties": ["authenticated"],
+        "port":{
+          "http_property": "foo.logs.webapp.address",
+          "http_default_port": "19888",
+          "https_property": "foo.webapp.https.address",
+          "https_default_port": "8090",
+          "regex": "\\w*:(\\d+)",
+          "site": "foo-site"
+        }
+      }
+    ]
+  }
+}
\ No newline at end of file


[44/50] [abbrv] ambari git commit: AMBARI-19018 - Services should be able to specify their own resources subdirs for syncing to agents

Posted by nc...@apache.org.
AMBARI-19018 - Services should be able to specify their own resources subdirs for syncing to agents


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

Branch: refs/heads/branch-dev-patch-upgrade
Commit: 232a9d87e72dfb87e0d25f6a4cba6738e27beb53
Parents: 60a6bd4
Author: Tim Thorpe <tt...@apache.org>
Authored: Fri Dec 2 08:15:09 2016 -0800
Committer: Tim Thorpe <tt...@apache.org>
Committed: Fri Dec 2 08:15:09 2016 -0800

----------------------------------------------------------------------
 .../ambari_agent/CustomServiceOrchestrator.py   |   7 +-
 .../src/main/python/ambari_agent/FileCache.py   |  12 ++-
 .../TestCustomServiceOrchestrator.py            |  30 +-----
 .../test/python/ambari_agent/TestFileCache.py   |  10 +-
 .../ambari/server/agent/ExecutionCommand.java   |   1 +
 .../AmbariManagementControllerImpl.java         |   9 ++
 .../ambari/server/state/ComponentInfo.java      |  14 +++
 .../python/ambari_server/serverConfiguration.py |  14 +--
 .../AMBARI_METRICS/0.1.0/metainfo.xml           |   1 +
 .../AmbariManagementControllerTest.java         |   9 ++
 .../server/orm/InMemoryDefaultTestModule.java   |   5 +
 ambari-server/src/test/python/TestMpacks.py     | 102 +++++++++++++------
 .../src/test/resources/dashboards/README.txt    |  18 ++++
 .../stacks/HDP/0.1/services/HDFS/metainfo.xml   |   1 +
 14 files changed, 150 insertions(+), 83 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/232a9d87/ambari-agent/src/main/python/ambari_agent/CustomServiceOrchestrator.py
----------------------------------------------------------------------
diff --git a/ambari-agent/src/main/python/ambari_agent/CustomServiceOrchestrator.py b/ambari-agent/src/main/python/ambari_agent/CustomServiceOrchestrator.py
index 7d61611..11c8cbe 100644
--- a/ambari-agent/src/main/python/ambari_agent/CustomServiceOrchestrator.py
+++ b/ambari-agent/src/main/python/ambari_agent/CustomServiceOrchestrator.py
@@ -154,12 +154,7 @@ class CustomServiceOrchestrator():
         self.file_cache.get_host_scripts_base_dir(server_url_prefix)          
         hook_dir = self.file_cache.get_hook_base_dir(command, server_url_prefix)
         base_dir = self.file_cache.get_service_base_dir(command, server_url_prefix)
-        from ActionQueue import ActionQueue  # To avoid cyclic dependency
-        if self.COMMAND_TYPE in command and command[self.COMMAND_TYPE] == ActionQueue.EXECUTION_COMMAND:
-          logger.info("Found it - " + str(command[self.COMMAND_TYPE]) + " yeah")
-          # limiting to only EXECUTION_COMMANDs for now
-          # TODO need a design for limiting to specific role/component such as METRICS_GRAFANA
-          self.file_cache.get_dashboard_base_dir(server_url_prefix)
+        self.file_cache.get_custom_resources_subdir(command, server_url_prefix)
 
         script_path = self.resolve_script_path(base_dir, script)
         script_tuple = (script_path, base_dir)

http://git-wip-us.apache.org/repos/asf/ambari/blob/232a9d87/ambari-agent/src/main/python/ambari_agent/FileCache.py
----------------------------------------------------------------------
diff --git a/ambari-agent/src/main/python/ambari_agent/FileCache.py b/ambari-agent/src/main/python/ambari_agent/FileCache.py
index 83ac373..a9ea8f6 100644
--- a/ambari-agent/src/main/python/ambari_agent/FileCache.py
+++ b/ambari-agent/src/main/python/ambari_agent/FileCache.py
@@ -45,7 +45,6 @@ class FileCache():
   STACKS_CACHE_DIRECTORY="stacks"
   COMMON_SERVICES_DIRECTORY="common-services"
   CUSTOM_ACTIONS_CACHE_DIRECTORY="custom_actions"
-  DASHBOARD_DIRECTORY="dashboards"
   HOST_SCRIPTS_CACHE_DIRECTORY="host_scripts"
   HASH_SUM_FILE=".hash"
   ARCHIVE_NAME="archive.zip"
@@ -100,12 +99,17 @@ class FileCache():
                                   server_url_prefix)
 
 
-  def get_dashboard_base_dir(self, server_url_prefix):
+  def get_custom_resources_subdir(self, command, server_url_prefix):
     """
-    Returns a base directory for dashboards
+    Returns a custom directory which must be a subdirectory of the resources dir
     """
+    try:
+      custom_dir = command['commandParams']['custom_folder']
+    except KeyError:
+      return None
+
     return self.provide_directory(self.cache_dir,
-                                  self.DASHBOARD_DIRECTORY,
+                                  custom_dir,
                                   server_url_prefix)
 
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/232a9d87/ambari-agent/src/test/python/ambari_agent/TestCustomServiceOrchestrator.py
----------------------------------------------------------------------
diff --git a/ambari-agent/src/test/python/ambari_agent/TestCustomServiceOrchestrator.py b/ambari-agent/src/test/python/ambari_agent/TestCustomServiceOrchestrator.py
index 0304adc..5323d9a 100644
--- a/ambari-agent/src/test/python/ambari_agent/TestCustomServiceOrchestrator.py
+++ b/ambari-agent/src/test/python/ambari_agent/TestCustomServiceOrchestrator.py
@@ -220,7 +220,7 @@ class TestCustomServiceOrchestrator(TestCase):
     except AgentException:
       pass # Expected
 
-  @patch.object(FileCache, "get_dashboard_base_dir")
+  @patch.object(FileCache, "get_custom_resources_subdir")
   @patch.object(CustomServiceOrchestrator, "resolve_script_path")
   @patch.object(CustomServiceOrchestrator, "resolve_hook_script_path")
   @patch.object(FileCache, "get_host_scripts_base_dir")
@@ -235,7 +235,7 @@ class TestCustomServiceOrchestrator(TestCase):
                       get_host_scripts_base_dir_mock, 
                       resolve_hook_script_path_mock, 
                       resolve_script_path_mock,
-                      get_dashboard_base_dir_mock):
+                      get_custom_resources_subdir_mock):
     
     FileCache_mock.return_value = None
     command = {
@@ -267,7 +267,6 @@ class TestCustomServiceOrchestrator(TestCase):
     unix_process_id = 111
     orchestrator.commands_in_progress = {command['taskId']: unix_process_id}
     get_hook_base_dir_mock.return_value = "/hooks/"
-    get_dashboard_base_dir_mock.return_value = "/dashboards/"
     # normal run case
     run_file_mock.return_value = {
         'stdout' : 'sss',
@@ -278,7 +277,6 @@ class TestCustomServiceOrchestrator(TestCase):
     self.assertEqual(ret['exitcode'], 0)
     self.assertTrue(run_file_mock.called)
     self.assertEqual(run_file_mock.call_count, 3)
-    self.assertTrue(get_dashboard_base_dir_mock.called)
 
     run_file_mock.reset_mock()
 
@@ -301,25 +299,6 @@ class TestCustomServiceOrchestrator(TestCase):
 
     run_file_mock.reset_mock()
 
-    # For role=METRICS_GRAFANA, dashboards should be sync'd
-    command['role'] = 'METRICS_GRAFANA'
-    get_dashboard_base_dir_mock.reset_mock()
-    get_dashboard_base_dir_mock.return_value = "/dashboards/"
-
-    run_file_mock.return_value = {
-        'stdout' : 'sss',
-        'stderr' : 'eee',
-        'exitcode': 0,
-      }
-    ret = orchestrator.runCommand(command, "out.txt", "err.txt")
-    self.assertEqual(ret['exitcode'], 0)
-    self.assertTrue(run_file_mock.called)
-    self.assertEqual(run_file_mock.call_count, 3)
-    self.assertTrue(get_dashboard_base_dir_mock.called)
-
-    command['role'] = 'REGION_SERVER'
-    run_file_mock.reset_mock()
-
     # unknown script type case
     command['commandParams']['script_type'] = "SOME_TYPE"
     ret = orchestrator.runCommand(command, "out.txt", "err.txt")
@@ -332,7 +311,6 @@ class TestCustomServiceOrchestrator(TestCase):
 
     pass
 
-  @patch.object(FileCache, "get_dashboard_base_dir")
   @patch("ambari_commons.shell.kill_process_with_children")
   @patch.object(CustomServiceOrchestrator, "resolve_script_path")
   @patch.object(CustomServiceOrchestrator, "resolve_hook_script_path")
@@ -347,8 +325,7 @@ class TestCustomServiceOrchestrator(TestCase):
                       get_hook_base_dir_mock, get_service_base_dir_mock,
                       get_host_scripts_base_dir_mock,
                       resolve_hook_script_path_mock, resolve_script_path_mock,
-                      kill_process_with_children_mock,
-                      get_dashboard_base_dir_mock):
+                      kill_process_with_children_mock):
     FileCache_mock.return_value = None
     command = {
       'role' : 'REGION_SERVER',
@@ -378,7 +355,6 @@ class TestCustomServiceOrchestrator(TestCase):
     unix_process_id = 111
     orchestrator.commands_in_progress = {command['taskId']: unix_process_id}
     get_hook_base_dir_mock.return_value = "/hooks/"
-    get_dashboard_base_dir_mock.return_value = "/dashboards/"
     run_file_mock_return_value = {
       'stdout' : 'killed',
       'stderr' : 'killed',

http://git-wip-us.apache.org/repos/asf/ambari/blob/232a9d87/ambari-agent/src/test/python/ambari_agent/TestFileCache.py
----------------------------------------------------------------------
diff --git a/ambari-agent/src/test/python/ambari_agent/TestFileCache.py b/ambari-agent/src/test/python/ambari_agent/TestFileCache.py
index fbefc2b..00f6b69 100644
--- a/ambari-agent/src/test/python/ambari_agent/TestFileCache.py
+++ b/ambari-agent/src/test/python/ambari_agent/TestFileCache.py
@@ -119,10 +119,16 @@ class TestFileCache(TestCase):
 
 
   @patch.object(FileCache, "provide_directory")
-  def test_get_dashboard_base_dir(self, provide_directory_mock):
+  def test_get_custom_resources_subdir(self, provide_directory_mock):
     provide_directory_mock.return_value = "dummy value"
     fileCache = FileCache(self.config)
-    res = fileCache.get_dashboard_base_dir("server_url_pref")
+    command = {
+      'commandParams': {
+        'custom_folder' : 'dashboards'
+      }
+    }
+
+    res = fileCache.get_custom_resources_subdir(command, "server_url_pref")
     self.assertEquals(
       pprint.pformat(provide_directory_mock.call_args_list[0][0]),
       "('/var/lib/ambari-agent/cache', 'dashboards', 'server_url_pref')")

http://git-wip-us.apache.org/repos/asf/ambari/blob/232a9d87/ambari-server/src/main/java/org/apache/ambari/server/agent/ExecutionCommand.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/agent/ExecutionCommand.java b/ambari-server/src/main/java/org/apache/ambari/server/agent/ExecutionCommand.java
index 29737ee..ef1ee4f 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/agent/ExecutionCommand.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/agent/ExecutionCommand.java
@@ -343,6 +343,7 @@ public class ExecutionCommand extends AgentCommand {
     String SCRIPT_TYPE = "script_type";
     String SERVICE_PACKAGE_FOLDER = "service_package_folder";
     String HOOKS_FOLDER = "hooks_folder";
+    String CUSTOM_FOLDER = "custom_folder";
     String STACK_NAME = "stack_name";
     String SERVICE_TYPE = "service_type";
     String STACK_VERSION = "stack_version";

http://git-wip-us.apache.org/repos/asf/ambari/blob/232a9d87/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java
index ac9e405..0448b9f 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java
@@ -25,6 +25,7 @@ import static org.apache.ambari.server.agent.ExecutionCommand.KeyNames.AMBARI_DB
 import static org.apache.ambari.server.agent.ExecutionCommand.KeyNames.CLIENTS_TO_UPDATE_CONFIGS;
 import static org.apache.ambari.server.agent.ExecutionCommand.KeyNames.COMMAND_RETRY_ENABLED;
 import static org.apache.ambari.server.agent.ExecutionCommand.KeyNames.COMMAND_TIMEOUT;
+import static org.apache.ambari.server.agent.ExecutionCommand.KeyNames.CUSTOM_FOLDER;
 import static org.apache.ambari.server.agent.ExecutionCommand.KeyNames.DB_DRIVER_FILENAME;
 import static org.apache.ambari.server.agent.ExecutionCommand.KeyNames.GROUP_LIST;
 import static org.apache.ambari.server.agent.ExecutionCommand.KeyNames.HOOKS_FOLDER;
@@ -2217,6 +2218,14 @@ public class AmbariManagementControllerImpl implements AmbariManagementControlle
       serviceInfo.getServicePackageFolder());
     commandParams.put(HOOKS_FOLDER, stackInfo.getStackHooksFolder());
 
+    String customCacheDirectory = componentInfo.getCustomFolder();
+    if (customCacheDirectory != null) {
+      File customCache = new File(configs.getResourceDirPath(), customCacheDirectory);
+      if (customCache.exists() && customCache.isDirectory()) {
+        commandParams.put(CUSTOM_FOLDER, customCacheDirectory);
+      }
+    }
+
     String clusterName = cluster.getClusterName();
     if (customCommandExecutionHelper.isTopologyRefreshRequired(roleCommand.name(), clusterName, serviceName)) {
       commandParams.put(ExecutionCommand.KeyNames.REFRESH_TOPOLOGY, "True");

http://git-wip-us.apache.org/repos/asf/ambari/blob/232a9d87/ambari-server/src/main/java/org/apache/ambari/server/state/ComponentInfo.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/state/ComponentInfo.java b/ambari-server/src/main/java/org/apache/ambari/server/state/ComponentInfo.java
index 1e494b4..bd9b798 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/state/ComponentInfo.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/state/ComponentInfo.java
@@ -133,6 +133,9 @@ public class ComponentInfo {
 
   private String timelineAppid;
 
+  @XmlElement(name="customFolder")
+  private String customFolder;
+
   public ComponentInfo() {
   }
 
@@ -158,6 +161,7 @@ public class ComponentInfo {
     clientConfigFiles = prototype.clientConfigFiles;
     timelineAppid = prototype.timelineAppid;
     reassignAllowed = prototype.reassignAllowed;
+    customFolder = prototype.customFolder;
   }
 
   public String getName() {
@@ -396,6 +400,14 @@ public class ComponentInfo {
     this.reassignAllowed = reassignAllowed;
   }
 
+  public String getCustomFolder() {
+    return customFolder;
+  }
+
+  public void setCustomFolder(String customFolder) {
+    this.customFolder = customFolder;
+  }
+
   @Override
   public boolean equals(Object o) {
     if (this == o) return true;
@@ -426,6 +438,7 @@ public class ComponentInfo {
     if (name != null ? !name.equals(that.name) : that.name != null) return false;
     if (clientConfigFiles != null ? !clientConfigFiles.equals(that.clientConfigFiles) :
         that.clientConfigFiles != null) return false;
+    if (customFolder != null ? !customFolder.equals(that.customFolder) : that.customFolder != null) return false;
 
     return true;
   }
@@ -450,6 +463,7 @@ public class ComponentInfo {
     result = 31 * result + (clientConfigFiles != null ? clientConfigFiles.hashCode() : 0);
     // NULL = 0, TRUE = 2, FALSE = 1
     result = 31 * result + (versionAdvertisedField != null ? (versionAdvertisedField.booleanValue() ? 2 : 1) : 0);
+    result = 31 * result + (customFolder != null ? customFolder.hashCode() : 0);
     return result;
   }
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/232a9d87/ambari-server/src/main/python/ambari_server/serverConfiguration.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/python/ambari_server/serverConfiguration.py b/ambari-server/src/main/python/ambari_server/serverConfiguration.py
index 9596e0d..6a6c89e 100644
--- a/ambari-server/src/main/python/ambari_server/serverConfiguration.py
+++ b/ambari-server/src/main/python/ambari_server/serverConfiguration.py
@@ -186,7 +186,6 @@ SETUP_OR_UPGRADE_MSG = "- If this is a new setup, then run the \"ambari-server s
 DEFAULT_DB_NAME = "ambari"
 
 SECURITY_KEYS_DIR = "security.server.keys_dir"
-DASHBOARD_PATH_PROPERTY = 'dashboards.path'
 EXTENSION_PATH_PROPERTY = 'extensions.path'
 COMMON_SERVICES_PATH_PROPERTY = 'common.services.path'
 MPACKS_STAGING_PATH_PROPERTY = 'mpacks.staging.path'
@@ -398,8 +397,8 @@ class ServerConfigDefaults(object):
     self.EXTENSION_LOCATION_DEFAULT = ""
     self.COMMON_SERVICES_LOCATION_DEFAULT = ""
     self.MPACKS_STAGING_LOCATION_DEFAULT = ""
-    self.DASHBOARD_LOCATION_DEFAULT = ""
     self.SERVER_TMP_DIR_DEFAULT = ""
+    self.DASHBOARD_DIRNAME = "dashboards"
 
     self.DEFAULT_VIEWS_DIR = ""
 
@@ -470,7 +469,6 @@ class ServerConfigDefaultsWindows(ServerConfigDefaults):
     self.EXTENSION_LOCATION_DEFAULT = "resources\\extensions"
     self.COMMON_SERVICES_LOCATION_DEFAULT = "resources\\common-services"
     self.MPACKS_STAGING_LOCATION_DEFAULT = "resources\\mpacks"
-    self.DASHBOARD_LOCATION_DEFAULT = "resources\\dashboards"
     self.SERVER_TMP_DIR_DEFAULT = "data\\tmp"
 
     self.DEFAULT_VIEWS_DIR = "resources\\views"
@@ -557,7 +555,6 @@ class ServerConfigDefaultsLinux(ServerConfigDefaults):
     self.EXTENSION_LOCATION_DEFAULT = AmbariPath.get("/var/lib/ambari-server/resources/extensions")
     self.COMMON_SERVICES_LOCATION_DEFAULT = AmbariPath.get("/var/lib/ambari-server/resources/common-services")
     self.MPACKS_STAGING_LOCATION_DEFAULT = AmbariPath.get("/var/lib/ambari-server/resources/mpacks")
-    self.DASHBOARD_LOCATION_DEFAULT = AmbariPath.get("/var/lib/ambari-server/resources/dashboards")
     self.SERVER_TMP_DIR_DEFAULT = AmbariPath.get("/var/lib/ambari-server/data/tmp")
 
     self.DEFAULT_VIEWS_DIR = AmbariPath.get("/var/lib/ambari-server/resources/views")
@@ -1448,13 +1445,8 @@ def get_mpacks_staging_location(properties):
 # Dashboard location
 #
 def get_dashboard_location(properties):
-  try:
-    dashboard_location = properties[DASHBOARD_PATH_PROPERTY]
-  except KeyError:
-    dashboard_location = configDefaults.DASHBOARD_LOCATION_DEFAULT
-
-  if not dashboard_location:
-    dashboard_location = configDefaults.DASHBOARD_LOCATION_DEFAULT
+  resources_dir = get_resources_location(properties)
+  dashboard_location = os.path.join(resources_dir, configDefaults.DASHBOARD_DIRNAME)
   return dashboard_location
 
 #

http://git-wip-us.apache.org/repos/asf/ambari/blob/232a9d87/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/metainfo.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/metainfo.xml b/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/metainfo.xml
index 43a4320..740a91a 100644
--- a/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/metainfo.xml
+++ b/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/metainfo.xml
@@ -101,6 +101,7 @@
           <category>MASTER</category>
           <cardinality>0-1</cardinality>
           <versionAdvertised>false</versionAdvertised>
+          <customFolder>dashboards</customFolder>
           <commandScript>
             <script>scripts/metrics_grafana.py</script>
             <scriptType>PYTHON</scriptType>

http://git-wip-us.apache.org/repos/asf/ambari/blob/232a9d87/ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariManagementControllerTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariManagementControllerTest.java b/ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariManagementControllerTest.java
index 0fdaa46..db64f17 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariManagementControllerTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariManagementControllerTest.java
@@ -1283,6 +1283,15 @@ public class AmbariManagementControllerTest {
     assertEquals("false", ec.getCommandParams().get("command_retry_enabled"));
     Map<String, Set<String>> chInfo = ec.getClusterHostInfo();
     assertTrue(chInfo.containsKey("namenode_host"));
+    assertFalse(ec.getCommandParams().containsKey("custom_folder"));
+
+    ec = controller.getExecutionCommand(cluster,
+                                        s1.getServiceComponent("DATANODE").getServiceComponentHost(host1),
+                                        RoleCommand.START);
+    assertEquals(cluster1, ec.getClusterName());
+    assertNotNull(ec.getCommandParams());
+    assertTrue(ec.getCommandParams().containsKey("custom_folder"));
+    assertEquals("dashboards", ec.getCommandParams().get("custom_folder"));
   }
 
   @Test

http://git-wip-us.apache.org/repos/asf/ambari/blob/232a9d87/ambari-server/src/test/java/org/apache/ambari/server/orm/InMemoryDefaultTestModule.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/orm/InMemoryDefaultTestModule.java b/ambari-server/src/test/java/org/apache/ambari/server/orm/InMemoryDefaultTestModule.java
index 6773176..a4a9e26 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/orm/InMemoryDefaultTestModule.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/orm/InMemoryDefaultTestModule.java
@@ -90,6 +90,7 @@ public class InMemoryDefaultTestModule extends AbstractModule {
     String stacks = "src/test/resources/stacks";
     String version = "src/test/resources/version";
     String sharedResourcesDir = "src/test/resources/";
+    String resourcesDir = "src/test/resources/";
     if (System.getProperty("os.name").contains("Windows")) {
       stacks = ClassLoader.getSystemClassLoader().getResource("stacks").getPath();
       version = new File(new File(ClassLoader.getSystemClassLoader().getResource("").getPath()).getParent(), "version").getPath();
@@ -116,6 +117,10 @@ public class InMemoryDefaultTestModule extends AbstractModule {
       properties.setProperty(Configuration.SHARED_RESOURCES_DIR.getKey(), sharedResourcesDir);
     }
 
+    if (!properties.containsKey(Configuration.RESOURCES_DIR.getKey())) {
+      properties.setProperty(Configuration.RESOURCES_DIR.getKey(), resourcesDir);
+    }
+
     try {
       install(Modules.override(new BeanDefinitionsCachingTestControllerModule(properties)).with(new AbstractModule() {
         @Override

http://git-wip-us.apache.org/repos/asf/ambari/blob/232a9d87/ambari-server/src/test/python/TestMpacks.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/TestMpacks.py b/ambari-server/src/test/python/TestMpacks.py
index ba37856..32db005 100644
--- a/ambari-server/src/test/python/TestMpacks.py
+++ b/ambari-server/src/test/python/TestMpacks.py
@@ -64,7 +64,7 @@ def get_configs():
     serverConfiguration.STACK_LOCATION_KEY : "/var/lib/ambari-server/resources/stacks",
     serverConfiguration.COMMON_SERVICES_PATH_PROPERTY : "/var/lib/ambari-server/resources/common-services",
     serverConfiguration.EXTENSION_PATH_PROPERTY : "/var/lib/ambari-server/resources/extensions",
-    serverConfiguration.DASHBOARD_PATH_PROPERTY : "/var/lib/ambari-server/resources/dashboards",
+    serverConfiguration.RESOURCES_DIR_PROPERTY : "/var/lib/ambari-server/resources",
     serverConfiguration.MPACKS_STAGING_PATH_PROPERTY : mpacks_directory,
     serverConfiguration.SERVER_TMP_DIR_PROPERTY : "/tmp",
     serverConfiguration.JDBC_DATABASE_PROPERTY: "postgres"
@@ -100,9 +100,11 @@ class TestMpacks(TestCase):
       fail = True
     self.assertTrue(fail)
 
+  @patch("os.path.exists")
   @patch("ambari_server.setupMpacks.get_YN_input")
   @patch("ambari_server.setupMpacks.run_mpack_install_checker")
-  def test_validate_purge(self, run_mpack_install_checker_mock, get_YN_input_mock):
+  @patch("ambari_server.setupMpacks.get_ambari_properties")
+  def test_validate_purge(self, get_ambari_properties_mock, run_mpack_install_checker_mock, get_YN_input_mock, os_path_exists_mock):
     options = self._create_empty_options_mock()
     options.purge = True
     purge_list = options.purge_list.split(',')
@@ -112,6 +114,7 @@ class TestMpacks(TestCase):
     replay_mode = False
     run_mpack_install_checker_mock.return_value = (0, "No errors found", "")
     get_YN_input_mock.return_value = True
+    os_path_exists_mock.return_value = True
 
     fail = False
     try:
@@ -160,22 +163,28 @@ class TestMpacks(TestCase):
     extensions_directory = configs[serverConfiguration.EXTENSION_PATH_PROPERTY]
     common_services_directory = configs[serverConfiguration.COMMON_SERVICES_PATH_PROPERTY]
     mpacks_directory = configs[serverConfiguration.MPACKS_STAGING_PATH_PROPERTY]
-    os_path_exists_mock.return_value = False
+    os_path_exists_mock.side_effect = [True]
 
     purge_stacks_and_mpacks(None)
-    os_path_exists_calls = []
+    os_path_exists_calls = [
+      call('/var/lib/ambari-server/resources'),
+    ]
     os_path_exists_mock.assert_has_calls(os_path_exists_calls)
 
+    os_path_exists_mock.side_effect = [True, False, False]
     purge_stacks_and_mpacks(options.purge_list.split(","))
     os_path_exists_calls = [
+      call('/var/lib/ambari-server/resources'),
       call(stacks_directory),
       call(mpacks_directory)
     ]
     os_path_exists_mock.assert_has_calls(os_path_exists_calls)
 
     options.purge_list = ",".join([STACK_DEFINITIONS_RESOURCE_NAME, SERVICE_DEFINITIONS_RESOURCE_NAME, MPACKS_RESOURCE_NAME])
+    os_path_exists_mock.side_effect = [True, False, False, False]
     purge_stacks_and_mpacks(options.purge_list.split(","))
     os_path_exists_calls = [
+      call('/var/lib/ambari-server/resources'),
       call(stacks_directory),
       call(common_services_directory),
       call(mpacks_directory)
@@ -183,8 +192,10 @@ class TestMpacks(TestCase):
     os_path_exists_mock.assert_has_calls(os_path_exists_calls)
 
     options.purge_list = ",".join([STACK_DEFINITIONS_RESOURCE_NAME, EXTENSION_DEFINITIONS_RESOURCE_NAME, MPACKS_RESOURCE_NAME])
+    os_path_exists_mock.side_effect = [True, False, False, False]
     purge_stacks_and_mpacks(options.purge_list.split(","))
     os_path_exists_calls = [
+      call('/var/lib/ambari-server/resources'),
       call(stacks_directory),
       call(extensions_directory),
       call(mpacks_directory)
@@ -193,10 +204,13 @@ class TestMpacks(TestCase):
 
     options.purge_list = ",".join([STACK_DEFINITIONS_RESOURCE_NAME, SERVICE_DEFINITIONS_RESOURCE_NAME, MPACKS_RESOURCE_NAME])
     options.replay_mode = True
+    os_path_exists_mock.side_effect = [True, False, False, False]
     purge_stacks_and_mpacks(options.purge_list.split(","))
     os_path_exists_calls = [
+      call('/var/lib/ambari-server/resources'),
       call(stacks_directory),
-      call(common_services_directory)
+      call(common_services_directory),
+      call(mpacks_directory)
     ]
     os_path_exists_mock.assert_has_calls(os_path_exists_calls)
 
@@ -266,10 +280,11 @@ class TestMpacks(TestCase):
     get_ambari_version_mock.return_value = "2.4.0.0"
     run_os_command_mock.return_value = (0, "", "")
     mpacks_directory = configs[serverConfiguration.MPACKS_STAGING_PATH_PROPERTY]
-    """
+
     os_path_exists_calls = [call('/tmp/mystack.tar.gz'),
                             call('mpacks/mystack-ambari-mpack-1.0.0.0/mpack.json'),
                             call('mpacks/mystack-ambari-mpack-1.0.0.0/hooks/before_install.py'),
+                            call('/var/lib/ambari-server/resources'),
                             call('/var/lib/ambari-server/resources/stacks'),
                             call('/var/lib/ambari-server/resources/extensions'),
                             call('/var/lib/ambari-server/resources/common-services'),
@@ -277,12 +292,14 @@ class TestMpacks(TestCase):
                             call(mpacks_directory + '/cache'),
                             call('/var/lib/ambari-server/resources/dashboards'),
                             call(mpacks_directory + '/mystack-ambari-mpack-1.0.0.0'),
+                            call('/var/lib/ambari-server/resources'),
                             call('/var/lib/ambari-server/resources/common-services/SERVICEA'),
                             call(mpacks_directory + '/mystack-ambari-mpack-1.0.0.0/common-services/SERVICEA/1.0/dashboards'),
                             call(mpacks_directory + '/mystack-ambari-mpack-1.0.0.0/common-services/SERVICEA/2.0/dashboards'),
                             call('/var/lib/ambari-server/resources/common-services/SERVICEB'),
                             call(mpacks_directory + '/mystack-ambari-mpack-1.0.0.0/common-services/SERVICEB/1.0.0/dashboards'),
                             call(mpacks_directory + '/mystack-ambari-mpack-1.0.0.0/common-services/SERVICEB/2.0.0/dashboards'),
+                            call('/var/lib/ambari-server/resources'),
                             call('/var/lib/ambari-server/resources/stacks/MYSTACK'),
                             call('/var/lib/ambari-server/resources/stacks/MYSTACK/1.0'),
                             call('/var/lib/ambari-server/resources/stacks/MYSTACK/1.0/services'),
@@ -295,22 +312,26 @@ class TestMpacks(TestCase):
                             call(mpacks_directory + '/mystack-ambari-mpack-1.0.0.0/stacks/MYSTACK/2.0/services/SERVICEA/dashboards'),
                             call(mpacks_directory + '/mystack-ambari-mpack-1.0.0.0/stacks/MYSTACK/2.0/services/SERVICEB/dashboards'),
                             call(mpacks_directory + '/mystack-ambari-mpack-1.0.0.0/hooks/after_install.py')]
-    """
-    os_path_exists_mock.side_effect = [True, True, True, False, True, False, False, False, False,
-                                       False, False, False, False, False, False,
-                                       False, False, False, False, False, False, False, False,
-                                       False, False, False, False, True]
+
+    os_path_exists_mock.side_effect = [True, True, True, True, False, True, False, False, False, False,
+                                       False, True, False, False, False, False, False, False, True, False,
+                                       False, False, False, False, False, False, False, False, False, False,
+                                       True]
     get_ambari_properties_mock.return_value = configs
     shutil_move_mock.return_value = True
 
-    install_mpack(options)
+    try:
+      install_mpack(options)
+    except Exception as e:
+      print e
 
     stacks_directory = configs[serverConfiguration.STACK_LOCATION_KEY]
     common_services_directory = configs[serverConfiguration.COMMON_SERVICES_PATH_PROPERTY]
     extensions_directory = configs[serverConfiguration.EXTENSION_PATH_PROPERTY]
     mpacks_directory = configs[serverConfiguration.MPACKS_STAGING_PATH_PROPERTY]
-    dashboards_directory = serverConfiguration.get_dashboard_location(configs)
     mpacks_staging_directory = os.path.join(mpacks_directory, "mystack-ambari-mpack-1.0.0.0")
+    resources_directory = configs[serverConfiguration.RESOURCES_DIR_PROPERTY]
+    dashboards_directory = os.path.join(resources_directory, "dashboards")
 
     run_os_command_calls = [
       call([
@@ -377,6 +398,7 @@ class TestMpacks(TestCase):
            "SERVICEB", None)
     ]
 
+    os_path_exists_mock.assert_has_calls(os_path_exists_calls)
     self.assertTrue(purge_stacks_and_mpacks_mock.called)
     run_os_command_mock.assert_has_calls(run_os_command_calls)
     os_mkdir_mock.assert_has_calls(os_mkdir_calls)
@@ -403,8 +425,8 @@ class TestMpacks(TestCase):
     expand_mpack_mock.return_value = "mpacks/myextension-ambari-mpack-1.0.0.0"
     get_ambari_version_mock.return_value = "2.4.0.0"
     
-    os_path_exists_mock.side_effect = [True, True, True, False, True, False, False, False,
-                                       False, True, False, False, False]
+    os_path_exists_mock.side_effect = [True, True, True, True, False, True, False, False, False,
+                                       False, True, True, False, False, False]
     get_ambari_properties_mock.return_value = configs
     shutil_move_mock.return_value = True
 
@@ -413,10 +435,12 @@ class TestMpacks(TestCase):
     extensions_directory = configs[serverConfiguration.EXTENSION_PATH_PROPERTY]
     mpacks_directory = configs[serverConfiguration.MPACKS_STAGING_PATH_PROPERTY]
     mpacks_staging_directory = os.path.join(mpacks_directory, "myextension-ambari-mpack-1.0.0.0")
-    dashboards_directory = serverConfiguration.get_dashboard_location(configs)
+    resources_directory = configs[serverConfiguration.RESOURCES_DIR_PROPERTY]
+    dashboards_directory = os.path.join(resources_directory, "dashboards")
 
     os_path_exists_calls = [call('/tmp/myextension.tar.gz'),
                             call('mpacks/myextension-ambari-mpack-1.0.0.0/mpack.json'),
+                            call('/var/lib/ambari-server/resources'),
                             call('/var/lib/ambari-server/resources/stacks'),
                             call('/var/lib/ambari-server/resources/extensions'),
                             call('/var/lib/ambari-server/resources/common-services'),
@@ -424,6 +448,7 @@ class TestMpacks(TestCase):
                             call(mpacks_directory + '/cache'),
                             call('/var/lib/ambari-server/resources/dashboards'),
                             call(mpacks_directory + '/myextension-ambari-mpack-1.0.0.0'),
+                            call('/var/lib/ambari-server/resources'),
                             call('/var/lib/ambari-server/resources/extensions'),
                             call('/var/lib/ambari-server/resources/extensions/MYEXTENSION'),
                             call(mpacks_directory + '/myextension-ambari-mpack-1.0.0.0/extensions/MYEXTENSION/1.0/services'),
@@ -476,9 +501,9 @@ class TestMpacks(TestCase):
     expand_mpack_mock.return_value = "mpacks/myservice-ambari-mpack-1.0.0.0"
     get_ambari_version_mock.return_value = "2.4.0.0"
 
-    os_path_exists_mock.side_effect = [True, True, True, True, True, True,
-                                       True, True, False, False, False, False,
-                                       True, True, True, False, True, True,
+    os_path_exists_mock.side_effect = [True, True, True, True, True, True, True,
+                                       True, True, False, False, True, False, False,
+                                       True, True, True, True, False, True, True,
                                        True, False]
 
     get_ambari_properties_mock.return_value = configs
@@ -491,11 +516,13 @@ class TestMpacks(TestCase):
     common_services_directory = configs[serverConfiguration.COMMON_SERVICES_PATH_PROPERTY]
     mpacks_directory = configs[serverConfiguration.MPACKS_STAGING_PATH_PROPERTY]
     mpacks_staging_directory = os.path.join(mpacks_directory, "myservice-ambari-mpack-1.0.0.0")
-    dashboards_directory = serverConfiguration.get_dashboard_location(configs)
+    resources_directory = configs[serverConfiguration.RESOURCES_DIR_PROPERTY]
+    dashboards_directory = os.path.join(resources_directory, "dashboards")
 
     os_path_exists_calls = [call('/tmp/myservice.tar.gz'),
                             call('mpacks/myservice-ambari-mpack-1.0.0.0/mpack.json'),
                             call('/var/lib/ambari-server/resources/stacks/MYSTACK/1.0'),
+                            call('/var/lib/ambari-server/resources'),
                             call('/var/lib/ambari-server/resources/stacks'),
                             call('/var/lib/ambari-server/resources/extensions'),
                             call('/var/lib/ambari-server/resources/common-services'),
@@ -503,8 +530,10 @@ class TestMpacks(TestCase):
                             call(mpacks_directory + '/cache'),
                             call('/var/lib/ambari-server/resources/dashboards'),
                             call(mpacks_directory + '/myservice-ambari-mpack-1.0.0.0'),
+                            call('/var/lib/ambari-server/resources'),
                             call('/var/lib/ambari-server/resources/common-services/MYSERVICE'),
                             call(mpacks_directory + '/myservice-ambari-mpack-1.0.0.0/common-services/MYSERVICE/1.0.0/dashboards'),
+                            call('/var/lib/ambari-server/resources'),
                             call('/var/lib/ambari-server/resources/stacks/MYSTACK'),
                             call('/var/lib/ambari-server/resources/stacks/MYSTACK/1.0'),
                             call('/var/lib/ambari-server/resources/stacks/MYSTACK/1.0/services'),
@@ -562,14 +591,14 @@ class TestMpacks(TestCase):
     get_ambari_version_mock.return_value = "2.4.0.0"
     run_os_command_mock.return_value = (0, "", "")
     mpacks_directory = configs[serverConfiguration.MPACKS_STAGING_PATH_PROPERTY]
-    os_path_exists_mock.side_effect = [True, True, True, True, True, True, True, True,
-                                       True, True, True, True, True, True, True, False,
-                                       False, True, False, False, True, False, False, 
-                                       False, False, False, True, True, True, False,
-                                       True, True, False, True, True, False, False,
-                                       False, False, False, True, True, True, True,
-                                       True, True, True, False, True, False, True, True, 
-                                       True, True, True, True]
+    os_path_exists_mock.side_effect = [True, True, True, True, True, True, True, True, True, True,
+                                       True, True, True, True, True, True, True, False, False, True,
+                                       True, False, False, True, False, False, False, False, False, True,
+                                       True, True, True, False, True, True, False, True, True, False,
+                                       False, False, False, False, True, True, True, True, True, True,
+                                       True, False, True, False, True, True, True, True, True, True,
+                                       True]
+
     get_ambari_properties_mock.return_value = configs
     shutil_move_mock.return_value = True
 
@@ -579,10 +608,12 @@ class TestMpacks(TestCase):
     common_services_directory = configs[serverConfiguration.COMMON_SERVICES_PATH_PROPERTY]
     mpacks_directory = configs[serverConfiguration.MPACKS_STAGING_PATH_PROPERTY]
     mpacks_staging_directory = os.path.join(mpacks_directory, "mystack-ambari-mpack-1.0.0.1")
-    dashboards_directory = serverConfiguration.get_dashboard_location(configs)
+    resources_directory = configs[serverConfiguration.RESOURCES_DIR_PROPERTY]
+    dashboards_directory = os.path.join(resources_directory, "dashboards")
 
     os_path_exists_calls = [call('/tmp/mystack-1.0.0.1.tar.gz'),
                             call('mpacks/mystack-ambari-mpack-1.0.0.1/mpack.json'),
+                            call('/var/lib/ambari-server/resources'),
                             call(mpacks_directory),
                             call(mpacks_directory + '/myextension-ambari-mpack-1.0.0.0/mpack.json'),
                             call(mpacks_directory + '/myservice-ambari-mpack-1.0.0.0/mpack.json'),
@@ -591,6 +622,7 @@ class TestMpacks(TestCase):
                             call('/tmp/mystack-1.0.0.1.tar.gz'),
                             call('mpacks/mystack-ambari-mpack-1.0.0.1/mpack.json'),
                             call('mpacks/mystack-ambari-mpack-1.0.0.1/hooks/before_upgrade.py'),
+                            call('/var/lib/ambari-server/resources'),
                             call('/var/lib/ambari-server/resources/stacks'),
                             call('/var/lib/ambari-server/resources/extensions'),
                             call('/var/lib/ambari-server/resources/common-services'),
@@ -598,6 +630,7 @@ class TestMpacks(TestCase):
                             call(mpacks_directory + '/cache'),
                             call('/var/lib/ambari-server/resources/dashboards'),
                             call(mpacks_directory + '/mystack-ambari-mpack-1.0.0.1'),
+                            call('/var/lib/ambari-server/resources'),
                             call('/var/lib/ambari-server/resources/common-services/SERVICEA'),
                             call(mpacks_directory + '/mystack-ambari-mpack-1.0.0.1/common-services/SERVICEA/1.0/dashboards'),
                             call(mpacks_directory + '/mystack-ambari-mpack-1.0.0.1/common-services/SERVICEA/2.0/dashboards'),
@@ -607,6 +640,7 @@ class TestMpacks(TestCase):
                             call('/var/lib/ambari-server/resources/common-services/SERVICEC'),
                             call(mpacks_directory + '/mystack-ambari-mpack-1.0.0.1/common-services/SERVICEC/1.0.0/dashboards'),
                             call(mpacks_directory + '/mystack-ambari-mpack-1.0.0.1/common-services/SERVICEC/2.0.0/dashboards'),
+                            call('/var/lib/ambari-server/resources'),
                             call('/var/lib/ambari-server/resources/stacks/MYSTACK'),
                             call('/var/lib/ambari-server/resources/stacks/MYSTACK/1.0'),
                             call('/var/lib/ambari-server/resources/stacks/MYSTACK/1.0/services'),
@@ -631,6 +665,7 @@ class TestMpacks(TestCase):
                             call('/var/lib/ambari-server/resources/dashboards/grafana-dashboards/SERVICEC'),
                             call(mpacks_directory + '/mystack-ambari-mpack-1.0.0.1/stacks/MYSTACK/3.0/services/SERVICEC/dashboards/service-metrics/SERVICEC.txt'),
                             call('/var/lib/ambari-server/resources/dashboards/service-metrics/SERVICEC.txt'),
+                            call('/var/lib/ambari-server/resources'),
                             call(mpacks_directory),
                             call(mpacks_directory + '/myextension-ambari-mpack-1.0.0.0/mpack.json'),
                             call(mpacks_directory + '/myservice-ambari-mpack-1.0.0.0/mpack.json'),
@@ -775,7 +810,7 @@ class TestMpacks(TestCase):
       serverConfiguration.COMMON_SERVICES_PATH_PROPERTY : os.path.join(uninstall_directory, "common-services"),
       serverConfiguration.EXTENSION_PATH_PROPERTY : os.path.join(uninstall_directory, "extensions"),
       serverConfiguration.MPACKS_STAGING_PATH_PROPERTY : mpacks_directory,
-      serverConfiguration.DASHBOARD_PATH_PROPERTY : os.path.join(uninstall_directory, "dashboards"),
+      serverConfiguration.RESOURCES_DIR_PROPERTY : uninstall_directory,
       serverConfiguration.SERVER_TMP_DIR_PROPERTY : "/tmp"
     }
 
@@ -784,7 +819,8 @@ class TestMpacks(TestCase):
     stacks_directory = fake_configs[serverConfiguration.STACK_LOCATION_KEY]
     extension_directory = fake_configs[serverConfiguration.EXTENSION_PATH_PROPERTY]
     common_services_directory = fake_configs[serverConfiguration.COMMON_SERVICES_PATH_PROPERTY]
-    dashboard_directory = fake_configs[serverConfiguration.DASHBOARD_PATH_PROPERTY]
+    resources_directory = fake_configs[serverConfiguration.RESOURCES_DIR_PROPERTY]
+    dashboards_directory = os.path.join(resources_directory, "dashboards")
 
     _uninstall_mpack("mystack-ambari-mpack", "1.0.0.1")
 
@@ -794,8 +830,8 @@ class TestMpacks(TestCase):
                               call(os.path.join(stacks_directory, "2.0/files/metainfo2.xml")),
                               call(os.path.join(extension_directory, "SERVICEB")),
                               call(os.path.join(common_services_directory, "SERVICEB")),
-                              call(os.path.join(dashboard_directory, "SERVICEB")),
-                              call(os.path.join(dashboard_directory, "files/STORM.txt"))] 
+                              call(os.path.join(dashboards_directory, "SERVICEB")),
+                              call(os.path.join(dashboards_directory, "files/STORM.txt"))]
 
   def _create_empty_options_mock(self):
     options = MagicMock()

http://git-wip-us.apache.org/repos/asf/ambari/blob/232a9d87/ambari-server/src/test/resources/dashboards/README.txt
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/resources/dashboards/README.txt b/ambari-server/src/test/resources/dashboards/README.txt
new file mode 100644
index 0000000..919d510
--- /dev/null
+++ b/ambari-server/src/test/resources/dashboards/README.txt
@@ -0,0 +1,18 @@
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+
+Test directory for sync'ing a components custom folder - AMBARI-19018

http://git-wip-us.apache.org/repos/asf/ambari/blob/232a9d87/ambari-server/src/test/resources/stacks/HDP/0.1/services/HDFS/metainfo.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/resources/stacks/HDP/0.1/services/HDFS/metainfo.xml b/ambari-server/src/test/resources/stacks/HDP/0.1/services/HDFS/metainfo.xml
index f4195a8..7629552 100644
--- a/ambari-server/src/test/resources/stacks/HDP/0.1/services/HDFS/metainfo.xml
+++ b/ambari-server/src/test/resources/stacks/HDP/0.1/services/HDFS/metainfo.xml
@@ -57,6 +57,7 @@
           <name>DATANODE</name>
           <category>SLAVE</category>
           <cardinality>1+</cardinality>
+          <customFolder>dashboards</customFolder>
           <commandScript>
             <script>scripts/datanode.py</script>
             <scriptType>PYTHON</scriptType>


[07/50] [abbrv] ambari git commit: AMBARI-18987 A general preupgrade check on if services cannot be upgrade are installed (dili)

Posted by nc...@apache.org.
AMBARI-18987 A general preupgrade check on if services cannot be upgrade are installed (dili)


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

Branch: refs/heads/branch-dev-patch-upgrade
Commit: fff9980992ffcb40e643a4235a7cc36899f1fa5a
Parents: 1087859
Author: Di Li <di...@apache.org>
Authored: Wed Nov 30 12:49:03 2016 -0500
Committer: Di Li <di...@apache.org>
Committed: Wed Nov 30 12:49:03 2016 -0500

----------------------------------------------------------------------
 .../server/checks/ServicePresenceCheck.java     | 55 +++++++++-----------
 .../HDP/2.3/upgrades/nonrolling-upgrade-2.5.xml |  5 +-
 .../HDP/2.3/upgrades/nonrolling-upgrade-2.6.xml |  5 +-
 .../stacks/HDP/2.3/upgrades/upgrade-2.5.xml     |  5 +-
 .../stacks/HDP/2.3/upgrades/upgrade-2.6.xml     |  5 +-
 .../HDP/2.4/upgrades/nonrolling-upgrade-2.5.xml |  5 +-
 .../HDP/2.4/upgrades/nonrolling-upgrade-2.6.xml |  5 +-
 .../stacks/HDP/2.4/upgrades/upgrade-2.5.xml     |  5 +-
 .../stacks/HDP/2.4/upgrades/upgrade-2.6.xml     |  5 +-
 9 files changed, 57 insertions(+), 38 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/fff99809/ambari-server/src/main/java/org/apache/ambari/server/checks/ServicePresenceCheck.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/checks/ServicePresenceCheck.java b/ambari-server/src/main/java/org/apache/ambari/server/checks/ServicePresenceCheck.java
index 0f4eeb1..4642b88 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/checks/ServicePresenceCheck.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/checks/ServicePresenceCheck.java
@@ -19,7 +19,6 @@ package org.apache.ambari.server.checks;
 
 import java.util.ArrayList;
 import java.util.Arrays;
-import java.util.Iterator;
 import java.util.LinkedHashMap;
 import java.util.List;
 import java.util.Map;
@@ -47,7 +46,7 @@ public class ServicePresenceCheck extends AbstractCheckDescriptor{
 
   private static final Logger LOG = LoggerFactory.getLogger(ServicePresenceCheck.class);
 
-  static final String KEY_SERVICE_REMOVED = "servcie_removed";
+  static final String KEY_SERVICE_REMOVED = "service_removed";
   /*
    * List of services that do not support upgrade
    * services must be removed before the stack upgrade
@@ -77,28 +76,26 @@ public class ServicePresenceCheck extends AbstractCheckDescriptor{
     Map<String, String> removedServices = getRemovedServices(request);
     List<String> failReasons = new ArrayList<>();
 
-    if(null != noUpgradeSupportServices && !noUpgradeSupportServices.isEmpty()){
-      String reason = getFailReason(prerequisiteCheck, request);
-      for(String service: noUpgradeSupportServices){
-        if (installedServices.contains(service.toUpperCase())){
-          prerequisiteCheck.getFailedOn().add(service);
-          String msg = String.format(reason, service, service);
-          failReasons.add(msg);
-        }
+    String reason = getFailReason(prerequisiteCheck, request);
+    for(String service: noUpgradeSupportServices){
+      if (installedServices.contains(service.toUpperCase())){
+        prerequisiteCheck.getFailedOn().add(service);
+        String msg = String.format(reason, service, service);
+        failReasons.add(msg);
       }
     }
-    if(null != removedServices){
-      String reason = getFailReason(KEY_SERVICE_REMOVED, prerequisiteCheck, request);
-      for (Map.Entry<String, String> entry : removedServices.entrySet()) {
-        String removedService = entry.getKey();
-        if(installedServices.contains(removedService.toUpperCase())){
-          prerequisiteCheck.getFailedOn().add(removedService);
-          String newService = entry.getValue();
-          String msg = String.format(reason, removedService, newService);
-          failReasons.add(msg);
-        }
+
+    reason = getFailReason(KEY_SERVICE_REMOVED, prerequisiteCheck, request);
+    for (Map.Entry<String, String> entry : removedServices.entrySet()) {
+      String removedService = entry.getKey();
+      if(installedServices.contains(removedService.toUpperCase())){
+        prerequisiteCheck.getFailedOn().add(removedService);
+        String newService = entry.getValue();
+        String msg = String.format(reason, removedService, newService);
+        failReasons.add(msg);
       }
     }
+
     if(!failReasons.isEmpty()){
       prerequisiteCheck.setStatus(PrereqCheckStatus.FAIL);
       prerequisiteCheck.setFailReason(StringUtils.join(failReasons, '\n'));
@@ -126,52 +123,50 @@ public class ServicePresenceCheck extends AbstractCheckDescriptor{
    * @return service names
    * */
   private List<String> getNoUpgradeSupportServices(PrereqCheckRequest request){
+    List<String> result = new ArrayList<String>();
     String value = getPropertyValue(request, NO_UPGRADE_SUPPORT_SERVICES_PROPERTY_NAME);
     if (null != value){
       String[] services = value.split(",");
-      List<String> result = new ArrayList<String>();
       for(String service: services){
         service = service.trim();
         if (!service.isEmpty()){
           result.add(service);
         }
       }
-      return result;
-    } else {
-      return null;
     }
+    return result;
   }
 
   /**
    * @return service names and new service names map
    * */
   private Map<String, String> getRemovedServices(PrereqCheckRequest request) throws AmbariException{
+    Map<String, String> result = new LinkedHashMap<String, String>();
     String value = getPropertyValue(request, REMOVED_SERVICES_PROPERTY_NAME);
     String newValue = getPropertyValue(request, NEW_SERVICES_PROPERTY_NAME);
     if(value == null && newValue == null){
-      return null; //no need to check removed services as they are not specified in the upgrade xml file.
+      return result; //no need to check removed services as they are not specified in the upgrade xml file.
     } else {
       if (value == null || newValue == null){
-        throw new AmbariException("Removed services must be paired with new services list.");
+        throw new AmbariException(String.format("Both %s and %s list must be specified in the upgrade XML file.", REMOVED_SERVICES_PROPERTY_NAME, NEW_SERVICES_PROPERTY_NAME));
       } else {
         List<String> oldServices = Arrays.asList(value.split(","));
         List<String> newServices = Arrays.asList(newValue.split(","));
         if (oldServices.size() != newServices.size()){
-          throw new AmbariException("Removed services must be paired with new services list.");
+          throw new AmbariException(String.format("%s must have the same number of services as the %s list.", NEW_SERVICES_PROPERTY_NAME, REMOVED_SERVICES_PROPERTY_NAME));
         } else {
-          Map<String, String> result = new LinkedHashMap<String, String>();
           for (int i = 0; i < oldServices.size(); i++){
             String oldService = oldServices.get(i).trim();
             String newService = newServices.get(i).trim();
             if (oldService.isEmpty() || newService.isEmpty()) {
-              throw new AmbariException("Removed services must be paired with new services list.");
+              throw new AmbariException(String.format("Make sure both %s and %s list only contain comma separated list of services.", NEW_SERVICES_PROPERTY_NAME, REMOVED_SERVICES_PROPERTY_NAME));
             } else {
               result.put(oldService, newService);
             }
           }
-          return result;
         }
       }
     }
+    return result;
   }
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/fff99809/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/nonrolling-upgrade-2.5.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/nonrolling-upgrade-2.5.xml b/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/nonrolling-upgrade-2.5.xml
index 1d964f8..24b90b2 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/nonrolling-upgrade-2.5.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/nonrolling-upgrade-2.5.xml
@@ -22,12 +22,15 @@
   <type>NON_ROLLING</type>
   <prerequisite-checks>
     <check>org.apache.ambari.server.checks.RangerAuditDbCheck</check>
-    <check>org.apache.ambari.server.checks.AtlasPresenceCheck</check>
+    <check>org.apache.ambari.server.checks.ServicePresenceCheck</check>
     <configuration>
       <!-- Configuration properties for all pre-reqs including required pre-reqs -->
       <check-properties name="org.apache.ambari.server.checks.HiveDynamicServiceDiscoveryCheck">
         <property name="min-failure-stack-version">HDP-2.3.0.0</property>
       </check-properties>
+      <check-properties name="org.apache.ambari.server.checks.ServicePresenceCheck">
+        <property name="no-upgrade-support-service-names">Atlas</property>
+      </check-properties>
     </configuration>
   </prerequisite-checks>
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/fff99809/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/nonrolling-upgrade-2.6.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/nonrolling-upgrade-2.6.xml b/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/nonrolling-upgrade-2.6.xml
index fe2598b..019c76e 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/nonrolling-upgrade-2.6.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/nonrolling-upgrade-2.6.xml
@@ -22,12 +22,15 @@
   <type>NON_ROLLING</type>
   <prerequisite-checks>
     <check>org.apache.ambari.server.checks.RangerAuditDbCheck</check>
-    <check>org.apache.ambari.server.checks.AtlasPresenceCheck</check>
+    <check>org.apache.ambari.server.checks.ServicePresenceCheck</check>
     <configuration>
       <!-- Configuration properties for all pre-reqs including required pre-reqs -->
       <check-properties name="org.apache.ambari.server.checks.HiveDynamicServiceDiscoveryCheck">
         <property name="min-failure-stack-version">HDP-2.3.0.0</property>
       </check-properties>
+      <check-properties name="org.apache.ambari.server.checks.ServicePresenceCheck">
+        <property name="no-upgrade-support-service-names">Atlas</property>
+      </check-properties>
     </configuration>
   </prerequisite-checks>
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/fff99809/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/upgrade-2.5.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/upgrade-2.5.xml b/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/upgrade-2.5.xml
index 10219b5..9b4a2a7 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/upgrade-2.5.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/upgrade-2.5.xml
@@ -33,7 +33,7 @@
     <check>org.apache.ambari.server.checks.ServicesYarnWorkPreservingCheck</check>
     <check>org.apache.ambari.server.checks.YarnRMHighAvailabilityCheck</check>
     <check>org.apache.ambari.server.checks.YarnTimelineServerStatePreservingCheck</check>
-    <check>org.apache.ambari.server.checks.AtlasPresenceCheck</check>
+    <check>org.apache.ambari.server.checks.ServicePresenceCheck</check>
     <check>org.apache.ambari.server.checks.RangerAuditDbCheck</check>
 
     <!-- Specific to HDP 2.5, Storm is not rolling -->
@@ -45,6 +45,9 @@
       <check-properties name="org.apache.ambari.server.checks.HiveDynamicServiceDiscoveryCheck">
         <property name="min-failure-stack-version">HDP-2.3.0.0</property>
       </check-properties>
+      <check-properties name="org.apache.ambari.server.checks.ServicePresenceCheck">
+        <property name="no-upgrade-support-service-names">Atlas</property>
+      </check-properties>
     </configuration>
   </prerequisite-checks>
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/fff99809/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/upgrade-2.6.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/upgrade-2.6.xml b/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/upgrade-2.6.xml
index 55fc284..c8baea1 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/upgrade-2.6.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/upgrade-2.6.xml
@@ -33,7 +33,7 @@
     <check>org.apache.ambari.server.checks.ServicesYarnWorkPreservingCheck</check>
     <check>org.apache.ambari.server.checks.YarnRMHighAvailabilityCheck</check>
     <check>org.apache.ambari.server.checks.YarnTimelineServerStatePreservingCheck</check>
-    <check>org.apache.ambari.server.checks.AtlasPresenceCheck</check>
+    <check>org.apache.ambari.server.checks.ServicePresenceCheck</check>
     <check>org.apache.ambari.server.checks.RangerAuditDbCheck</check>
 
     <!-- Specific to HDP 2.5, Storm is not rolling -->
@@ -45,6 +45,9 @@
       <check-properties name="org.apache.ambari.server.checks.HiveDynamicServiceDiscoveryCheck">
         <property name="min-failure-stack-version">HDP-2.3.0.0</property>
       </check-properties>
+      <check-properties name="org.apache.ambari.server.checks.ServicePresenceCheck">
+        <property name="no-upgrade-support-service-names">Atlas</property>
+      </check-properties>
     </configuration>
   </prerequisite-checks>
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/fff99809/ambari-server/src/main/resources/stacks/HDP/2.4/upgrades/nonrolling-upgrade-2.5.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.4/upgrades/nonrolling-upgrade-2.5.xml b/ambari-server/src/main/resources/stacks/HDP/2.4/upgrades/nonrolling-upgrade-2.5.xml
index ea9c60c..3608247 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.4/upgrades/nonrolling-upgrade-2.5.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.4/upgrades/nonrolling-upgrade-2.5.xml
@@ -22,13 +22,16 @@
   <type>NON_ROLLING</type>
   <prerequisite-checks>
     <check>org.apache.ambari.server.checks.RangerAuditDbCheck</check>
-    <check>org.apache.ambari.server.checks.AtlasPresenceCheck</check>
+    <check>org.apache.ambari.server.checks.ServicePresenceCheck</check>
 
     <configuration>
       <!-- Configuration properties for all pre-reqs including required pre-reqs -->
       <check-properties name="org.apache.ambari.server.checks.HiveDynamicServiceDiscoveryCheck">
         <property name="min-failure-stack-version">HDP-2.3.0.0</property>
       </check-properties>
+      <check-properties name="org.apache.ambari.server.checks.ServicePresenceCheck">
+        <property name="no-upgrade-support-service-names">Atlas</property>
+      </check-properties>
     </configuration>
   </prerequisite-checks>
   

http://git-wip-us.apache.org/repos/asf/ambari/blob/fff99809/ambari-server/src/main/resources/stacks/HDP/2.4/upgrades/nonrolling-upgrade-2.6.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.4/upgrades/nonrolling-upgrade-2.6.xml b/ambari-server/src/main/resources/stacks/HDP/2.4/upgrades/nonrolling-upgrade-2.6.xml
index 6597cde..2a1ecf7 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.4/upgrades/nonrolling-upgrade-2.6.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.4/upgrades/nonrolling-upgrade-2.6.xml
@@ -22,13 +22,16 @@
   <type>NON_ROLLING</type>
   <prerequisite-checks>
     <check>org.apache.ambari.server.checks.RangerAuditDbCheck</check>
-    <check>org.apache.ambari.server.checks.AtlasPresenceCheck</check>
+    <check>org.apache.ambari.server.checks.ServicePresenceCheck</check>
 
     <configuration>
       <!-- Configuration properties for all pre-reqs including required pre-reqs -->
       <check-properties name="org.apache.ambari.server.checks.HiveDynamicServiceDiscoveryCheck">
         <property name="min-failure-stack-version">HDP-2.3.0.0</property>
       </check-properties>
+      <check-properties name="org.apache.ambari.server.checks.ServicePresenceCheck">
+        <property name="no-upgrade-support-service-names">Atlas</property>
+      </check-properties>
     </configuration>
   </prerequisite-checks>
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/fff99809/ambari-server/src/main/resources/stacks/HDP/2.4/upgrades/upgrade-2.5.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.4/upgrades/upgrade-2.5.xml b/ambari-server/src/main/resources/stacks/HDP/2.4/upgrades/upgrade-2.5.xml
index 5e457cf..9767f01 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.4/upgrades/upgrade-2.5.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.4/upgrades/upgrade-2.5.xml
@@ -34,7 +34,7 @@
     <check>org.apache.ambari.server.checks.ServicesYarnWorkPreservingCheck</check>
     <check>org.apache.ambari.server.checks.YarnRMHighAvailabilityCheck</check>
     <check>org.apache.ambari.server.checks.YarnTimelineServerStatePreservingCheck</check>
-    <check>org.apache.ambari.server.checks.AtlasPresenceCheck</check>
+    <check>org.apache.ambari.server.checks.ServicePresenceCheck</check>
     <check>org.apache.ambari.server.checks.RangerAuditDbCheck</check>
 
     <!-- Specific to HDP 2.5, Storm is not rolling -->
@@ -46,6 +46,9 @@
       <check-properties name="org.apache.ambari.server.checks.HiveDynamicServiceDiscoveryCheck">
         <property name="min-failure-stack-version">HDP-2.3.0.0</property>
       </check-properties>
+      <check-properties name="org.apache.ambari.server.checks.ServicePresenceCheck">
+        <property name="no-upgrade-support-service-names">Atlas</property>
+      </check-properties>
     </configuration>
   </prerequisite-checks>
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/fff99809/ambari-server/src/main/resources/stacks/HDP/2.4/upgrades/upgrade-2.6.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.4/upgrades/upgrade-2.6.xml b/ambari-server/src/main/resources/stacks/HDP/2.4/upgrades/upgrade-2.6.xml
index d4f4ff9..2fd7a7a 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.4/upgrades/upgrade-2.6.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.4/upgrades/upgrade-2.6.xml
@@ -34,7 +34,7 @@
     <check>org.apache.ambari.server.checks.ServicesYarnWorkPreservingCheck</check>
     <check>org.apache.ambari.server.checks.YarnRMHighAvailabilityCheck</check>
     <check>org.apache.ambari.server.checks.YarnTimelineServerStatePreservingCheck</check>
-    <check>org.apache.ambari.server.checks.AtlasPresenceCheck</check>
+    <check>org.apache.ambari.server.checks.ServicePresenceCheck</check>
     <check>org.apache.ambari.server.checks.RangerAuditDbCheck</check>
 
     <!-- Specific to HDP 2.5, Storm is not rolling -->
@@ -46,6 +46,9 @@
       <check-properties name="org.apache.ambari.server.checks.HiveDynamicServiceDiscoveryCheck">
         <property name="min-failure-stack-version">HDP-2.3.0.0</property>
       </check-properties>
+      <check-properties name="org.apache.ambari.server.checks.ServicePresenceCheck">
+        <property name="no-upgrade-support-service-names">Atlas</property>
+      </check-properties>
     </configuration>
   </prerequisite-checks>
 


[47/50] [abbrv] ambari git commit: AMBARI-19064 Refactor widgets on Dashboard page. (atkach)

Posted by nc...@apache.org.
AMBARI-19064 Refactor widgets on Dashboard page. (atkach)


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

Branch: refs/heads/branch-dev-patch-upgrade
Commit: 9348725b1067fab38907c8eebc172978729394ad
Parents: 7eb2eaa
Author: Andrii Tkach <at...@apache.org>
Authored: Fri Dec 2 19:27:20 2016 +0200
Committer: Andrii Tkach <at...@apache.org>
Committed: Fri Dec 2 19:27:20 2016 +0200

----------------------------------------------------------------------
 .../mixins/main/dashboard/widgets/editable.js   |  47 +-
 .../main/dashboard/edit_widget_popup.hbs        |   4 +-
 .../edit_widget_popup_single_threshold.hbs      |   2 +-
 .../main/dashboard/plus_button_filter.hbs       |   2 +-
 .../app/templates/main/dashboard/widgets.hbs    |   8 +-
 .../main/dashboard/widgets/pie_chart.hbs        |   5 +-
 .../app/views/common/not-scrollable-textarea.js |   2 +-
 ambari-web/app/views/main/dashboard/widget.js   | 159 ++--
 ambari-web/app/views/main/dashboard/widgets.js  | 824 +++++++++----------
 .../main/dashboard/widgets/datanode_live.js     |   7 -
 .../main/dashboard/widgets/flume_agent_live.js  |   7 -
 .../main/dashboard/widgets/hawqsegment_live.js  |   7 -
 .../dashboard/widgets/hbase_average_load.js     |  11 +-
 .../views/main/dashboard/widgets/hbase_links.js |   4 -
 .../main/dashboard/widgets/hbase_master_heap.js |   4 -
 .../dashboard/widgets/hbase_master_uptime.js    |   5 -
 .../widgets/hbase_regions_in_transition.js      |  10 +-
 .../main/dashboard/widgets/hdfs_capacity.js     |   4 -
 .../views/main/dashboard/widgets/hdfs_links.js  |   4 -
 .../views/main/dashboard/widgets/metrics_cpu.js |   3 -
 .../main/dashboard/widgets/metrics_load.js      |   3 -
 .../main/dashboard/widgets/metrics_memory.js    |   3 -
 .../main/dashboard/widgets/metrics_network.js   |   3 -
 .../main/dashboard/widgets/namenode_cpu.js      |   4 -
 .../main/dashboard/widgets/namenode_heap.js     |   4 -
 .../main/dashboard/widgets/namenode_rpc.js      |  10 +-
 .../main/dashboard/widgets/namenode_uptime.js   |   5 -
 .../dashboard/widgets/node_managers_live.js     |   7 -
 .../main/dashboard/widgets/pie_chart_widget.js  |  16 +-
 .../views/main/dashboard/widgets/pxf_live.js    |   6 -
 .../dashboard/widgets/resource_manager_heap.js  |   4 -
 .../widgets/resource_manager_uptime.js          |   5 -
 .../main/dashboard/widgets/supervisor_live.js   |   7 -
 .../views/main/dashboard/widgets/text_widget.js |   4 +-
 .../widgets/text_widget_single_threshold.js     |   6 +-
 .../dashboard/widgets/uptime_text_widget.js     |   2 -
 .../views/main/dashboard/widgets/yarn_links.js  |   4 -
 .../views/main/dashboard/widgets/yarn_memory.js |   4 -
 .../test/views/main/dashboard/widget_test.js    | 200 ++---
 .../widgets/hbase_average_load_test.js          |   4 +-
 .../widgets/hbase_regions_in_transition_test.js |   6 +-
 .../main/dashboard/widgets/namenode_rpc_test.js |  13 +-
 .../text_widget_single_threshold_test.js        |  10 +-
 .../main/dashboard/widgets/text_widget_test.js  |  10 +-
 .../widgets/uptime_text_widget_test.js          |   2 +-
 .../test/views/main/dashboard/widgets_test.js   | 669 ++++++---------
 46 files changed, 813 insertions(+), 1317 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/9348725b/ambari-web/app/mixins/main/dashboard/widgets/editable.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/mixins/main/dashboard/widgets/editable.js b/ambari-web/app/mixins/main/dashboard/widgets/editable.js
index f330ec3..3206229 100644
--- a/ambari-web/app/mixins/main/dashboard/widgets/editable.js
+++ b/ambari-web/app/mixins/main/dashboard/widgets/editable.js
@@ -23,24 +23,24 @@ App.EditableWidgetMixin = Em.Mixin.create({
   hintInfo: '',
 
   editWidget: function () {
-    var parent = this;
+    var self = this;
     var configObj = Ember.Object.create({
-      thresh1: parent.get('thresh1') + '',
-      thresh2: parent.get('thresh2') + '',
-      hintInfo: parent.get('hintInfo'),
+      thresholdMin: self.get('thresholdMin') + '',
+      thresholdMax: self.get('thresholdMax') + '',
+      hintInfo: self.get('hintInfo'),
       isThresh1Error: false,
       isThresh2Error: false,
       errorMessage1: "",
       errorMessage2: "",
       maxValue: 'infinity',
       observeNewThresholdValue: function () {
-        var thresh1 = this.get('thresh1');
-        var thresh2 = this.get('thresh2');
-        if (thresh1.trim() !== "") {
-          if (isNaN(thresh1) || thresh1 < 0) {
+        var thresholdMin = this.get('thresholdMin');
+        var thresholdMax = this.get('thresholdMax');
+        if (thresholdMin.trim() !== "") {
+          if (isNaN(thresholdMin) || thresholdMin < 0) {
             this.set('isThresh1Error', true);
             this.set('errorMessage1', 'Invalid! Enter a number larger than 0');
-          } else if ( this.get('isThresh2Error') === false && parseFloat(thresh2)<= parseFloat(thresh1)){
+          } else if ( this.get('isThresh2Error') === false && parseFloat(thresholdMax)<= parseFloat(thresholdMin)){
             this.set('isThresh1Error', true);
             this.set('errorMessage1', 'Threshold 1 should be smaller than threshold 2 !');
           } else {
@@ -52,8 +52,8 @@ App.EditableWidgetMixin = Em.Mixin.create({
           this.set('errorMessage1', 'This is required');
         }
 
-        if (thresh2.trim() !== "") {
-          if (isNaN(thresh2) || thresh2 < 0) {
+        if (thresholdMax.trim() !== "") {
+          if (isNaN(thresholdMax) || thresholdMax < 0) {
             this.set('isThresh2Error', true);
             this.set('errorMessage2', 'Invalid! Enter a number larger than 0');
           } else {
@@ -65,12 +65,12 @@ App.EditableWidgetMixin = Em.Mixin.create({
           this.set('errorMessage2', 'This is required');
         }
 
-      }.observes('thresh1', 'thresh2')
+      }.observes('thresholdMin', 'thresholdMax')
 
     });
 
-    var browserVerion = this.getInternetExplorerVersion();
-    App.ModalPopup.show( {
+    var browserVersion = this.getInternetExplorerVersion();
+    App.ModalPopup.show({
       header: Em.I18n.t('dashboard.widgets.popupHeader'),
       classNames: [ 'modal-edit-widget'],
       modalDialogClasses: ['modal-lg'],
@@ -82,17 +82,12 @@ App.EditableWidgetMixin = Em.Mixin.create({
       onPrimary: function () {
         configObj.observeNewThresholdValue();
         if (!configObj.isThresh1Error && !configObj.isThresh2Error) {
-          parent.set('thresh1', parseFloat(configObj.get('thresh1')) );
-          parent.set('thresh2', parseFloat(configObj.get('thresh2')) );
-          if (!App.get('testMode')) {
-            //save to persist
-            var bigParent = parent.get('parentView');
-            bigParent.getUserPref(bigParent.get('persistKey'));
-            var oldValue = bigParent.get('currentPrefObject');
-            oldValue.threshold[parseInt(parent.id, 10)] = [configObj.get('thresh1'), configObj.get('thresh2')];
-            bigParent.postUserPref(bigParent.get('persistKey'),oldValue);
-          }
 
+          var parent = self.get('parentView');
+          var userPreferences = parent.get('userPreferences');
+          userPreferences.threshold[Number(self.get('id'))] = [configObj.get('thresholdMin'), configObj.get('thresholdMax')];
+          parent.saveWidgetsSettings(userPreferences);
+          parent.renderWidgets();
           this.hide();
         }
       },
@@ -102,7 +97,7 @@ App.EditableWidgetMixin = Em.Mixin.create({
         var colors = [App.healthStatusGreen, App.healthStatusOrange, App.healthStatusRed]; //color green, orange ,red
         var handlers = [33, 66]; //fixed value
 
-        if (browserVerion === -1 || browserVerion > 9) {
+        if (browserVersion === -1 || browserVersion > 9) {
           configObj.set('isIE9', false);
           configObj.set('isGreenOrangeRed', true);
           $("#slider-range").slider({
@@ -112,7 +107,7 @@ App.EditableWidgetMixin = Em.Mixin.create({
             max: 100,
             values: handlers,
             create: function (event, ui) {
-              parent.updateColors(handlers, colors);
+              self.updateColors(handlers, colors);
             }
           });
         } else {

http://git-wip-us.apache.org/repos/asf/ambari/blob/9348725b/ambari-web/app/templates/main/dashboard/edit_widget_popup.hbs
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates/main/dashboard/edit_widget_popup.hbs b/ambari-web/app/templates/main/dashboard/edit_widget_popup.hbs
index 3a36ed6..3802e29 100644
--- a/ambari-web/app/templates/main/dashboard/edit_widget_popup.hbs
+++ b/ambari-web/app/templates/main/dashboard/edit_widget_popup.hbs
@@ -41,13 +41,13 @@
           <input type="text" value="0" disabled="disabled" class="form-control" />
         </div>
         <div id="slider-value2" {{bindAttr class="view.configPropertyObj.isThresh1Error:slider-error :value-on-slider :col-md-4 view.configPropertyObj.isThresh1Error:has-error"}}>
-          {{view Ember.TextField class="form-control" valueBinding="view.configPropertyObj.thresh1"}}
+          {{view Ember.TextField class="form-control" valueBinding="view.configPropertyObj.thresholdMin"}}
           {{#if view.configPropertyObj.errorMessage1}}
             <span class="help-block validation-block">{{view.configPropertyObj.errorMessage1}}</span>
           {{/if}}
         </div>
         <div id="slider-value3" {{bindAttr class="view.configPropertyObj.isThresh2Error:slider-error :value-on-slider :col-md-4 view.configPropertyObj.isThresh2Error:has-error"}}>
-          {{view Ember.TextField class="form-control" valueBinding="view.configPropertyObj.thresh2"}}
+          {{view Ember.TextField class="form-control" valueBinding="view.configPropertyObj.thresholdMax"}}
           {{#if view.configPropertyObj.errorMessage1}}
             <span class="help-block validation-block">{{view.configPropertyObj.errorMessage2}}</span>
           {{/if}}

http://git-wip-us.apache.org/repos/asf/ambari/blob/9348725b/ambari-web/app/templates/main/dashboard/edit_widget_popup_single_threshold.hbs
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates/main/dashboard/edit_widget_popup_single_threshold.hbs b/ambari-web/app/templates/main/dashboard/edit_widget_popup_single_threshold.hbs
index d80e601..982dc9b 100644
--- a/ambari-web/app/templates/main/dashboard/edit_widget_popup_single_threshold.hbs
+++ b/ambari-web/app/templates/main/dashboard/edit_widget_popup_single_threshold.hbs
@@ -43,7 +43,7 @@
       <input type="text" value="0" disabled="disabled" class="form-control" />
     </div>
       <div id="slider-value2" {{bindAttr class="view.configPropertyObj.isThresh1Error:slider-error :value-on-slider :col-md-4 :col-md-offset-2 :col-sm-offset-2 view.configPropertyObj.isThresh1Error:has-error"}}>
-        {{view Ember.TextField valueBinding="view.configPropertyObj.thresh1" class="form-control"}}
+        {{view Ember.TextField valueBinding="view.configPropertyObj.thresholdMin" class="form-control"}}
         {{#if view.configPropertyObj.errorMessage1}}
           <span class="help-block validation-block">{{view.configPropertyObj.errorMessage1}}</span>
         {{/if}}

http://git-wip-us.apache.org/repos/asf/ambari/blob/9348725b/ambari-web/app/templates/main/dashboard/plus_button_filter.hbs
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates/main/dashboard/plus_button_filter.hbs b/ambari-web/app/templates/main/dashboard/plus_button_filter.hbs
index df7714c..81420ff 100644
--- a/ambari-web/app/templates/main/dashboard/plus_button_filter.hbs
+++ b/ambari-web/app/templates/main/dashboard/plus_button_filter.hbs
@@ -21,7 +21,7 @@
       <ul>
         {{#each widget in view.hiddenWidgets}}
           <li>
-            {{view view.widgetCheckbox class="checkbox" checkedBinding="widget.checked" labelBinding="widget.displayName"}}
+            {{view view.widgetCheckbox class="checkbox" checkedBinding="widget.checked" labelBinding="widget.title"}}
           </li>
         {{/each}}
       </ul>

http://git-wip-us.apache.org/repos/asf/ambari/blob/9348725b/ambari-web/app/templates/main/dashboard/widgets.hbs
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates/main/dashboard/widgets.hbs b/ambari-web/app/templates/main/dashboard/widgets.hbs
index a778033..8e04f1c 100644
--- a/ambari-web/app/templates/main/dashboard/widgets.hbs
+++ b/ambari-web/app/templates/main/dashboard/widgets.hbs
@@ -48,13 +48,13 @@
     <div id="dashboard-widgets"  class="widgets-container">
       <div class="thumbnails" id="sortable">
         {{#if view.visibleWidgets.length}}
-          {{#each widgetClass in view.visibleWidgets}}
-            <div {{bindAttr class="widgetClass.class"}}>
-              {{view widgetClass }}
-            </div>
+          {{#each widget in view.visibleWidgets}}
+             {{view widget.viewClass widgetBinding="widget"}}
           {{/each}}
         {{/if}}
       </div>
     </div>
   </div>
+{{else}}
+  {{view App.SpinnerView}}
 {{/if}}

http://git-wip-us.apache.org/repos/asf/ambari/blob/9348725b/ambari-web/app/templates/main/dashboard/widgets/pie_chart.hbs
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates/main/dashboard/widgets/pie_chart.hbs b/ambari-web/app/templates/main/dashboard/widgets/pie_chart.hbs
index fdeafd1..1b14503 100644
--- a/ambari-web/app/templates/main/dashboard/widgets/pie_chart.hbs
+++ b/ambari-web/app/templates/main/dashboard/widgets/pie_chart.hbs
@@ -42,7 +42,10 @@
 
         {{#if view.isPieExist}}
           <div {{bindAttr class=":widget-content view.hoverContentTopClass"}}>
-            {{view view.content modelBinding="view.model" thresh1Binding="view.thresh1" thresh2Binding="view.thresh2"}}
+            {{view view.content
+                modelBinding="view.model"
+                thresholdMinBinding="view.thresholdMin"
+                thresholdMaxBinding="view.thresholdMax"}}
           </div>
         {{else}}
           <div class="widget-content-isNA">{{t services.service.summary.notAvailable}}</div>

http://git-wip-us.apache.org/repos/asf/ambari/blob/9348725b/ambari-web/app/views/common/not-scrollable-textarea.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/common/not-scrollable-textarea.js b/ambari-web/app/views/common/not-scrollable-textarea.js
index 1898714..d0e4178 100644
--- a/ambari-web/app/views/common/not-scrollable-textarea.js
+++ b/ambari-web/app/views/common/not-scrollable-textarea.js
@@ -26,7 +26,7 @@ var App = require('app');
  */
 App.NotScrollableTextArea = Em.TextArea.extend({
 
-  didInsertElement() {
+  didInsertElement: function() {
     this.fitHeight();
     this.$().select();
   },

http://git-wip-us.apache.org/repos/asf/ambari/blob/9348725b/ambari-web/app/views/main/dashboard/widget.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/dashboard/widget.js b/ambari-web/app/views/main/dashboard/widget.js
index cc5be28..495db2e 100644
--- a/ambari-web/app/views/main/dashboard/widget.js
+++ b/ambari-web/app/views/main/dashboard/widget.js
@@ -24,26 +24,30 @@ App.DashboardWidgetView = Em.View.extend({
    * @type {string}
    * @default null
    */
-  title: null,
-  templateName: null, // each has specific template
+  title: Em.computed.alias('widget.title'),
+
+  templateName: null,
+
+  sourceName: Em.computed.alias('widget.sourceName'),
+
+  widget: null,
 
   /**
-   * Setup model for widget by `model_type`. Usually `model_type` is a lowercase service name,
-   * for example `hdfs`, `yarn`, etc. You need to set `model_type` in extended object View, for example
-   * look App.DataNodeUpView.
-   * @type {object} - model that set up in App.MainDashboardView.setWidgetsDataModel()
+   * @type {object} - record from model that serve as data source
    */
   model : function () {
-    if (!this.get('model_type')) return {};
-    return this.get('parentView').get(this.get('model_type') + '_model');
-  }.property(),
+    var model = Em.Object.create();
+    if (Em.isNone(this.get('sourceName'))) {
+      return model;
+    }
+    return this.findModelBySource(this.get('sourceName'));
+  }.property('sourceName'),
 
   /**
-   * id 1-10 used to identify
    * @type {number}
    * @default null
    */
-  id: null,
+  id: Em.computed.alias('widget.id'),
 
   /**
    * html id bind to view-class: widget-(1)
@@ -52,6 +56,8 @@ App.DashboardWidgetView = Em.View.extend({
    */
   viewID: Em.computed.format('widget-{0}', 'id'),
 
+  classNames: ['span2p4'],
+
   attributeBindings: ['viewID'],
 
   /**
@@ -74,15 +80,19 @@ App.DashboardWidgetView = Em.View.extend({
 
   /**
    * @type {number}
-   * @default null
+   * @default 0
    */
-  thresh1: null,
+  thresholdMin: function() {
+    return Em.isNone(this.get('widget.threshold')) ? 0 : this.get('widget.threshold')[0];
+  }.property('widget.threshold'),
 
   /**
    * @type {number}
-   * @default null
+   * @default 0
    */
-  thresh2: null,
+  thresholdMax: function() {
+    return Em.isNone(this.get('widget.threshold')) ? 0 : this.get('widget.threshold')[1];
+  }.property('widget.threshold'),
 
   /**
    * @type {Boolean}
@@ -95,8 +105,8 @@ App.DashboardWidgetView = Em.View.extend({
    * @class
    */
   widgetConfig: Ember.Object.extend({
-    thresh1: '',
-    thresh2: '',
+    thresholdMin: '',
+    thresholdMax: '',
     hintInfo: Em.computed.i18nFormat('dashboard.widgets.hintInfo.common', 'maxValue'),
     isThresh1Error: false,
     isThresh2Error: false,
@@ -104,15 +114,15 @@ App.DashboardWidgetView = Em.View.extend({
     errorMessage2: "",
     maxValue: 0,
     observeThresh1Value: function () {
-      var thresh1 = this.get('thresh1');
-      var thresh2 = this.get('thresh2');
+      var thresholdMin = this.get('thresholdMin');
+      var thresholdMax = this.get('thresholdMax');
       var maxValue = this.get('maxValue');
 
-      if (thresh1.trim() !== "") {
-        if (isNaN(thresh1) || thresh1 > maxValue || thresh1 < 0) {
+      if (thresholdMin.trim() !== "") {
+        if (isNaN(thresholdMin) || thresholdMin > maxValue || thresholdMin < 0) {
           this.set('isThresh1Error', true);
           this.set('errorMessage1', Em.I18n.t('dashboard.widgets.error.invalid').format(maxValue));
-        } else if (this.get('isThresh2Error') === false && parseFloat(thresh2) <= parseFloat(thresh1)) {
+        } else if (this.get('isThresh2Error') === false && parseFloat(thresholdMax) <= parseFloat(thresholdMin)) {
           this.set('isThresh1Error', true);
           this.set('errorMessage1', Em.I18n.t('dashboard.widgets.error.smaller'));
         } else {
@@ -124,13 +134,13 @@ App.DashboardWidgetView = Em.View.extend({
         this.set('errorMessage1', Em.I18n.t('admin.users.editError.requiredField'));
       }
       this.updateSlider();
-    }.observes('thresh1', 'maxValue'),
+    }.observes('thresholdMin', 'maxValue'),
     observeThresh2Value: function () {
-      var thresh2 = this.get('thresh2');
+      var thresholdMax = this.get('thresholdMax');
       var maxValue = this.get('maxValue');
 
-      if (thresh2.trim() !== "") {
-        if (isNaN(thresh2) || thresh2 > maxValue || thresh2 < 0) {
+      if (thresholdMax.trim() !== "") {
+        if (isNaN(thresholdMax) || thresholdMax > maxValue || thresholdMax < 0) {
           this.set('isThresh2Error', true);
           this.set('errorMessage2', Em.I18n.t('dashboard.widgets.error.invalid').format(maxValue));
         } else {
@@ -142,15 +152,15 @@ App.DashboardWidgetView = Em.View.extend({
         this.set('errorMessage2', Em.I18n.t('admin.users.editError.requiredField'));
       }
       this.updateSlider();
-    }.observes('thresh2', 'maxValue'),
+    }.observes('thresholdMax', 'maxValue'),
     updateSlider: function () {
-      var thresh1 = this.get('thresh1');
-      var thresh2 = this.get('thresh2');
+      var thresholdMin = this.get('thresholdMin');
+      var thresholdMax = this.get('thresholdMax');
       // update the slider handles and color
       if (this.get('isThresh1Error') === false && this.get('isThresh2Error') === false) {
         $("#slider-range")
-          .slider('values', 0, parseFloat(thresh1))
-          .slider('values', 1, parseFloat(thresh2));
+          .slider('values', 0, parseFloat(thresholdMin))
+          .slider('values', 1, parseFloat(thresholdMax));
       }
     }
   }),
@@ -162,46 +172,36 @@ App.DashboardWidgetView = Em.View.extend({
     });
   },
 
+  findModelBySource: function (source) {
+    if (source === 'HOST_METRICS' && App.get('services.hostMetrics').length > 0) {
+      return App.get('services.hostMetrics');
+    }
+    var extendedModel = App.Service.extendedModel[source];
+    if (extendedModel) {
+      return App[extendedModel].find(source);
+    } else {
+      return App.Service.find(source);
+    }
+  },
+
   willDestroyElement : function() {
     $("[rel='ZoomInTooltip']").tooltip('destroy');
   },
+
   /**
    * delete widget
-   * @param {object} event
    */
   deleteWidget: function () {
     var parent = this.get('parentView');
-    var self = this;
-
-    if (App.get('testMode')) {
-      //update view on dashboard
-      var objClass = parent.widgetsMapper(this.get('id'));
-      parent.get('visibleWidgets').removeObject(objClass);
-      parent.get('hiddenWidgets').pushObject(Em.Object.create({displayName: this.get('title'), id: this.get('id'), checked: false}));
-    } else {
-      //reconstruct new persist value then post in persist
-      parent.getUserPref(parent.get('persistKey')).complete(function () {
-        self.deleteWidgetComplete.apply(self);
-      });
-    }
-  },
-
-  /**
-   * delete widget complete callback
-   */
-  deleteWidgetComplete: function () {
-    var parent = this.get('parentView');
-    var oldValue = parent.get('currentPrefObject');
+    var userPreferences = parent.get('userPreferences');
     var deletedId = this.get('id');
-    var newValue = Em.Object.create({
-      dashboardVersion: oldValue.dashboardVersion,
-      visible: oldValue.visible.slice(0).without(deletedId),
-      hidden: oldValue.hidden,
-      threshold: oldValue.threshold
-    });
-    newValue.hidden.push([deletedId, this.get('title')]);
-    parent.postUserPref(parent.get('persistKey'), newValue);
-    parent.translateToReal(newValue);
+    var newValue = {
+      visible: userPreferences.visible.slice(0).without(deletedId),
+      hidden: userPreferences.hidden.concat([deletedId]),
+      threshold: userPreferences.threshold
+    };
+    parent.saveWidgetsSettings(newValue);
+    parent.renderWidgets();
   },
 
   /**
@@ -210,8 +210,8 @@ App.DashboardWidgetView = Em.View.extend({
    */
   editWidget: function (event) {
     var configObj = this.get('widgetConfig').create({
-      thresh1: this.get('thresh1') + '',
-      thresh2: this.get('thresh2') + '',
+      thresholdMin: this.get('thresholdMin') + '',
+      thresholdMax: this.get('thresholdMax') + '',
       maxValue: parseFloat(this.get('maxValue'))
     });
     this.showEditDialog(configObj)
@@ -239,18 +239,14 @@ App.DashboardWidgetView = Em.View.extend({
         configObj.observeThresh1Value();
         configObj.observeThresh2Value();
         if (!configObj.isThresh1Error && !configObj.isThresh2Error) {
-          self.set('thresh1', parseFloat(configObj.get('thresh1')));
-          self.set('thresh2', parseFloat(configObj.get('thresh2')));
-
-          if (!App.get('testMode')) {
-            // save to persist
-            var parent = self.get('parentView');
-            parent.getUserPref(parent.get('persistKey')).complete(function () {
-              var oldValue = parent.get('currentPrefObject');
-              oldValue.threshold[parseInt(self.get('id'), 10)] = [configObj.get('thresh1'), configObj.get('thresh2')];
-              parent.postUserPref(parent.get('persistKey'), oldValue);
-            });
-          }
+          self.set('thresholdMin', parseFloat(configObj.get('thresholdMin')));
+          self.set('thresholdMax', parseFloat(configObj.get('thresholdMax')));
+
+          var parent = self.get('parentView');
+          var userPreferences = parent.get('userPreferences');
+          userPreferences.threshold[Number(self.get('id'))] = [configObj.get('thresholdMin'), configObj.get('thresholdMax')];
+          parent.saveWidgetsSettings(userPreferences);
+          parent.renderWidgets();
 
           this.hide();
         }
@@ -259,7 +255,7 @@ App.DashboardWidgetView = Em.View.extend({
       didInsertElement: function () {
         this._super();
         var browserVersion = self.getInternetExplorerVersion();
-        var handlers = [configObj.get('thresh1'), configObj.get('thresh2')];
+        var handlers = [configObj.get('thresholdMin'), configObj.get('thresholdMax')];
         var colors = [App.healthStatusGreen, App.healthStatusOrange, App.healthStatusRed]; //color green, orange ,red
 
         if (browserVersion === -1 || browserVersion > 9) {
@@ -275,8 +271,8 @@ App.DashboardWidgetView = Em.View.extend({
             },
             slide: function (event, ui) {
               updateColors(ui.values);
-              configObj.set('thresh1', ui.values[0] + '');
-              configObj.set('thresh2', ui.values[1] + '');
+              configObj.set('thresholdMin', ui.values[0] + '');
+              configObj.set('thresholdMax', ui.values[1] + '');
             },
             change: function (event, ui) {
               updateColors(ui.values);
@@ -351,8 +347,3 @@ App.DashboardWidgetView = Em.View.extend({
   }.property('hiddenInfo.length')
 
 });
-
-
-App.DashboardWidgetView.reopenClass({
-  class: 'span2p4'
-});

http://git-wip-us.apache.org/repos/asf/ambari/blob/9348725b/ambari-web/app/views/main/dashboard/widgets.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/dashboard/widgets.js b/ambari-web/app/views/main/dashboard/widgets.js
index 999fc08..4e22aad 100644
--- a/ambari-web/app/views/main/dashboard/widgets.js
+++ b/ambari-web/app/views/main/dashboard/widgets.js
@@ -20,20 +20,187 @@ var App = require('app');
 var filters = require('views/common/filter_view');
 
 App.MainDashboardWidgetsView = Em.View.extend(App.UserPref, App.LocalStorage, App.TimeRangeMixin, {
-
   name: 'mainDashboardWidgetsView',
-
   templateName: require('templates/main/dashboard/widgets'),
 
-  didInsertElement: function () {
-    this._super();
-    this.setWidgetsDataModel();
-    this.setInitPrefObject();
-    this.setOnLoadVisibleWidgets();
-    this.set('isDataLoaded', true);
-    App.loadTimer.finish('Dashboard Metrics Page');
-    Em.run.next(this, 'makeSortable');
-  },
+  widgetsDefinition: [
+    {
+      id: 1,
+      viewName: 'NameNodeHeapPieChartView',
+      sourceName: 'HDFS',
+      title: Em.I18n.t('dashboard.widgets.NameNodeHeap'),
+      threshold: [80, 90]
+    },
+    {
+      id: 2,
+      viewName: 'NameNodeCapacityPieChartView',
+      sourceName: 'HDFS',
+      title: Em.I18n.t('dashboard.widgets.HDFSDiskUsage'),
+      threshold: [85, 95]
+    },
+    {
+      id: 3,
+      viewName: 'NameNodeCpuPieChartView',
+      sourceName: 'HDFS',
+      title: Em.I18n.t('dashboard.widgets.NameNodeCpu'),
+      threshold: [90, 95]
+    },
+    {
+      id: 4,
+      viewName: 'DataNodeUpView',
+      sourceName: 'HDFS',
+      title: Em.I18n.t('dashboard.widgets.DataNodeUp'),
+      threshold: [80, 90]
+    },
+    {
+      id: 5,
+      viewName: 'NameNodeRpcView',
+      sourceName: 'HDFS',
+      title: Em.I18n.t('dashboard.widgets.NameNodeRpc'),
+      threshold: [1000, 3000]
+    },
+    {
+      id: 6,
+      viewName: 'ChartClusterMetricsMemoryWidgetView',
+      sourceName: 'HOST_METRICS',
+      title: Em.I18n.t('dashboard.clusterMetrics.memory'),
+      threshold: []
+    },
+    {
+      id: 7,
+      viewName: 'ChartClusterMetricsNetworkWidgetView',
+      sourceName: 'HOST_METRICS',
+      title: Em.I18n.t('dashboard.clusterMetrics.network'),
+      threshold: []
+    },
+    {
+      id: 8,
+      viewName: 'ChartClusterMetricsCPUWidgetView',
+      sourceName: 'HOST_METRICS',
+      title: Em.I18n.t('dashboard.clusterMetrics.cpu'),
+      threshold: []
+    },
+    {
+      id: 9,
+      viewName: 'ChartClusterMetricsLoadWidgetView',
+      sourceName: 'HOST_METRICS',
+      title: Em.I18n.t('dashboard.clusterMetrics.load'),
+      threshold: []
+    },
+    {
+      id: 10,
+      viewName: 'NameNodeUptimeView',
+      sourceName: 'HDFS',
+      title: Em.I18n.t('dashboard.widgets.NameNodeUptime'),
+      threshold: []
+    },
+    {
+      id: 11,
+      viewName: 'HDFSLinksView',
+      sourceName: 'HDFS',
+      title: Em.I18n.t('dashboard.widgets.HDFSLinks'),
+      threshold: []
+    },
+    {
+      id: 12,
+      viewName: 'HBaseLinksView',
+      sourceName: 'HBASE',
+      title: Em.I18n.t('dashboard.widgets.HBaseLinks'),
+      threshold: []
+    },
+    {
+      id: 13,
+      viewName: 'HBaseMasterHeapPieChartView',
+      sourceName: 'HBASE',
+      title: Em.I18n.t('dashboard.widgets.HBaseMasterHeap'),
+      threshold: [70, 90]
+    },
+    {
+      id: 14,
+      viewName: 'HBaseAverageLoadView',
+      sourceName: 'HBASE',
+      title: Em.I18n.t('dashboard.widgets.HBaseAverageLoad'),
+      threshold: [150, 250]
+    },
+    {
+      id: 15,
+      viewName: 'HBaseRegionsInTransitionView',
+      sourceName: 'HBASE',
+      title: Em.I18n.t('dashboard.widgets.HBaseRegionsInTransition'),
+      threshold: [3, 10],
+      isHiddenByDefault: true
+    },
+    {
+      id: 16,
+      viewName: 'HBaseMasterUptimeView',
+      sourceName: 'HBASE',
+      title: Em.I18n.t('dashboard.widgets.HBaseMasterUptime'),
+      threshold: []
+    },
+    {
+      id: 17,
+      viewName: 'ResourceManagerHeapPieChartView',
+      sourceName: 'YARN',
+      title: Em.I18n.t('dashboard.widgets.ResourceManagerHeap'),
+      threshold: [70, 90]
+    },
+    {
+      id: 18,
+      viewName: 'ResourceManagerUptimeView',
+      sourceName: 'YARN',
+      title: Em.I18n.t('dashboard.widgets.ResourceManagerUptime'),
+      threshold: []
+    },
+    {
+      id: 19,
+      viewName: 'NodeManagersLiveView',
+      sourceName: 'YARN',
+      title: Em.I18n.t('dashboard.widgets.NodeManagersLive'),
+      threshold: [50, 75]
+    },
+    {
+      id: 20,
+      viewName: 'YARNMemoryPieChartView',
+      sourceName: 'YARN',
+      title: Em.I18n.t('dashboard.widgets.YARNMemory'),
+      threshold: [50, 75]
+    },
+    {
+      id: 21,
+      viewName: 'SuperVisorUpView',
+      sourceName: 'STORM',
+      title: Em.I18n.t('dashboard.widgets.SuperVisorUp'),
+      threshold: [85, 95]
+    },
+    {
+      id: 22,
+      viewName: 'FlumeAgentUpView',
+      sourceName: 'FLUME',
+      title: Em.I18n.t('dashboard.widgets.FlumeAgentUp'),
+      threshold: [85, 95]
+    },
+    {
+      id: 23,
+      viewName: 'YARNLinksView',
+      sourceName: 'YARN',
+      title: Em.I18n.t('dashboard.widgets.YARNLinks'),
+      threshold: []
+    },
+    {
+      id: 24,
+      viewName: 'HawqSegmentUpView',
+      sourceName: 'HAWQ',
+      title: Em.I18n.t('dashboard.widgets.HawqSegmentUp'),
+      threshold: [75, 90]
+    },
+    {
+      id: 25,
+      viewName: 'PxfUpView',
+      sourceName: 'PXF',
+      title: Em.I18n.t('dashboard.widgets.PxfUp'),
+      threshold: []
+    }
+  ],
 
   /**
    * List of services
@@ -42,6 +209,12 @@ App.MainDashboardWidgetsView = Em.View.extend(App.UserPref, App.LocalStorage, Ap
   content: [],
 
   /**
+   * Key-name to store data in Local Storage and Persist
+   * @type {string}
+   */
+  persistKey: Em.computed.format('user-pref-{0}-dashboard', 'App.router.loginName'),
+
+  /**
    * @type {boolean}
    */
   isDataLoaded: false,
@@ -52,177 +225,6 @@ App.MainDashboardWidgetsView = Em.View.extend(App.UserPref, App.LocalStorage, Ap
    */
   isMoving: false,
 
-  timeRangeClassName: 'pull-left',
-
-  /**
-   * Make widgets' list sortable on New Dashboard style
-   */
-  makeSortable: function () {
-    var self = this;
-    $("#sortable").sortable({
-      items: "> div",
-      //placeholder: "sortable-placeholder",
-      cursor: "move",
-      tolerance: "pointer",
-      scroll: false,
-      update: function (event, ui) {
-        if (!App.get('testMode')) {
-          // update persist then translate to real
-          var widgetsArray = $('div[viewid]'); // get all in DOM
-          self.getUserPref(self.get('persistKey')).complete(function () {
-            var oldValue = self.get('currentPrefObject') || self.getDBProperty(self.get('persistKey'));
-            var newValue = Em.Object.create({
-              dashboardVersion: oldValue.dashboardVersion,
-              visible: [],
-              hidden: oldValue.hidden,
-              threshold: oldValue.threshold
-            });
-            var size = oldValue.visible.length;
-            for (var j = 0; j <= size - 1; j++) {
-              var viewID = widgetsArray.get(j).getAttribute('viewid');
-              var id = viewID.split("-").get(1);
-              newValue.visible.push(id);
-            }
-            self.postUserPref(self.get('persistKey'), newValue);
-            self.setDBProperty(self.get('persistKey'), newValue);
-            //self.translateToReal(newValue);
-          });
-        }
-      },
-      activate: function (event, ui) {
-        self.set('isMoving', true);
-      },
-      deactivate: function (event, ui) {
-        self.set('isMoving', false);
-      }
-    }).disableSelection();
-  },
-
-  /**
-   * Set Service model values
-   */
-  setWidgetsDataModel: function () {
-    if (App.get('services.hostMetrics').length > 0) {
-      this.set('host_metrics_model', App.get('services.hostMetrics'));
-    }
-    App.Service.find().forEach(function (item) {
-      var extendedModel = App.Service.extendedModel[item.get('serviceName')];
-      var key = item.get('serviceName').toLowerCase() + '_model';
-      if (extendedModel && App[extendedModel].find(item.get('id'))) {
-        this.set(key, App[extendedModel].find(item.get('id')));
-      } else {
-        this.set(key, item);
-      }
-    }, this);
-  },
-
-  resolveConfigDependencies: function(visibleFull, hiddenFull) {
-    var clusterEnv = App.router.get('clusterController.clusterEnv').properties;
-
-    if (clusterEnv['hide_yarn_memory_widget'] === 'true') {
-      hiddenFull.push(['20', 'YARN Memory']);
-    } else {
-      visibleFull.splice(visibleFull.indexOf('19'), 0, '20');
-    }
-  },
-
-  /**
-   * Load widget statuses to <code>initPrefObject</code>
-   */
-  setInitPrefObject: function () {
-    //in case of some service not installed
-    var visibleFull = [
-      '2', '4', '11', //hdfs
-      '6', '7', '8', '9', //host metrics
-      '1', '5', '3', '10', //hdfs
-      '13', '12', '14', '16', //hbase
-      '17', '18', '19', '23', // all yarn
-      '21', // storm
-      '22', // flume
-      '24', // hawq
-      '25' // pxf
-    ]; // all in order
-    var hiddenFull = [
-      ['15', 'Region In Transition']
-    ];
-    this.resolveConfigDependencies(visibleFull, hiddenFull);
-
-    // Display widgets for host metrics if the stack definition has a host metrics service to display it.
-    if (this.get('host_metrics_model') == null) {
-      var hostMetrics = ['6', '7', '8', '9'];
-      hostMetrics.forEach(function (item) {
-        visibleFull = visibleFull.without(item);
-      }, this);
-    }
-
-    if (this.get('hdfs_model') == null) {
-      var hdfs = ['1', '2', '3', '4', '5', '10', '11'];
-      hdfs.forEach(function (item) {
-        visibleFull = visibleFull.without(item);
-      }, this);
-    }
-    if (this.get('hbase_model') == null) {
-      var hbase = ['12', '13', '14', '16'];
-      hbase.forEach(function (item) {
-        visibleFull = visibleFull.without(item);
-      }, this);
-      hiddenFull = hiddenFull.filter(function(item) {
-        return item[0] !== '15';
-      });
-    }
-    if (this.get('yarn_model') == null) {
-      var yarn = ['17', '18', '19', '20', '23'];
-      yarn.forEach(function (item) {
-        visibleFull = visibleFull.without(item);
-      }, this);
-    }
-    if (this.get('storm_model') == null) {
-      var storm = ['21'];
-      storm.forEach(function (item) {
-        visibleFull = visibleFull.without(item);
-      }, this);
-    }
-    if (this.get('flume_model') == null) {
-      var flume = ['22'];
-      flume.forEach(function (item) {
-        visibleFull = visibleFull.without(item);
-      }, this);
-    }
-    if (this.get('hawq_model') == null) {
-      var hawq = ['24'];
-      hawq.forEach(function (item) {
-        visibleFull = visibleFull.without(item);
-      }, this);
-    }
-    if (this.get('pxf_model') == null) {
-      var pxf = ['25'];
-      pxf.forEach(function (item) {
-        visibleFull = visibleFull.without(item);
-      }, this);
-    }
-    var obj = this.get('initPrefObject');
-    obj.set('visible', visibleFull);
-    obj.set('hidden', hiddenFull);
-  },
-
-  host_metrics_model: null,
-
-  hdfs_model: null,
-
-  mapreduce2_model: null,
-
-  yarn_model: null,
-
-  hbase_model: null,
-
-  storm_model: null,
-
-  flume_model: null,
-
-  hawq_model: null,
-
-  pxf_model: null,
-
   /**
    * List of visible widgets
    * @type {Ember.Enumerable}
@@ -235,302 +237,162 @@ App.MainDashboardWidgetsView = Em.View.extend(App.UserPref, App.LocalStorage, Ap
    */
   hiddenWidgets: [], // widget child view will push object in this array if deleted
 
-  /**
-   * Submenu view for New Dashboard style
-   * @type {Ember.View}
-   * @class
-   */
-  plusButtonFilterView: Ember.View.extend({
-    tagName: 'ul',
-    classNames: ['dropdown-menu'],
-    templateName: require('templates/main/dashboard/plus_button_filter'),
-    hiddenWidgetsBinding: 'parentView.hiddenWidgets',
-    visibleWidgetsBinding: 'parentView.visibleWidgets',
-    valueBinding: '',
-    widgetCheckbox: App.CheckboxView.extend({
-      didInsertElement: function () {
-        $('.checkbox').click(function (event) {
-          event.stopPropagation();
-        });
-      }
-    }),
-    closeFilter: Em.K,
-    applyFilter: function () {
-      var self = this;
-      var parent = this.get('parentView');
-      var hiddenWidgets = this.get('hiddenWidgets');
-      var checkedWidgets = hiddenWidgets.filterProperty('checked', true);
-
-      if (App.get('testMode')) {
-        var visibleWidgets = this.get('visibleWidgets');
-        checkedWidgets.forEach(function (item) {
-          var newObj = parent.widgetsMapper(item.id);
-          visibleWidgets.pushObject(newObj);
-          hiddenWidgets.removeObject(item);
-        }, this);
-      } else {
-        //save in persist
-        parent.getUserPref(parent.get('persistKey')).complete(function(){
-          self.applyFilterComplete.apply(self);
-        });
-      }
-    },
-    applyFilterComplete: function () {
-      var parent = this.get('parentView'),
-        hiddenWidgets = this.get('hiddenWidgets'),
-        oldValue = parent.get('currentPrefObject'),
-        newValue = Em.Object.create({
-          dashboardVersion: oldValue.dashboardVersion,
-          visible: oldValue.visible,
-          hidden: [],
-          threshold: oldValue.threshold
-        });
-      hiddenWidgets.filterProperty('checked').forEach(function (item) {
-        newValue.visible.push(item.id);
-        hiddenWidgets.removeObject(item);
-      }, this);
-      hiddenWidgets.forEach(function (item) {
-        newValue.hidden.push([item.id, item.displayName]);
-      }, this);
-      parent.postUserPref(parent.get('persistKey'), newValue);
-      parent.translateToReal(newValue);
-    }
-  }),
+  timeRangeClassName: 'pull-left',
 
   /**
-   * Translate from Json value got from persist to real widgets view
+   * Example:
+   * {
+   *   visible: [1, 2, 4],
+   *   hidden: [3, 5],
+   *   threshold: {
+   *     1: [80, 90],
+   *     2: [],
+   *     3: [1, 2]
+   *   }
+   * }
+   * @type {Object|null}
    */
-  translateToReal: function (value) {
-    var version = value.dashboardVersion;
-    var visible = value.visible;
-    var hidden = value.hidden;
-    var threshold = value.threshold;
-
-    if (version === 'new') {
-      var visibleWidgets = [];
-      var hiddenWidgets = [];
-      // re-construct visibleWidgets and hiddenWidgets
-      for (var i = 0; i < visible.length; i++) {
-        var id = visible[i];
-        var widgetClass = this.widgetsMapper(id);
-        //override with new threshold
-        if (threshold[id].length > 0) {
-          widgetClass.reopen({
-            thresh1: threshold[id][0],
-            thresh2: threshold[id][1]
-          });
-        }
-        visibleWidgets.pushObject(widgetClass);
-      }
-      for (var j = 0; j < hidden.length; j++) {
-        var title = hidden[j][1];
-        hiddenWidgets.pushObject(Em.Object.create({displayName: title, id: hidden[j][0], checked: false}));
-      }
-      this.set('visibleWidgets', visibleWidgets);
-      this.set('hiddenWidgets', hiddenWidgets);
-    }
+  userPreferences: null,
+
+  didInsertElement: function () {
+    var self = this;
+
+    this._super();
+    this.loadWidgetsSettings().complete(function() {
+      self.checkServicesChange();
+      self.renderWidgets();
+      self.set('isDataLoaded', true);
+      App.loadTimer.finish('Dashboard Metrics Page');
+      Em.run.next(self, 'makeSortable');
+    });
   },
 
   /**
    * Set visibility-status for widgets
    */
-  setOnLoadVisibleWidgets: function () {
-    var self = this;
-    if (App.get('testMode')) {
-      this.translateToReal(this.get('initPrefObject'));
-    } else {
-      // called when first load/refresh/jump back page
-      this.getUserPref(this.get('persistKey')).complete(function () {
-        if (self.get('state') === 'inDOM') {
-          self.setOnLoadVisibleWidgetsComplete.apply(self);
-        }
-      });
-    }
+  loadWidgetsSettings: function () {
+    return this.getUserPref(this.get('persistKey'));
   },
 
   /**
-   * complete load of visible widgets
+   * make POST call to save settings
+   * @param {object} settings
    */
-  setOnLoadVisibleWidgetsComplete: function () {
-    var currentPrefObject = this.get('currentPrefObject') || this.getDBProperty(this.get('persistKey'));
-    if (currentPrefObject) { // fit for no dashboard version
-      if (!currentPrefObject.dashboardVersion) {
-        currentPrefObject.dashboardVersion = 'new';
-        this.postUserPref(this.get('persistKey'), currentPrefObject);
-        this.setDBProperty(this.get('persistKey'), currentPrefObject);
-      }
-      this.set('currentPrefObject', this.checkServicesChange(currentPrefObject));
-      this.translateToReal(this.get('currentPrefObject'));
-    }
-    else {
-      // post persist then translate init object
-      this.postUserPref(this.get('persistKey'), this.get('initPrefObject'));
-      this.setDBProperty(this.get('persistKey'), this.get('initPrefObject'));
-      this.translateToReal(this.get('initPrefObject'));
-    }
+  saveWidgetsSettings: function (settings) {
+    this.set('userPreferences', settings);
+    this.setDBProperty(this.get('persistKey'), settings);
+    this.postUserPref(this.get('persistKey'), settings);
   },
 
-  /**
-   * Remove widget from visible and hidden lists
-   * @param {Object} value
-   * @param {Object} widget
-   * @returns {*}
-   */
-  removeWidget: function (value, widget) {
-    value.visible = value.visible.without(widget);
-    for (var j = 0; j < value.hidden.length; j++) {
-      if (value.hidden[j][0] == widget) {
-        value.hidden.splice(j, 1);
-      }
+  getUserPrefSuccessCallback: function (response) {
+    if (response) {
+      this.set('userPreferences', response);
+    } else {
+      this.getUserPrefErrorCallback();
     }
-    return value;
   },
 
-  /**
-   * Check if widget is in visible or hidden list
-   * @param {Object} value
-   * @param {Object} widget
-   * @returns {bool}
-   */
-  containsWidget: function (value, widget) {
-    var flag = value.visible.contains(widget);
-    for (var j = 0; j < value.hidden.length; j++) {
-      if (!flag && value.hidden[j][0] == widget) {
-        flag = true;
-        break;
-      }
+  getUserPrefErrorCallback: function () {
+    var userPreferences = this.generateDefaultUserPreferences();
+    this.saveWidgetsSettings(userPreferences);
+  },
+
+  resolveConfigDependencies: function(widgetsDefinition) {
+    var clusterEnv = App.router.get('clusterController.clusterEnv').properties;
+    var yarnMemoryWidget = widgetsDefinition.findProperty('id', 20);
+
+    if (clusterEnv['hide_yarn_memory_widget'] === 'true') {
+      yarnMemoryWidget.isHiddenByDefault = true;
     }
-    return flag;
   },
 
-  /**
-   * check if stack has upgraded from HDP 1.0 to 2.0 OR add/delete services.
-   * Update the value on server if true.
-   * @param {Object} currentPrefObject
-   * @return {Object}
-   */
-  checkServicesChange: function (currentPrefObject) {
-    var toDelete = $.extend(true, {}, currentPrefObject);
-    var toAdd = [];
-    var serviceWidgetsMap = {
-      hdfs_model: ['1', '2', '3', '4', '5', '10', '11'],
-      host_metrics_model: ['6', '7', '8', '9'],
-      hbase_model: ['12', '13', '14', '15', '16'],
-      yarn_model: ['17', '18', '19', '20', '23'],
-      storm_model: ['21'],
-      flume_model: ['22'],
-      hawq_model: ['24'],
-      pxf_model: ['25']
+  generateDefaultUserPreferences: function() {
+    var widgetsDefinition = this.get('widgetsDefinition');
+    var preferences = {
+      visible: [],
+      hidden: [],
+      threshold: {}
     };
 
-    // check each service, find out the newly added service and already deleted service
-    Em.keys(serviceWidgetsMap).forEach(function (modelName) {
-      if (!Em.isNone(this.get(modelName))) {
-        var ids = serviceWidgetsMap[modelName];
-        var flag = this.containsWidget(toDelete, ids[0]);
-        if (flag) {
-          ids.forEach(function (item) {
-            toDelete = this.removeWidget(toDelete, item);
-          }, this);
+    this.resolveConfigDependencies(widgetsDefinition);
+
+    widgetsDefinition.forEach(function(widget) {
+      if (App.Service.find(widget.sourceName).get('isLoaded') || widget.sourceName === 'HOST_METRICS') {
+        if (widget.isHiddenByDefault) {
+          preferences.hidden.push(widget.id);
         } else {
-          toAdd = toAdd.concat(ids);
+          preferences.visible.push(widget.id);
         }
       }
-    }, this);
+      preferences.threshold[widget.id] = widget.threshold;
+    });
 
-    var value = currentPrefObject;
-    if (toDelete.visible.length || toDelete.hidden.length) {
-      toDelete.visible.forEach(function (item) {
-        value = this.removeWidget(value, item);
-      }, this);
-      toDelete.hidden.forEach(function (item) {
-        value = this.removeWidget(value, item[0]);
-      }, this);
-    }
-    if (toAdd.length) {
-      value.visible = value.visible.concat(toAdd);
-      var allThreshold = this.get('initPrefObject').threshold;
-      // add new threshold OR override with default value
-      toAdd.forEach(function (item) {
-        value.threshold[item] = allThreshold[item];
-      }, this);
-    }
-    return value;
+    return preferences;
   },
 
   /**
-   * Get view for widget by widget's id
-   * @param {string} id
-   * @returns {Ember.View}
+   * set widgets to view in order to render
    */
-  widgetsMapper: function (id) {
-    return Em.get({
-      '1': App.NameNodeHeapPieChartView,
-      '2': App.NameNodeCapacityPieChartView,
-      '3': App.NameNodeCpuPieChartView,
-      '4': App.DataNodeUpView,
-      '5': App.NameNodeRpcView,
-      '6': App.ChartClusterMetricsMemoryWidgetView,
-      '7': App.ChartClusterMetricsNetworkWidgetView,
-      '8': App.ChartClusterMetricsCPUWidgetView,
-      '9': App.ChartClusterMetricsLoadWidgetView,
-      '10': App.NameNodeUptimeView,
-      '11': App.HDFSLinksView,
-      '12': App.HBaseLinksView,
-      '13': App.HBaseMasterHeapPieChartView,
-      '14': App.HBaseAverageLoadView,
-      '15': App.HBaseRegionsInTransitionView,
-      '16': App.HBaseMasterUptimeView,
-      '17': App.ResourceManagerHeapPieChartView,
-      '18': App.ResourceManagerUptimeView,
-      '19': App.NodeManagersLiveView,
-      '20': App.YARNMemoryPieChartView,
-      '21': App.SuperVisorUpView,
-      '22': App.FlumeAgentUpView,
-      '23': App.YARNLinksView,
-      '24': App.HawqSegmentUpView,
-      '25': App.PxfUpView
-    }, id);
-  },
+  renderWidgets: function () {
+    var widgetsDefinitionMap = this.get('widgetsDefinition').toMapByProperty('id');
+    var userPreferences = this.get('userPreferences');
+    var visibleWidgets = [];
+    var hiddenWidgets = [];
+
+    userPreferences.visible.forEach(function(id) {
+      var widget = widgetsDefinitionMap[id];
+      visibleWidgets.push(Em.Object.create({
+        id: id,
+        threshold: userPreferences.threshold[id],
+        viewClass: App[widget.viewName],
+        sourceName: widget.sourceName,
+        title: widget.title
+      }));
+    });
 
-  /**
-   * @type {Object|null}
-   */
-  currentPrefObject: null,
+    userPreferences.hidden.forEach(function(id) {
+      var widget = widgetsDefinitionMap[id];
+      hiddenWidgets.push(Em.Object.create({
+        id: id,
+        title: widget.title,
+        checked: false
+      }));
+    });
 
-  /**
-   * @type {Ember.Object}
-   */
-  initPrefObject: Em.Object.create({
-    dashboardVersion: 'new',
-    visible: [],
-    hidden: [],
-    threshold: {1: [80, 90], 2: [85, 95], 3: [90, 95], 4: [80, 90], 5: [1000, 3000], 6: [], 7: [], 8: [], 9: [], 10: [], 11: [], 12: [], 13: [70, 90], 14: [150, 250], 15: [3, 10], 16: [],
-      17: [70, 90], 18: [], 19: [50, 75], 20: [50, 75], 21: [85, 95], 22: [85, 95], 23: [], 24: [75, 90], 25: []} // id:[thresh1, thresh2]
-  }),
+    this.set('visibleWidgets', visibleWidgets);
+    this.set('hiddenWidgets', hiddenWidgets);
+  },
 
   /**
-   * Key-name to store data in Local Storage and Persist
-   * @type {string}
+   * check if stack has upgraded from HDP 1.0 to 2.0 OR add/delete services.
+   * Update the value on server if true.
    */
-  persistKey: Em.computed.format('user-pref-{0}-dashboard', 'App.router.loginName'),
+  checkServicesChange: function () {
+    var userPreferences = this.get('userPreferences');
+    var defaultPreferences = this.generateDefaultUserPreferences();
+    var newValue = {
+      visible: userPreferences.visible.slice(0),
+      hidden: userPreferences.hidden.slice(0),
+      threshold: userPreferences.threshold
+    };
+    var isChanged = false;
 
-  getUserPrefSuccessCallback: function (response, request, data) {
-    if (response) {
-      var initPrefObject = this.get('initPrefObject');
-      initPrefObject.get('threshold');
-      for(var k in response.threshold) {
-        if (response.threshold.hasOwnProperty(k)) {
-          if (response.threshold[k].length === 0 && initPrefObject.get('threshold')[k] && initPrefObject.get('threshold')[k].length) {
-            response.threshold[k] = initPrefObject.get('threshold')[k];
-          }
-        }
+    defaultPreferences.visible.forEach(function(id) {
+      if (!userPreferences.visible.contains(id) && !userPreferences.hidden.contains(id)) {
+        isChanged = true;
+        newValue.visible.push(id);
       }
-      this.set('currentPrefObject', response);
-    }
-  },
+    });
 
-  getUserPrefErrorCallback: function (request) {
+    defaultPreferences.hidden.forEach(function(id) {
+      if (!userPreferences.visible.contains(id) && !userPreferences.hidden.contains(id)) {
+        isChanged = true;
+        newValue.hidden.push(id);
+      }
+    });
+    if (isChanged) {
+      this.saveWidgetsSettings(newValue);
+    }
   },
 
   /**
@@ -539,19 +401,91 @@ App.MainDashboardWidgetsView = Em.View.extend(App.UserPref, App.LocalStorage, Ap
   resetAllWidgets: function () {
     var self = this;
     App.showConfirmationPopup(function () {
-      if (!App.get('testMode')) {
-        self.postUserPref(self.get('persistKey'), self.get('initPrefObject'));
-        self.setDBProperty(self.get('persistKey'), self.get('initPrefObject'));
-      }
+      self.saveWidgetsSettings(self.generateDefaultUserPreferences());
       self.setProperties({
         currentTimeRangeIndex: 0,
         customStartTime: null,
         customEndTime: null
       });
-      self.translateToReal(self.get('initPrefObject'));
+      self.renderWidgets();
     });
   },
 
+  /**
+   * Make widgets' list sortable on New Dashboard style
+   */
+  makeSortable: function () {
+    var self = this;
+    return $("#sortable").sortable({
+      items: "> div",
+      cursor: "move",
+      tolerance: "pointer",
+      scroll: false,
+      update: function () {
+        var widgetsArray = $('div[viewid]');
+
+        var userPreferences = self.get('userPreferences') || self.getDBProperty(self.get('persistKey'));
+        var newValue = Em.Object.create({
+          visible: [],
+          hidden: userPreferences.hidden,
+          threshold: userPreferences.threshold
+        });
+        var size = userPreferences.visible.length;
+        for (var j = 0; j <= size - 1; j++) {
+          var viewID = widgetsArray.get(j).getAttribute('viewid');
+          var id = Number(viewID.split("-").get(1));
+          newValue.visible.push(id);
+        }
+        self.saveWidgetsSettings(newValue);
+      },
+      activate: function (event, ui) {
+        self.set('isMoving', true);
+      },
+      deactivate: function (event, ui) {
+        self.set('isMoving', false);
+      }
+    }).disableSelection();
+  },
+
+  /**
+   * Submenu view for New Dashboard style
+   * @type {Ember.View}
+   * @class
+   */
+  plusButtonFilterView: Ember.View.extend({
+    tagName: 'ul',
+    classNames: ['dropdown-menu'],
+    templateName: require('templates/main/dashboard/plus_button_filter'),
+    hiddenWidgetsBinding: 'parentView.hiddenWidgets',
+    valueBinding: '',
+    widgetCheckbox: App.CheckboxView.extend({
+      didInsertElement: function () {
+        $('.checkbox').click(function (event) {
+          event.stopPropagation();
+        });
+      }
+    }),
+    closeFilter: Em.K,
+    applyFilter: function () {
+      var parent = this.get('parentView'),
+        hiddenWidgets = this.get('hiddenWidgets'),
+        userPreferences = parent.get('userPreferences'),
+        newValue = {
+          visible: userPreferences.visible.slice(0),
+          hidden: userPreferences.hidden.slice(0),
+          threshold: userPreferences.threshold
+        };
+
+      hiddenWidgets.filterProperty('checked').forEach(function (item) {
+        newValue.visible.push(item.id);
+        newValue.hidden = newValue.hidden.without(item.id);
+        hiddenWidgets.removeObject(item);
+      }, this);
+      parent.saveWidgetsSettings(newValue);
+      parent.renderWidgets();
+    }
+  }),
+
   showAlertsPopup: Em.K
 
 });

http://git-wip-us.apache.org/repos/asf/ambari/blob/9348725b/ambari-web/app/views/main/dashboard/widgets/datanode_live.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/dashboard/widgets/datanode_live.js b/ambari-web/app/views/main/dashboard/widgets/datanode_live.js
index 184b046..ff1daaa 100644
--- a/ambari-web/app/views/main/dashboard/widgets/datanode_live.js
+++ b/ambari-web/app/views/main/dashboard/widgets/datanode_live.js
@@ -30,11 +30,6 @@ function counterOrNA(key) {
 
 App.DataNodeUpView = App.TextDashboardWidgetView.extend(App.EditableWithLimitWidgetMixin, {
 
-  title: Em.I18n.t('dashboard.widgets.DataNodeUp'),
-  id: '4',
-
-  model_type: 'hdfs',
-
   hiddenInfo: function () {
     return [
       this.get('dataNodesLive') + ' ' + Em.I18n.t('dashboard.services.hdfs.nodes.live'),
@@ -45,8 +40,6 @@ App.DataNodeUpView = App.TextDashboardWidgetView.extend(App.EditableWithLimitWid
 
   hiddenInfoClass: "hidden-info-three-line",
 
-  thresh1: 40,
-  thresh2: 70,
   maxValue: 100,
 
   dataNodesLive: counterOrNA('liveDataNodes'),

http://git-wip-us.apache.org/repos/asf/ambari/blob/9348725b/ambari-web/app/views/main/dashboard/widgets/flume_agent_live.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/dashboard/widgets/flume_agent_live.js b/ambari-web/app/views/main/dashboard/widgets/flume_agent_live.js
index e8169c9..280c25d 100644
--- a/ambari-web/app/views/main/dashboard/widgets/flume_agent_live.js
+++ b/ambari-web/app/views/main/dashboard/widgets/flume_agent_live.js
@@ -20,11 +20,6 @@ var App = require('app');
 
 App.FlumeAgentUpView = App.TextDashboardWidgetView.extend(App.EditableWithLimitWidgetMixin, {
 
-  title: Em.I18n.t('dashboard.widgets.FlumeAgentUp'),
-  id: '22',
-
-  model_type: 'flume',
-
   hiddenInfo: function () {
     return [
       this.get('flumeAgentsLive.length') + ' ' + Em.I18n.t('dashboard.services.hdfs.nodes.live'),
@@ -34,8 +29,6 @@ App.FlumeAgentUpView = App.TextDashboardWidgetView.extend(App.EditableWithLimitW
 
   hiddenInfoClass: "hidden-info-two-line",
 
-  thresh1: 40,
-  thresh2: 70,
   maxValue: 100,
 
   flumeAgentComponents: Em.computed.filterBy('model.hostComponents', 'componentName', 'FLUME_HANDLER'),

http://git-wip-us.apache.org/repos/asf/ambari/blob/9348725b/ambari-web/app/views/main/dashboard/widgets/hawqsegment_live.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/dashboard/widgets/hawqsegment_live.js b/ambari-web/app/views/main/dashboard/widgets/hawqsegment_live.js
index 04e7d66..ac35c07 100644
--- a/ambari-web/app/views/main/dashboard/widgets/hawqsegment_live.js
+++ b/ambari-web/app/views/main/dashboard/widgets/hawqsegment_live.js
@@ -31,11 +31,6 @@ function counterOrNA(key) {
 
 App.HawqSegmentUpView = App.TextDashboardWidgetView.extend(App.EditableWithLimitWidgetMixin, {
 
-  title: Em.I18n.t('dashboard.widgets.HawqSegmentUp'),
-  id: '24',
-
-  model_type: 'hawq',
-
   hiddenInfo: function () {
     return [
       this.get('hawqSegmentsStarted') + ' ' + Em.I18n.t('dashboard.services.components.started'),
@@ -46,8 +41,6 @@ App.HawqSegmentUpView = App.TextDashboardWidgetView.extend(App.EditableWithLimit
 
   hiddenInfoClass: "hidden-info-three-line",
 
-  thresh1: 75,
-  thresh2: 90,
   maxValue: 100,
 
   hawqSegmentsStarted: counterOrNA('hawqSegmentsStarted'),

http://git-wip-us.apache.org/repos/asf/ambari/blob/9348725b/ambari-web/app/views/main/dashboard/widgets/hbase_average_load.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/dashboard/widgets/hbase_average_load.js b/ambari-web/app/views/main/dashboard/widgets/hbase_average_load.js
index 48c4de0..986953f 100644
--- a/ambari-web/app/views/main/dashboard/widgets/hbase_average_load.js
+++ b/ambari-web/app/views/main/dashboard/widgets/hbase_average_load.js
@@ -20,11 +20,6 @@ var App = require('app');
 
 App.HBaseAverageLoadView = App.TextDashboardWidgetView.extend(App.EditableWidgetMixin, {
 
-  title: Em.I18n.t('dashboard.widgets.HBaseAverageLoad'),
-  id: '14',
-
-  model_type: 'hbase',
-
   hiddenInfo: function () {
     var avgLoad = this.get('model.averageLoad');
     if (isNaN(avgLoad)) {
@@ -33,15 +28,13 @@ App.HBaseAverageLoadView = App.TextDashboardWidgetView.extend(App.EditableWidget
     return [Em.I18n.t('dashboard.services.hbase.averageLoadPerServer').format(avgLoad)];
   }.property("model.averageLoad"),
 
-  isGreen: Em.computed.lteProperties('data', 'thresh1'),
-  isRed: Em.computed.gtProperties('data', 'thresh2'),
+  isGreen: Em.computed.lteProperties('data', 'thresholdMin'),
+  isRed: Em.computed.gtProperties('data', 'thresholdMax'),
 
   isNA: function (){
     return this.get('data') === null || isNaN(this.get('data'));
   }.property('data'),
 
-  thresh1: 0.5,
-  thresh2: 2,
   maxValue: 'infinity',
 
   data: Em.computed.alias('model.averageLoad'),

http://git-wip-us.apache.org/repos/asf/ambari/blob/9348725b/ambari-web/app/views/main/dashboard/widgets/hbase_links.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/dashboard/widgets/hbase_links.js b/ambari-web/app/views/main/dashboard/widgets/hbase_links.js
index 4f2053a..9600094 100644
--- a/ambari-web/app/views/main/dashboard/widgets/hbase_links.js
+++ b/ambari-web/app/views/main/dashboard/widgets/hbase_links.js
@@ -21,10 +21,6 @@ var App = require('app');
 App.HBaseLinksView = App.LinkDashboardWidgetView.extend({
 
   templateName: require('templates/main/dashboard/widgets/hbase_links'),
-  title: Em.I18n.t('dashboard.widgets.HBaseLinks'),
-  id: '12',
-
-  model_type: 'hbase',
 
   port: function() {
     return App.StackService.find('HBASE').compareCurrentVersion('1.1') > -1 ? '16010' : '60010';

http://git-wip-us.apache.org/repos/asf/ambari/blob/9348725b/ambari-web/app/views/main/dashboard/widgets/hbase_master_heap.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/dashboard/widgets/hbase_master_heap.js b/ambari-web/app/views/main/dashboard/widgets/hbase_master_heap.js
index 63b1cc2..4ddba36 100644
--- a/ambari-web/app/views/main/dashboard/widgets/hbase_master_heap.js
+++ b/ambari-web/app/views/main/dashboard/widgets/hbase_master_heap.js
@@ -21,10 +21,6 @@ var numberUtils = require('utils/number_utils');
 
 App.HBaseMasterHeapPieChartView = App.PieChartDashboardWidgetView.extend({
 
-  title: Em.I18n.t('dashboard.widgets.HBaseMasterHeap'),
-  id: '13',
-
-  model_type: 'hbase',
   modelFieldMax: 'heapMemoryMax',
   modelFieldUsed: 'heapMemoryUsed',
   widgetHtmlId: 'widget-hbase-heap',

http://git-wip-us.apache.org/repos/asf/ambari/blob/9348725b/ambari-web/app/views/main/dashboard/widgets/hbase_master_uptime.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/dashboard/widgets/hbase_master_uptime.js b/ambari-web/app/views/main/dashboard/widgets/hbase_master_uptime.js
index 0801ac2..ea338dd 100644
--- a/ambari-web/app/views/main/dashboard/widgets/hbase_master_uptime.js
+++ b/ambari-web/app/views/main/dashboard/widgets/hbase_master_uptime.js
@@ -20,11 +20,6 @@ var App = require('app');
 
 App.HBaseMasterUptimeView = App.UptimeTextDashboardWidgetView.extend({
 
-  title: Em.I18n.t('dashboard.widgets.HBaseMasterUptime'),
-  id: '16',
-
-  model_type: 'hbase',
-
   component: 'Hbase Master',
   modelField: 'masterStartTime',
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/9348725b/ambari-web/app/views/main/dashboard/widgets/hbase_regions_in_transition.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/dashboard/widgets/hbase_regions_in_transition.js b/ambari-web/app/views/main/dashboard/widgets/hbase_regions_in_transition.js
index 1f225c6..922a10e 100644
--- a/ambari-web/app/views/main/dashboard/widgets/hbase_regions_in_transition.js
+++ b/ambari-web/app/views/main/dashboard/widgets/hbase_regions_in_transition.js
@@ -20,10 +20,6 @@ var App = require('app');
 
 App.HBaseRegionsInTransitionView = App.TextDashboardWidgetView.extend(App.EditableWidgetMixin, {
 
-  title: Em.I18n.t('dashboard.widgets.HBaseRegionsInTransition'),
-  id: '15',
-
-  model_type: 'hbase',
   hiddenInfo: function () {
     return [
       this.get("model.regionsInTransition") + " regions",
@@ -32,15 +28,13 @@ App.HBaseRegionsInTransitionView = App.TextDashboardWidgetView.extend(App.Editab
   }.property("model.regionsInTransition"),
 
   classNameBindings: ['isRed', 'isOrange', 'isGreen', 'isNA'],
-  isGreen: Em.computed.lteProperties('data', 'thresh1'),
-  isRed: Em.computed.gtProperties('data', 'thresh2'),
+  isGreen: Em.computed.lteProperties('data', 'thresholdMin'),
+  isRed: Em.computed.gtProperties('data', 'thresholdMax'),
   isOrange: Em.computed.and('!isGreen', '!isRed'),
   isNA: function () {
     return this.get('data') === null;
   }.property('data'),
 
-  thresh1: 0.5,
-  thresh2: 2,
   maxValue: 'infinity',
 
   data: Em.computed.alias('model.regionsInTransition'),

http://git-wip-us.apache.org/repos/asf/ambari/blob/9348725b/ambari-web/app/views/main/dashboard/widgets/hdfs_capacity.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/dashboard/widgets/hdfs_capacity.js b/ambari-web/app/views/main/dashboard/widgets/hdfs_capacity.js
index e64534d..6bc19d9 100644
--- a/ambari-web/app/views/main/dashboard/widgets/hdfs_capacity.js
+++ b/ambari-web/app/views/main/dashboard/widgets/hdfs_capacity.js
@@ -21,10 +21,6 @@ var numberUtils = require('utils/number_utils');
 
 App.NameNodeCapacityPieChartView = App.PieChartDashboardWidgetView.extend({
 
-  title: Em.I18n.t('dashboard.widgets.HDFSDiskUsage'),
-  id: '2',
-
-  model_type: 'hdfs',
   modelFieldMax: 'capacityTotal',
   /**
    * HDFS model has 'remaining' value, but not 'used'

http://git-wip-us.apache.org/repos/asf/ambari/blob/9348725b/ambari-web/app/views/main/dashboard/widgets/hdfs_links.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/dashboard/widgets/hdfs_links.js b/ambari-web/app/views/main/dashboard/widgets/hdfs_links.js
index cfe5eb1..900a900 100644
--- a/ambari-web/app/views/main/dashboard/widgets/hdfs_links.js
+++ b/ambari-web/app/views/main/dashboard/widgets/hdfs_links.js
@@ -21,10 +21,6 @@ var App = require('app');
 App.HDFSLinksView = App.LinkDashboardWidgetView.extend({
 
   templateName: require('templates/main/dashboard/widgets/hdfs_links'),
-  title: Em.I18n.t('dashboard.widgets.HDFSLinks'),
-  id: '11',
-
-  model_type: 'hdfs',
 
   port: '50070',
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/9348725b/ambari-web/app/views/main/dashboard/widgets/metrics_cpu.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/dashboard/widgets/metrics_cpu.js b/ambari-web/app/views/main/dashboard/widgets/metrics_cpu.js
index 72ef1c2..b7efaab 100644
--- a/ambari-web/app/views/main/dashboard/widgets/metrics_cpu.js
+++ b/ambari-web/app/views/main/dashboard/widgets/metrics_cpu.js
@@ -20,9 +20,6 @@ var App = require('app');
 
 App.ChartClusterMetricsCPUWidgetView = App.ClusterMetricsDashboardWidgetView.extend({
 
-  title: Em.I18n.t('dashboard.clusterMetrics.cpu'),
-  id: '8',
-
   content: App.ChartClusterMetricsCPU.extend({
     noTitleUnderGraph: true,
     inWidget: true

http://git-wip-us.apache.org/repos/asf/ambari/blob/9348725b/ambari-web/app/views/main/dashboard/widgets/metrics_load.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/dashboard/widgets/metrics_load.js b/ambari-web/app/views/main/dashboard/widgets/metrics_load.js
index c357934..c13e047 100644
--- a/ambari-web/app/views/main/dashboard/widgets/metrics_load.js
+++ b/ambari-web/app/views/main/dashboard/widgets/metrics_load.js
@@ -20,9 +20,6 @@ var App = require('app');
 
 App.ChartClusterMetricsLoadWidgetView = App.ClusterMetricsDashboardWidgetView.extend({
 
-  title: Em.I18n.t('dashboard.clusterMetrics.load'),
-  id: '9',
-
   content: App.ChartClusterMetricsLoad.extend({
     noTitleUnderGraph: true,
     inWidget: true

http://git-wip-us.apache.org/repos/asf/ambari/blob/9348725b/ambari-web/app/views/main/dashboard/widgets/metrics_memory.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/dashboard/widgets/metrics_memory.js b/ambari-web/app/views/main/dashboard/widgets/metrics_memory.js
index 659d647..824c9dd 100644
--- a/ambari-web/app/views/main/dashboard/widgets/metrics_memory.js
+++ b/ambari-web/app/views/main/dashboard/widgets/metrics_memory.js
@@ -20,9 +20,6 @@ var App = require('app');
 
 App.ChartClusterMetricsMemoryWidgetView = App.ClusterMetricsDashboardWidgetView.extend({
 
-  title: Em.I18n.t('dashboard.clusterMetrics.memory'),
-  id: '6',
-
   content: App.ChartClusterMetricsMemory.extend({
     noTitleUnderGraph: true,
     inWidget: true

http://git-wip-us.apache.org/repos/asf/ambari/blob/9348725b/ambari-web/app/views/main/dashboard/widgets/metrics_network.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/dashboard/widgets/metrics_network.js b/ambari-web/app/views/main/dashboard/widgets/metrics_network.js
index 40fdb0b..8f9e6cd 100644
--- a/ambari-web/app/views/main/dashboard/widgets/metrics_network.js
+++ b/ambari-web/app/views/main/dashboard/widgets/metrics_network.js
@@ -20,9 +20,6 @@ var App = require('app');
 
 App.ChartClusterMetricsNetworkWidgetView = App.ClusterMetricsDashboardWidgetView.extend({
 
-  title: Em.I18n.t('dashboard.clusterMetrics.network'),
-  id: '7',
-
   content: App.ChartClusterMetricsNetwork.extend({
     noTitleUnderGraph: true,
     inWidget: true

http://git-wip-us.apache.org/repos/asf/ambari/blob/9348725b/ambari-web/app/views/main/dashboard/widgets/namenode_cpu.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/dashboard/widgets/namenode_cpu.js b/ambari-web/app/views/main/dashboard/widgets/namenode_cpu.js
index 161b5c0..d6a3ebd 100644
--- a/ambari-web/app/views/main/dashboard/widgets/namenode_cpu.js
+++ b/ambari-web/app/views/main/dashboard/widgets/namenode_cpu.js
@@ -20,10 +20,6 @@ var App = require('app');
 
 App.NameNodeCpuPieChartView = App.PieChartDashboardWidgetView.extend({
 
-  title: Em.I18n.t('dashboard.widgets.NameNodeCpu'),
-  id: '3',
-
-  model_type: 'hdfs',
   widgetHtmlId: 'widget-nn-cpu',
   cpuWio: null,
   nnHostName: "",

http://git-wip-us.apache.org/repos/asf/ambari/blob/9348725b/ambari-web/app/views/main/dashboard/widgets/namenode_heap.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/dashboard/widgets/namenode_heap.js b/ambari-web/app/views/main/dashboard/widgets/namenode_heap.js
index 731143c..2ef6470 100644
--- a/ambari-web/app/views/main/dashboard/widgets/namenode_heap.js
+++ b/ambari-web/app/views/main/dashboard/widgets/namenode_heap.js
@@ -20,10 +20,6 @@ var App = require('app');
 
 App.NameNodeHeapPieChartView = App.PieChartDashboardWidgetView.extend({
 
-  title: Em.I18n.t('dashboard.widgets.NameNodeHeap'),
-  id: '1',
-
-  model_type: 'hdfs',
   modelFieldMax: 'jvmMemoryHeapMax',
   modelFieldUsed: 'jvmMemoryHeapUsed',
   widgetHtmlId: 'widget-nn-heap',

http://git-wip-us.apache.org/repos/asf/ambari/blob/9348725b/ambari-web/app/views/main/dashboard/widgets/namenode_rpc.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/dashboard/widgets/namenode_rpc.js b/ambari-web/app/views/main/dashboard/widgets/namenode_rpc.js
index 58b86d9..769fd22 100644
--- a/ambari-web/app/views/main/dashboard/widgets/namenode_rpc.js
+++ b/ambari-web/app/views/main/dashboard/widgets/namenode_rpc.js
@@ -20,10 +20,6 @@ var App = require('app');
 
 App.NameNodeRpcView = App.TextDashboardWidgetView.extend(App.EditableWidgetMixin, {
 
-  title: Em.I18n.t('dashboard.widgets.NameNodeRpc'),
-  id: '5',
-
-  model_type: 'hdfs',
   hiddenInfo: function () {
     return [
       this.get('content') + ' average RPC',
@@ -31,13 +27,11 @@ App.NameNodeRpcView = App.TextDashboardWidgetView.extend(App.EditableWidgetMixin
     ];
   }.property('content'),
 
-  thresh1: 0.5,
-  thresh2: 2,
   maxValue: 'infinity',
 
-  isGreen: Em.computed.lteProperties('data', 'thresh1'),
+  isGreen: Em.computed.lteProperties('data', 'thresholdMin'),
 
-  isRed: Em.computed.gtProperties('data', 'thresh2'),
+  isRed: Em.computed.gtProperties('data', 'thresholdMax'),
 
   data: function () {
     if (this.get('model.nameNodeRpc')) {

http://git-wip-us.apache.org/repos/asf/ambari/blob/9348725b/ambari-web/app/views/main/dashboard/widgets/namenode_uptime.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/dashboard/widgets/namenode_uptime.js b/ambari-web/app/views/main/dashboard/widgets/namenode_uptime.js
index e55f871..30ae592 100644
--- a/ambari-web/app/views/main/dashboard/widgets/namenode_uptime.js
+++ b/ambari-web/app/views/main/dashboard/widgets/namenode_uptime.js
@@ -20,11 +20,6 @@ var App = require('app');
 
 App.NameNodeUptimeView = App.UptimeTextDashboardWidgetView.extend({
 
-  title: Em.I18n.t('dashboard.widgets.NameNodeUptime'),
-  id: '10',
-
-  model_type: 'hdfs',
-
   component: 'NameNode',
   modelField: 'nameNodeStartTime',
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/9348725b/ambari-web/app/views/main/dashboard/widgets/node_managers_live.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/dashboard/widgets/node_managers_live.js b/ambari-web/app/views/main/dashboard/widgets/node_managers_live.js
index d5bf50b..5dc5430 100644
--- a/ambari-web/app/views/main/dashboard/widgets/node_managers_live.js
+++ b/ambari-web/app/views/main/dashboard/widgets/node_managers_live.js
@@ -20,11 +20,6 @@ var App = require('app');
 
 App.NodeManagersLiveView = App.TextDashboardWidgetView.extend(App.EditableWithLimitWidgetMixin, {
 
-  title: Em.I18n.t('dashboard.widgets.NodeManagersLive'),
-  id: '19',
-
-  model_type: 'yarn',
-
   hiddenInfo: function () {
     var nmActive = this.get('model.nodeManagersCountActive') == null ? Em.I18n.t('services.service.summary.notAvailable') : this.get('model.nodeManagersCountActive');
     var nmLost = this.get('model.nodeManagersCountLost') == null ? Em.I18n.t('services.service.summary.notAvailable') : this.get('model.nodeManagersCountLost');
@@ -43,8 +38,6 @@ App.NodeManagersLiveView = App.TextDashboardWidgetView.extend(App.EditableWithLi
 
   hiddenInfoClass: "hidden-info-five-line",
 
-  thresh1: 40,
-  thresh2: 70,
   maxValue: 100,
 
   isDataAvailable: Em.computed.and('!model.metricsNotAvailable', 'App.router.clusterController.isComponentsStateLoaded'),

http://git-wip-us.apache.org/repos/asf/ambari/blob/9348725b/ambari-web/app/views/main/dashboard/widgets/pie_chart_widget.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/dashboard/widgets/pie_chart_widget.js b/ambari-web/app/views/main/dashboard/widgets/pie_chart_widget.js
index 8f2dc90..5dd85d1 100644
--- a/ambari-web/app/views/main/dashboard/widgets/pie_chart_widget.js
+++ b/ambari-web/app/views/main/dashboard/widgets/pie_chart_widget.js
@@ -85,8 +85,8 @@ App.PieChartDashboardWidgetView = App.DashboardWidgetView.extend({
     model: null,  //data bind here
     id: Em.computed.alias('parentView.widgetHtmlId'), // html id
     stroke: '#D6DDDF', //light grey
-    thresh1: null, //bind from parent
-    thresh2: null,
+    thresholdMin: null, //bind from parent
+    thresholdMax: null,
     innerR: 25,
 
     existCenterText: true,
@@ -107,15 +107,15 @@ App.PieChartDashboardWidgetView = App.DashboardWidgetView.extend({
 
     contentColor: function () {
       var used = parseFloat(this.get('parentView.dataForPieChart')[1]);
-      var thresh1 = parseFloat(this.get('thresh1'));
-      var thresh2 = parseFloat(this.get('thresh2'));
-      if (used <= thresh1) {
+      var thresholdMin = parseFloat(this.get('thresholdMin'));
+      var thresholdMax = parseFloat(this.get('thresholdMax'));
+      if (used <= thresholdMin) {
         this.set('palette', new Rickshaw.Color.Palette({
           scheme: ['#FFFFFF', App.healthStatusGreen].reverse()
         }));
         return App.healthStatusGreen;
       }
-      if (used <= thresh2) {
+      if (used <= thresholdMax) {
         this.set('palette', new Rickshaw.Color.Palette({
           scheme: ['#FFFFFF', App.healthStatusOrange].reverse()
         }));
@@ -125,7 +125,7 @@ App.PieChartDashboardWidgetView = App.DashboardWidgetView.extend({
         scheme: ['#FFFFFF', App.healthStatusRed].reverse()
       }));
       return App.healthStatusRed;
-    }.property('data', 'thresh1', 'thresh2'),
+    }.property('data', 'thresholdMin', 'thresholdMax'),
 
     // refresh text and color when data in model changed
     refreshSvg: function () {
@@ -137,6 +137,6 @@ App.PieChartDashboardWidgetView = App.DashboardWidgetView.extend({
 
       // draw new svg
       this.appendSvg();
-    }.observes('data', 'thresh1', 'thresh2')
+    }.observes('data', 'thresholdMin', 'thresholdMax')
   })
 });

http://git-wip-us.apache.org/repos/asf/ambari/blob/9348725b/ambari-web/app/views/main/dashboard/widgets/pxf_live.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/dashboard/widgets/pxf_live.js b/ambari-web/app/views/main/dashboard/widgets/pxf_live.js
index 74b2096..a002fe3 100644
--- a/ambari-web/app/views/main/dashboard/widgets/pxf_live.js
+++ b/ambari-web/app/views/main/dashboard/widgets/pxf_live.js
@@ -31,11 +31,6 @@ function counterOrNA(key) {
 
 App.PxfUpView = App.TextDashboardSingleThresholdWidgetView.extend(App.SingleNumericThresholdMixin,{
 
-  title: Em.I18n.t('dashboard.widgets.PxfUp'),
-  id: '25',
-
-  model_type: 'pxf',
-
   hiddenInfo: function () {
     return [
       this.get('pxfsStarted') + ' ' + Em.I18n.t('dashboard.services.components.started'),
@@ -46,7 +41,6 @@ App.PxfUpView = App.TextDashboardSingleThresholdWidgetView.extend(App.SingleNume
 
   hiddenInfoClass: "hidden-info-three-line",
 
-  thresh1: 0,
   maxValue: counterOrNA('pxfsTotal'),
 
   pxfsStarted: counterOrNA('pxfsStarted'),

http://git-wip-us.apache.org/repos/asf/ambari/blob/9348725b/ambari-web/app/views/main/dashboard/widgets/resource_manager_heap.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/dashboard/widgets/resource_manager_heap.js b/ambari-web/app/views/main/dashboard/widgets/resource_manager_heap.js
index 9509053..e0e6514 100644
--- a/ambari-web/app/views/main/dashboard/widgets/resource_manager_heap.js
+++ b/ambari-web/app/views/main/dashboard/widgets/resource_manager_heap.js
@@ -20,10 +20,6 @@ var App = require('app');
 
 App.ResourceManagerHeapPieChartView = App.PieChartDashboardWidgetView.extend({
 
-  title: Em.I18n.t('dashboard.widgets.ResourceManagerHeap'),
-  id: '17',
-
-  model_type: 'yarn',
   modelFieldMax: 'jvmMemoryHeapMax',
   modelFieldUsed: 'jvmMemoryHeapUsed',
   widgetHtmlId: 'widget-rm-heap',

http://git-wip-us.apache.org/repos/asf/ambari/blob/9348725b/ambari-web/app/views/main/dashboard/widgets/resource_manager_uptime.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/dashboard/widgets/resource_manager_uptime.js b/ambari-web/app/views/main/dashboard/widgets/resource_manager_uptime.js
index 6d87741..72f2ca3 100644
--- a/ambari-web/app/views/main/dashboard/widgets/resource_manager_uptime.js
+++ b/ambari-web/app/views/main/dashboard/widgets/resource_manager_uptime.js
@@ -20,11 +20,6 @@ var App = require('app');
 
 App.ResourceManagerUptimeView = App.UptimeTextDashboardWidgetView.extend({
 
-  title: Em.I18n.t('dashboard.widgets.ResourceManagerUptime'),
-  id: '18',
-
-  model_type: 'yarn',
-
   component: 'ResourceManager',
   modelField: 'resourceManagerStartTime',
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/9348725b/ambari-web/app/views/main/dashboard/widgets/supervisor_live.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/dashboard/widgets/supervisor_live.js b/ambari-web/app/views/main/dashboard/widgets/supervisor_live.js
index b8e36ca..9158e59 100644
--- a/ambari-web/app/views/main/dashboard/widgets/supervisor_live.js
+++ b/ambari-web/app/views/main/dashboard/widgets/supervisor_live.js
@@ -20,11 +20,6 @@ var App = require('app');
 
 App.SuperVisorUpView = App.TextDashboardWidgetView.extend(App.EditableWithLimitWidgetMixin, {
 
-  title: Em.I18n.t('dashboard.widgets.SuperVisorUp'),
-  id: '21',
-
-  model_type: 'storm',
-
   hiddenInfo: function () {
     return [
       this.get('superVisorsLive') + ' ' + Em.I18n.t('dashboard.services.hdfs.nodes.live'),
@@ -34,8 +29,6 @@ App.SuperVisorUpView = App.TextDashboardWidgetView.extend(App.EditableWithLimitW
 
   hiddenInfoClass: "hidden-info-two-line",
 
-  thresh1: 40,
-  thresh2: 70,
   maxValue: 100,
 
   superVisorsLive: Em.computed.alias('model.superVisorsStarted'),

http://git-wip-us.apache.org/repos/asf/ambari/blob/9348725b/ambari-web/app/views/main/dashboard/widgets/text_widget.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/dashboard/widgets/text_widget.js b/ambari-web/app/views/main/dashboard/widgets/text_widget.js
index 388ea52..daa354c 100644
--- a/ambari-web/app/views/main/dashboard/widgets/text_widget.js
+++ b/ambari-web/app/views/main/dashboard/widgets/text_widget.js
@@ -24,9 +24,9 @@ App.TextDashboardWidgetView = App.DashboardWidgetView.extend({
 
   classNameBindings: ['isRed', 'isOrange', 'isGreen', 'isNA'],
 
-  isRed: Em.computed.lteProperties('data', 'thresh1'),
+  isRed: Em.computed.lteProperties('data', 'thresholdMin'),
   isOrange: Em.computed.and('!isGreen', '!isRed'),
-  isGreen: Em.computed.gtProperties('data', 'thresh2'),
+  isGreen: Em.computed.gtProperties('data', 'thresholdMax'),
 
   isNA: function () {
     return this.get('data') === null;

http://git-wip-us.apache.org/repos/asf/ambari/blob/9348725b/ambari-web/app/views/main/dashboard/widgets/text_widget_single_threshold.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/dashboard/widgets/text_widget_single_threshold.js b/ambari-web/app/views/main/dashboard/widgets/text_widget_single_threshold.js
index 69c5821..e079446 100644
--- a/ambari-web/app/views/main/dashboard/widgets/text_widget_single_threshold.js
+++ b/ambari-web/app/views/main/dashboard/widgets/text_widget_single_threshold.js
@@ -23,8 +23,8 @@ App.TextDashboardSingleThresholdWidgetView = App.DashboardWidgetView.extend({
   templateName: require('templates/main/dashboard/widgets/simple_text'),
 
   classNameBindings: ['isRed', 'isGreen', 'isNA'],
-  isGreen: Em.computed.lteProperties('data', 'thresh1'),
-  isRed: Em.computed.gtProperties('data', 'thresh1'),
+  isGreen: Em.computed.lteProperties('data', 'thresholdMin'),
+  isRed: Em.computed.gtProperties('data', 'thresholdMin'),
 
   isNA: function () {
     return this.get('data') === null;
@@ -32,6 +32,6 @@ App.TextDashboardSingleThresholdWidgetView = App.DashboardWidgetView.extend({
 
   hiddenInfo: [],
 
-  maxValue: null,
+  maxValue: null
 
 });

http://git-wip-us.apache.org/repos/asf/ambari/blob/9348725b/ambari-web/app/views/main/dashboard/widgets/uptime_text_widget.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/dashboard/widgets/uptime_text_widget.js b/ambari-web/app/views/main/dashboard/widgets/uptime_text_widget.js
index 792aa70..74d59f1 100644
--- a/ambari-web/app/views/main/dashboard/widgets/uptime_text_widget.js
+++ b/ambari-web/app/views/main/dashboard/widgets/uptime_text_widget.js
@@ -27,8 +27,6 @@ App.UptimeTextDashboardWidgetView = App.TextDashboardWidgetView.extend({
 
   hiddenInfoClass: "hidden-info-three-line",
 
-  thresh1: 5,
-  thresh2: 10,
   maxValue: 'infinity',
 
   component: null,

http://git-wip-us.apache.org/repos/asf/ambari/blob/9348725b/ambari-web/app/views/main/dashboard/widgets/yarn_links.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/dashboard/widgets/yarn_links.js b/ambari-web/app/views/main/dashboard/widgets/yarn_links.js
index d7b6488..e7be6d2 100644
--- a/ambari-web/app/views/main/dashboard/widgets/yarn_links.js
+++ b/ambari-web/app/views/main/dashboard/widgets/yarn_links.js
@@ -20,10 +20,6 @@ var App = require('app');
 
 App.YARNLinksView = App.LinkDashboardWidgetView.extend({
   templateName: require('templates/main/dashboard/widgets/yarn_links'),
-  title: Em.I18n.t('dashboard.widgets.YARNLinks'),
-  id: '23',
-
-  model_type: 'yarn',
 
   componentName : 'NODEMANAGER'
 });

http://git-wip-us.apache.org/repos/asf/ambari/blob/9348725b/ambari-web/app/views/main/dashboard/widgets/yarn_memory.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/dashboard/widgets/yarn_memory.js b/ambari-web/app/views/main/dashboard/widgets/yarn_memory.js
index b4dc9b7..be3beb2 100644
--- a/ambari-web/app/views/main/dashboard/widgets/yarn_memory.js
+++ b/ambari-web/app/views/main/dashboard/widgets/yarn_memory.js
@@ -20,11 +20,7 @@ var App = require('app');
 
 App.YARNMemoryPieChartView = App.PieChartDashboardWidgetView.extend({
 
-  title: Em.I18n.t('dashboard.widgets.YARNMemory'),
-  id: '20',
-
   widgetHtmlId: 'widget-yarn-memory',
-  model_type: 'yarn',
   modelFieldUsed: 'allocatedMemory',
   modelFieldMax: 'maxMemory',
 


[25/50] [abbrv] ambari git commit: AMBARI-19048 Delete service action should show the config recommendation popup. (ababiichuk)

Posted by nc...@apache.org.
AMBARI-19048 Delete service action should show the config recommendation popup. (ababiichuk)


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

Branch: refs/heads/branch-dev-patch-upgrade
Commit: 9b21f30b5f081d7b313f9070ae125afc84db7647
Parents: ef63373
Author: ababiichuk <ab...@hortonworks.com>
Authored: Thu Dec 1 16:00:31 2016 +0200
Committer: ababiichuk <ab...@hortonworks.com>
Committed: Thu Dec 1 17:07:49 2016 +0200

----------------------------------------------------------------------
 .../controllers/main/service/info/configs.js    |  2 +-
 ambari-web/app/controllers/main/service/item.js | 49 ++++++++++++++------
 .../app/controllers/wizard/step7_controller.js  |  2 +-
 .../app/mixins/main/service/groups_mapping.js   |  2 +-
 .../info/delete_service_warning_popup.hbs       | 28 +++++++++++
 .../test/controllers/main/service/item_test.js  | 13 +++---
 6 files changed, 74 insertions(+), 22 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/9b21f30b/ambari-web/app/controllers/main/service/info/configs.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/service/info/configs.js b/ambari-web/app/controllers/main/service/info/configs.js
index 130b1b5..94caf4a 100644
--- a/ambari-web/app/controllers/main/service/info/configs.js
+++ b/ambari-web/app/controllers/main/service/info/configs.js
@@ -21,7 +21,7 @@ var batchUtils = require('utils/batch_scheduled_requests');
 
 App.MainServiceInfoConfigsController = Em.Controller.extend(App.AddSecurityConfigs, App.ConfigsLoader,
   App.ServerValidatorMixin, App.EnhancedConfigsMixin, App.ThemesMappingMixin, App.ConfigsSaverMixin,
-  App.ConfigsComparator, App.ComponentActionsByConfigs, App.TrackRequestMixin, {
+  App.ConfigsComparator, App.ComponentActionsByConfigs, {
 
   name: 'mainServiceInfoConfigsController',
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/9b21f30b/ambari-web/app/controllers/main/service/item.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/service/item.js b/ambari-web/app/controllers/main/service/item.js
index 18a121f..19b021b 100644
--- a/ambari-web/app/controllers/main/service/item.js
+++ b/ambari-web/app/controllers/main/service/item.js
@@ -21,7 +21,7 @@ var batchUtils = require('utils/batch_scheduled_requests');
 var blueprintUtils = require('utils/blueprint');
 var stringUtils = require('utils/string_utils');
 
-App.MainServiceItemController = Em.Controller.extend(App.SupportClientConfigsDownload, App.InstallComponent, App.ConfigsSaverMixin, App.EnhancedConfigsMixin, {
+App.MainServiceItemController = Em.Controller.extend(App.SupportClientConfigsDownload, App.InstallComponent, App.ConfigsSaverMixin, App.EnhancedConfigsMixin, App.GroupsMappingMixin, {
   name: 'mainServiceItemController',
 
   /**
@@ -86,6 +86,8 @@ App.MainServiceItemController = Em.Controller.extend(App.SupportClientConfigsDow
 
   deleteServiceProgressPopup: null,
 
+  isRecommendationInProgress: false,
+
   isClientsOnlyService: function() {
     return App.get('services.clientOnly').contains(this.get('content.serviceName'));
   }.property('content.serviceName'),
@@ -1317,17 +1319,38 @@ App.MainServiceItemController = Em.Controller.extend(App.SupportClientConfigsDow
   showLastWarning: function (serviceName, interDependentServices, dependentServicesToDeleteFmt) {
     var self = this,
       displayName = App.format.role(serviceName, true),
-      popupHeader = Em.I18n.t('services.service.delete.popup.header');
-
-    return App.showConfirmationPopup(
-      function() {self.confirmDeleteService(serviceName, interDependentServices, dependentServicesToDeleteFmt)},
-      Em.I18n.t('services.service.delete.popup.warning').format(displayName) +
-      (interDependentServices.length ? Em.I18n.t('services.service.delete.popup.warning.dependent').format(dependentServicesToDeleteFmt) : ''),
-      null,
-      popupHeader,
-      Em.I18n.t('common.delete'),
-      true
-    );
+      popupHeader = Em.I18n.t('services.service.delete.popup.header'),
+      popupPrimary = Em.I18n.t('common.delete'),
+      warningMessage = Em.I18n.t('services.service.delete.popup.warning').format(displayName) +
+        (interDependentServices.length ? Em.I18n.t('services.service.delete.popup.warning.dependent').format(dependentServicesToDeleteFmt) : '');
+    this.clearRecommendationsInfo();
+    this.setProperties({
+      isRecommendationInProgress: true,
+      selectedConfigGroup: Em.Object.create({
+        isDefault: true
+      })
+    });
+    this.loadConfigRecommendations(null, function () {
+      var serviceNames = self.get('changedProperties').mapProperty('serviceName').uniq();
+      self.loadConfigGroups(serviceNames).done(function () {
+        self.set('isRecommendationInProgress', false);
+      })
+    });
+    return App.ModalPopup.show({
+      controller: self,
+      header: popupHeader,
+      primary: popupPrimary,
+      primaryClass: 'btn-danger',
+      disablePrimary: Em.computed.alias('controller.isRecommendationInProgress'),
+      bodyClass: Em.View.extend({
+        templateName: require('templates/main/service/info/delete_service_warning_popup'),
+        warningMessage: new Em.Handlebars.SafeString(warningMessage)
+      }),
+      onPrimary: function () {
+        self.confirmDeleteService(serviceName, interDependentServices, dependentServicesToDeleteFmt);
+        this._super();
+      }
+    });
   },
 
   /**
@@ -1569,7 +1592,7 @@ App.MainServiceItemController = Em.Controller.extend(App.SupportClientConfigsDow
     if (params.servicesToDeleteNext) {
       this.deleteServiceCall(params.servicesToDeleteNext);
     } else {
-      this.loadConfigRecommendations(null, this.saveConfigs.bind(this));
+      this.saveConfigs();
     }
   },
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/9b21f30b/ambari-web/app/controllers/wizard/step7_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/wizard/step7_controller.js b/ambari-web/app/controllers/wizard/step7_controller.js
index d43b69b..0d30d12 100644
--- a/ambari-web/app/controllers/wizard/step7_controller.js
+++ b/ambari-web/app/controllers/wizard/step7_controller.js
@@ -42,7 +42,7 @@ var App = require('app');
  * @property {?object[]} slaveComponentHosts
  */
 
-App.WizardStep7Controller = Em.Controller.extend(App.ServerValidatorMixin, App.EnhancedConfigsMixin, App.ToggleIsRequiredMixin, App.GroupsMappingMixin, App.TrackRequestMixin, {
+App.WizardStep7Controller = Em.Controller.extend(App.ServerValidatorMixin, App.EnhancedConfigsMixin, App.ToggleIsRequiredMixin, App.GroupsMappingMixin, {
 
   name: 'wizardStep7Controller',
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/9b21f30b/ambari-web/app/mixins/main/service/groups_mapping.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/mixins/main/service/groups_mapping.js b/ambari-web/app/mixins/main/service/groups_mapping.js
index df2fabf..0781aa3 100644
--- a/ambari-web/app/mixins/main/service/groups_mapping.js
+++ b/ambari-web/app/mixins/main/service/groups_mapping.js
@@ -23,7 +23,7 @@ var App = require('app');
  *
  * @type {Em.Mixin}
  */
-App.GroupsMappingMixin = Em.Mixin.create({
+App.GroupsMappingMixin = Em.Mixin.create(App.TrackRequestMixin, {
 
   /**
    * Load config groups

http://git-wip-us.apache.org/repos/asf/ambari/blob/9b21f30b/ambari-web/app/templates/main/service/info/delete_service_warning_popup.hbs
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates/main/service/info/delete_service_warning_popup.hbs b/ambari-web/app/templates/main/service/info/delete_service_warning_popup.hbs
new file mode 100644
index 0000000..4155947
--- /dev/null
+++ b/ambari-web/app/templates/main/service/info/delete_service_warning_popup.hbs
@@ -0,0 +1,28 @@
+{{!
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements.  See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership.  The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License.  You may obtain a copy of the License at
+*
+*     http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+}}
+
+{{view.warningMessage}}
+{{#if controller.isRecommendationInProgress}}
+  {{view App.SpinnerView}}
+{{else}}
+  {{#if controller.changedProperties.length}}
+    <div class="alert alert-warning">
+      <span>{{dependenciesMessage}}</span> <a href="#" {{action "showChangedDependentConfigs" target="controller"}}>{{t common.showDetails}}</a>
+    </div>
+  {{/if}}
+{{/if}}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/9b21f30b/ambari-web/test/controllers/main/service/item_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/main/service/item_test.js b/ambari-web/test/controllers/main/service/item_test.js
index 082fbd9..a22733f 100644
--- a/ambari-web/test/controllers/main/service/item_test.js
+++ b/ambari-web/test/controllers/main/service/item_test.js
@@ -1380,6 +1380,7 @@ describe('App.MainServiceItemController', function () {
       sinon.stub(App.ModalPopup, 'show');
       sinon.stub(App.format, 'role', function(name) {return name});
       sinon.stub(mainServiceItemController, 'kerberosDeleteWarning');
+      sinon.stub(mainServiceItemController, 'showLastWarning');
 
       mainServiceItemController.reopen({
         interDependentServices: []
@@ -1439,7 +1440,7 @@ describe('App.MainServiceItemController', function () {
       this.allowUninstallServices.returns(true);
       this.mockService.returns([Em.Object.create({workStatus: App.Service.statesMap.stopped}), Em.Object.create({workStatus: App.Service.statesMap.stopped})]);
       mainServiceItemController.deleteService('S1');
-      expect(App.showConfirmationPopup.calledOnce).to.be.true;
+      expect(mainServiceItemController.showLastWarning.calledOnce).to.be.true;
     });
 
     it("service has not dependent services, and install failed", function() {
@@ -1447,7 +1448,7 @@ describe('App.MainServiceItemController', function () {
       this.allowUninstallServices.returns(true);
       this.mockService.returns([Em.Object.create({workStatus: App.Service.statesMap.install_failed}), Em.Object.create({workStatus: App.Service.statesMap.install_failed})]);
       mainServiceItemController.deleteService('S1');
-      expect(App.showConfirmationPopup.calledOnce).to.be.true;
+      expect(mainServiceItemController.showLastWarning.calledOnce).to.be.true;
     });
 
     it("service has not dependent services, and not stopped", function() {
@@ -1671,27 +1672,27 @@ describe('App.MainServiceItemController', function () {
 
     beforeEach(function() {
       mainServiceItemController = App.MainServiceItemController.create({});
-      sinon.stub(mainServiceItemController, 'loadConfigRecommendations', Em.K);
+      sinon.stub(mainServiceItemController, 'saveConfigs', Em.K);
       sinon.stub(mainServiceItemController, 'deleteServiceCall', Em.K);
       mainServiceItemController.reopen({
         interDependentServices: []
       })
     });
     afterEach(function() {
-      mainServiceItemController.loadConfigRecommendations.restore();
+      mainServiceItemController.saveConfigs.restore();
       mainServiceItemController.deleteServiceCall.restore();
     });
 
     it("window.location.reload should be called", function() {
       mainServiceItemController.deleteServiceCallSuccessCallback([], null, {});
       expect(mainServiceItemController.deleteServiceCall.called).to.be.false;
-      expect(mainServiceItemController.loadConfigRecommendations.calledOnce).to.be.true;
+      expect(mainServiceItemController.saveConfigs.calledOnce).to.be.true;
     });
 
     it("deleteServiceCall should be called", function() {
       mainServiceItemController.deleteServiceCallSuccessCallback([], null, {servicesToDeleteNext: true});
       expect(mainServiceItemController.deleteServiceCall.calledOnce).to.be.true;
-      expect(mainServiceItemController.loadConfigRecommendations.called).to.be.false;
+      expect(mainServiceItemController.saveConfigs.called).to.be.false;
     });
   });
 


[37/50] [abbrv] ambari git commit: AMBARI-19061. Ambari-server restart command not working. if any parameters are changed and reset to default. (aonishuk)

Posted by nc...@apache.org.
AMBARI-19061. Ambari-server restart command not working. if any parameters are changed and reset to default.  (aonishuk)


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

Branch: refs/heads/branch-dev-patch-upgrade
Commit: 2de7ee8d01ce850bbbf9844ad8789615b6570168
Parents: c2dc753
Author: Andrew Onishuk <ao...@hortonworks.com>
Authored: Fri Dec 2 11:45:57 2016 +0200
Committer: Andrew Onishuk <ao...@hortonworks.com>
Committed: Fri Dec 2 11:45:57 2016 +0200

----------------------------------------------------------------------
 .../src/main/python/ambari_server/utils.py      | 23 ++++++++++----------
 1 file changed, 12 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/2de7ee8d/ambari-server/src/main/python/ambari_server/utils.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/python/ambari_server/utils.py b/ambari-server/src/main/python/ambari_server/utils.py
index 26e59ae..fc631f5 100644
--- a/ambari-server/src/main/python/ambari_server/utils.py
+++ b/ambari-server/src/main/python/ambari_server/utils.py
@@ -127,17 +127,18 @@ def save_main_pid_ex(pids, pidfile, exclude_list=[], skip_daemonize=False):
   """
   pid_saved = False
   try:
-    pfile = open(pidfile, "w")
-    for item in pids:
-      if pid_exists(item["pid"]) and (item["exe"] not in exclude_list):
-        pfile.write("%s\n" % item["pid"])
-        pid_saved = True
-        logger.info("Ambari server started with PID " + str(item["pid"]))
-      if pid_exists(item["pid"]) and (item["exe"] in exclude_list) and not skip_daemonize:
-        try:
-          os.kill(int(item["pid"]), signal.SIGKILL)
-        except:
-          pass
+    if pids:
+      pfile = open(pidfile, "w")
+      for item in pids:
+        if pid_exists(item["pid"]) and (item["exe"] not in exclude_list):
+          pfile.write("%s\n" % item["pid"])
+          pid_saved = True
+          logger.info("Ambari server started with PID " + str(item["pid"]))
+        if pid_exists(item["pid"]) and (item["exe"] in exclude_list) and not skip_daemonize:
+          try:
+            os.kill(int(item["pid"]), signal.SIGKILL)
+          except:
+            pass
   except IOError as e:
     logger.error("Failed to write PID to " + pidfile + " due to " + str(e))
     pass


[40/50] [abbrv] ambari git commit: AMBARI-18441 - upgrade ambari to 2.1.1 error (Wang Yaoxin via jonathanhurley)

Posted by nc...@apache.org.
AMBARI-18441 - upgrade ambari to 2.1.1 error (Wang Yaoxin via jonathanhurley)


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

Branch: refs/heads/branch-dev-patch-upgrade
Commit: ae3ff2a09b6b36f8a456987c60fc695dd262b6bb
Parents: 80084a9
Author: Jonathan Hurley <jh...@hortonworks.com>
Authored: Fri Dec 2 10:13:22 2016 -0500
Committer: Jonathan Hurley <jh...@hortonworks.com>
Committed: Fri Dec 2 10:13:45 2016 -0500

----------------------------------------------------------------------
 .../server/upgrade/UpgradeCatalog211.java       | 24 ++++++++++++--------
 1 file changed, 15 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/ae3ff2a0/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog211.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog211.java b/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog211.java
index db13612..eb835ef 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog211.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog211.java
@@ -212,8 +212,8 @@ public class UpgradeCatalog211 extends AbstractUpgradeCatalog {
         statement = dbAccessor.getConnection().createStatement();
         if (statement != null) {
           String selectSQL = MessageFormat.format(
-              "SELECT cluster_id, service_name, component_name, host_id FROM {0}",
-              HOST_COMPONENT_STATE_TABLE);
+              "SELECT id, cluster_id, service_name, component_name, host_id FROM {0} ORDER BY {1} {2}",
+              HOST_COMPONENT_STATE_TABLE, "id", "DESC");
 
           resultSet = statement.executeQuery(selectSQL);
           while (resultSet.next()) {
@@ -221,13 +221,19 @@ public class UpgradeCatalog211 extends AbstractUpgradeCatalog {
             final String serviceName = resultSet.getString("service_name");
             final String componentName = resultSet.getString("component_name");
             final Long hostId = resultSet.getLong("host_id");
-
-            String updateSQL = MessageFormat.format(
-                "UPDATE {0} SET {1} = {2,number,#} WHERE cluster_id = {3} AND service_name = ''{4}'' AND component_name = ''{5}'' and host_id = {6,number,#}",
-                HOST_COMPONENT_STATE_TABLE, HOST_COMPONENT_STATE_ID_COLUMN, m_hcsId.getAndIncrement(),
-                clusterId, serviceName, componentName, hostId);
-
-            dbAccessor.executeQuery(updateSQL);
+            final Long idKey = resultSet.getLong("id");
+
+            if (idKey != 0 && m_hcsId.get() == 1) {
+              m_hcsId.set(idKey);
+              m_hcsId.getAndIncrement();
+            } else if(idKey == 0) {
+              String updateSQL = MessageFormat.format(
+                  "UPDATE {0} SET {1} = {2,number,#} WHERE cluster_id = {3} AND service_name = ''{4}'' AND component_name = ''{5}'' and host_id = {6,number,#}",
+                  HOST_COMPONENT_STATE_TABLE, HOST_COMPONENT_STATE_ID_COLUMN, m_hcsId.getAndIncrement(),
+                  clusterId, serviceName, componentName, hostId);
+
+              dbAccessor.executeQuery(updateSQL);
+            }
           }
         }
       } finally {


[28/50] [abbrv] ambari git commit: AMBARI-18929. Yarn service check fails when either resource manager is down in HA enabled cluster (Weiwei Yang via alejandro)

Posted by nc...@apache.org.
AMBARI-18929. Yarn service check fails when either resource manager is down in HA enabled cluster (Weiwei Yang via alejandro)


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

Branch: refs/heads/branch-dev-patch-upgrade
Commit: 88e0c29e0617f05c0ecb72a75e74b2bb3def6bac
Parents: 6100be6
Author: Alejandro Fernandez <af...@hortonworks.com>
Authored: Thu Dec 1 09:45:56 2016 -0800
Committer: Alejandro Fernandez <af...@hortonworks.com>
Committed: Thu Dec 1 09:45:56 2016 -0800

----------------------------------------------------------------------
 .../2.1.0.2.0/package/scripts/service_check.py  |  66 +++++++----
 .../2.0.6/YARN/test_yarn_service_check.py       | 111 ++++++++++---------
 2 files changed, 100 insertions(+), 77 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/88e0c29e/ambari-server/src/main/resources/common-services/YARN/2.1.0.2.0/package/scripts/service_check.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/YARN/2.1.0.2.0/package/scripts/service_check.py b/ambari-server/src/main/resources/common-services/YARN/2.1.0.2.0/package/scripts/service_check.py
index c0bd480..b934767 100644
--- a/ambari-server/src/main/resources/common-services/YARN/2.1.0.2.0/package/scripts/service_check.py
+++ b/ambari-server/src/main/resources/common-services/YARN/2.1.0.2.0/package/scripts/service_check.py
@@ -130,34 +130,56 @@ class ServiceCheckDefault(ServiceCheck):
       if "application" in item:
         application_name = item
 
-    for rm_webapp_address in params.rm_webapp_addresses_list:
-      info_app_url = params.scheme + "://" + rm_webapp_address + "/ws/v1/cluster/apps/" + application_name
+    # Find out the active RM from RM list
+    # Raise an exception if the active rm cannot be determined
+    active_rm_webapp_address = self.get_active_rm_webapp_address()
+    Logger.info("Active Resource Manager web app address is : " + active_rm_webapp_address);
 
-      get_app_info_cmd = "curl --negotiate -u : -ks --location-trusted --connect-timeout " + CURL_CONNECTION_TIMEOUT + " " + info_app_url
+    # Verify job state from active resource manager via rest api
+    info_app_url = params.scheme + "://" + active_rm_webapp_address + "/ws/v1/cluster/apps/" + application_name
+    get_app_info_cmd = "curl --negotiate -u : -ks --location-trusted --connect-timeout " + CURL_CONNECTION_TIMEOUT + " " + info_app_url
 
-      return_code, stdout, _ = get_user_call_output(get_app_info_cmd,
-                                            user=params.smokeuser,
-                                            path='/usr/sbin:/sbin:/usr/local/bin:/bin:/usr/bin',
-                                            )
+    return_code, stdout, _ = get_user_call_output(get_app_info_cmd,
+                                                  user=params.smokeuser,
+                                                  path='/usr/sbin:/sbin:/usr/local/bin:/bin:/usr/bin',
+                                                  )
 
-      # Handle HDP<2.2.8.1 where RM doesn't do automatic redirection from standby to active
-      if stdout.startswith("This is standby RM. Redirecting to the current active RM:"):
-        Logger.info(format("Skipped checking of {rm_webapp_address} since returned '{stdout}'"))
-        continue
+    try:
+      json_response = json.loads(stdout)
+    except Exception as e:
+      raise Fail(format("Response from YARN API was not a valid JSON. Response: {stdout}"))
 
-      try:
-        json_response = json.loads(stdout)
-      except Exception as e:
-        raise Fail(format("Response from YARN API was not a valid JSON. Response: {stdout}"))
-      
-      if json_response is None or 'app' not in json_response or \
-              'state' not in json_response['app'] or 'finalStatus' not in json_response['app']:
-        raise Fail("Application " + app_url + " returns invalid data.")
-
-      if json_response['app']['state'] != "FINISHED" or json_response['app']['finalStatus'] != "SUCCEEDED":
-        raise Fail("Application " + app_url + " state/status is not valid. Should be FINISHED/SUCCEEDED.")
+    if json_response is None or 'app' not in json_response or \
+            'state' not in json_response['app'] or 'finalStatus' not in json_response['app']:
+      raise Fail("Application " + app_url + " returns invalid data.")
 
+    if json_response['app']['state'] != "FINISHED" or json_response['app']['finalStatus'] != "SUCCEEDED":
+      raise Fail("Application " + app_url + " state/status is not valid. Should be FINISHED/SUCCEEDED.")
 
+  def get_active_rm_webapp_address(self):
+    import params
+    active_rm_webapp_address = None
+    rm_webapp_addresses = params.rm_webapp_addresses_list
+    if rm_webapp_addresses is not None and len(rm_webapp_addresses) > 0:
+      for rm_webapp_address in rm_webapp_addresses:
+        rm_state_url = params.scheme + "://" + rm_webapp_address + "/ws/v1/cluster/info"
+        get_cluster_info_cmd = "curl --negotiate -u : -ks --location-trusted --connect-timeout " + CURL_CONNECTION_TIMEOUT + " " + rm_state_url
+        try:
+          return_code, stdout, _ = get_user_call_output(get_cluster_info_cmd,
+                                                        user=params.smokeuser,
+                                                        path='/usr/sbin:/sbin:/usr/local/bin:/bin:/usr/bin',
+                                                        )
+          json_response = json.loads(stdout)
+          if json_response is not None and 'clusterInfo' in json_response \
+            and json_response['clusterInfo']['haState'] == "ACTIVE":
+              active_rm_webapp_address = rm_webapp_address
+              break
+        except Exception as e:
+          Logger.warning(format("Cluster info is not available from calling {get_cluster_info_cmd}"))
+
+    if active_rm_webapp_address is None:
+      raise Fail('Resource Manager state is not available. Failed to determine the active Resource Manager web application address from {0}'.format(','.join(rm_webapp_addresses)));
+    return active_rm_webapp_address
 
 if __name__ == "__main__":
   ServiceCheck().execute()

http://git-wip-us.apache.org/repos/asf/ambari/blob/88e0c29e/ambari-server/src/test/python/stacks/2.0.6/YARN/test_yarn_service_check.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/stacks/2.0.6/YARN/test_yarn_service_check.py b/ambari-server/src/test/python/stacks/2.0.6/YARN/test_yarn_service_check.py
index bb671aa..fe7456d 100644
--- a/ambari-server/src/test/python/stacks/2.0.6/YARN/test_yarn_service_check.py
+++ b/ambari-server/src/test/python/stacks/2.0.6/YARN/test_yarn_service_check.py
@@ -22,11 +22,11 @@ import re
 from mock.mock import MagicMock, call, patch
 from stacks.utils.RMFTestCase import *
 
-curl_call = MagicMock(return_value=(0, "{ \"app\": {\"state\": \"FINISHED\",\"finalStatus\": \"SUCCEEDED\"}}",''))
+curl_returns = [(0, "{\"clusterInfo\":{\"id\": \"1471586271500\",\"haState\": \"ACTIVE\"}}",''),
+                         (0, "{\"app\":{\"state\": \"FINISHED\",\"finalStatus\":\"SUCCEEDED\"}}",'')]
 
 @patch("platform.linux_distribution", new = MagicMock(return_value="Linux"))
 @patch("sys.executable", new = '/usr/bin/python2.6')
-@patch("resource_management.libraries.functions.get_user_call_output.get_user_call_output", new = curl_call)
 class TestServiceCheck(RMFTestCase):
   COMMON_SERVICES_PACKAGE_DIR = "YARN/2.1.0.2.0/package"
   STACK_VERSION = "2.0.6"
@@ -38,32 +38,32 @@ class TestServiceCheck(RMFTestCase):
     re_search_mock.return_value = m
     m.group.return_value = "http://c6402.ambari.apache.org:8088/proxy/application_1429699682952_0010/"
 
-    self.executeScript(self.COMMON_SERVICES_PACKAGE_DIR + "/scripts/service_check.py",
-                          classname="ServiceCheck",
-                          command="service_check",
-                          config_file="default.json",
-                          stack_version = self.STACK_VERSION,
-                          target = RMFTestCase.TARGET_COMMON_SERVICES,
-                          checked_call_mocks = [(0, "some test text, appTrackingUrl=http:"
-                                "//c6402.ambari.apache.org:8088/proxy/application_1429885383763_0001/, some test text")]
-    )
-    self.assertResourceCalled('HdfsResource', '/user/ambari-qa',
-                              immutable_paths = self.DEFAULT_IMMUTABLE_PATHS,
-                              security_enabled = False,
-                              hadoop_bin_dir = '/usr/bin',
-                              keytab = UnknownConfigurationMock(),
-                              kinit_path_local = '/usr/bin/kinit',
-                              user = 'hdfs',
-                              dfs_type = '',
-                              mode = 0770,
-                              owner = 'ambari-qa',
-                              action = ['create_on_execute'], hdfs_resource_ignore_file='/var/lib/ambari-agent/data/.hdfs_resource_ignore', hdfs_site=self.getConfig()['configurations']['hdfs-site'], principal_name=UnknownConfigurationMock(), default_fs='hdfs://c6401.ambari.apache.org:8020',
-                              hadoop_conf_dir = '/etc/hadoop/conf',
-                              type = 'directory',
-                              )
-    self.assertCurlCallForwardsCredentialsOnRedirect()
-    self.assertNoMoreResources()
-
+    with patch("resource_management.libraries.functions.get_user_call_output.get_user_call_output", side_effect = curl_returns) as mock_curl:
+        self.executeScript(self.COMMON_SERVICES_PACKAGE_DIR + "/scripts/service_check.py",
+                           classname="ServiceCheck",
+                           command="service_check",
+                           config_file="default.json",
+                           stack_version = self.STACK_VERSION,
+                           target = RMFTestCase.TARGET_COMMON_SERVICES,
+                           checked_call_mocks = [(0, "some test text, appTrackingUrl=http:"
+                                                  "//c6402.ambari.apache.org:8088/proxy/application_1429885383763_0001/, some test text")]
+                           )
+        self.assertResourceCalled('HdfsResource', '/user/ambari-qa',
+                                  immutable_paths = self.DEFAULT_IMMUTABLE_PATHS,
+                                  security_enabled = False,
+                                  hadoop_bin_dir = '/usr/bin',
+                                  keytab = UnknownConfigurationMock(),
+                                  kinit_path_local = '/usr/bin/kinit',
+                                  user = 'hdfs',
+                                  dfs_type = '',
+                                  mode = 0770,
+                                  owner = 'ambari-qa',
+                                  action = ['create_on_execute'], hdfs_resource_ignore_file='/var/lib/ambari-agent/data/.hdfs_resource_ignore', hdfs_site=self.getConfig()['configurations']['hdfs-site'], principal_name=UnknownConfigurationMock(), default_fs='hdfs://c6401.ambari.apache.org:8020',
+                                  hadoop_conf_dir = '/etc/hadoop/conf',
+                                  type = 'directory',
+                                  )
+        self.assertCurlCallForwardsCredentialsOnRedirect(mock_curl_call = mock_curl)
+        self.assertNoMoreResources()
 
   @patch("re.search")
   def test_service_check_secured(self, re_search_mock):
@@ -71,31 +71,32 @@ class TestServiceCheck(RMFTestCase):
     re_search_mock.return_value = m
     m.group.return_value = "http://c6402.ambari.apache.org:8088/proxy/application_1429699682952_0010/"
 
-    self.executeScript(self.COMMON_SERVICES_PACKAGE_DIR + "/scripts/service_check.py",
-                          classname="ServiceCheck",
-                          command="service_check",
-                          config_file="secured.json",
-                          stack_version = self.STACK_VERSION,
-                          target = RMFTestCase.TARGET_COMMON_SERVICES,
-                          checked_call_mocks = [(0, "some test text, appTrackingUrl=http:"
-                               "//c6402.ambari.apache.org:8088/proxy/application_1429885383763_0001/, some test text")]
-    )
-    self.assertResourceCalled('HdfsResource', '/user/ambari-qa',
-                              immutable_paths = self.DEFAULT_IMMUTABLE_PATHS,
-                              security_enabled = True,
-                              hadoop_bin_dir = '/usr/bin',
-                              keytab = '/etc/security/keytabs/hdfs.headless.keytab',
-                              kinit_path_local = '/usr/bin/kinit',
-                              user = 'hdfs',
-                              dfs_type = '',
-                              mode = 0770,
-                              owner = 'ambari-qa',
-                              action = ['create_on_execute'], hdfs_resource_ignore_file='/var/lib/ambari-agent/data/.hdfs_resource_ignore', hdfs_site=self.getConfig()['configurations']['hdfs-site'], principal_name='hdfs', default_fs='hdfs://c6401.ambari.apache.org:8020',
-                              hadoop_conf_dir = '/etc/hadoop/conf',
-                              type = 'directory',
-                              )
-    self.assertCurlCallForwardsCredentialsOnRedirect()
-    self.assertNoMoreResources()
+    with patch("resource_management.libraries.functions.get_user_call_output.get_user_call_output", side_effect = curl_returns) as mock_curl:
+        self.executeScript(self.COMMON_SERVICES_PACKAGE_DIR + "/scripts/service_check.py",
+                           classname="ServiceCheck",
+                           command="service_check",
+                           config_file="secured.json",
+                           stack_version = self.STACK_VERSION,
+                           target = RMFTestCase.TARGET_COMMON_SERVICES,
+                           checked_call_mocks = [(0, "some test text, appTrackingUrl=http:"
+                                                  "//c6402.ambari.apache.org:8088/proxy/application_1429885383763_0001/, some test text")]
+                           )
+        self.assertResourceCalled('HdfsResource', '/user/ambari-qa',
+                                  immutable_paths = self.DEFAULT_IMMUTABLE_PATHS,
+                                  security_enabled = True,
+                                  hadoop_bin_dir = '/usr/bin',
+                                  keytab = '/etc/security/keytabs/hdfs.headless.keytab',
+                                  kinit_path_local = '/usr/bin/kinit',
+                                  user = 'hdfs',
+                                  dfs_type = '',
+                                  mode = 0770,
+                                  owner = 'ambari-qa',
+                                  action = ['create_on_execute'], hdfs_resource_ignore_file='/var/lib/ambari-agent/data/.hdfs_resource_ignore', hdfs_site=self.getConfig()['configurations']['hdfs-site'], principal_name='hdfs', default_fs='hdfs://c6401.ambari.apache.org:8020',
+                                  hadoop_conf_dir = '/etc/hadoop/conf',
+                                  type = 'directory',
+                                  )
+        self.assertCurlCallForwardsCredentialsOnRedirect(mock_curl_call = mock_curl)
+        self.assertNoMoreResources()
 
-  def assertCurlCallForwardsCredentialsOnRedirect(self):
-    self.assertIn('--location-trusted', curl_call.call_args[0][0])
\ No newline at end of file
+  def assertCurlCallForwardsCredentialsOnRedirect(self, mock_curl_call):
+    self.assertIn('--location-trusted', mock_curl_call.call_args[0][0])


[09/50] [abbrv] ambari git commit: AMBARI-18600: Workflow Designer View: When logs are empty, you see the spinner, instead of a message (sangeetar)

Posted by nc...@apache.org.
AMBARI-18600: Workflow Designer View: When logs are empty, you see the spinner, instead of a message (sangeetar)


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

Branch: refs/heads/branch-dev-patch-upgrade
Commit: 0afdf6512b914b01417d0fecd2fba334e8dc0195
Parents: 3a14b4a
Author: Sangeeta Ravindran <sa...@apache.org>
Authored: Wed Nov 30 11:16:31 2016 -0800
Committer: Sangeeta Ravindran <sa...@apache.org>
Committed: Wed Nov 30 11:16:31 2016 -0800

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


http://git-wip-us.apache.org/repos/asf/ambari/blob/0afdf651/contrib/views/wfmanager/src/main/resources/ui/app/components/job-details.js
----------------------------------------------------------------------
diff --git a/contrib/views/wfmanager/src/main/resources/ui/app/components/job-details.js b/contrib/views/wfmanager/src/main/resources/ui/app/components/job-details.js
index e403dc4..0e5fd36 100644
--- a/contrib/views/wfmanager/src/main/resources/ui/app/components/job-details.js
+++ b/contrib/views/wfmanager/src/main/resources/ui/app/components/job-details.js
@@ -349,6 +349,7 @@ export default Ember.Component.extend({
           url = url + '&type=action&scope='+ params.logActionList;
         }
         Ember.$.get(url,function(response){
+          response = response.trim().length > 0 ? response : "No messages present";
           this.set('model.jobLog', response);
         }.bind(this)).fail(function(error){
           this.set('error', error);
@@ -356,6 +357,7 @@ export default Ember.Component.extend({
       },
       getErrorLog : function (){
         Ember.$.get(Ember.ENV.API_URL+'/v2/job/'+this.get('id')+'?show=errorlog',function(response){
+          response = response.trim().length > 0 ? response : "No messages present";
           this.set('model.errorLog', response);
         }.bind(this)).fail(function(error){
           this.set('error', error);
@@ -363,6 +365,7 @@ export default Ember.Component.extend({
       },
       getAuditLog : function (){
         Ember.$.get(Ember.ENV.API_URL+'/v2/job/'+this.get('id')+'?show=auditlog',function(response){
+          response = response.trim().length > 0 ? response : "No messages present";
           this.set('model.auditLog', response);
         }.bind(this)).fail(function(error){
           this.set('error', error);


[49/50] [abbrv] ambari git commit: AMBARI-19020. Ubuntu14/16 Add Support for Zookeeper on HDP 2.5 (Duc Le via ncole)

Posted by nc...@apache.org.
AMBARI-19020. Ubuntu14/16 Add Support for Zookeeper on HDP 2.5 (Duc Le via ncole)


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

Branch: refs/heads/branch-dev-patch-upgrade
Commit: 05fe42351131f77a6ee5d58da355b1c461562046
Parents: def3b0a
Author: Nate Cole <nc...@hortonworks.com>
Authored: Fri Dec 2 13:23:36 2016 -0500
Committer: Nate Cole <nc...@hortonworks.com>
Committed: Fri Dec 2 13:23:36 2016 -0500

----------------------------------------------------------------------
 .../main/resources/common-services/ZOOKEEPER/3.4.6/metainfo.xml    | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/05fe4235/ambari-server/src/main/resources/common-services/ZOOKEEPER/3.4.6/metainfo.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/ZOOKEEPER/3.4.6/metainfo.xml b/ambari-server/src/main/resources/common-services/ZOOKEEPER/3.4.6/metainfo.xml
index 525078e..cbb5ba2 100644
--- a/ambari-server/src/main/resources/common-services/ZOOKEEPER/3.4.6/metainfo.xml
+++ b/ambari-server/src/main/resources/common-services/ZOOKEEPER/3.4.6/metainfo.xml
@@ -35,7 +35,7 @@
           </packages>
         </osSpecific>
         <osSpecific>
-          <osFamily>ubuntu12</osFamily>
+          <osFamily>ubuntu12,ubuntu14,ubuntu16</osFamily>
           <packages>
             <package>
               <name>zookeeper-${stack_version}</name>


[18/50] [abbrv] ambari git commit: AMBARI-19045 Remove unnecessary Log Feeder Date Mapper tests

Posted by nc...@apache.org.
AMBARI-19045 Remove unnecessary Log Feeder Date Mapper tests

Change-Id: Ia8d613c0c53bff04c5ccee0579a337b8cbb3a00a


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

Branch: refs/heads/branch-dev-patch-upgrade
Commit: dc5f4e259ce0f83a3a648de54468f6dadacd5291
Parents: 195b745
Author: Miklos Gergely <mg...@hortonworks.com>
Authored: Thu Dec 1 11:43:28 2016 +0100
Committer: Miklos Gergely <mg...@hortonworks.com>
Committed: Thu Dec 1 11:43:28 2016 +0100

----------------------------------------------------------------------
 .../ambari/logfeeder/mapper/MapperDateTest.java | 56 --------------------
 1 file changed, 56 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/dc5f4e25/ambari-logsearch/ambari-logsearch-logfeeder/src/test/java/org/apache/ambari/logfeeder/mapper/MapperDateTest.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-logfeeder/src/test/java/org/apache/ambari/logfeeder/mapper/MapperDateTest.java b/ambari-logsearch/ambari-logsearch-logfeeder/src/test/java/org/apache/ambari/logfeeder/mapper/MapperDateTest.java
index 667c9ff..08680f6 100644
--- a/ambari-logsearch/ambari-logsearch-logfeeder/src/test/java/org/apache/ambari/logfeeder/mapper/MapperDateTest.java
+++ b/ambari-logsearch/ambari-logsearch-logfeeder/src/test/java/org/apache/ambari/logfeeder/mapper/MapperDateTest.java
@@ -141,60 +141,4 @@ public class MapperDateTest {
     assertEquals("Invalid value wasn't returned as it is", invalidValue, mappedValue);
     assertTrue("jsonObj is not empty", jsonObj.isEmpty());
   }
-  
-  @Test
-  public void testMapperDate_patternWithoutYear_previousYearLog() throws Exception {
-    LOG.info("testMapperDate_patternWithoutYear_previousYearLog()");
-    String fieldName = "logtime";
-    Calendar currentCalendar = Calendar.getInstance();
-    Map<String, Object> mapConfigs = new HashMap<>();
-    mapConfigs.put("target_date_pattern", "yyyy-MM-dd HH:mm:ss.SSS");
-    String srcDatePattern ="MMM dd HH:mm:ss";
-    mapConfigs.put("src_date_pattern", srcDatePattern);
-    MapperDate mapperDate = new MapperDate();
-    assertTrue("Could not initialize!", mapperDate.init(null, fieldName, null, mapConfigs));
-    Map<String, Object> jsonObj = new HashMap<>();
-    Calendar nextMonthCalendar = Calendar.getInstance();
-    
-    nextMonthCalendar.set(Calendar.MONTH, currentCalendar.get(Calendar.MONTH)+1 );
-    String inputDateStr = new SimpleDateFormat("MMM").format(nextMonthCalendar.getTime()) + " 01 12:01:45";
-    Object mappedValue = mapperDate.apply(jsonObj, inputDateStr);
-    Date mappedDateValue = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS").parse(mappedValue.toString());
-    String mappedDateValueStr = new SimpleDateFormat(srcDatePattern).format(mappedDateValue);
-    assertEquals(Date.class, mappedDateValue.getClass());
-    
-    int expectedLogYear = currentCalendar.get(Calendar.YEAR)-1;
-    Calendar mapppedValueCalendar = Calendar.getInstance();
-    mapppedValueCalendar.setTime(mappedDateValue);
-    assertEquals("Mapped year wasn't matched properly", expectedLogYear, mapppedValueCalendar.get(Calendar.YEAR));
-    assertEquals("Mapped date wasn't matched properly", inputDateStr, mappedDateValueStr);
-    assertEquals("Value wasn't put into jsonObj",mappedValue, jsonObj.remove(fieldName));
-    assertTrue("jsonObj is not empty", jsonObj.isEmpty());
-  }
-  
-  @Test
-  public void testMapperDate_patternWithoutYear_currentYearLog() throws Exception {
-    LOG.info("testMapperDate_patternWithoutYear_currentYearLog()");
-    String fieldName = "logtime";
-    Calendar currentCalendar = Calendar.getInstance();
-    Map<String, Object> mapConfigs = new HashMap<>();
-    mapConfigs.put("target_date_pattern", "yyyy-MM-dd HH:mm:ss.SSS");
-    String srcDatePattern ="MMM dd HH:mm:ss";
-    mapConfigs.put("src_date_pattern", srcDatePattern);
-    MapperDate mapperDate = new MapperDate();
-    assertTrue("Could not initialize!", mapperDate.init(null, fieldName, null, mapConfigs));
-    Map<String, Object> jsonObj = new HashMap<>();
-    String inputDateStr = new SimpleDateFormat("MMM").format(currentCalendar.getTime()) + " 01 12:01:45";
-    Object mappedValue = mapperDate.apply(jsonObj, inputDateStr);
-    Date mappedDateValue = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS").parse(mappedValue.toString());
-    String mappedDateValueStr = new SimpleDateFormat(srcDatePattern).format(mappedDateValue);
-    assertEquals(Date.class, mappedDateValue.getClass());
-    int expectedLogYear = currentCalendar.get(Calendar.YEAR);
-    Calendar mapppedValueCalendar = Calendar.getInstance();
-    mapppedValueCalendar.setTime(mappedDateValue);
-    assertEquals("Mapped year wasn't matched properly", expectedLogYear, mapppedValueCalendar.get(Calendar.YEAR));
-    assertEquals("Mapped date wasn't matched properly", inputDateStr, mappedDateValueStr);
-    assertEquals("Value wasn't put into jsonObj",mappedValue, jsonObj.remove(fieldName));
-    assertTrue("jsonObj is not empty", jsonObj.isEmpty());
-  }
 }


[23/50] [abbrv] ambari git commit: AMBARI-18736. Perf: Simulate alerts for multiple Ambari Agents running on single Host.(vbrodetskyi)

Posted by nc...@apache.org.
http://git-wip-us.apache.org/repos/asf/ambari/blob/ef63373e/ambari-server/src/main/resources/stacks/PERF/1.0/services/HDFS/alerts.json
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/PERF/1.0/services/HDFS/alerts.json b/ambari-server/src/main/resources/stacks/PERF/1.0/services/HDFS/alerts.json
index 8ccfa47..34cea4c 100644
--- a/ambari-server/src/main/resources/stacks/PERF/1.0/services/HDFS/alerts.json
+++ b/ambari-server/src/main/resources/stacks/PERF/1.0/services/HDFS/alerts.json
@@ -1,469 +1,21 @@
 {
   "HDFS":{
-    "service": [
-      {
-        "name": "datanode_process_percent",
-        "label": "Percent DataNodes Available",
-        "description": "This alert is triggered if the number of down DataNodes in the cluster is greater than the configured critical threshold. It aggregates the results of DataNode process checks.",
-        "interval": 1,
-        "scope": "SERVICE",
-        "enabled": true,
-        "source": {
-          "type": "AGGREGATE",
-          "alert_name": "datanode_process",
-          "reporting": {
-            "ok": {
-              "text": "affected: [{1}], total: [{0}]"
-            },
-            "warning": {
-              "text": "affected: [{1}], total: [{0}]",
-              "value": 10
-            },
-            "critical": {
-              "text": "affected: [{1}], total: [{0}]",
-              "value": 30
-            },
-            "units" : "%",
-            "type": "PERCENT"
-          }
-        }
-      },
-      {
-        "name": "datanode_storage_percent",
-        "label": "Percent DataNodes With Available Space",
-        "description": "This service-level alert is triggered if the storage on a certain percentage of DataNodes exceeds either the warning or critical threshold values.",
-        "interval": 1,
-        "scope": "SERVICE",
-        "enabled": true,
-        "source": {
-          "type": "AGGREGATE",
-          "alert_name": "datanode_storage",
-          "reporting": {
-            "ok": {
-              "text": "affected: [{1}], total: [{0}]"
-            },
-            "warning": {
-              "text": "affected: [{1}], total: [{0}]",
-              "value": 10
-            },
-            "critical": {
-              "text": "affected: [{1}], total: [{0}]",
-              "value": 30
-            },
-            "units" : "%",
-            "type": "PERCENT"
-          }
-        }
-      },
-      {
-        "name": "journalnode_process_percent",
-        "label": "Percent JournalNodes Available",
-        "description": "This alert is triggered if the number of down JournalNodes in the cluster is greater than the configured critical threshold. It aggregates the results of JournalNode process checks.",
-        "interval": 1,
-        "scope": "SERVICE",
-        "enabled": true,
-        "source": {
-          "type": "AGGREGATE",
-          "alert_name": "journalnode_process",
-          "reporting": {
-            "ok": {
-              "text": "affected: [{1}], total: [{0}]"
-            },
-            "warning": {
-              "text": "affected: [{1}], total: [{0}]",
-              "value": 33
-            },
-            "critical": {
-              "text": "affected: [{1}], total: [{0}]",
-              "value": 50
-            },
-            "units" : "%",
-            "type": "PERCENT"
-          }
-        }
-      }
-    ],
     "NAMENODE": [
-      {
-        "name": "namenode_webui",
-        "label": "NameNode Web UI",
-        "description": "This host-level alert is triggered if the NameNode Web UI is unreachable.",
-        "interval": 1,
-        "scope": "ANY",
-        "enabled": true,
-        "source": {
-          "type": "WEB",
-          "uri": {
-            "http": "{{hdfs-site/dfs.namenode.http-address}}",
-            "https": "{{hdfs-site/dfs.namenode.https-address}}",
-            "https_property": "{{hdfs-site/dfs.http.policy}}",
-            "https_property_value": "HTTPS_ONLY",
-            "kerberos_keytab": "{{hdfs-site/dfs.web.authentication.kerberos.keytab}}",
-            "kerberos_principal": "{{hdfs-site/dfs.web.authentication.kerberos.principal}}",
-            "connection_timeout": 5.0,
-            "high_availability": {
-              "nameservice": "{{hdfs-site/dfs.internal.nameservices}}",
-              "alias_key" : "{{hdfs-site/dfs.ha.namenodes.{{ha-nameservice}}}}",
-              "http_pattern" : "{{hdfs-site/dfs.namenode.http-address.{{ha-nameservice}}.{{alias}}}}",
-              "https_pattern" : "{{hdfs-site/dfs.namenode.https-address.{{ha-nameservice}}.{{alias}}}}"
-            }
-          },
-          "reporting": {
-            "ok": {
-              "text": "HTTP {0} response in {2:.3f}s"
-            },
-            "warning":{
-              "text": "HTTP {0} response from {1} in {2:.3f}s ({3})"
-            },
-            "critical": {
-              "text": "Connection failed to {1} ({3})"
-            }
-          }
-        }
-      },
+
       {
         "name": "upgrade_finalized_state",
         "label": "HDFS Upgrade Finalized State",
         "description": "This service-level alert is triggered if HDFS is not in the finalized state",
         "interval": 1,
-        "scope": "SERVICE",
+        "scope": "HOST",
         "enabled": true,
         "source": {
           "type": "SCRIPT",
-          "path": "HDFS/2.1.0.2.0/package/alerts/alert_upgrade_finalized.py",
+          "path": "PERF/1.0/services/HDFS/package/alerts/alert_upgrade_finalized.py",
           "parameters": []
         }
       },
-      {
-        "name": "namenode_cpu",
-        "label": "NameNode Host CPU Utilization",
-        "description": "This host-level alert is triggered if CPU utilization of the NameNode exceeds certain warning and critical thresholds. It checks the NameNode JMX Servlet for the SystemCPULoad property. The threshold values are in percent.",
-        "interval": 5,
-        "scope": "ANY",
-        "enabled": true,
-        "source": {
-          "type": "METRIC",
-          "uri": {
-            "http": "{{hdfs-site/dfs.namenode.http-address}}",
-            "https": "{{hdfs-site/dfs.namenode.https-address}}",
-            "kerberos_keytab": "{{hdfs-site/dfs.web.authentication.kerberos.keytab}}",
-            "kerberos_principal": "{{hdfs-site/dfs.web.authentication.kerberos.principal}}",
-            "https_property": "{{hdfs-site/dfs.http.policy}}",
-            "https_property_value": "HTTPS_ONLY",
-            "connection_timeout": 5.0,
-            "high_availability": {
-              "nameservice": "{{hdfs-site/dfs.internal.nameservices}}",
-              "alias_key" : "{{hdfs-site/dfs.ha.namenodes.{{ha-nameservice}}}}",
-              "http_pattern" : "{{hdfs-site/dfs.namenode.http-address.{{ha-nameservice}}.{{alias}}}}",
-              "https_pattern" : "{{hdfs-site/dfs.namenode.https-address.{{ha-nameservice}}.{{alias}}}}"
-            }
-          },
-          "reporting": {
-            "ok": {
-              "text": "{1} CPU, load {0:.1%}"
-            },
-            "warning": {
-              "text": "{1} CPU, load {0:.1%}",
-              "value": 200
-            },
-            "critical": {
-              "text": "{1} CPU, load {0:.1%}",
-              "value": 250
-            },
-            "units" : "%",
-            "type": "PERCENT"
-          },
-          "jmx": {
-            "property_list": [
-              "java.lang:type=OperatingSystem/SystemCpuLoad",
-              "java.lang:type=OperatingSystem/AvailableProcessors"
-            ],
-            "value": "{0} * 100"
-          }
-        }
-      },
-      {
-        "name": "namenode_hdfs_blocks_health",
-        "label": "NameNode Blocks Health",
-        "description": "This service-level alert is triggered if the number of corrupt or missing blocks exceeds the configured critical threshold. The threshold values are in blocks.",
-        "interval": 2,
-        "scope": "ANY",
-        "enabled": true,
-        "source": {
-          "type": "METRIC",
-          "uri": {
-            "http": "{{hdfs-site/dfs.namenode.http-address}}",
-            "https": "{{hdfs-site/dfs.namenode.https-address}}",
-            "kerberos_keytab": "{{hdfs-site/dfs.web.authentication.kerberos.keytab}}",
-            "kerberos_principal": "{{hdfs-site/dfs.web.authentication.kerberos.principal}}",
-            "https_property": "{{hdfs-site/dfs.http.policy}}",
-            "https_property_value": "HTTPS_ONLY",
-            "connection_timeout": 5.0,
-            "high_availability": {
-              "nameservice": "{{hdfs-site/dfs.internal.nameservices}}",
-              "alias_key" : "{{hdfs-site/dfs.ha.namenodes.{{ha-nameservice}}}}",
-              "http_pattern" : "{{hdfs-site/dfs.namenode.http-address.{{ha-nameservice}}.{{alias}}}}",
-              "https_pattern" : "{{hdfs-site/dfs.namenode.https-address.{{ha-nameservice}}.{{alias}}}}"
-            }
-          },
-          "reporting": {
-            "ok": {
-              "text": "Total Blocks:[{1}], Missing Blocks:[{0}]"
-            },
-            "warning": {
-              "text": "Total Blocks:[{1}], Missing Blocks:[{0}]",
-              "value": 1
-            },          
-            "critical": {
-              "text": "Total Blocks:[{1}], Missing Blocks:[{0}]",
-              "value": 1
-            },
-            "units" : "Blocks"
-          },
-          "jmx": {
-            "property_list": [
-              "Hadoop:service=NameNode,name=FSNamesystem/MissingBlocks",
-              "Hadoop:service=NameNode,name=FSNamesystem/BlocksTotal"
-            ],
-            "value": "{0}"
-          }
-        }
-      },
-      {
-        "name": "namenode_hdfs_pending_deletion_blocks",
-        "label": "HDFS Pending Deletion Blocks",
-        "description": "This service-level alert is triggered if the number of blocks pending deletion in HDFS exceeds the configured warning and critical thresholds. It checks the NameNode JMX Servlet for the PendingDeletionBlock property.",
-        "interval": 2,
-        "scope": "ANY",
-        "enabled": true,
-        "source": {
-          "type": "METRIC",
-          "uri": {
-            "http": "{{hdfs-site/dfs.namenode.http-address}}",
-            "https": "{{hdfs-site/dfs.namenode.https-address}}",
-            "kerberos_keytab": "{{hdfs-site/dfs.web.authentication.kerberos.keytab}}",
-            "kerberos_principal": "{{hdfs-site/dfs.web.authentication.kerberos.principal}}",
-            "https_property": "{{hdfs-site/dfs.http.policy}}",
-            "https_property_value": "HTTPS_ONLY",
-            "connection_timeout": 5.0,
-            "high_availability": {
-              "nameservice": "{{hdfs-site/dfs.internal.nameservices}}",
-              "alias_key" : "{{hdfs-site/dfs.ha.namenodes.{{ha-nameservice}}}}",
-              "http_pattern" : "{{hdfs-site/dfs.namenode.http-address.{{ha-nameservice}}.{{alias}}}}",
-              "https_pattern" : "{{hdfs-site/dfs.namenode.https-address.{{ha-nameservice}}.{{alias}}}}"
-            }
-          },
-          "reporting": {
-            "ok": {
-              "text": "Pending Deletion Blocks:[{0}]"
-            },
-            "warning": {
-              "text": "Pending Deletion Blocks:[{0}]",
-              "value": 100000
-            },
-            "critical": {
-              "text": "Pending Deletion Blocks:[{0}]",
-              "value": 100000
-            },
-            "units" : "Blocks"
-          },
-          "jmx": {
-            "property_list": [
-              "Hadoop:service=NameNode,name=FSNamesystem/PendingDeletionBlocks"
-            ],
-            "value": "{0}"
-          }
-        }
-      },
-      {
-        "name": "namenode_hdfs_capacity_utilization",
-        "label": "HDFS Capacity Utilization",
-        "description": "This service-level alert is triggered if the HDFS capacity utilization exceeds the configured warning and critical thresholds. It checks the NameNode JMX Servlet for the CapacityUsed and CapacityRemaining properties. The threshold values are in percent.",
-        "interval": 2,
-        "scope": "ANY",
-        "enabled": true,
-        "source": {
-          "type": "METRIC",
-          "uri": {
-            "http": "{{hdfs-site/dfs.namenode.http-address}}",
-            "https": "{{hdfs-site/dfs.namenode.https-address}}",
-            "kerberos_keytab": "{{hdfs-site/dfs.web.authentication.kerberos.keytab}}",
-            "kerberos_principal": "{{hdfs-site/dfs.web.authentication.kerberos.principal}}",
-            "https_property": "{{hdfs-site/dfs.http.policy}}",
-            "https_property_value": "HTTPS_ONLY",
-            "connection_timeout": 5.0,
-            "high_availability": {
-              "nameservice": "{{hdfs-site/dfs.internal.nameservices}}",
-              "alias_key" : "{{hdfs-site/dfs.ha.namenodes.{{ha-nameservice}}}}",
-              "http_pattern" : "{{hdfs-site/dfs.namenode.http-address.{{ha-nameservice}}.{{alias}}}}",
-              "https_pattern" : "{{hdfs-site/dfs.namenode.https-address.{{ha-nameservice}}.{{alias}}}}"
-            }
-          },
-          "reporting": {
-            "ok": {
-              "text": "Capacity Used:[{2:.0f}%, {0}], Capacity Remaining:[{1}]"
-            },
-            "warning": {
-              "text": "Capacity Used:[{2:.0f}%, {0}], Capacity Remaining:[{1}]",
-              "value": 75
-            },          
-            "critical": {
-              "text": "Capacity Used:[{2:.0f}%, {0}], Capacity Remaining:[{1}]",
-              "value": 80
-            },
-            "units" : "%",
-            "type": "PERCENT"
-          },
-          "jmx": {
-            "property_list": [
-              "Hadoop:service=NameNode,name=FSNamesystemState/CapacityUsed",
-              "Hadoop:service=NameNode,name=FSNamesystemState/CapacityRemaining"
-            ],
-            "value": "{0}/({0} + {1}) * 100.0"
-          }
-        }
-      },
-      {
-        "name": "namenode_rpc_latency",
-        "label": "NameNode RPC Latency",
-        "description": "This host-level alert is triggered if the NameNode RPC latency exceeds the configured critical threshold. Typically an increase in the RPC processing time increases the RPC queue length, causing the average queue wait time to increase for NameNode operations. The threshold values are in milliseconds.",
-        "interval": 2,
-        "scope": "ANY",
-        "enabled": true,
-        "source": {
-          "type": "METRIC",
-          "uri": {
-            "http": "{{hdfs-site/dfs.namenode.http-address}}",
-            "https": "{{hdfs-site/dfs.namenode.https-address}}",
-            "kerberos_keytab": "{{hdfs-site/dfs.web.authentication.kerberos.keytab}}",
-            "kerberos_principal": "{{hdfs-site/dfs.web.authentication.kerberos.principal}}",
-            "https_property": "{{hdfs-site/dfs.http.policy}}",
-            "https_property_value": "HTTPS_ONLY",
-            "connection_timeout": 5.0,
-            "high_availability": {
-              "nameservice": "{{hdfs-site/dfs.internal.nameservices}}",
-              "alias_key" : "{{hdfs-site/dfs.ha.namenodes.{{ha-nameservice}}}}",
-              "http_pattern" : "{{hdfs-site/dfs.namenode.http-address.{{ha-nameservice}}.{{alias}}}}",
-              "https_pattern" : "{{hdfs-site/dfs.namenode.https-address.{{ha-nameservice}}.{{alias}}}}"
-            }
-          },
-          "reporting": {
-            "ok": {
-              "text": "Average Queue Time:[{0}], Average Processing Time:[{1}]"
-            },
-            "warning": {
-              "text": "Average Queue Time:[{0}], Average Processing Time:[{1}]",
-              "value": 3000
-            },          
-            "critical": {
-              "text": "Average Queue Time:[{0}], Average Processing Time:[{1}]",
-              "value": 5000
-            },
-            "units" : "ms"
-          },
-          "jmx": {
-            "property_list": [
-              "Hadoop:service=NameNode,name=RpcActivityForPort*/RpcQueueTimeAvgTime",
-              "Hadoop:service=NameNode,name=RpcActivityForPort*/RpcProcessingTimeAvgTime"
-            ],
-            "value": "{0}"
-          }
-        }
-      },
-      {
-        "name": "namenode_directory_status",
-        "label": "NameNode Directory Status",
-        "description": "This host-level alert is triggered if the NameNode NameDirStatuses metric (name=NameNodeInfo/NameDirStatuses) reports a failed directory. The threshold values are in the number of directories that are not healthy.",
-        "interval": 1,
-        "scope": "ANY",
-        "enabled": true,
-        "source": {
-          "type": "METRIC",
-          "uri": {
-            "http": "{{hdfs-site/dfs.namenode.http-address}}",
-            "https": "{{hdfs-site/dfs.namenode.https-address}}",
-            "kerberos_keytab": "{{hdfs-site/dfs.web.authentication.kerberos.keytab}}",
-            "kerberos_principal": "{{hdfs-site/dfs.web.authentication.kerberos.principal}}",
-            "https_property": "{{hdfs-site/dfs.http.policy}}",
-            "https_property_value": "HTTPS_ONLY",
-            "connection_timeout": 5.0,
-            "high_availability": {
-              "nameservice": "{{hdfs-site/dfs.internal.nameservices}}",
-              "alias_key" : "{{hdfs-site/dfs.ha.namenodes.{{ha-nameservice}}}}",
-              "http_pattern" : "{{hdfs-site/dfs.namenode.http-address.{{ha-nameservice}}.{{alias}}}}",
-              "https_pattern" : "{{hdfs-site/dfs.namenode.https-address.{{ha-nameservice}}.{{alias}}}}"
-            }
-          },
-          "reporting": {
-            "ok": {
-              "text": "Directories are healthy"
-            },
-            "warning": {
-              "text": "Failed directory count: {1}",
-              "value": 1
-            },          
-            "critical": {
-              "text": "Failed directory count: {1}",
-              "value": 1
-            },
-            "units" : "Dirs"
-          },
-          "jmx": {
-            "property_list": [
-              "Hadoop:service=NameNode,name=NameNodeInfo/NameDirStatuses"
-            ],
-            "value": "calculate(args)\ndef calculate(args):\n  import json\n  json_statuses = json.loads({0})\n  return len(json_statuses['failed']) if 'failed' in json_statuses else 0"
-          }
-        }
-      },
-      {
-        "name": "datanode_health_summary",
-        "label": "DataNode Health Summary",
-        "description": "This service-level alert is triggered if there are unhealthy DataNodes",
-        "interval": 1,
-        "scope": "SERVICE",
-        "enabled": true,
-        "source": {
-          "type": "METRIC",
-          "uri": {
-            "http": "{{hdfs-site/dfs.namenode.http-address}}",
-            "https": "{{hdfs-site/dfs.namenode.https-address}}",
-            "kerberos_keytab": "{{hdfs-site/dfs.web.authentication.kerberos.keytab}}",
-            "kerberos_principal": "{{hdfs-site/dfs.web.authentication.kerberos.principal}}",
-            "https_property": "{{hdfs-site/dfs.http.policy}}",
-            "https_property_value": "HTTPS_ONLY",
-            "connection_timeout": 5.0,
-            "high_availability": {
-              "nameservice": "{{hdfs-site/dfs.internal.nameservices}}",
-              "alias_key": "{{hdfs-site/dfs.ha.namenodes.{{ha-nameservice}}}}",
-              "http_pattern": "{{hdfs-site/dfs.namenode.http-address.{{ha-nameservice}}.{{alias}}}}",
-              "https_pattern": "{{hdfs-site/dfs.namenode.https-address.{{ha-nameservice}}.{{alias}}}}"
-            }
-          },
-          "reporting": {
-            "ok": {
-              "text": "All {2} DataNode(s) are healthy"
-            },
-            "warning": {
-              "text": "DataNode Health: [Live={2}, Stale={1}, Dead={0}]",
-              "value": 1
-            },
-            "critical": {
-              "text": "DataNode Health: [Live={2}, Stale={1}, Dead={0}]",
-              "value": 1
-            },
-            "units": "DNs"
-          },
-          "jmx": {
-            "property_list": [
-              "Hadoop:service=NameNode,name=FSNamesystemState/NumDeadDataNodes",
-              "Hadoop:service=NameNode,name=FSNamesystemState/NumStaleDataNodes",
-              "Hadoop:service=NameNode,name=FSNamesystemState/NumLiveDataNodes"
-            ],
-            "value": "{0} + {1}"
-          }
-        }
-      },
+
       {
         "name": "namenode_last_checkpoint",
         "label": "NameNode Last Checkpoint",
@@ -473,7 +25,7 @@
         "enabled": true,
         "source": {
           "type": "SCRIPT",
-          "path": "HDFS/2.1.0.2.0/package/alerts/alert_checkpoint_time.py",
+          "path": "PERF/1.0/services/HDFS/package/alerts/alert_checkpoint_time.py",
           "parameters": [
             {
               "name": "connection.timeout",
@@ -520,1265 +72,47 @@
             }
           ]
         }
-      },
+      }
+    ],
+    "SECONDARY_NAMENODE": [
       {
-        "name": "namenode_ha_health",
-        "label": "NameNode High Availability Health",
-        "description": "This service-level alert is triggered if either the Active NameNode or Standby NameNode are not running.",
+        "name": "secondary_namenode_process",
+        "label": "Secondary NameNode Process",
+        "description": "This host-level alert is triggered if the Secondary NameNode process cannot be confirmed to be up and listening on the network.",
         "interval": 1,
-        "scope": "ANY",
-        "enabled": true,
-        "ignore_host": true,
-        "source": {
-          "type": "SCRIPT",
-          "path": "HDFS/2.1.0.2.0/package/alerts/alert_ha_namenode_health.py",
-          "parameters": [
-            {
-              "name": "connection.timeout",
-              "display_name": "Connection Timeout",
-              "value": 5.0,
-              "type": "NUMERIC",
-              "description": "The maximum time before this alert is considered to be CRITICAL",
-              "units": "seconds",
-              "threshold": "CRITICAL"
-            }
-          ]
-        }
-      },
-      {
-        "name": "namenode_service_rpc_queue_latency_hourly",
-        "label": "NameNode Service RPC Queue Latency (Hourly)",
-        "description": "This service-level alert is triggered if the deviation of RPC queue latency on datanode port has grown beyond the specified threshold within an hour period.",
-        "interval": 5,
-        "scope": "ANY",
-        "enabled": true,
-        "source": {
-          "type": "SCRIPT",
-          "path": "HDFS/2.1.0.2.0/package/alerts/alert_metrics_deviation.py",
-          "parameters": [
-            {
-              "name": "mergeHaMetrics",
-              "display_name": "Whether active and stanby NameNodes metrics should be merged",
-              "value": "false",
-              "type": "STRING",
-              "description": "Whether active and stanby NameNodes metrics should be merged.",
-              "visibility": "HIDDEN"
-            },
-            {
-              "name": "interval",
-              "display_name": "Time interval in minutes",
-              "value": 60,
-              "type": "NUMERIC",
-              "description": "Time interval in minutes.",
-              "visibility": "HIDDEN"
-            },
-            {
-              "name": "appId",
-              "display_name": "AMS application id",
-              "value": "NAMENODE",
-              "type": "STRING",
-              "description": "The application id used to retrieve the metric.",
-              "visibility": "HIDDEN"
-            },
-            {
-              "name": "metricName",
-              "display_name": "Metric Name",
-              "value": "rpc.rpc.datanode.RpcQueueTimeAvgTime",
-              "type": "STRING",
-              "description": "The metric to monitor.",
-              "visibility": "HIDDEN"
-            },
-            {
-              "name": "metric.deviation.warning.threshold",
-              "display_name": "Growth Rate",
-              "type": "PERCENT",
-              "units": "%",
-              "value": 100,
-              "description": "The percentage of RPC queue latency growth.",
-              "threshold": "WARNING"
-            },
-            {
-              "name": "metric.deviation.critical.threshold",
-              "display_name": "Growth Rate",
-              "type": "PERCENT",
-              "units": "%",
-              "value": 200,
-              "description": "The percentage of RPC queue latency growth.",
-              "threshold": "CRITICAL"
-            },
-            {
-              "name": "minimumValue",
-              "display_name": "Minimum Latency",
-              "value": 30,
-              "type": "NUMERIC",
-              "units": "seconds",
-              "description": "The minimum latency to measure growth."
-            },
-            {
-              "name": "metric.units",
-              "display_name": "Metric Units",
-              "type": "STRING",
-              "value": "ms",
-              "description": "The units that the metric data points are reported in.",
-              "visibility": "HIDDEN"
-            }
-          ]
-        }
-      },
-      {
-        "name": "namenode_client_rpc_queue_latency_hourly",
-        "label": "NameNode Client RPC Queue Latency (Hourly)",
-        "description": "This service-level alert is triggered if the deviation of RPC queue latency on client port has grown beyond the specified threshold within an hour period.",
-        "interval": 5,
-        "scope": "ANY",
+        "scope": "HOST",
         "enabled": true,
         "source": {
           "type": "SCRIPT",
-          "path": "HDFS/2.1.0.2.0/package/alerts/alert_metrics_deviation.py",
-          "parameters": [
-            {
-              "name": "mergeHaMetrics",
-              "display_name": "Whether active and stanby NameNodes metrics should be merged",
-              "value": "false",
-              "type": "STRING",
-              "description": "Whether active and stanby NameNodes metrics should be merged.",
-              "visibility": "HIDDEN"
-            },
-            {
-              "name": "interval",
-              "display_name": "Time interval in minutes",
-              "value": 60,
-              "type": "NUMERIC",
-              "description": "Time interval in minutes.",
-              "visibility": "HIDDEN"
-            },
-            {
-              "name": "appId",
-              "display_name": "AMS application id",
-              "value": "NAMENODE",
-              "type": "STRING",
-              "description": "The application id used to retrieve the metric.",
-              "visibility": "HIDDEN"
-            },
-            {
-              "name": "metricName",
-              "display_name": "Metric Name",
-              "value": "rpc.rpc.client.RpcQueueTimeAvgTime",
-              "type": "STRING",
-              "description": "The metric to monitor.",
-              "visibility": "HIDDEN"
-            },
-            {
-              "name": "metric.deviation.warning.threshold",
-              "display_name": "Growth Rate",
-              "type": "PERCENT",
-              "units": "%",
-              "value": 100,
-              "description": "The percentage of RPC queue latency growth.",
-              "threshold": "WARNING"
-            },
-            {
-              "name": "metric.deviation.critical.threshold",
-              "display_name": "Growth Rate",
-              "type": "PERCENT",
-              "units": "%",
-              "value": 200,
-              "description": "The percentage of RPC queue latency growth.",
-              "threshold": "CRITICAL"
-            },
-            {
-              "name": "minimumValue",
-              "display_name": "Minimum Latency",
-              "value": 30,
-              "type": "NUMERIC",
-              "units": "seconds",
-              "description": "The minimum latency to measure growth."
-            },
-            {
-              "name": "metric.units",
-              "display_name": "Metric Units",
-              "type": "STRING",
-              "value": "ms",
-              "description": "The units that the metric data points are reported in.",
-              "visibility": "HIDDEN"
-            }
-          ]
+          "path": "PERF/1.0/services/HDFS/package/alerts/alert_snamenode_process.py"
         }
-      },
+      }
+    ],
+    "NFS_GATEWAY": [
       {
-        "name": "namenode_service_rpc_processing_latency_hourly",
-        "label": "NameNode Service RPC Processing Latency (Hourly)",
-        "description": "This service-level alert is triggered if the deviation of RPC latency on datanode port has grown beyond the specified threshold within an hour period.",
-        "interval": 5,
-        "scope": "ANY",
+        "name": "nfsgateway_process",
+        "label": "NFS Gateway Process",
+        "description": "This host-level alert is triggered if the NFS Gateway process cannot be confirmed to be up and listening on the network.",
+        "interval": 1,
+        "scope": "HOST",
         "enabled": true,
         "source": {
           "type": "SCRIPT",
-          "path": "HDFS/2.1.0.2.0/package/alerts/alert_metrics_deviation.py",
-          "parameters": [
-            {
-              "name": "mergeHaMetrics",
-              "display_name": "Whether active and stanby NameNodes metrics should be merged",
-              "value": "false",
-              "type": "STRING",
-              "description": "Whether active and stanby NameNodes metrics should be merged.",
-              "visibility": "HIDDEN"
-            },
-            {
-              "name": "interval",
-              "display_name": "Time interval in minutes",
-              "value": 60,
-              "type": "NUMERIC",
-              "description": "Time interval in minutes.",
-              "visibility": "HIDDEN"
-            },
-            {
-              "name": "appId",
-              "display_name": "AMS application id",
-              "value": "NAMENODE",
-              "type": "STRING",
-              "description": "The application id used to retrieve the metric.",
-              "visibility": "HIDDEN"
-            },
-            {
-              "name": "metricName",
-              "display_name": "Metric Name",
-              "value": "rpc.rpc.datanode.RpcProcessingTimeAvgTime",
-              "type": "STRING",
-              "description": "The metric to monitor.",
-              "visibility": "HIDDEN"
-            },
-            {
-              "name": "metric.deviation.warning.threshold",
-              "display_name": "Growth Rate",
-              "type": "PERCENT",
-              "units": "%",
-              "value": 100,
-              "description": "The percentage of RPC processing latency growth.",
-              "threshold": "WARNING"
-            },
-            {
-              "name": "metric.deviation.critical.threshold",
-              "display_name": "Growth Rate",
-              "type": "PERCENT",
-              "units": "%",
-              "value": 200,
-              "description": "The percentage of RPC processing latency growth.",
-              "threshold": "CRITICAL"
-            },
-            {
-              "name": "minimumValue",
-              "display_name": "Minimum Latency",
-              "value": 30,
-              "type": "NUMERIC",
-              "units": "seconds",
-              "description": "The minimum latency to measure growth."
-            },
-            {
-              "name": "metric.units",
-              "display_name": "Metric Units",
-              "type": "STRING",
-              "value": "ms",
-              "description": "The units that the metric data points are reported in.",
-              "visibility": "HIDDEN"
-            }
-          ]
+          "path": "PERF/1.0/services/HDFS/package/alerts/alert_nfs_gateway_process.py"
         }
-      },
+      }
+    ],
+    "DATANODE": [
       {
-        "name": "namenode_client_rpc_processing_latency_hourly",
-        "label": "NameNode Client RPC Processing Latency (Hourly)",
-        "description": "This service-level alert is triggered if the deviation of RPC latency on client port has grown beyond the specified threshold within an hour period.",
-        "interval": 5,
-        "scope": "ANY",
+        "name": "datanode_unmounted_data_dir",
+        "label": "DataNode Unmounted Data Dir",
+        "description": "This host-level alert is triggered if one of the data directories on a host was previously on a mount point and became unmounted. If the mount history file does not exist, then report an error if a host has one or more mounted data directories as well as one or more unmounted data directories on the root partition. This may indicate that a data directory is writing to the root partition, which is undesirable.",
+        "interval": 1,
+        "scope": "HOST",
         "enabled": true,
         "source": {
           "type": "SCRIPT",
-          "path": "HDFS/2.1.0.2.0/package/alerts/alert_metrics_deviation.py",
-          "parameters": [
-            {
-              "name": "mergeHaMetrics",
-              "display_name": "Whether active and stanby NameNodes metrics should be merged",
-              "value": "false",
-              "type": "STRING",
-              "description": "Whether active and stanby NameNodes metrics should be merged.",
-              "visibility": "HIDDEN"
-            },
-            {
-              "name": "interval",
-              "display_name": "Time interval in minutes",
-              "value": 60,
-              "type": "NUMERIC",
-              "description": "Time interval in minutes.",
-              "visibility": "HIDDEN"
-            },
-            {
-              "name": "appId",
-              "display_name": "AMS application id",
-              "value": "NAMENODE",
-              "type": "STRING",
-              "description": "The application id used to retrieve the metric.",
-              "visibility": "HIDDEN"
-            },
-            {
-              "name": "metricName",
-              "display_name": "Metric Name",
-              "value": "rpc.rpc.client.RpcProcessingTimeAvgTime",
-              "type": "STRING",
-              "description": "The metric to monitor.",
-              "visibility": "HIDDEN"
-            },
-            {
-              "name": "metric.deviation.warning.threshold",
-              "display_name": "Growth Rate",
-              "type": "PERCENT",
-              "units": "%",
-              "value": 100,
-              "description": "The percentage of RPC processing latency growth.",
-              "threshold": "WARNING"
-            },
-            {
-              "name": "metric.deviation.critical.threshold",
-              "display_name": "Growth Rate",
-              "type": "PERCENT",
-              "units": "%",
-              "value": 200,
-              "description": "The percentage of RPC processing latency growth.",
-              "threshold": "CRITICAL"
-            },
-            {
-              "name": "minimumValue",
-              "display_name": "Minimum Latency",
-              "value": 30,
-              "type": "NUMERIC",
-              "units": "seconds",
-              "description": "The minimum latency to measure growth."
-            },
-            {
-              "name": "metric.units",
-              "display_name": "Metric Units",
-              "type": "STRING",
-              "value": "ms",
-              "description": "The units that the metric data points are reported in.",
-              "visibility": "HIDDEN"
-            }
-          ]
-        }
-      },
-      {
-        "name": "increase_nn_heap_usage_daily",
-        "label": "NameNode Heap Usage (Daily)",
-        "description": "This service-level alert is triggered if the NameNode heap usage deviation has grown beyond the specified threshold within a day period.",
-        "interval": 480,
-        "scope": "ANY",
-        "enabled": true,
-        "source": {
-          "type": "SCRIPT",
-          "path": "HDFS/2.1.0.2.0/package/alerts/alert_metrics_deviation.py",
-          "parameters": [
-            {
-              "name": "mergeHaMetrics",
-              "display_name": "Whether active and stanby NameNodes metrics should be merged",
-              "value": "false",
-              "type": "STRING",
-              "description": "Whether active and stanby NameNodes metrics should be merged.",
-              "visibility": "HIDDEN"
-            },
-            {
-              "name": "interval",
-              "display_name": "Time interval in minutes",
-              "value": 1440,
-              "type": "NUMERIC",
-              "description": "Time interval in minutes.",
-              "visibility": "HIDDEN"
-            },
-            {
-              "name": "appId",
-              "display_name": "AMS application id",
-              "value": "NAMENODE",
-              "type": "STRING",
-              "description": "The application id used to retrieve the metric.",
-              "visibility": "HIDDEN"
-            },
-            {
-              "name": "metricName",
-              "display_name": "Metric Name",
-              "value": "jvm.JvmMetrics.MemHeapUsedM",
-              "type": "STRING",
-              "description": "The metric to monitor.",
-              "visibility": "HIDDEN"
-            },
-            {
-              "name": "metric.deviation.warning.threshold",
-              "display_name": "Growth Rate",
-              "type": "PERCENT",
-              "units": "%",
-              "value": 20,
-              "description": "The percentage of NameNode heap usage growth.",
-              "threshold": "WARNING"
-            },
-            {
-              "name": "metric.deviation.critical.threshold",
-              "display_name": "Growth Rate",
-              "type": "PERCENT",
-              "units": "%",
-              "value": 50,
-              "description": "The percentage of NameNode heap usage growth.",
-              "threshold": "CRITICAL"
-            },
-            {
-              "name": "metric.units",
-              "display_name": "Metric Units",
-              "type": "STRING",
-              "value": "MB",
-              "description": "The units that the metric data points are reported in.",
-              "visibility": "HIDDEN"
-            },
-            {
-              "name": "minimumValue",
-              "display_name": "Minimum Heap",
-              "value": 100,
-              "type": "NUMERIC",
-              "units": "MB",
-              "description": "The minimum heap increase in a day."
-            }
-          ]
-        }
-      },
-      {
-        "name": "namenode_service_rpc_processing_latency_daily",
-        "label": "NameNode Service RPC Processing Latency (Daily)",
-        "description": "This service-level alert is triggered if the deviation of RPC latency on datanode port has grown beyond the specified threshold within a day period.",
-        "interval": 480,
-        "scope": "ANY",
-        "enabled": true,
-        "source": {
-          "type": "SCRIPT",
-          "path": "HDFS/2.1.0.2.0/package/alerts/alert_metrics_deviation.py",
-          "parameters": [
-            {
-              "name": "mergeHaMetrics",
-              "display_name": "Whether active and stanby NameNodes metrics should be merged",
-              "value": "false",
-              "type": "STRING",
-              "description": "Whether active and stanby NameNodes metrics should be merged.",
-              "visibility": "HIDDEN"
-            },
-            {
-              "name": "interval",
-              "display_name": "Time interval in minutes",
-              "value": 1440,
-              "type": "NUMERIC",
-              "description": "Time interval in minutes.",
-              "visibility": "HIDDEN"
-            },
-            {
-              "name": "appId",
-              "display_name": "AMS application id",
-              "value": "NAMENODE",
-              "type": "STRING",
-              "description": "The application id used to retrieve the metric.",
-              "visibility": "HIDDEN"
-            },
-            {
-              "name": "metricName",
-              "display_name": "Metric Name",
-              "value": "rpc.rpc.datanode.RpcProcessingTimeAvgTime",
-              "type": "STRING",
-              "description": "The metric to monitor.",
-              "visibility": "HIDDEN"
-            },
-            {
-              "name": "metric.deviation.warning.threshold",
-              "display_name": "Growth Rate",
-              "type": "PERCENT",
-              "units": "%",
-              "value": 100,
-              "description": "The percentage of RPC processing latency growth.",
-              "threshold": "WARNING"
-            },
-            {
-              "name": "metric.deviation.critical.threshold",
-              "display_name": "Growth Rate",
-              "type": "PERCENT",
-              "units": "%",
-              "value": 200,
-              "description": "The percentage of RPC processing latency growth.",
-              "threshold": "CRITICAL"
-            },
-            {
-              "name": "minimumValue",
-              "display_name": "Minimum Latency",
-              "value": 30,
-              "type": "NUMERIC",
-              "units": "seconds",
-              "description": "The minimum latency to measure growth."
-            },
-            {
-              "name": "metric.units",
-              "display_name": "Metric Units",
-              "type": "STRING",
-              "value": "ms",
-              "description": "The units that the metric data points are reported in.",
-              "visibility": "HIDDEN"
-            }
-          ]
-        }
-      },
-      {
-        "name": "namenode_client_rpc_processing_latency_daily",
-        "label": "NameNode Client RPC Processing Latency (Daily)",
-        "description": "This service-level alert is triggered if the deviation of RPC latency on client port has grown beyond the specified threshold within a day period.",
-        "interval": 480,
-        "scope": "ANY",
-        "enabled": true,
-        "source": {
-          "type": "SCRIPT",
-          "path": "HDFS/2.1.0.2.0/package/alerts/alert_metrics_deviation.py",
-          "parameters": [
-            {
-              "name": "mergeHaMetrics",
-              "display_name": "Whether active and stanby NameNodes metrics should be merged",
-              "value": "false",
-              "type": "STRING",
-              "description": "Whether active and stanby NameNodes metrics should be merged.",
-              "visibility": "HIDDEN"
-            },
-            {
-              "name": "interval",
-              "display_name": "Time interval in minutes",
-              "value": 1440,
-              "type": "NUMERIC",
-              "description": "Time interval in minutes.",
-              "visibility": "HIDDEN"
-            },
-            {
-              "name": "appId",
-              "display_name": "AMS application id",
-              "value": "NAMENODE",
-              "type": "STRING",
-              "description": "The application id used to retrieve the metric.",
-              "visibility": "HIDDEN"
-            },
-            {
-              "name": "metricName",
-              "display_name": "Metric Name",
-              "value": "rpc.rpc.client.RpcProcessingTimeAvgTime",
-              "type": "STRING",
-              "description": "The metric to monitor.",
-              "visibility": "HIDDEN"
-            },
-            {
-              "name": "metric.deviation.warning.threshold",
-              "display_name": "Growth Rate",
-              "type": "PERCENT",
-              "units": "%",
-              "value": 100,
-              "description": "The percentage of RPC processing latency growth.",
-              "threshold": "WARNING"
-            },
-            {
-              "name": "metric.deviation.critical.threshold",
-              "display_name": "Growth Rate",
-              "type": "PERCENT",
-              "units": "%",
-              "value": 200,
-              "description": "The percentage of RPC processing latency growth.",
-              "threshold": "CRITICAL"
-            },
-            {
-              "name": "minimumValue",
-              "display_name": "Minimum Latency",
-              "value": 30,
-              "type": "NUMERIC",
-              "units": "seconds",
-              "description": "The minimum latency to measure growth."
-            },
-            {
-              "name": "metric.units",
-              "display_name": "Metric Units",
-              "type": "STRING",
-              "value": "ms",
-              "description": "The units that the metric data points are reported in.",
-              "visibility": "HIDDEN"
-            }
-          ]
-        }
-      },
-      {
-        "name": "namenode_service_rpc_queue_latency_daily",
-        "label": "NameNode Service RPC Queue Latency (Daily)",
-        "description": "This service-level alert is triggered if the deviation of RPC latency on datanode port has grown beyond the specified threshold within a day period.",
-        "interval": 480,
-        "scope": "ANY",
-        "enabled": true,
-        "source": {
-          "type": "SCRIPT",
-          "path": "HDFS/2.1.0.2.0/package/alerts/alert_metrics_deviation.py",
-          "parameters": [
-            {
-              "name": "mergeHaMetrics",
-              "display_name": "Whether active and stanby NameNodes metrics should be merged",
-              "value": "false",
-              "type": "STRING",
-              "description": "Whether active and stanby NameNodes metrics should be merged.",
-              "visibility": "HIDDEN"
-            },
-            {
-              "name": "interval",
-              "display_name": "Time interval in minutes",
-              "value": 1440,
-              "type": "NUMERIC",
-              "description": "Time interval in minutes.",
-              "visibility": "HIDDEN"
-            },
-            {
-              "name": "appId",
-              "display_name": "AMS application id",
-              "value": "NAMENODE",
-              "type": "STRING",
-              "description": "The application id used to retrieve the metric.",
-              "visibility": "HIDDEN"
-            },
-            {
-              "name": "metricName",
-              "display_name": "Metric Name",
-              "value": "rpc.rpc.datanode.RpcQueueTimeAvgTime",
-              "type": "STRING",
-              "description": "The metric to monitor.",
-              "visibility": "HIDDEN"
-            },
-            {
-              "name": "metric.deviation.warning.threshold",
-              "display_name": "Growth Rate",
-              "type": "PERCENT",
-              "units": "%",
-              "value": 100,
-              "description": "The percentage of RPC queue latency growth.",
-              "threshold": "WARNING"
-            },
-            {
-              "name": "metric.deviation.critical.threshold",
-              "display_name": "Growth Rate",
-              "type": "PERCENT",
-              "units": "%",
-              "value": 200,
-              "description": "The percentage of RPC queue latency growth.",
-              "threshold": "CRITICAL"
-            },
-            {
-              "name": "minimumValue",
-              "display_name": "Minimum Latency",
-              "value": 30,
-              "type": "NUMERIC",
-              "units": "seconds",
-              "description": "The minimum latency to measure growth."
-            },
-            {
-              "name": "metric.units",
-              "display_name": "Metric Units",
-              "type": "STRING",
-              "value": "MB",
-              "description": "The units that the metric data points are reported in.",
-              "visibility": "HIDDEN"
-            }
-          ]
-        }
-      },
-      {
-        "name": "namenode_client_rpc_queue_latency_daily",
-        "label": "NameNode Client RPC Queue Latency (Daily)",
-        "description": "This service-level alert is triggered if the deviation of RPC latency on client port has grown beyond the specified threshold within a day period.",
-        "interval": 480,
-        "scope": "ANY",
-        "enabled": true,
-        "source": {
-          "type": "SCRIPT",
-          "path": "HDFS/2.1.0.2.0/package/alerts/alert_metrics_deviation.py",
-          "parameters": [
-            {
-              "name": "mergeHaMetrics",
-              "display_name": "Whether active and stanby NameNodes metrics should be merged",
-              "value": "false",
-              "type": "STRING",
-              "description": "Whether active and stanby NameNodes metrics should be merged.",
-              "visibility": "HIDDEN"
-            },
-            {
-              "name": "interval",
-              "display_name": "Time interval in minutes",
-              "value": 1440,
-              "type": "NUMERIC",
-              "description": "Time interval in minutes.",
-              "visibility": "HIDDEN"
-            },
-            {
-              "name": "appId",
-              "display_name": "AMS application id",
-              "value": "NAMENODE",
-              "type": "STRING",
-              "description": "The application id used to retrieve the metric.",
-              "visibility": "HIDDEN"
-            },
-            {
-              "name": "metricName",
-              "display_name": "Metric Name",
-              "value": "rpc.rpc.client.RpcQueueTimeAvgTime",
-              "type": "STRING",
-              "description": "The metric to monitor.",
-              "visibility": "HIDDEN"
-            },
-            {
-              "name": "metric.deviation.warning.threshold",
-              "display_name": "Growth Rate",
-              "type": "PERCENT",
-              "units": "%",
-              "value": 100,
-              "description": "The percentage of RPC queue latency growth.",
-              "threshold": "WARNING"
-            },
-            {
-              "name": "metric.deviation.critical.threshold",
-              "display_name": "Growth Rate",
-              "type": "PERCENT",
-              "units": "%",
-              "value": 200,
-              "description": "The percentage of RPC queue latency growth.",
-              "threshold": "CRITICAL"
-            },
-            {
-              "name": "minimumValue",
-              "display_name": "Minimum Latency",
-              "value": 30,
-              "type": "NUMERIC",
-              "units": "seconds",
-              "description": "The minimum latency to measure growth."
-            },
-            {
-              "name": "metric.units",
-              "display_name": "Metric Units",
-              "type": "STRING",
-              "value": "ms",
-              "description": "The units that the metric data points are reported in.",
-              "visibility": "HIDDEN"
-            }
-          ]
-        }
-      },
-      {
-        "name": "namenode_increase_in_storage_capacity_usage_daily",
-        "label": "HDFS Storage Capacity Usage (Daily)",
-        "description": "This service-level alert is triggered if the increase in storage capacity usage deviation has grown beyond the specified threshold within a day period.",
-        "interval": 480,
-        "scope": "ANY",
-        "enabled": true,
-        "source": {
-          "type": "SCRIPT",
-          "path": "HDFS/2.1.0.2.0/package/alerts/alert_metrics_deviation.py",
-          "parameters": [
-            {
-              "name": "mergeHaMetrics",
-              "display_name": "Whether active and stanby NameNodes metrics should be merged",
-              "value": "false",
-              "type": "STRING",
-              "description": "Whether active and stanby NameNodes metrics should be merged.",
-              "visibility": "HIDDEN"
-            },
-            {
-              "name": "interval",
-              "display_name": "Time interval in minutes",
-              "value": 1440,
-              "type": "NUMERIC",
-              "description": "Time interval in minutes.",
-              "visibility": "HIDDEN"
-            },
-            {
-              "name": "appId",
-              "display_name": "AMS application id",
-              "value": "NAMENODE",
-              "type": "STRING",
-              "description": "The application id used to retrieve the metric.",
-              "visibility": "HIDDEN"
-            },
-            {
-              "name": "metricName",
-              "display_name": "Metric Name",
-              "value": "dfs.FSNamesystem.CapacityUsed",
-              "type": "STRING",
-              "description": "The metric to monitor.",
-              "visibility": "HIDDEN"
-            },
-            {
-              "name": "metric.deviation.warning.threshold",
-              "display_name": "Growth Rate",
-              "type": "PERCENT",
-              "units": "%",
-              "value": 30,
-              "description": "The percentage of storage capacity usage growth.",
-              "threshold": "WARNING"
-            },
-            {
-              "name": "metric.deviation.critical.threshold",
-              "display_name": "Growth Rate",
-              "type": "PERCENT",
-              "units": "%",
-              "value": 50,
-              "description": "The percentage of storage capacity usage growth.",
-              "threshold": "CRITICAL"
-            },
-            {
-              "name": "metric.units",
-              "display_name": "Metric Units",
-              "type": "STRING",
-              "value": "B",
-              "description": "The units that the metric data points are reported in.",
-              "visibility": "HIDDEN"
-            },
-            {
-              "name": "minimumValue",
-              "display_name": "Minimum Capacity",
-              "value": 100,
-              "type": "NUMERIC",
-              "units": "MB",
-              "description": "The minimum capacity increase in a day."
-            }
-          ]
-        }
-      },
-      {
-        "name": "increase_nn_heap_usage_weekly",
-        "label": "NameNode Heap Usage (Weekly)",
-        "description": "This service-level alert is triggered if the NameNode heap usage deviation has grown beyond the specified threshold within a week period.",
-        "interval": 1440,
-        "scope": "ANY",
-        "enabled": true,
-        "source": {
-          "type": "SCRIPT",
-          "path": "HDFS/2.1.0.2.0/package/alerts/alert_metrics_deviation.py",
-          "parameters": [
-            {
-              "name": "mergeHaMetrics",
-              "display_name": "Whether active and stanby NameNodes metrics should be merged",
-              "value": "false",
-              "type": "STRING",
-              "description": "Whether active and stanby NameNodes metrics should be merged.",
-              "visibility": "HIDDEN"
-            },
-            {
-              "name": "interval",
-              "display_name": "Time interval in minutes",
-              "value": 10080,
-              "type": "NUMERIC",
-              "description": "Time interval in minutes.",
-              "visibility": "HIDDEN"
-            },
-            {
-              "name": "appId",
-              "display_name": "AMS application id",
-              "value": "NAMENODE",
-              "type": "STRING",
-              "description": "The application id used to retrieve the metric.",
-              "visibility": "HIDDEN"
-            },
-            {
-              "name": "metricName",
-              "display_name": "Metric Name",
-              "value": "jvm.JvmMetrics.MemHeapUsedM",
-              "type": "STRING",
-              "description": "The metric to monitor.",
-              "visibility": "HIDDEN"
-            },
-            {
-              "name": "metric.deviation.warning.threshold",
-              "display_name": "Growth Rate",
-              "type": "PERCENT",
-              "units": "%",
-              "value": 20,
-              "description": "The percentage of NameNode heap usage growth.",
-              "threshold": "WARNING"
-            },
-            {
-              "name": "metric.deviation.critical.threshold",
-              "display_name": "Growth Rate",
-              "type": "PERCENT",
-              "units": "%",
-              "value": 50,
-              "description": "The percentage of NameNode heap usage growth.",
-              "threshold": "CRITICAL"
-            },
-            {
-              "name": "metric.units",
-              "display_name": "Metric Units",
-              "type": "STRING",
-              "value": "MB",
-              "description": "The units that the metric data points are reported in.",
-              "visibility": "HIDDEN"
-            },
-            {
-              "name": "minimumValue",
-              "display_name": "Minimum Heap",
-              "value": 1000,
-              "type": "NUMERIC",
-              "units": "MB",
-              "description": "The minimum heap increase in a week."
-            }
-          ]
-        }
-      },
-      {
-        "name": "namenode_increase_in_storage_capacity_usage_weekly",
-        "label": "HDFS Storage Capacity Usage (Weekly)",
-        "description": "This service-level alert is triggered if the increase in storage capacity usage deviation has grown beyond the specified threshold within a week period.",
-        "interval": 1440,
-        "scope": "ANY",
-        "enabled": true,
-        "source": {
-          "type": "SCRIPT",
-          "path": "HDFS/2.1.0.2.0/package/alerts/alert_metrics_deviation.py",
-          "parameters": [
-            {
-              "name": "mergeHaMetrics",
-              "display_name": "Whether active and stanby NameNodes metrics should be merged",
-              "value": "false",
-              "type": "STRING",
-              "description": "Whether active and stanby NameNodes metrics should be merged.",
-              "visibility": "HIDDEN"
-            },
-            {
-              "name": "interval",
-              "display_name": "Time interval in minutes",
-              "value": 10080,
-              "type": "NUMERIC",
-              "description": "Time interval in minutes.",
-              "visibility": "HIDDEN"
-            },
-            {
-              "name": "appId",
-              "display_name": "AMS application id",
-              "value": "NAMENODE",
-              "type": "STRING",
-              "description": "The application id used to retrieve the metric.",
-              "visibility": "HIDDEN"
-            },
-            {
-              "name": "metricName",
-              "display_name": "Metric Name",
-              "value": "dfs.FSNamesystem.CapacityUsed",
-              "type": "STRING",
-              "description": "The metric to monitor.",
-              "visibility": "HIDDEN"
-            },
-            {
-              "name": "metric.deviation.warning.threshold",
-              "display_name": "Growth Rate",
-              "type": "PERCENT",
-              "units": "%",
-              "value": 10,
-              "description": "The percentage of storage capacity usage growth.",
-              "threshold": "WARNING"
-            },
-            {
-              "name": "metric.deviation.critical.threshold",
-              "display_name": "Growth Rate",
-              "type": "PERCENT",
-              "units": "%",
-              "value": 20,
-              "description": "The percentage of storage capacity usage growth.",
-              "threshold": "CRITICAL"
-            },
-            {
-              "name": "metric.units",
-              "display_name": "Metric Units",
-              "type": "STRING",
-              "value": "B",
-              "description": "The units that the metric data points are reported in.",
-              "visibility": "HIDDEN"
-            },
-            {
-              "name": "minimumValue",
-              "display_name": "Minimum Capacity",
-              "value": 1000,
-              "type": "NUMERIC",
-              "units": "MB",
-              "description": "The minimum capacity increase in a week."
-            }
-          ]
-        }
-      }
-    ],
-    "SECONDARY_NAMENODE": [
-      {
-        "name": "secondary_namenode_process",
-        "label": "Secondary NameNode Process",
-        "description": "This host-level alert is triggered if the Secondary NameNode process cannot be confirmed to be up and listening on the network.",
-        "interval": 1,
-        "scope": "ANY",
-        "enabled": true,
-        "source": {
-          "type": "WEB",
-          "uri": {
-            "http": "{{hdfs-site/dfs.namenode.secondary.http-address}}",
-            "https": "{{hdfs-site/dfs.namenode.secondary.https-address}}",
-            "kerberos_keytab": "{{hdfs-site/dfs.web.authentication.kerberos.keytab}}",
-            "kerberos_principal": "{{hdfs-site/dfs.web.authentication.kerberos.principal}}",
-            "https_property": "{{hdfs-site/dfs.http.policy}}",
-            "https_property_value": "HTTPS_ONLY"
-          },
-          "reporting": {
-            "ok": {
-              "text": "HTTP {0} response in {2:.3f}s"
-            },
-            "warning":{
-              "text": "HTTP {0} response from {1} in {2:.3f}s ({3})"
-            },
-            "critical": {
-              "text": "Connection failed to {1} ({3})"
-            }
-          }
-        }
-      }
-    ],
-    "NFS_GATEWAY": [
-      {
-        "name": "nfsgateway_process",
-        "label": "NFS Gateway Process",
-        "description": "This host-level alert is triggered if the NFS Gateway process cannot be confirmed to be up and listening on the network.",
-        "interval": 1,
-        "scope": "HOST",
-        "enabled": true,
-        "source": {
-          "type": "PORT",
-          "uri": "{{hdfs-site/nfs.server.port}}",
-          "default_port": 2049,
-          "reporting": {
-            "ok": {
-              "text": "TCP OK - {0:.3f}s response on port {1}"
-            },
-            "warning": {
-              "text": "TCP OK - {0:.3f}s response on port {1}",
-              "value": 1.5
-            },
-            "critical": {
-              "text": "Connection failed: {0} to {1}:{2}",
-              "value": 5.0
-            }
-          }
-        }
-      }
-    ],
-    "JOURNALNODE": [
-      {
-        "name": "journalnode_process",
-        "label": "JournalNode Web UI",
-        "description": "This host-level alert is triggered if the JournalNode Web UI is unreachable.",
-        "interval": 1,
-        "scope": "HOST",
-        "enabled": true,
-        "source": {
-          "type": "WEB",
-          "uri": {
-            "http": "{{hdfs-site/dfs.journalnode.http-address}}",
-            "https": "{{hdfs-site/dfs.journalnode.https-address}}",
-            "kerberos_keytab": "{{hdfs-site/dfs.web.authentication.kerberos.keytab}}",
-            "kerberos_principal": "{{hdfs-site/dfs.web.authentication.kerberos.principal}}",
-            "https_property": "{{hdfs-site/dfs.http.policy}}",
-            "https_property_value": "HTTPS_ONLY",
-            "connection_timeout": 5.0
-          },
-          "reporting": {
-            "ok": {
-              "text": "HTTP {0} response in {2:.3f}s"
-            },
-            "warning": {
-              "text": "HTTP {0} response from {1} in {2:.3f}s ({3})"
-            },
-            "critical": {
-              "text": "Connection failed to {1} ({3})"
-            }
-          }
-        }
-      }
-    ],      
-    "DATANODE": [
-      {
-        "name": "datanode_process",
-        "label": "DataNode Process",
-        "description": "This host-level alert is triggered if the individual DataNode processes cannot be established to be up and listening on the network.",
-        "interval": 1,
-        "scope": "HOST",
-        "enabled": true,
-        "source": {
-          "type": "PORT",        
-          "uri": "{{hdfs-site/dfs.datanode.address}}",
-          "default_port": 50010,
-          "reporting": {
-            "ok": {
-              "text": "TCP OK - {0:.3f}s response on port {1}"
-            },
-            "warning": {
-              "text": "TCP OK - {0:.3f}s response on port {1}",
-              "value": 1.5
-            },
-            "critical": {
-              "text": "Connection failed: {0} to {1}:{2}",
-              "value": 5.0
-            }
-          }
-        }
-      },
-      {
-        "name": "datanode_webui",
-        "label": "DataNode Web UI",
-        "description": "This host-level alert is triggered if the DataNode Web UI is unreachable.",
-        "interval": 1,
-        "scope": "HOST",
-        "enabled": true,
-        "source": {
-          "type": "WEB",
-          "uri": {
-            "http": "{{hdfs-site/dfs.datanode.http.address}}",
-            "https": "{{hdfs-site/dfs.datanode.https.address}}",
-            "https_property": "{{hdfs-site/dfs.http.policy}}",
-            "https_property_value": "HTTPS_ONLY",
-            "kerberos_keytab": "{{hdfs-site/dfs.web.authentication.kerberos.keytab}}",
-            "kerberos_principal": "{{hdfs-site/dfs.web.authentication.kerberos.principal}}",
-            "connection_timeout": 5.0
-          },
-          "reporting": {
-            "ok": {
-              "text": "HTTP {0} response in {2:.3f}s"
-            },
-            "warning":{
-              "text": "HTTP {0} response from {1} in {2:.3f}s ({3})"
-            },
-            "critical": {
-              "text": "Connection failed to {1} ({3})"
-            }
-          }
-        }
-      },    
-      {
-        "name": "datanode_storage",
-        "label": "DataNode Storage",
-        "description": "This host-level alert is triggered if storage capacity if full on the DataNode. It checks the DataNode JMX Servlet for the Capacity and Remaining properties. The threshold values are in percent.",
-        "interval": 2,
-        "scope": "HOST",
-        "enabled": true,
-        "source": {
-          "type": "METRIC",
-          "uri": {
-            "http": "{{hdfs-site/dfs.datanode.http.address}}",
-            "https": "{{hdfs-site/dfs.datanode.https.address}}",
-            "kerberos_keytab": "{{hdfs-site/dfs.web.authentication.kerberos.keytab}}",
-            "kerberos_principal": "{{hdfs-site/dfs.web.authentication.kerberos.principal}}",
-            "https_property": "{{hdfs-site/dfs.http.policy}}",
-            "https_property_value": "HTTPS_ONLY",
-            "connection_timeout": 5.0
-          },
-          "reporting": {
-            "ok": {
-              "text": "Remaining Capacity:[{0}], Total Capacity:[{2:.0f}% Used, {1}]"
-            },
-            "warning": {
-              "text": "Remaining Capacity:[{0}], Total Capacity:[{2:.0f}% Used, {1}]",
-              "value": 75
-            },
-            "critical": {
-              "text": "Remaining Capacity:[{0}], Total Capacity:[{2:.0f}% Used, {1}]",
-              "value": 80
-            },
-            "units" : "%",
-            "type": "PERCENT"
-          },
-          "jmx": {
-            "property_list": [
-              "Hadoop:service=DataNode,name=FSDatasetState-*/Remaining",
-              "Hadoop:service=DataNode,name=FSDatasetState-*/Capacity"
-            ],
-            "value": "({1} - {0})/{1} * 100.0"
-          }
-        }
-      },
-      {
-        "name": "datanode_unmounted_data_dir",
-        "label": "DataNode Unmounted Data Dir",
-        "description": "This host-level alert is triggered if one of the data directories on a host was previously on a mount point and became unmounted. If the mount history file does not exist, then report an error if a host has one or more mounted data directories as well as one or more unmounted data directories on the root partition. This may indicate that a data directory is writing to the root partition, which is undesirable.",
-        "interval": 2,
-        "scope": "HOST",
-        "enabled": true,
-        "source": {
-          "type": "SCRIPT",
-          "path": "HDFS/2.1.0.2.0/package/alerts/alert_datanode_unmounted_data_dir.py"
-        }
-      },
-      {
-        "name": "datanode_heap_usage",
-        "label": "DataNode Heap Usage",
-        "description": "This host-level alert is triggered if heap usage goes past thresholds on the DataNode. It checks the DataNode JMXServlet for the MemHeapUsedM and MemHeapMaxM properties. The threshold values are in percent.",
-        "interval": 2,
-        "scope": "HOST",
-        "enabled": true,
-        "source": {
-          "type": "METRIC",
-          "uri": {
-            "http": "{{hdfs-site/dfs.datanode.http.address}}",
-            "https": "{{hdfs-site/dfs.datanode.https.address}}",
-            "kerberos_keytab": "{{hdfs-site/dfs.web.authentication.kerberos.keytab}}",
-            "kerberos_principal": "{{hdfs-site/dfs.web.authentication.kerberos.principal}}",
-            "https_property": "{{hdfs-site/dfs.http.policy}}",
-            "https_property_value": "HTTPS_ONLY",
-            "connection_timeout": 5.0
-          },
-          "reporting": {
-            "ok": {
-              "text": "Used Heap:[{2:.0f}%, {0} MB], Max Heap: {1} MB"
-            },
-            "warning": {
-              "text": "Used Heap:[{2:.0f}%, {0} MB], Max Heap: {1} MB",
-              "value": 80
-            },
-            "critical": {
-              "text": "Used Heap:[{2:.0f}%, {0} MB], Max Heap: {1} MB",
-              "value": 90
-            },
-            "units" : "%",
-            "type": "PERCENT"
-          },
-          "jmx": {
-            "property_list": [
-              "Hadoop:service=DataNode,name=JvmMetrics/MemHeapUsedM",
-              "Hadoop:service=DataNode,name=JvmMetrics/MemHeapMaxM"
-            ],
-            "value": "100.0 - (({1} - {0})/{1} * 100.0)"
-          }
-        }
-      }
-    ],
-    "ZKFC": [
-      {
-        "name": "hdfs_zookeeper_failover_controller_process",
-        "label": "ZooKeeper Failover Controller Process",
-        "description": "This host-level alert is triggered if the ZooKeeper Failover Controller process cannot be confirmed to be up and listening on the network.",
-        "interval": 1,
-        "scope": "ANY",
-        "enabled": true,
-        "source": {
-          "type": "PORT",
-          "uri": "{{hdfs-site/dfs.ha.zkfc.port}}",
-          "default_port": 8019,
-          "reporting": {
-            "ok": {
-              "text": "TCP OK - {0:.3f}s response on port {1}"
-            },
-            "warning": {
-              "text": "TCP OK - {0:.3f}s response on port {1}",
-              "value": 1.5
-            },
-            "critical": {
-              "text": "Connection failed: {0} to {1}:{2}",
-              "value": 5.0
-            }
-          }
+          "path": "PERF/1.0/services/HDFS/package/alerts/alert_datanode_unmounted_data_dir.py"
         }
       }
     ]

http://git-wip-us.apache.org/repos/asf/ambari/blob/ef63373e/ambari-server/src/main/resources/stacks/PERF/1.0/services/HDFS/configuration/hdfs-alert-config.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/PERF/1.0/services/HDFS/configuration/hdfs-alert-config.xml b/ambari-server/src/main/resources/stacks/PERF/1.0/services/HDFS/configuration/hdfs-alert-config.xml
new file mode 100644
index 0000000..760e706
--- /dev/null
+++ b/ambari-server/src/main/resources/stacks/PERF/1.0/services/HDFS/configuration/hdfs-alert-config.xml
@@ -0,0 +1,75 @@
+<?xml version="1.0"?>
+<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
+<!--
+    Licensed to the Apache Software Foundation (ASF) under one or more
+    contributor license agreements.  See the NOTICE file distributed with
+    this work for additional information regarding copyright ownership.
+    The ASF licenses this file to You under the Apache License, Version 2.0
+    (the "License"); you may not use this file except in compliance with
+    the License.  You may obtain a copy of the License at
+
+        http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+-->
+
+<configuration xmlns:xi="http://www.w3.org/2001/XInclude" supports_final="true">
+
+    <property>
+        <name>alert.behavior.type</name>
+        <value>percentage</value>
+        <description>
+            This property describes type of alert behaviour.
+            There are three types percentage, timeout, flip.
+        </description>
+    </property>
+
+
+    <property>
+        <name>alert.success.percentage</name>
+        <value>100</value>
+        <description>
+            This property will be actual only when alert.behaviour.type
+            set to "percentage". Here you should set percent of successful
+            alert checks.
+        </description>
+    </property>
+
+
+    <property>
+        <name>alert.timeout.return.value</name>
+        <value>false</value>
+        <description>
+            This property will be actual only when alert.behaviour.type
+            set to "timeout". Here you should set result which alert will
+            return after timeout, false|true|none.
+        </description>
+    </property>
+
+    <property>
+        <name>alert.timeout.secs</name>
+        <value>120</value>
+        <description>
+            This property will be actual only when alert.behaviour.type
+            set to "timeout". Here you should set number of seconds for
+            alert to sleep.
+        </description>
+    </property>
+
+
+    <property>
+        <name>alert.flip.interval.mins</name>
+        <value>3</value>
+        <description>
+            This property will be actual only when alert.behaviour.type
+            set to "flip". Here you should set number of minutes at which
+            the alert should flip from true|false.
+        </description>
+    </property>
+
+
+</configuration>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/ef63373e/ambari-server/src/main/resources/stacks/PERF/1.0/services/HDFS/metainfo.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/PERF/1.0/services/HDFS/metainfo.xml b/ambari-server/src/main/resources/stacks/PERF/1.0/services/HDFS/metainfo.xml
index bf26fbd..42edc8d 100644
--- a/ambari-server/src/main/resources/stacks/PERF/1.0/services/HDFS/metainfo.xml
+++ b/ambari-server/src/main/resources/stacks/PERF/1.0/services/HDFS/metainfo.xml
@@ -227,6 +227,7 @@
       </requiredServices>
 
       <configuration-dependencies>
+        <config-type>hdfs-alert-config</config-type>
         <config-type>core-site</config-type>
         <config-type>hdfs-site</config-type>
         <config-type>hadoop-env</config-type>

http://git-wip-us.apache.org/repos/asf/ambari/blob/ef63373e/ambari-server/src/main/resources/stacks/PERF/1.0/services/HDFS/package/alerts/alert_checkpoint_time.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/PERF/1.0/services/HDFS/package/alerts/alert_checkpoint_time.py b/ambari-server/src/main/resources/stacks/PERF/1.0/services/HDFS/package/alerts/alert_checkpoint_time.py
index 1e69def..73bc168 100644
--- a/ambari-server/src/main/resources/stacks/PERF/1.0/services/HDFS/package/alerts/alert_checkpoint_time.py
+++ b/ambari-server/src/main/resources/stacks/PERF/1.0/services/HDFS/package/alerts/alert_checkpoint_time.py
@@ -20,36 +20,31 @@ limitations under the License.
 
 import logging
 
-RESULT_CODE_OK = 'OK'
-RESULT_CODE_CRITICAL = 'CRITICAL'
-RESULT_CODE_UNKNOWN = 'UNKNOWN'
+from resource_management.libraries.functions.simulate_perf_cluster_alert_behaviour import simulate_perf_cluster_alert_behaviour
 
-OK_MESSAGE = 'Ok'
+ALERT_BEHAVIOUR_TYPE = "{{hdfs-alert-config/alert.behavior.type}}"
 
-HDFS_SITE_KEY = '{{hdfs-site}}'
+ALERT_SUCCESS_PERCENTAGE = "{{hdfs-alert-config/alert.success.percentage}}"
 
-NN_HTTP_ADDRESS_KEY = '{{hdfs-site/dfs.namenode.http-address}}'
-NN_HTTPS_ADDRESS_KEY = '{{hdfs-site/dfs.namenode.https-address}}'
-NN_HTTP_POLICY_KEY = '{{hdfs-site/dfs.http.policy}}'
-NN_CHECKPOINT_TX_KEY = '{{hdfs-site/dfs.namenode.checkpoint.txns}}'
-NN_CHECKPOINT_PERIOD_KEY = '{{hdfs-site/dfs.namenode.checkpoint.period}}'
+ALERT_TIMEOUT_RETURN_VALUE = "{{hdfs-alert-config/alert.timeout.return.value}}"
+ALERT_TIMEOUT_SECS = "{{hdfs-alert-config/alert.timeout.secs}}"
 
-KERBEROS_KEYTAB = '{{hdfs-site/dfs.web.authentication.kerberos.keytab}}'
-KERBEROS_PRINCIPAL = '{{hdfs-site/dfs.web.authentication.kerberos.principal}}'
-SECURITY_ENABLED_KEY = '{{cluster-env/security_enabled}}'
-SMOKEUSER_KEY = "{{cluster-env/smokeuser}}"
-EXECUTABLE_SEARCH_PATHS = '{{kerberos-env/executable_search_paths}}'
+ALERT_FLIP_INTERVAL_MINS = "{{hdfs-alert-config/alert.flip.interval.mins}}"
 
 logger = logging.getLogger('ambari_alerts')
 
+alert_behaviour_properties = {"alert_behaviour_type" : ALERT_BEHAVIOUR_TYPE, "alert_success_percentage" : ALERT_SUCCESS_PERCENTAGE,
+                              "alert_timeout_return_value" : ALERT_TIMEOUT_RETURN_VALUE, "alert_timeout_secs" : ALERT_TIMEOUT_SECS,
+                              "alert_flip_interval_mins" : ALERT_FLIP_INTERVAL_MINS}
+
 def get_tokens():
   """
   Returns a tuple of tokens in the format {{site/property}} that will be used
   to build the dictionary passed into execute
   """
-  return (HDFS_SITE_KEY, NN_HTTP_ADDRESS_KEY, NN_HTTPS_ADDRESS_KEY, NN_HTTP_POLICY_KEY, EXECUTABLE_SEARCH_PATHS,
-      NN_CHECKPOINT_TX_KEY, NN_CHECKPOINT_PERIOD_KEY, KERBEROS_KEYTAB, KERBEROS_PRINCIPAL, SECURITY_ENABLED_KEY, SMOKEUSER_KEY)
-  
+  return (ALERT_BEHAVIOUR_TYPE, ALERT_SUCCESS_PERCENTAGE, ALERT_TIMEOUT_RETURN_VALUE, ALERT_TIMEOUT_SECS,
+          ALERT_FLIP_INTERVAL_MINS)
+
 
 def execute(configurations={}, parameters={}, host_name=None):
   """
@@ -61,9 +56,4 @@ def execute(configurations={}, parameters={}, host_name=None):
   host_name (string): the name of this host where the alert is running
   """
 
-  if configurations is None:
-    return (('UNKNOWN', ['There were no configurations supplied to the script.']))
-
-  result_code = RESULT_CODE_OK
-  label = OK_MESSAGE
-  return (result_code, [label])
\ No newline at end of file
+  return simulate_perf_cluster_alert_behaviour(alert_behaviour_properties, configurations)
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/ef63373e/ambari-server/src/main/resources/stacks/PERF/1.0/services/HDFS/package/alerts/alert_datanode_unmounted_data_dir.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/PERF/1.0/services/HDFS/package/alerts/alert_datanode_unmounted_data_dir.py b/ambari-server/src/main/resources/stacks/PERF/1.0/services/HDFS/package/alerts/alert_datanode_unmounted_data_dir.py
index 8c122ae..73bc168 100644
--- a/ambari-server/src/main/resources/stacks/PERF/1.0/services/HDFS/package/alerts/alert_datanode_unmounted_data_dir.py
+++ b/ambari-server/src/main/resources/stacks/PERF/1.0/services/HDFS/package/alerts/alert_datanode_unmounted_data_dir.py
@@ -20,24 +20,30 @@ limitations under the License.
 
 import logging
 
-RESULT_STATE_OK = 'OK'
-RESULT_STATE_WARNING = 'WARNING'
-RESULT_STATE_CRITICAL = 'CRITICAL'
-RESULT_STATE_UNKNOWN = 'UNKNOWN'
+from resource_management.libraries.functions.simulate_perf_cluster_alert_behaviour import simulate_perf_cluster_alert_behaviour
 
-OK_MESSAGE = 'Ok'
+ALERT_BEHAVIOUR_TYPE = "{{hdfs-alert-config/alert.behavior.type}}"
 
-DFS_DATA_DIR = '{{hdfs-site/dfs.datanode.data.dir}}'
-DATA_DIR_MOUNT_FILE = "/var/lib/ambari-agent/data/datanode/dfs_data_dir_mount.hist"
+ALERT_SUCCESS_PERCENTAGE = "{{hdfs-alert-config/alert.success.percentage}}"
 
-logger = logging.getLogger()
+ALERT_TIMEOUT_RETURN_VALUE = "{{hdfs-alert-config/alert.timeout.return.value}}"
+ALERT_TIMEOUT_SECS = "{{hdfs-alert-config/alert.timeout.secs}}"
+
+ALERT_FLIP_INTERVAL_MINS = "{{hdfs-alert-config/alert.flip.interval.mins}}"
+
+logger = logging.getLogger('ambari_alerts')
+
+alert_behaviour_properties = {"alert_behaviour_type" : ALERT_BEHAVIOUR_TYPE, "alert_success_percentage" : ALERT_SUCCESS_PERCENTAGE,
+                              "alert_timeout_return_value" : ALERT_TIMEOUT_RETURN_VALUE, "alert_timeout_secs" : ALERT_TIMEOUT_SECS,
+                              "alert_flip_interval_mins" : ALERT_FLIP_INTERVAL_MINS}
 
 def get_tokens():
   """
   Returns a tuple of tokens in the format {{site/property}} that will be used
   to build the dictionary passed into execute
   """
-  return (DFS_DATA_DIR, DATA_DIR_MOUNT_FILE)
+  return (ALERT_BEHAVIOUR_TYPE, ALERT_SUCCESS_PERCENTAGE, ALERT_TIMEOUT_RETURN_VALUE, ALERT_TIMEOUT_SECS,
+          ALERT_FLIP_INTERVAL_MINS)
 
 
 def execute(configurations={}, parameters={}, host_name=None):
@@ -48,27 +54,6 @@ def execute(configurations={}, parameters={}, host_name=None):
   configurations (dictionary): a mapping of configuration key to value
   parameters (dictionary): a mapping of script parameter key to value
   host_name (string): the name of this host where the alert is running
-
-  DataNode directories can be of the following formats and each needs to be supported:
-    /grid/dn/archive0
-    [SSD]/grid/dn/archive0
-    [ARCHIVE]file:///grid/dn/archive0
   """
-  warnings = []
-  errors = []
-
-  if configurations is None:
-    return (RESULT_STATE_UNKNOWN, ['There were no configurations supplied to the script.'])
-
-  # Check required properties
-  if DFS_DATA_DIR not in configurations:
-    return (RESULT_STATE_UNKNOWN, ['{0} is a required parameter for the script'.format(DFS_DATA_DIR)])
-
-  dfs_data_dir = configurations[DFS_DATA_DIR]
-
-  if dfs_data_dir is None:
-    return (RESULT_STATE_UNKNOWN, ['{0} is a required parameter for the script and the value is null'.format(DFS_DATA_DIR)])
 
-  result_code = RESULT_STATE_OK
-  label = OK_MESSAGE
-  return (result_code, [label])
\ No newline at end of file
+  return simulate_perf_cluster_alert_behaviour(alert_behaviour_properties, configurations)
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/ef63373e/ambari-server/src/main/resources/stacks/PERF/1.0/services/HDFS/package/alerts/alert_ha_namenode_health.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/PERF/1.0/services/HDFS/package/alerts/alert_ha_namenode_health.py b/ambari-server/src/main/resources/stacks/PERF/1.0/services/HDFS/package/alerts/alert_ha_namenode_health.py
deleted file mode 100644
index 7f03d88..0000000
--- a/ambari-server/src/main/resources/stacks/PERF/1.0/services/HDFS/package/alerts/alert_ha_namenode_health.py
+++ /dev/null
@@ -1,75 +0,0 @@
-#!/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.
-"""
-
-import logging
-
-RESULT_STATE_OK = 'OK'
-RESULT_STATE_CRITICAL = 'CRITICAL'
-RESULT_STATE_UNKNOWN = 'UNKNOWN'
-RESULT_STATE_SKIPPED = 'SKIPPED'
-
-OK_MESSAGE = 'Ok'
-
-HDFS_SITE_KEY = '{{hdfs-site}}'
-NAMESERVICE_KEY = '{{hdfs-site/dfs.internal.nameservices}}'
-NN_HTTP_ADDRESS_KEY = '{{hdfs-site/dfs.namenode.http-address}}'
-NN_HTTPS_ADDRESS_KEY = '{{hdfs-site/dfs.namenode.https-address}}'
-DFS_POLICY_KEY = '{{hdfs-site/dfs.http.policy}}'
-
-KERBEROS_KEYTAB = '{{hdfs-site/dfs.web.authentication.kerberos.keytab}}'
-KERBEROS_PRINCIPAL = '{{hdfs-site/dfs.web.authentication.kerberos.principal}}'
-SECURITY_ENABLED_KEY = '{{cluster-env/security_enabled}}'
-SMOKEUSER_KEY = '{{cluster-env/smokeuser}}'
-EXECUTABLE_SEARCH_PATHS = '{{kerberos-env/executable_search_paths}}'
-
-logger = logging.getLogger('ambari_alerts')
-
-def get_tokens():
-  """
-  Returns a tuple of tokens in the format {{site/property}} that will be used
-  to build the dictionary passed into execute
-  """
-  return (HDFS_SITE_KEY, NAMESERVICE_KEY, NN_HTTP_ADDRESS_KEY, EXECUTABLE_SEARCH_PATHS,
-  NN_HTTPS_ADDRESS_KEY, DFS_POLICY_KEY, SMOKEUSER_KEY, KERBEROS_KEYTAB, KERBEROS_PRINCIPAL, SECURITY_ENABLED_KEY)
-  
-
-def execute(configurations={}, parameters={}, host_name=None):
-  """
-  Returns a tuple containing the result code and a pre-formatted result label
-
-  Keyword arguments:
-  configurations (dictionary): a mapping of configuration key to value
-  parameters (dictionary): a mapping of script parameter key to value
-  host_name (string): the name of this host where the alert is running
-  """
-  if configurations is None:
-    return (RESULT_STATE_UNKNOWN, ['There were no configurations supplied to the script.'])
-
-  # if not in HA mode, then SKIP
-  if not NAMESERVICE_KEY in configurations:
-    return (RESULT_STATE_SKIPPED, ['NameNode HA is not enabled'])
-
-  # hdfs-site is required
-  if not HDFS_SITE_KEY in configurations:
-    return (RESULT_STATE_UNKNOWN, ['{0} is a required parameter for the script'.format(HDFS_SITE_KEY)])
-
-  result_code = RESULT_STATE_OK
-  label = OK_MESSAGE
-  return (result_code, [label])


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

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


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

Branch: refs/heads/branch-dev-patch-upgrade
Commit: 06327e65e9703830e003f3a6effdfe382e5c8de7
Parents: f70591b 05fe423
Author: Nate Cole <nc...@hortonworks.com>
Authored: Fri Dec 2 15:25:46 2016 -0500
Committer: Nate Cole <nc...@hortonworks.com>
Committed: Fri Dec 2 15:25:46 2016 -0500

----------------------------------------------------------------------
 .../admin-web/app/scripts/services/Cluster.js   |   51 -
 .../app/scripts/services/RoleDetailsModal.js    |   31 +-
 .../app/views/modals/RoleDetailsModal.html      |    6 +-
 .../src/main/python/ambari_agent/ActionQueue.py |   21 +-
 .../ambari_agent/CustomServiceOrchestrator.py   |   11 +-
 .../src/main/python/ambari_agent/FileCache.py   |   12 +-
 .../test/python/ambari_agent/TestActionQueue.py |   48 +
 .../TestCustomServiceOrchestrator.py            |   30 +-
 .../test/python/ambari_agent/TestFileCache.py   |   10 +-
 .../ambari_commons/ambari_metrics_helper.py     |   45 +-
 .../simulate_perf_cluster_alert_behaviour.py    |  108 ++
 .../libraries/script/script.py                  |   15 +-
 .../ambari/logfeeder/mapper/MapperDateTest.java |   56 -
 .../logsearch/common/ExternalServerClient.java  |   12 +-
 .../ambari/logsearch/dao/SolrCollectionDao.java |   64 +-
 .../timeline/AbstractTimelineMetricsSink.java   |    6 +-
 .../AbstractTimelineMetricSinkTest.java         |   10 +-
 .../conf/unix/ambari-metrics-grafana            |    6 +-
 .../timeline/HadoopTimelineMetricsSink.java     |    4 +-
 .../timeline/HadoopTimelineMetricsSinkTest.java |    6 +-
 .../src/main/python/core/config_reader.py       |    9 +-
 .../src/test/python/core/TestEmitter.py         |    2 +-
 ambari-server/conf/unix/ambari.properties       |    4 +-
 ambari-server/conf/windows/ambari.properties    |    2 +
 ambari-server/docs/configuration/index.md       |   33 +-
 .../ambari/server/agent/ExecutionCommand.java   |    1 +
 .../ambari/server/agent/HeartBeatHandler.java   |    2 +-
 .../ambari/server/agent/HeartbeatProcessor.java |    2 +-
 .../server/checks/ServicePresenceCheck.java     |   55 +-
 .../server/configuration/Configuration.java     |   53 +
 .../AmbariManagementControllerImpl.java         |    9 +
 .../controller/internal/CalculatedStatus.java   |   52 +-
 .../internal/RequestResourceProvider.java       |   34 +-
 .../internal/StageResourceProvider.java         |    2 +-
 .../internal/UpgradeResourceProvider.java       |   24 +-
 .../orm/AmbariJpaLocalTxnInterceptor.java       |    9 +-
 .../security/AbstractSecurityHeaderFilter.java  |   14 +
 .../AmbariServerSecurityHeaderFilter.java       |    1 +
 .../AmbariViewsSecurityHeaderFilter.java        |    1 +
 .../kerberos/MITKerberosOperationHandler.java   |   22 +-
 .../ambari/server/state/ComponentInfo.java      |   14 +
 .../ambari/server/state/quicklinks/Link.java    |   21 +
 .../services/RetryUpgradeActionService.java     |    2 +-
 .../stack/upgrade/ConfigurationCondition.java   |   72 +-
 .../server/upgrade/UpgradeCatalog211.java       |   24 +-
 .../server/upgrade/UpgradeCatalog250.java       |   58 +
 .../ambari/server/utils/RequestUtils.java       |   10 +
 .../ambari/server/utils/ShellCommandUtil.java   |   11 +-
 ambari-server/src/main/python/ambari-server.py  |   12 +-
 .../python/ambari_server/serverConfiguration.py |   14 +-
 .../main/python/ambari_server/serverUtils.py    |   11 +
 .../src/main/python/ambari_server/utils.py      |   81 +-
 .../src/main/python/ambari_server_main.py       |   70 +-
 .../main/resources/Ambari-DDL-MySQL-CREATE.sql  |   11 +-
 .../1.6.1.2.2.0/package/scripts/params.py       |    2 +-
 .../AMBARI_METRICS/0.1.0/metainfo.xml           |    1 +
 .../0.1.0/package/scripts/params.py             |    2 +-
 .../0.1.0/package/scripts/service_check.py      |    2 +-
 .../package/scripts/metadata_server.py          |   18 +
 .../FLUME/1.4.0.2.0/package/scripts/params.py   |    2 +-
 .../0.96.0.2.0/package/scripts/params_linux.py  |    2 +-
 .../package/alerts/alert_metrics_deviation.py   |    2 +-
 .../KAFKA/0.8.1/package/scripts/params.py       |    2 +-
 .../RANGER/0.4.0/package/scripts/params.py      |   14 +
 .../0.4.0/package/scripts/setup_ranger_xml.py   |   21 +
 .../common-services/RANGER/0.6.0/metainfo.xml   |    2 +
 .../STORM/0.9.1/package/scripts/params_linux.py |    2 +-
 .../2.1.0.2.0/package/scripts/service_check.py  |   66 +-
 .../ZOOKEEPER/3.4.6/metainfo.xml                |    2 +-
 .../custom_actions/scripts/install_packages.py  |    2 +-
 .../src/main/resources/scripts/stack_advisor.py |   11 +-
 .../HDP/2.0.6/configuration/cluster-env.xml     |   10 +
 .../2.0.6/hooks/before-START/scripts/params.py  |    2 +-
 .../stacks/HDP/2.0.6/services/stack_advisor.py  |   47 +-
 .../stacks/HDP/2.1/services/stack_advisor.py    |   20 +-
 .../stacks/HDP/2.2/services/stack_advisor.py    |    7 +
 .../HDP/2.3/upgrades/nonrolling-upgrade-2.3.xml |   27 +-
 .../HDP/2.3/upgrades/nonrolling-upgrade-2.4.xml |   27 +-
 .../HDP/2.3/upgrades/nonrolling-upgrade-2.5.xml |   32 +-
 .../HDP/2.3/upgrades/nonrolling-upgrade-2.6.xml |   32 +-
 .../stacks/HDP/2.3/upgrades/upgrade-2.5.xml     |    5 +-
 .../stacks/HDP/2.3/upgrades/upgrade-2.6.xml     |    5 +-
 .../HDP/2.4/upgrades/nonrolling-upgrade-2.4.xml |   27 +-
 .../HDP/2.4/upgrades/nonrolling-upgrade-2.5.xml |   32 +-
 .../HDP/2.4/upgrades/nonrolling-upgrade-2.6.xml |   32 +-
 .../stacks/HDP/2.4/upgrades/upgrade-2.5.xml     |    5 +-
 .../stacks/HDP/2.4/upgrades/upgrade-2.6.xml     |    5 +-
 .../stacks/HDP/2.5/services/KNOX/metainfo.xml   |    4 -
 .../stacks/HDP/2.5/services/OOZIE/metainfo.xml  |    4 +
 .../stacks/HDP/2.5/upgrades/config-upgrade.xml  |   12 +
 .../HDP/2.5/upgrades/host-ordered-upgrade.xml   |   11 +-
 .../HDP/2.5/upgrades/nonrolling-upgrade-2.5.xml |   27 +-
 .../HDP/2.5/upgrades/nonrolling-upgrade-2.6.xml |   31 +-
 .../stacks/HDP/2.5/upgrades/upgrade-2.6.xml     |    3 +
 .../configuration/hive-interactive-site.xml     |   58 +
 .../HIVE/configuration/tez-interactive-site.xml |   78 +
 .../HDP/2.6/upgrades/nonrolling-upgrade-2.6.xml |   27 +-
 .../2.1/hooks/before-START/scripts/params.py    |    4 +-
 .../stacks/PERF/1.0/services/HAPPY/alerts.json  |   20 +
 .../HAPPY/configuration/happy-alert-config.xml  |   75 +
 .../stacks/PERF/1.0/services/HAPPY/metainfo.xml |    5 +
 .../HAPPY/package/alerts/alert_happy_process.py |   59 +
 .../stacks/PERF/1.0/services/HBASE/alerts.json  |  110 +-
 .../HBASE/configuration/hbase-alert-config.xml  |   75 +
 .../stacks/PERF/1.0/services/HBASE/metainfo.xml |    1 +
 .../package/alerts/hbase_master_process.py      |   59 +
 .../alerts/hbase_regionserver_process.py        |   59 +
 .../stacks/PERF/1.0/services/HDFS/alerts.json   | 1728 +-----------------
 .../HDFS/configuration/hdfs-alert-config.xml    |   75 +
 .../stacks/PERF/1.0/services/HDFS/metainfo.xml  |    1 +
 .../package/alerts/alert_checkpoint_time.py     |   38 +-
 .../alerts/alert_datanode_unmounted_data_dir.py |   47 +-
 .../package/alerts/alert_ha_namenode_health.py  |   75 -
 .../package/alerts/alert_metrics_deviation.py   |   85 -
 .../package/alerts/alert_nfs_gateway_process.py |   59 +
 .../package/alerts/alert_snamenode_process.py   |   59 +
 .../package/alerts/alert_upgrade_finalized.py   |   49 +-
 .../stacks/PERF/1.0/services/SLEEPY/alerts.json |   20 +
 .../configuration/sleepy-alert-config.xml       |   75 +
 .../PERF/1.0/services/SLEEPY/metainfo.xml       |    5 +
 .../package/alerts/alert_sleepy_process.py      |   59 +
 .../stacks/PERF/1.0/services/SNOW/alerts.json   |   20 +
 .../SNOW/configuration/snow-alert-config.xml    |   75 +
 .../stacks/PERF/1.0/services/SNOW/metainfo.xml  |    5 +
 .../SNOW/package/alerts/alert_snow_process.py   |   59 +
 .../stacks/PERF/1.0/services/YARN/alerts.json   |  361 +---
 .../YARN/configuration/yarn-alert-config.xml    |   75 +
 .../stacks/PERF/1.0/services/YARN/metainfo.xml  |    3 +
 .../package/alerts/alert_history_process.py     |   59 +
 .../package/alerts/alert_nodemanager_health.py  |   36 +-
 .../alerts/alert_nodemanagers_summary.py        |   68 -
 .../alerts/alert_resourcemanager_process.py     |   59 +
 .../package/alerts/alert_timeline_process.py    |   59 +
 .../PERF/1.0/services/ZOOKEEPER/alerts.json     |   20 +
 .../ZOOKEEPER/configuration/zk-alert-config.xml |   75 +
 .../PERF/1.0/services/ZOOKEEPER/metainfo.xml    |    4 +
 .../package/alerts/alert_zk_server_process.py   |   59 +
 .../src/main/resources/stacks/stack_advisor.py  |  209 ++-
 .../src/main/resources/upgrade-pack.xsd         |    8 +-
 .../AmbariManagementControllerTest.java         |    9 +
 .../internal/CalculatedStatusTest.java          |   31 +
 .../internal/RequestResourceProviderTest.java   |   12 +-
 .../internal/UpgradeResourceProviderTest.java   |    4 +-
 .../orm/AmbariJpaLocalTxnInterceptorTest.java   |  155 ++
 .../server/orm/InMemoryDefaultTestModule.java   |    5 +
 .../AbstractSecurityHeaderFilterTest.java       |   29 +-
 .../MITKerberosOperationHandlerTest.java        |   23 +
 .../QuickLinksConfigurationModuleTest.java      |   36 +
 .../server/upgrade/UpgradeCatalog250Test.java   |   20 +-
 .../ambari/server/utils/RequestUtilsTest.java   |   18 +
 .../server/utils/TestShellCommandUtil.java      |   13 +-
 .../src/test/python/TestAmbariServer.py         |    6 +-
 ambari-server/src/test/python/TestMpacks.py     |  102 +-
 ambari-server/src/test/python/TestUtils.py      |   37 +-
 .../2.0.6/YARN/test_yarn_service_check.py       |  111 +-
 .../stacks/2.0.6/common/test_stack_advisor.py   |   16 +-
 .../stacks/2.1/common/test_stack_advisor.py     |    2 +
 .../stacks/2.2/common/test_stack_advisor.py     |   17 +-
 .../stacks/2.3/ATLAS/test_metadata_server.py    |    5 +-
 .../test/python/stacks/test_stack_adviser.py    |  239 +++
 .../child_quicklinks_with_properties.json       |   64 +
 .../src/test/resources/dashboards/README.txt    |   18 +
 .../parent_quicklinks_with_properties.json      |   65 +
 .../stacks/HDP/0.1/services/HDFS/metainfo.xml   |    1 +
 .../admin/stack_upgrade_history_controller.js   |    2 +-
 .../controllers/main/service/info/configs.js    |    2 +-
 .../controllers/main/service/info/summary.js    |   37 +-
 ambari-web/app/controllers/main/service/item.js |   49 +-
 .../main/service/reassign/step4_controller.js   |   19 +-
 .../app/controllers/wizard/step6_controller.js  |   58 +-
 .../app/controllers/wizard/step7_controller.js  |    2 +-
 .../app/mappers/stack_upgrade_history_mapper.js |    2 +-
 ambari-web/app/messages.js                      |   13 +-
 ambari-web/app/mixins.js                        |    1 -
 .../mixins/main/dashboard/widgets/editable.js   |   47 +-
 .../app/mixins/main/service/groups_mapping.js   |    2 +-
 .../stack_version/stack_upgrade_history.js      |    2 +-
 ambari-web/app/styles/stack_versions.less       |   16 +-
 .../highAvailability/journalNode/step2.hbs      |    2 +
 .../templates/main/admin/service_auto_start.hbs |   24 +-
 .../main/dashboard/edit_widget_popup.hbs        |    4 +-
 .../edit_widget_popup_single_threshold.hbs      |    2 +-
 .../main/dashboard/plus_button_filter.hbs       |    2 +-
 .../app/templates/main/dashboard/widgets.hbs    |    8 +-
 .../main/dashboard/widgets/pie_chart.hbs        |    5 +-
 .../info/delete_service_warning_popup.hbs       |   28 +
 .../main/service/info/service_alert_popup.hbs   |   15 +-
 ambari-web/app/templates/wizard/step1.hbs       |    2 +-
 .../app/utils/configs/config_initializer.js     |   28 +-
 .../mount_points_based_initializer_mixin.js     |  340 ----
 .../app/views/common/not-scrollable-textarea.js |    2 +-
 ambari-web/app/views/main/admin.js              |    3 +-
 .../app/views/main/admin/service_auto_start.js  |    5 +
 .../service_auto_start/component_auto_start.js  |    1 +
 .../upgrade_history_details_view.js             |    2 +-
 .../admin/stack_upgrade/upgrade_history_view.js |  120 +-
 ambari-web/app/views/main/dashboard/widget.js   |  159 +-
 ambari-web/app/views/main/dashboard/widgets.js  |  824 ++++-----
 .../main/dashboard/widgets/datanode_live.js     |    7 -
 .../main/dashboard/widgets/flume_agent_live.js  |    7 -
 .../main/dashboard/widgets/hawqsegment_live.js  |    7 -
 .../dashboard/widgets/hbase_average_load.js     |   11 +-
 .../views/main/dashboard/widgets/hbase_links.js |    4 -
 .../main/dashboard/widgets/hbase_master_heap.js |    4 -
 .../dashboard/widgets/hbase_master_uptime.js    |    5 -
 .../widgets/hbase_regions_in_transition.js      |   10 +-
 .../main/dashboard/widgets/hdfs_capacity.js     |    4 -
 .../views/main/dashboard/widgets/hdfs_links.js  |    4 -
 .../views/main/dashboard/widgets/metrics_cpu.js |    3 -
 .../main/dashboard/widgets/metrics_load.js      |    3 -
 .../main/dashboard/widgets/metrics_memory.js    |    3 -
 .../main/dashboard/widgets/metrics_network.js   |    3 -
 .../main/dashboard/widgets/namenode_cpu.js      |    4 -
 .../main/dashboard/widgets/namenode_heap.js     |    4 -
 .../main/dashboard/widgets/namenode_rpc.js      |   10 +-
 .../main/dashboard/widgets/namenode_uptime.js   |    5 -
 .../dashboard/widgets/node_managers_live.js     |    7 -
 .../main/dashboard/widgets/pie_chart_widget.js  |   16 +-
 .../views/main/dashboard/widgets/pxf_live.js    |    6 -
 .../dashboard/widgets/resource_manager_heap.js  |    4 -
 .../widgets/resource_manager_uptime.js          |    5 -
 .../main/dashboard/widgets/supervisor_live.js   |    7 -
 .../views/main/dashboard/widgets/text_widget.js |    4 +-
 .../widgets/text_widget_single_threshold.js     |    6 +-
 .../dashboard/widgets/uptime_text_widget.js     |    2 -
 .../views/main/dashboard/widgets/yarn_links.js  |    4 -
 .../views/main/dashboard/widgets/yarn_memory.js |    4 -
 ambari-web/app/views/wizard/step1_view.js       |    7 +
 .../test/controllers/main/service/item_test.js  |   13 +-
 .../service/reassign/step4_controller_test.js   |    2 +-
 .../test/controllers/wizard/step6_test.js       |    6 +-
 ambari-web/test/utils/ajax/ajax_test.js         |    9 +-
 .../utils/configs/config_initializer_test.js    |  457 -----
 .../test/views/main/dashboard/widget_test.js    |  200 +-
 .../widgets/hbase_average_load_test.js          |    4 +-
 .../widgets/hbase_regions_in_transition_test.js |    6 +-
 .../main/dashboard/widgets/namenode_rpc_test.js |   13 +-
 .../text_widget_single_threshold_test.js        |   10 +-
 .../main/dashboard/widgets/text_widget_test.js  |   10 +-
 .../widgets/uptime_text_widget_test.js          |    2 +-
 .../test/views/main/dashboard/widgets_test.js   |  669 +++----
 contrib/utils/perf/deploy-gce-perf-cluster.py   |  243 ++-
 .../src/main/resources/ui/app/app.js            |   14 +-
 .../src/main/resources/ui/pig-web/app/app.js    |   14 +-
 contrib/views/pom.xml                           |    1 -
 .../resources/ui/app/components/job-details.js  |    3 +
 contrib/views/zeppelin/pom.xml                  |  190 --
 .../view/zeppelin/ZeppelinServiceCheck.java     |   55 -
 .../ambari/view/zeppelin/ZeppelinServlet.java   |  113 --
 .../zeppelin/src/main/resources/WEB-INF/web.xml |   40 -
 .../src/main/resources/view.log4j.properties    |   27 -
 .../views/zeppelin/src/main/resources/view.xml  |   48 -
 docs/pom.xml                                    |    4 +-
 253 files changed, 5213 insertions(+), 6089 deletions(-)
----------------------------------------------------------------------


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


[20/50] [abbrv] ambari git commit: AMBARI-19043 : CAPACITY-SCHEDULER & PIG View not loading for Ambari-2.5.0 (Akhil PB via nitirajrathore)

Posted by nc...@apache.org.
AMBARI-19043 : CAPACITY-SCHEDULER & PIG View not loading for Ambari-2.5.0 (Akhil PB via nitirajrathore)


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

Branch: refs/heads/branch-dev-patch-upgrade
Commit: 7c07dd3595068b4e9a58db0fd2d6a8415898261c
Parents: 4b38791
Author: Nitiraj Rathore <ni...@gmail.com>
Authored: Thu Dec 1 17:46:00 2016 +0530
Committer: Nitiraj Rathore <ni...@gmail.com>
Committed: Thu Dec 1 17:46:00 2016 +0530

----------------------------------------------------------------------
 .../src/main/resources/ui/app/app.js                  | 14 +++++++++++++-
 .../pig/src/main/resources/ui/pig-web/app/app.js      | 14 +++++++++++++-
 2 files changed, 26 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/7c07dd35/contrib/views/capacity-scheduler/src/main/resources/ui/app/app.js
----------------------------------------------------------------------
diff --git a/contrib/views/capacity-scheduler/src/main/resources/ui/app/app.js b/contrib/views/capacity-scheduler/src/main/resources/ui/app/app.js
index fa1e05a..5854a09 100644
--- a/contrib/views/capacity-scheduler/src/main/resources/ui/app/app.js
+++ b/contrib/views/capacity-scheduler/src/main/resources/ui/app/app.js
@@ -53,4 +53,16 @@ Ember.Application.initializer({
   }
 });
 
-module.exports = Em.Application.create();
+module.exports = Em.Application.create({
+  Resolver: Ember.DefaultResolver.extend({
+    resolveTemplate: function(parsedName) {
+      var resolvedTemplate = this._super(parsedName);
+      var templateName = 'templates/' + parsedName.fullNameWithoutType.replace(/\./g, '/');
+      if (resolvedTemplate) {
+        return resolvedTemplate;
+      } else {
+        return Ember.TEMPLATES[templateName];
+      }
+    }
+  })
+});

http://git-wip-us.apache.org/repos/asf/ambari/blob/7c07dd35/contrib/views/pig/src/main/resources/ui/pig-web/app/app.js
----------------------------------------------------------------------
diff --git a/contrib/views/pig/src/main/resources/ui/pig-web/app/app.js b/contrib/views/pig/src/main/resources/ui/pig-web/app/app.js
index 866b8a7..c683f72 100644
--- a/contrib/views/pig/src/main/resources/ui/pig-web/app/app.js
+++ b/contrib/views/pig/src/main/resources/ui/pig-web/app/app.js
@@ -35,5 +35,17 @@ module.exports = Em.Application.create({
     }
     var namespaceUrl = 'api/v1/views' + view + version + '/instances' + instance;
     return namespaceUrl;
-  }
+  },
+
+  Resolver: Ember.DefaultResolver.extend({
+    resolveTemplate: function(parsedName) {
+      var resolvedTemplate = this._super(parsedName);
+      var templateName = 'templates/' + parsedName.fullNameWithoutType.replace(/\./g, '/');
+      if (resolvedTemplate) {
+        return resolvedTemplate;
+      } else {
+        return Ember.TEMPLATES[templateName];
+      }
+    }
+  })
 });


[38/50] [abbrv] ambari git commit: AMBARI-19063. Do not change timeline.metrics.service.webapp.address in move wizard (akovalenko)

Posted by nc...@apache.org.
AMBARI-19063. Do not change timeline.metrics.service.webapp.address in move wizard (akovalenko)


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

Branch: refs/heads/branch-dev-patch-upgrade
Commit: e242fc091abe15bc59e8572c43d9227c97e7a247
Parents: 2de7ee8
Author: Aleksandr Kovalenko <ak...@hortonworks.com>
Authored: Fri Dec 2 15:43:15 2016 +0200
Committer: Aleksandr Kovalenko <ak...@hortonworks.com>
Committed: Fri Dec 2 15:44:42 2016 +0200

----------------------------------------------------------------------
 .../main/service/reassign/step4_controller.js    | 19 ++++++++++---------
 .../service/reassign/step4_controller_test.js    |  2 +-
 2 files changed, 11 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/e242fc09/ambari-web/app/controllers/main/service/reassign/step4_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/service/reassign/step4_controller.js b/ambari-web/app/controllers/main/service/reassign/step4_controller.js
index 26ac68c..64c2a8e 100644
--- a/ambari-web/app/controllers/main/service/reassign/step4_controller.js
+++ b/ambari-web/app/controllers/main/service/reassign/step4_controller.js
@@ -71,6 +71,12 @@ App.ReassignMasterWizardStep4Controller = App.HighAvailabilityProgressPageContro
   hostComponents: [],
 
   /**
+   * List of components, that do not need reconfiguration for moving to another host
+   * Reconfigure command will be skipped
+   */
+  componentsWithoutReconfiguration: ['METRICS_COLLECTOR'],
+
+  /**
    * Map with lists of related services.
    * Used to define list of services to stop/start.
    */
@@ -189,14 +195,6 @@ App.ReassignMasterWizardStep4Controller = App.HighAvailabilityProgressPageContro
       }
     },
     {
-      componentName: 'METRICS_COLLECTOR',
-      configs: {
-        'ams-site': {
-          'timeline.metrics.service.webapp.address': '<replace-value>:6188'
-        }
-      }
-    },
-    {
       componentName: 'HISTORYSERVER',
       configs: {
         'mapred-site': {
@@ -398,6 +396,10 @@ App.ReassignMasterWizardStep4Controller = App.HighAvailabilityProgressPageContro
       this.removeTasks(['startZooKeeperServers', 'startNameNode']);
     }
 
+    if (this.get('componentsWithoutReconfiguration').contains(componentName)) {
+      this.removeTasks(['reconfigure']);
+    }
+
     if (!this.get('content.reassignComponentsInMM.length')) {
       this.removeTasks(['stopHostComponentsInMaintenanceMode']);
     }
@@ -542,7 +544,6 @@ App.ReassignMasterWizardStep4Controller = App.HighAvailabilityProgressPageContro
     'HIVE_SERVER': ['hive-site', 'webhcat-site', 'hive-env', 'core-site'],
     'HIVE_METASTORE': ['hive-site', 'webhcat-site', 'hive-env', 'core-site'],
     'MYSQL_SERVER': ['hive-site'],
-    'METRICS_COLLECTOR': ['ams-site'],
     'HISTORYSERVER': ['mapred-site']
   },
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/e242fc09/ambari-web/test/controllers/main/service/reassign/step4_controller_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/main/service/reassign/step4_controller_test.js b/ambari-web/test/controllers/main/service/reassign/step4_controller_test.js
index 5e7b0e3..9a73524 100644
--- a/ambari-web/test/controllers/main/service/reassign/step4_controller_test.js
+++ b/ambari-web/test/controllers/main/service/reassign/step4_controller_test.js
@@ -295,7 +295,7 @@ describe('App.ReassignMasterWizardStep4Controller', function () {
 
       controller.set('tasks', commandsForDB);
       controller.removeUnneededTasks();
-      expect(controller.get('tasks').mapProperty('id')).to.eql([1,2,5,6,8,9,10,12]);
+      expect(controller.get('tasks').mapProperty('id')).to.eql([1,2,5,6,8,10,12]);
     });
 
     it('reassign component is Mysql Server', function () {


[29/50] [abbrv] ambari git commit: AMBARI-19006. EU to message users to start YARN queues if work preserving recovery is disabled (alejandro)

Posted by nc...@apache.org.
AMBARI-19006. EU to message users to start YARN queues if work preserving recovery is disabled (alejandro)


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

Branch: refs/heads/branch-dev-patch-upgrade
Commit: 63938e09ca9e79ee541dd51104964322192e293f
Parents: 88e0c29
Author: Alejandro Fernandez <af...@hortonworks.com>
Authored: Mon Nov 28 18:05:41 2016 -0800
Committer: Alejandro Fernandez <af...@hortonworks.com>
Committed: Thu Dec 1 09:55:33 2016 -0800

----------------------------------------------------------------------
 .../stack/upgrade/ConfigurationCondition.java   | 72 +++++++++++++++++---
 .../HDP/2.3/upgrades/nonrolling-upgrade-2.3.xml | 27 +++++---
 .../HDP/2.3/upgrades/nonrolling-upgrade-2.4.xml | 27 +++++---
 .../HDP/2.3/upgrades/nonrolling-upgrade-2.5.xml | 27 +++++---
 .../HDP/2.3/upgrades/nonrolling-upgrade-2.6.xml | 27 +++++---
 .../HDP/2.4/upgrades/nonrolling-upgrade-2.4.xml | 27 +++++---
 .../HDP/2.4/upgrades/nonrolling-upgrade-2.5.xml | 27 +++++---
 .../HDP/2.4/upgrades/nonrolling-upgrade-2.6.xml | 27 +++++---
 .../HDP/2.5/upgrades/nonrolling-upgrade-2.5.xml | 27 +++++---
 .../HDP/2.5/upgrades/nonrolling-upgrade-2.6.xml | 27 +++++---
 .../HDP/2.6/upgrades/nonrolling-upgrade-2.6.xml | 27 +++++---
 .../src/main/resources/upgrade-pack.xsd         |  8 ++-
 12 files changed, 231 insertions(+), 119 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/63938e09/ambari-server/src/main/java/org/apache/ambari/server/state/stack/upgrade/ConfigurationCondition.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/state/stack/upgrade/ConfigurationCondition.java b/ambari-server/src/main/java/org/apache/ambari/server/state/stack/upgrade/ConfigurationCondition.java
index 1bd88e4..d229270 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/state/stack/upgrade/ConfigurationCondition.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/state/stack/upgrade/ConfigurationCondition.java
@@ -52,7 +52,37 @@ public final class ConfigurationCondition extends Condition {
      * Equals comparison.
      */
     @XmlEnumValue("equals")
-    EQUALS;
+    EQUALS,
+
+    /**
+     * Not equals comparison.
+     */
+    @XmlEnumValue("not-equals")
+    NOT_EQUALS,
+
+    /**
+     * String contains.
+     */
+    @XmlEnumValue("contains")
+    CONTAINS,
+
+    /**
+     * Does not contain.
+     */
+    @XmlEnumValue("not-contains")
+    NOT_CONTAINS,
+
+    /**
+     * Exists with any value.
+     */
+    @XmlEnumValue("exists")
+    EXISTS,
+
+    /**
+     * Does not exist.
+     */
+    @XmlEnumValue("not-exists")
+    NOT_EXISTS;
   }
 
   /**
@@ -68,12 +98,18 @@ public final class ConfigurationCondition extends Condition {
   public String property;
 
   /**
-   * The value to compare against.
+   * The value to compare against; only valid if comparison type is in (=, !=, contains, !contains).
    */
   @XmlAttribute(name = "value")
   public String value;
 
   /**
+   * The value to return if comparison type is in (=, !=, contains, !contains) and the config is missing.
+   */
+  @XmlAttribute(name = "return_value_if_config_missing")
+  public boolean returnValueIfConfigMissing;
+
+  /**
    * The type of comparison to make.
    */
   @XmlAttribute(name = "comparison")
@@ -84,7 +120,7 @@ public final class ConfigurationCondition extends Condition {
    */
   @Override
   public String toString() {
-    return Objects.toStringHelper(this).add("type", type).add("property", property).add(value,
+    return Objects.toStringHelper(this).add("type", type).add("property", property).add("value",
         value).add("comparison", comparisonType).omitNullValues().toString();
   }
 
@@ -94,20 +130,40 @@ public final class ConfigurationCondition extends Condition {
   @Override
   public boolean isSatisfied(UpgradeContext upgradeContext) {
     Cluster cluster = upgradeContext.getCluster();
+
+    boolean propertyExists = false;
     Config config = cluster.getDesiredConfigByType(type);
-    if (null == config) {
-      return false;
+    Map<String, String> properties = null;
+    if (null != config) {
+      properties = config.getProperties();
+      if (properties.containsKey(property)) {
+        propertyExists = true;
+      }
+    }
+
+    if (comparisonType == ComparisonType.EXISTS) {
+      return propertyExists;
+    }
+    if (comparisonType == ComparisonType.NOT_EXISTS) {
+      return !propertyExists;
     }
 
-    Map<String, String> properties = config.getProperties();
-    if (MapUtils.isEmpty(properties)) {
-      return false;
+    // If property doesn't exist, we cannot make any claims using =, !=, contains !contains.
+    // Therefore, check if the Upgrade Pack provided a default return value when the config is missing.
+    if (!propertyExists) {
+      return returnValueIfConfigMissing;
     }
 
     String propertyValue = properties.get(property);
     switch (comparisonType) {
       case EQUALS:
         return StringUtils.equals(propertyValue, value);
+      case NOT_EQUALS:
+        return !StringUtils.equals(propertyValue, value);
+      case CONTAINS:
+        return StringUtils.contains(propertyValue, value);
+      case NOT_CONTAINS:
+        return !StringUtils.contains(propertyValue, value);
       default:
         return false;
     }

http://git-wip-us.apache.org/repos/asf/ambari/blob/63938e09/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/nonrolling-upgrade-2.3.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/nonrolling-upgrade-2.3.xml b/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/nonrolling-upgrade-2.3.xml
index d824309..d274135 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/nonrolling-upgrade-2.3.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/nonrolling-upgrade-2.3.xml
@@ -36,8 +36,9 @@
       <supports-auto-skip-failure>false</supports-auto-skip-failure>
 
       <execute-stage service="YARN" component="RESOURCEMANAGER" title="Stop YARN Queues">
+        <condition xsi:type="config" type="yarn-site" property="yarn.resourcemanager.work-preserving-recovery.enabled" value="true" comparison="not-equals"/>
         <task xsi:type="manual">
-          <message>Before continuing, please stop all YARN queues. If yarn-site's yarn.resourcemanager.work-preserving-recovery.enabled is set to true, then you can skip this step since the clients will retry on their own.</message>
+          <message>Before continuing, please stop all YARN queues.</message>
         </task>
       </execute-stage>
 
@@ -416,6 +417,20 @@
       </service>
     </group>
 
+    <group xsi:type="cluster" name="START_YARN_QUEUES" title="Start YARN Queues">
+      <direction>UPGRADE</direction>
+      <service-check>false</service-check>
+      <skippable>true</skippable>
+      <parallel-scheduler/>
+
+      <execute-stage service="YARN" component="RESOURCEMANAGER" title="Start YARN Queues">
+        <condition xsi:type="config" type="yarn-site" property="yarn.resourcemanager.work-preserving-recovery.enabled" value="true" comparison="not-equals"/>
+        <task xsi:type="manual">
+          <message>Before continuing, please start all YARN queues.</message>
+        </task>
+      </execute-stage>
+    </group>
+
     <group xsi:type="restart" name="HBASE" title="HBASE">
       <service-check>false</service-check>
       <skippable>true</skippable>
@@ -633,16 +648,6 @@
       </execute-stage>
     </group>
 
-    <group xsi:type="cluster" name="MANUAL_STEPS" title="Finishing Upgrade">
-      <direction>UPGRADE</direction>
-
-      <execute-stage service="YARN" component="RESOURCEMANAGER" title="Start YARN Queues">
-        <task xsi:type="manual">
-          <message>Please start previously stopped YARN queues. If yarn-site's yarn.resourcemanager.work-preserving-recovery.enabled is set to true, then you can skip this step since the clients will retry on their own.</message>
-        </task>
-      </execute-stage>
-    </group>
-
     <group xsi:type="cluster" name="POST_CLUSTER" title="Finalize {{direction.text.proper}}">
       <skippable>true</skippable>
       <supports-auto-skip-failure>false</supports-auto-skip-failure>

http://git-wip-us.apache.org/repos/asf/ambari/blob/63938e09/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/nonrolling-upgrade-2.4.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/nonrolling-upgrade-2.4.xml b/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/nonrolling-upgrade-2.4.xml
index 882e78b..8c9414a 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/nonrolling-upgrade-2.4.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/nonrolling-upgrade-2.4.xml
@@ -36,8 +36,9 @@
       <supports-auto-skip-failure>false</supports-auto-skip-failure>
 
       <execute-stage service="YARN" component="RESOURCEMANAGER" title="Stop YARN Queues">
+        <condition xsi:type="config" type="yarn-site" property="yarn.resourcemanager.work-preserving-recovery.enabled" value="true" comparison="not-equals"/>
         <task xsi:type="manual">
-          <message>Before continuing, please stop all YARN queues. If yarn-site's yarn.resourcemanager.work-preserving-recovery.enabled is set to true, then you can skip this step since the clients will retry on their own.</message>
+          <message>Before continuing, please stop all YARN queues.</message>
         </task>
       </execute-stage>
 
@@ -467,6 +468,20 @@
       </service>
     </group>
 
+    <group xsi:type="cluster" name="START_YARN_QUEUES" title="Start YARN Queues">
+      <direction>UPGRADE</direction>
+      <service-check>false</service-check>
+      <skippable>true</skippable>
+      <parallel-scheduler/>
+
+      <execute-stage service="YARN" component="RESOURCEMANAGER" title="Start YARN Queues">
+        <condition xsi:type="config" type="yarn-site" property="yarn.resourcemanager.work-preserving-recovery.enabled" value="true" comparison="not-equals"/>
+        <task xsi:type="manual">
+          <message>Before continuing, please start all YARN queues.</message>
+        </task>
+      </execute-stage>
+    </group>
+
     <group xsi:type="restart" name="HBASE" title="HBASE">
       <service-check>false</service-check>
       <skippable>true</skippable>
@@ -684,16 +699,6 @@
       </execute-stage>
     </group>
 
-    <group xsi:type="cluster" name="MANUAL_STEPS" title="Finishing Upgrade">
-      <direction>UPGRADE</direction>
-
-      <execute-stage service="YARN" component="RESOURCEMANAGER" title="Start YARN Queues">
-        <task xsi:type="manual">
-          <message>Please start previously stopped YARN queues. If yarn-site's yarn.resourcemanager.work-preserving-recovery.enabled is set to true, then you can skip this step since the clients will retry on their own.</message>
-        </task>
-      </execute-stage>
-    </group>
-
     <group xsi:type="cluster" name="POST_CLUSTER" title="Finalize {{direction.text.proper}}">
       <skippable>true</skippable>
       <supports-auto-skip-failure>false</supports-auto-skip-failure>

http://git-wip-us.apache.org/repos/asf/ambari/blob/63938e09/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/nonrolling-upgrade-2.5.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/nonrolling-upgrade-2.5.xml b/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/nonrolling-upgrade-2.5.xml
index 24b90b2..37a46d0 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/nonrolling-upgrade-2.5.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/nonrolling-upgrade-2.5.xml
@@ -47,8 +47,9 @@
       <supports-auto-skip-failure>false</supports-auto-skip-failure>
 
       <execute-stage service="YARN" component="RESOURCEMANAGER" title="Stop YARN Queues">
+        <condition xsi:type="config" type="yarn-site" property="yarn.resourcemanager.work-preserving-recovery.enabled" value="true" comparison="not-equals"/>
         <task xsi:type="manual">
-          <message>Before continuing, please stop all YARN queues. If yarn-site's yarn.resourcemanager.work-preserving-recovery.enabled is set to true, then you can skip this step since the clients will retry on their own.</message>
+          <message>Before continuing, please stop all YARN queues.</message>
         </task>
       </execute-stage>
 
@@ -611,6 +612,20 @@
       </service>
     </group>
 
+    <group xsi:type="cluster" name="START_YARN_QUEUES" title="Start YARN Queues">
+      <direction>UPGRADE</direction>
+      <service-check>false</service-check>
+      <skippable>true</skippable>
+      <parallel-scheduler/>
+
+      <execute-stage service="YARN" component="RESOURCEMANAGER" title="Start YARN Queues">
+        <condition xsi:type="config" type="yarn-site" property="yarn.resourcemanager.work-preserving-recovery.enabled" value="true" comparison="not-equals"/>
+        <task xsi:type="manual">
+          <message>Before continuing, please start all YARN queues.</message>
+        </task>
+      </execute-stage>
+    </group>
+
     <group xsi:type="restart" name="HBASE" title="HBASE">
       <service-check>false</service-check>
       <skippable>true</skippable>
@@ -828,16 +843,6 @@
       </execute-stage>
     </group>
 
-    <group xsi:type="cluster" name="MANUAL_STEPS" title="Finishing Upgrade">
-      <direction>UPGRADE</direction>
-
-      <execute-stage service="YARN" component="RESOURCEMANAGER" title="Start YARN Queues">
-        <task xsi:type="manual">
-          <message>Please start previously stopped YARN queues. If yarn-site's yarn.resourcemanager.work-preserving-recovery.enabled is set to true, then you can skip this step since the clients will retry on their own.</message>
-        </task>
-      </execute-stage>
-    </group>
-
     <group xsi:type="cluster" name="POST_CLUSTER" title="Finalize {{direction.text.proper}}">
       <skippable>true</skippable>
       <supports-auto-skip-failure>false</supports-auto-skip-failure>

http://git-wip-us.apache.org/repos/asf/ambari/blob/63938e09/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/nonrolling-upgrade-2.6.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/nonrolling-upgrade-2.6.xml b/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/nonrolling-upgrade-2.6.xml
index 019c76e..155aaf9 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/nonrolling-upgrade-2.6.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/nonrolling-upgrade-2.6.xml
@@ -48,8 +48,9 @@
       <supports-auto-skip-failure>false</supports-auto-skip-failure>
 
       <execute-stage service="YARN" component="RESOURCEMANAGER" title="Stop YARN Queues">
+        <condition xsi:type="config" type="yarn-site" property="yarn.resourcemanager.work-preserving-recovery.enabled" value="true" comparison="not-equals"/>
         <task xsi:type="manual">
-          <message>Before continuing, please stop all YARN queues. If yarn-site's yarn.resourcemanager.work-preserving-recovery.enabled is set to true, then you can skip this step since the clients will retry on their own.</message>
+          <message>Before continuing, please stop all YARN queues.</message>
         </task>
       </execute-stage>
 
@@ -612,6 +613,20 @@
       </service>
     </group>
 
+    <group xsi:type="cluster" name="START_YARN_QUEUES" title="Start YARN Queues">
+      <direction>UPGRADE</direction>
+      <service-check>false</service-check>
+      <skippable>true</skippable>
+      <parallel-scheduler/>
+
+      <execute-stage service="YARN" component="RESOURCEMANAGER" title="Start YARN Queues">
+        <condition xsi:type="config" type="yarn-site" property="yarn.resourcemanager.work-preserving-recovery.enabled" value="true" comparison="not-equals"/>
+        <task xsi:type="manual">
+          <message>Before continuing, please start all YARN queues.</message>
+        </task>
+      </execute-stage>
+    </group>
+
     <group xsi:type="restart" name="HBASE" title="HBASE">
       <service-check>false</service-check>
       <skippable>true</skippable>
@@ -829,16 +844,6 @@
       </execute-stage>
     </group>
 
-    <group xsi:type="cluster" name="MANUAL_STEPS" title="Finishing Upgrade">
-      <direction>UPGRADE</direction>
-
-      <execute-stage service="YARN" component="RESOURCEMANAGER" title="Start YARN Queues">
-        <task xsi:type="manual">
-          <message>Please start previously stopped YARN queues. If yarn-site's yarn.resourcemanager.work-preserving-recovery.enabled is set to true, then you can skip this step since the clients will retry on their own.</message>
-        </task>
-      </execute-stage>
-    </group>
-
     <group xsi:type="cluster" name="POST_CLUSTER" title="Finalize {{direction.text.proper}}">
       <skippable>true</skippable>
       <supports-auto-skip-failure>false</supports-auto-skip-failure>

http://git-wip-us.apache.org/repos/asf/ambari/blob/63938e09/ambari-server/src/main/resources/stacks/HDP/2.4/upgrades/nonrolling-upgrade-2.4.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.4/upgrades/nonrolling-upgrade-2.4.xml b/ambari-server/src/main/resources/stacks/HDP/2.4/upgrades/nonrolling-upgrade-2.4.xml
index b7d7983..b9a7e1e 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.4/upgrades/nonrolling-upgrade-2.4.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.4/upgrades/nonrolling-upgrade-2.4.xml
@@ -35,8 +35,9 @@
       <supports-auto-skip-failure>false</supports-auto-skip-failure>
 
       <execute-stage service="YARN" component="RESOURCEMANAGER" title="Stop YARN Queues">
+        <condition xsi:type="config" type="yarn-site" property="yarn.resourcemanager.work-preserving-recovery.enabled" value="true" comparison="not-equals"/>
         <task xsi:type="manual">
-          <message>Before continuing, please stop all YARN queues. If yarn-site's yarn.resourcemanager.work-preserving-recovery.enabled is set to true, then you can skip this step since the clients will retry on their own.</message>
+          <message>Before continuing, please stop all YARN queues.</message>
         </task>
       </execute-stage>
 
@@ -409,6 +410,20 @@
       </service>
     </group>
 
+    <group xsi:type="cluster" name="START_YARN_QUEUES" title="Start YARN Queues">
+      <direction>UPGRADE</direction>
+      <service-check>false</service-check>
+      <skippable>true</skippable>
+      <parallel-scheduler/>
+
+      <execute-stage service="YARN" component="RESOURCEMANAGER" title="Start YARN Queues">
+        <condition xsi:type="config" type="yarn-site" property="yarn.resourcemanager.work-preserving-recovery.enabled" value="true" comparison="not-equals"/>
+        <task xsi:type="manual">
+          <message>Before continuing, please start all YARN queues.</message>
+        </task>
+      </execute-stage>
+    </group>
+
     <group xsi:type="restart" name="HBASE" title="HBASE">
       <service-check>false</service-check>
       <skippable>true</skippable>
@@ -626,16 +641,6 @@
       </execute-stage>
     </group>
 
-    <group xsi:type="cluster" name="MANUAL_STEPS" title="Finishing Upgrade">
-      <direction>UPGRADE</direction>
-
-      <execute-stage service="YARN" component="RESOURCEMANAGER" title="Start YARN Queues">
-        <task xsi:type="manual">
-          <message>Please start previously stopped YARN queues. If yarn-site's yarn.resourcemanager.work-preserving-recovery.enabled is set to true, then you can skip this step since the clients will retry on their own.</message>
-        </task>
-      </execute-stage>
-    </group>
-
     <group xsi:type="cluster" name="POST_CLUSTER" title="Finalize {{direction.text.proper}}">
       <skippable>true</skippable>
       <supports-auto-skip-failure>false</supports-auto-skip-failure>

http://git-wip-us.apache.org/repos/asf/ambari/blob/63938e09/ambari-server/src/main/resources/stacks/HDP/2.4/upgrades/nonrolling-upgrade-2.5.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.4/upgrades/nonrolling-upgrade-2.5.xml b/ambari-server/src/main/resources/stacks/HDP/2.4/upgrades/nonrolling-upgrade-2.5.xml
index 3608247..7b9b55e 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.4/upgrades/nonrolling-upgrade-2.5.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.4/upgrades/nonrolling-upgrade-2.5.xml
@@ -43,8 +43,9 @@
       <supports-auto-skip-failure>false</supports-auto-skip-failure>
 
       <execute-stage service="YARN" component="RESOURCEMANAGER" title="Stop YARN Queues">
+        <condition xsi:type="config" type="yarn-site" property="yarn.resourcemanager.work-preserving-recovery.enabled" value="true" comparison="not-equals"/>
         <task xsi:type="manual">
-          <message>Before continuing, please stop all YARN queues. If yarn-site's yarn.resourcemanager.work-preserving-recovery.enabled is set to true, then you can skip this step since the clients will retry on their own.</message>
+          <message>Before continuing, please stop all YARN queues.</message>
         </task>
       </execute-stage>
 
@@ -562,6 +563,20 @@
       </service>
     </group>
 
+    <group xsi:type="cluster" name="START_YARN_QUEUES" title="Start YARN Queues">
+      <direction>UPGRADE</direction>
+      <service-check>false</service-check>
+      <skippable>true</skippable>
+      <parallel-scheduler/>
+
+      <execute-stage service="YARN" component="RESOURCEMANAGER" title="Start YARN Queues">
+        <condition xsi:type="config" type="yarn-site" property="yarn.resourcemanager.work-preserving-recovery.enabled" value="true" comparison="not-equals"/>
+        <task xsi:type="manual">
+          <message>Before continuing, please start all YARN queues.</message>
+        </task>
+      </execute-stage>
+    </group>
+
     <group xsi:type="restart" name="HBASE" title="HBASE">
       <service-check>false</service-check>
       <skippable>true</skippable>
@@ -779,16 +794,6 @@
       </execute-stage>
     </group>
 
-    <group xsi:type="cluster" name="MANUAL_STEPS" title="Finishing Upgrade">
-      <direction>UPGRADE</direction>
-
-      <execute-stage service="YARN" component="RESOURCEMANAGER" title="Start YARN Queues">
-        <task xsi:type="manual">
-          <message>Please start previously stopped YARN queues. If yarn-site's yarn.resourcemanager.work-preserving-recovery.enabled is set to true, then you can skip this step since the clients will retry on their own.</message>
-        </task>
-      </execute-stage>
-    </group>
-
     <group xsi:type="cluster" name="POST_CLUSTER" title="Finalize {{direction.text.proper}}">
       <skippable>true</skippable>
       <supports-auto-skip-failure>false</supports-auto-skip-failure>

http://git-wip-us.apache.org/repos/asf/ambari/blob/63938e09/ambari-server/src/main/resources/stacks/HDP/2.4/upgrades/nonrolling-upgrade-2.6.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.4/upgrades/nonrolling-upgrade-2.6.xml b/ambari-server/src/main/resources/stacks/HDP/2.4/upgrades/nonrolling-upgrade-2.6.xml
index 2a1ecf7..92ce832 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.4/upgrades/nonrolling-upgrade-2.6.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.4/upgrades/nonrolling-upgrade-2.6.xml
@@ -48,8 +48,9 @@
       <supports-auto-skip-failure>false</supports-auto-skip-failure>
 
       <execute-stage service="YARN" component="RESOURCEMANAGER" title="Stop YARN Queues">
+        <condition xsi:type="config" type="yarn-site" property="yarn.resourcemanager.work-preserving-recovery.enabled" value="true" comparison="not-equals"/>
         <task xsi:type="manual">
-          <message>Before continuing, please stop all YARN queues. If yarn-site's yarn.resourcemanager.work-preserving-recovery.enabled is set to true, then you can skip this step since the clients will retry on their own.</message>
+          <message>Before continuing, please stop all YARN queues.</message>
         </task>
       </execute-stage>
 
@@ -567,6 +568,20 @@
       </service>
     </group>
 
+    <group xsi:type="cluster" name="START_YARN_QUEUES" title="Start YARN Queues">
+      <direction>UPGRADE</direction>
+      <service-check>false</service-check>
+      <skippable>true</skippable>
+      <parallel-scheduler/>
+
+      <execute-stage service="YARN" component="RESOURCEMANAGER" title="Start YARN Queues">
+        <condition xsi:type="config" type="yarn-site" property="yarn.resourcemanager.work-preserving-recovery.enabled" value="true" comparison="not-equals"/>
+        <task xsi:type="manual">
+          <message>Before continuing, please start all YARN queues.</message>
+        </task>
+      </execute-stage>
+    </group>
+
     <group xsi:type="restart" name="HBASE" title="HBASE">
       <service-check>false</service-check>
       <skippable>true</skippable>
@@ -784,16 +799,6 @@
       </execute-stage>
     </group>
 
-    <group xsi:type="cluster" name="MANUAL_STEPS" title="Finishing Upgrade">
-      <direction>UPGRADE</direction>
-
-      <execute-stage service="YARN" component="RESOURCEMANAGER" title="Start YARN Queues">
-        <task xsi:type="manual">
-          <message>Please start previously stopped YARN queues. If yarn-site's yarn.resourcemanager.work-preserving-recovery.enabled is set to true, then you can skip this step since the clients will retry on their own.</message>
-        </task>
-      </execute-stage>
-    </group>
-
     <group xsi:type="cluster" name="POST_CLUSTER" title="Finalize {{direction.text.proper}}">
       <skippable>true</skippable>
       <supports-auto-skip-failure>false</supports-auto-skip-failure>

http://git-wip-us.apache.org/repos/asf/ambari/blob/63938e09/ambari-server/src/main/resources/stacks/HDP/2.5/upgrades/nonrolling-upgrade-2.5.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.5/upgrades/nonrolling-upgrade-2.5.xml b/ambari-server/src/main/resources/stacks/HDP/2.5/upgrades/nonrolling-upgrade-2.5.xml
index 414ce15..6bca487 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.5/upgrades/nonrolling-upgrade-2.5.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.5/upgrades/nonrolling-upgrade-2.5.xml
@@ -36,8 +36,9 @@
       <supports-auto-skip-failure>false</supports-auto-skip-failure>
 
       <execute-stage service="YARN" component="RESOURCEMANAGER" title="Stop YARN Queues">
+        <condition xsi:type="config" type="yarn-site" property="yarn.resourcemanager.work-preserving-recovery.enabled" value="true" comparison="not-equals"/>
         <task xsi:type="manual">
-          <message>Before continuing, please stop all YARN queues. If yarn-site's yarn.resourcemanager.work-preserving-recovery.enabled is set to true, then you can skip this step since the clients will retry on their own.</message>
+          <message>Before continuing, please stop all YARN queues.</message>
         </task>
       </execute-stage>
 
@@ -441,6 +442,20 @@
       </service>
     </group>
 
+    <group xsi:type="cluster" name="START_YARN_QUEUES" title="Start YARN Queues">
+      <direction>UPGRADE</direction>
+      <service-check>false</service-check>
+      <skippable>true</skippable>
+      <parallel-scheduler/>
+
+      <execute-stage service="YARN" component="RESOURCEMANAGER" title="Start YARN Queues">
+        <condition xsi:type="config" type="yarn-site" property="yarn.resourcemanager.work-preserving-recovery.enabled" value="true" comparison="not-equals"/>
+        <task xsi:type="manual">
+          <message>Before continuing, please start all YARN queues.</message>
+        </task>
+      </execute-stage>
+    </group>
+
     <group xsi:type="restart" name="HBASE" title="HBASE">
       <service-check>false</service-check>
       <skippable>true</skippable>
@@ -692,16 +707,6 @@
       </execute-stage>
     </group>
 
-    <group xsi:type="cluster" name="MANUAL_STEPS" title="Finishing Upgrade">
-      <direction>UPGRADE</direction>
-
-      <execute-stage service="YARN" component="RESOURCEMANAGER" title="Start YARN Queues">
-        <task xsi:type="manual">
-          <message>Please start previously stopped YARN queues. If yarn-site's yarn.resourcemanager.work-preserving-recovery.enabled is set to true, then you can skip this step since the clients will retry on their own.</message>
-        </task>
-      </execute-stage>
-    </group>
-
     <group xsi:type="cluster" name="POST_CLUSTER" title="Finalize {{direction.text.proper}}">
       <skippable>true</skippable>
       <supports-auto-skip-failure>false</supports-auto-skip-failure>

http://git-wip-us.apache.org/repos/asf/ambari/blob/63938e09/ambari-server/src/main/resources/stacks/HDP/2.5/upgrades/nonrolling-upgrade-2.6.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.5/upgrades/nonrolling-upgrade-2.6.xml b/ambari-server/src/main/resources/stacks/HDP/2.5/upgrades/nonrolling-upgrade-2.6.xml
index c13ad99..66f872d 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.5/upgrades/nonrolling-upgrade-2.6.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.5/upgrades/nonrolling-upgrade-2.6.xml
@@ -36,8 +36,9 @@
       <supports-auto-skip-failure>false</supports-auto-skip-failure>
 
       <execute-stage service="YARN" component="RESOURCEMANAGER" title="Stop YARN Queues">
+        <condition xsi:type="config" type="yarn-site" property="yarn.resourcemanager.work-preserving-recovery.enabled" value="true" comparison="not-equals"/>
         <task xsi:type="manual">
-          <message>Before continuing, please stop all YARN queues. If yarn-site's yarn.resourcemanager.work-preserving-recovery.enabled is set to true, then you can skip this step since the clients will retry on their own.</message>
+          <message>Before continuing, please stop all YARN queues.</message>
         </task>
       </execute-stage>
 
@@ -440,6 +441,20 @@
       </service>
     </group>
 
+    <group xsi:type="cluster" name="START_YARN_QUEUES" title="Start YARN Queues">
+      <direction>UPGRADE</direction>
+      <service-check>false</service-check>
+      <skippable>true</skippable>
+      <parallel-scheduler/>
+
+      <execute-stage service="YARN" component="RESOURCEMANAGER" title="Start YARN Queues">
+        <condition xsi:type="config" type="yarn-site" property="yarn.resourcemanager.work-preserving-recovery.enabled" value="true" comparison="not-equals"/>
+        <task xsi:type="manual">
+          <message>Before continuing, please start all YARN queues.</message>
+        </task>
+      </execute-stage>
+    </group>
+
     <group xsi:type="restart" name="HBASE" title="HBASE">
       <service-check>false</service-check>
       <skippable>true</skippable>
@@ -691,16 +706,6 @@
       </execute-stage>
     </group>
 
-    <group xsi:type="cluster" name="MANUAL_STEPS" title="Finishing Upgrade">
-      <direction>UPGRADE</direction>
-
-      <execute-stage service="YARN" component="RESOURCEMANAGER" title="Start YARN Queues">
-        <task xsi:type="manual">
-          <message>Please start previously stopped YARN queues. If yarn-site's yarn.resourcemanager.work-preserving-recovery.enabled is set to true, then you can skip this step since the clients will retry on their own.</message>
-        </task>
-      </execute-stage>
-    </group>
-
     <group xsi:type="cluster" name="POST_CLUSTER" title="Finalize {{direction.text.proper}}">
       <skippable>true</skippable>
       <supports-auto-skip-failure>false</supports-auto-skip-failure>

http://git-wip-us.apache.org/repos/asf/ambari/blob/63938e09/ambari-server/src/main/resources/stacks/HDP/2.6/upgrades/nonrolling-upgrade-2.6.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.6/upgrades/nonrolling-upgrade-2.6.xml b/ambari-server/src/main/resources/stacks/HDP/2.6/upgrades/nonrolling-upgrade-2.6.xml
index d34d476..1c65f9b 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.6/upgrades/nonrolling-upgrade-2.6.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.6/upgrades/nonrolling-upgrade-2.6.xml
@@ -36,8 +36,9 @@
       <supports-auto-skip-failure>false</supports-auto-skip-failure>
 
       <execute-stage service="YARN" component="RESOURCEMANAGER" title="Stop YARN Queues">
+        <condition xsi:type="config" type="yarn-site" property="yarn.resourcemanager.work-preserving-recovery.enabled" value="true" comparison="not-equals"/>
         <task xsi:type="manual">
-          <message>Before continuing, please stop all YARN queues. If yarn-site's yarn.resourcemanager.work-preserving-recovery.enabled is set to true, then you can skip this step since the clients will retry on their own.</message>
+          <message>Before continuing, please stop all YARN queues.</message>
         </task>
       </execute-stage>
 
@@ -414,6 +415,20 @@
       </service>
     </group>
 
+    <group xsi:type="cluster" name="START_YARN_QUEUES" title="Start YARN Queues">
+      <direction>UPGRADE</direction>
+      <service-check>false</service-check>
+      <skippable>true</skippable>
+      <parallel-scheduler/>
+
+      <execute-stage service="YARN" component="RESOURCEMANAGER" title="Start YARN Queues">
+        <condition xsi:type="config" type="yarn-site" property="yarn.resourcemanager.work-preserving-recovery.enabled" value="true" comparison="not-equals"/>
+        <task xsi:type="manual">
+          <message>Before continuing, please start all YARN queues.</message>
+        </task>
+      </execute-stage>
+    </group>
+
     <group xsi:type="restart" name="HBASE" title="HBASE">
       <service-check>false</service-check>
       <skippable>true</skippable>
@@ -665,16 +680,6 @@
       </execute-stage>
     </group>
 
-    <group xsi:type="cluster" name="MANUAL_STEPS" title="Finishing Upgrade">
-      <direction>UPGRADE</direction>
-
-      <execute-stage service="YARN" component="RESOURCEMANAGER" title="Start YARN Queues">
-        <task xsi:type="manual">
-          <message>Please start previously stopped YARN queues. If yarn-site's yarn.resourcemanager.work-preserving-recovery.enabled is set to true, then you can skip this step since the clients will retry on their own.</message>
-        </task>
-      </execute-stage>
-    </group>
-
     <group xsi:type="cluster" name="POST_CLUSTER" title="Finalize {{direction.text.proper}}">
       <skippable>true</skippable>
       <supports-auto-skip-failure>false</supports-auto-skip-failure>

http://git-wip-us.apache.org/repos/asf/ambari/blob/63938e09/ambari-server/src/main/resources/upgrade-pack.xsd
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/upgrade-pack.xsd b/ambari-server/src/main/resources/upgrade-pack.xsd
index 45cf5fa..aeec803 100644
--- a/ambari-server/src/main/resources/upgrade-pack.xsd
+++ b/ambari-server/src/main/resources/upgrade-pack.xsd
@@ -66,6 +66,11 @@
   <xs:simpleType name="config-condition-comparison-type">
     <xs:restriction base="xs:string">
       <xs:enumeration value="equals" />
+      <xs:enumeration value="not-equals" />
+      <xs:enumeration value="contains" />
+      <xs:enumeration value="not-contains" />
+      <xs:enumeration value="exists" />
+      <xs:enumeration value="not-exists" />
     </xs:restriction>
   </xs:simpleType>
   
@@ -76,7 +81,8 @@
       <xs:extension base="abstract-condition-type">  
         <xs:attribute name="type" type="xs:Name" use="required"/>
         <xs:attribute name="property" type="xs:Name" use="required"/>
-        <xs:attribute name="value" type="xs:string" use="required"/>
+        <xs:attribute name="value" type="xs:string" use="optional"/>
+        <xs:attribute name="return_value_if_config_missing" type="xs:boolean" use="optional"/>
         <xs:attribute name="comparison" type="config-condition-comparison-type" use="required"/>
       </xs:extension>
     </xs:complexContent>


[04/50] [abbrv] ambari git commit: AMBARI-19000. Ambari-server fails to restart with --debug if it is already running (aonishuk)

Posted by nc...@apache.org.
AMBARI-19000. Ambari-server fails to restart with --debug if it is already running (aonishuk)


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

Branch: refs/heads/branch-dev-patch-upgrade
Commit: e3b9a9f804537796fa46273b378935a14b75bb33
Parents: 28d7834
Author: Andrew Onishuk <ao...@hortonworks.com>
Authored: Wed Nov 30 17:07:22 2016 +0200
Committer: Andrew Onishuk <ao...@hortonworks.com>
Committed: Wed Nov 30 17:07:22 2016 +0200

----------------------------------------------------------------------
 ambari-server/src/main/python/ambari-server.py          | 12 +++++++++++-
 .../src/main/python/ambari_server/serverUtils.py        | 11 +++++++++++
 2 files changed, 22 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/e3b9a9f8/ambari-server/src/main/python/ambari-server.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/python/ambari-server.py b/ambari-server/src/main/python/ambari-server.py
index 41b2234..21bd0bb 100755
--- a/ambari-server/src/main/python/ambari-server.py
+++ b/ambari-server/src/main/python/ambari-server.py
@@ -35,7 +35,7 @@ from ambari_commons.os_utils import remove_file
 from ambari_server.BackupRestore import main as BackupRestore_main
 from ambari_server.dbConfiguration import DATABASE_NAMES, LINUX_DBMS_KEYS_LIST
 from ambari_server.serverConfiguration import configDefaults, get_ambari_properties, PID_NAME
-from ambari_server.serverUtils import is_server_runing, refresh_stack_hash
+from ambari_server.serverUtils import is_server_runing, refresh_stack_hash, wait_for_server_to_stop
 from ambari_server.serverSetup import reset, setup, setup_jce_policy
 from ambari_server.serverUpgrade import upgrade, upgrade_stack, set_current
 from ambari_server.setupHttps import setup_https, setup_truststore
@@ -63,6 +63,8 @@ logger = logging.getLogger()
 
 formatstr = "%(levelname)s %(asctime)s %(filename)s:%(lineno)d - %(message)s"
 
+SERVER_STOP_TIMEOUT = 30
+
 class UserActionPossibleArgs(object):
   def __init__(self, i_fn, i_possible_args_numbers, *args, **kwargs):
     self.fn = i_fn
@@ -166,6 +168,14 @@ def stop(args):
     except OSError, e:
       print_info_msg("Unable to stop Ambari Server - " + str(e))
       return
+
+    print "Waiting for server stop..."
+    logger.info("Waiting for server stop...")
+
+    if not wait_for_server_to_stop(SERVER_STOP_TIMEOUT):
+      print "Ambari-server failed to stop"
+      logger.info("Ambari-server failed to stop")
+
     pid_file_path = os.path.join(configDefaults.PID_DIR, PID_NAME)
     os.remove(pid_file_path)
     print "Ambari Server stopped"

http://git-wip-us.apache.org/repos/asf/ambari/blob/e3b9a9f8/ambari-server/src/main/python/ambari_server/serverUtils.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/python/ambari_server/serverUtils.py b/ambari-server/src/main/python/ambari_server/serverUtils.py
index 3af233c..4621646 100644
--- a/ambari-server/src/main/python/ambari_server/serverUtils.py
+++ b/ambari-server/src/main/python/ambari_server/serverUtils.py
@@ -19,6 +19,7 @@ limitations under the License.
 '''
 
 import os
+import time
 from ambari_commons.exceptions import FatalException, NonFatalException
 from ambari_commons.logging_utils import get_verbose
 from ambari_commons.os_family_impl import OsFamilyFuncImpl, OsFamilyImpl
@@ -62,6 +63,16 @@ def is_server_runing():
     return False, None
 
 
+def wait_for_server_to_stop(wait_timeout):
+  start_time = time.time()
+  is_timeout = lambda: time.time() - start_time > wait_timeout
+
+  while is_server_runing()[0] and not is_timeout():
+    time.sleep(0.1)
+
+  return not is_timeout()
+
+
 @OsFamilyFuncImpl(OSConst.WINSRV_FAMILY)
 def is_server_runing():
   from ambari_commons.os_windows import SERVICE_STATUS_STARTING, SERVICE_STATUS_RUNNING, SERVICE_STATUS_STOPPING, \


[36/50] [abbrv] ambari git commit: AMBARI-18975 Remove Zeppelin View from Ambari (r-kamath)

Posted by nc...@apache.org.
AMBARI-18975 Remove Zeppelin View from Ambari (r-kamath)


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

Branch: refs/heads/branch-dev-patch-upgrade
Commit: c2dc7538b65ab9f045010b7964ba00551b0ea099
Parents: 73d372b
Author: Renjith Kamath <re...@gmail.com>
Authored: Fri Dec 2 14:39:28 2016 +0530
Committer: Renjith Kamath <re...@gmail.com>
Committed: Fri Dec 2 14:52:51 2016 +0530

----------------------------------------------------------------------
 .../server/upgrade/UpgradeCatalog250.java       |   6 +
 .../server/upgrade/UpgradeCatalog250Test.java   |  17 +-
 contrib/views/pom.xml                           |   1 -
 contrib/views/zeppelin/pom.xml                  | 190 -------------------
 .../view/zeppelin/ZeppelinServiceCheck.java     |  55 ------
 .../ambari/view/zeppelin/ZeppelinServlet.java   | 113 -----------
 .../zeppelin/src/main/resources/WEB-INF/web.xml |  40 ----
 .../src/main/resources/view.log4j.properties    |  27 ---
 .../views/zeppelin/src/main/resources/view.xml  |  48 -----
 9 files changed, 17 insertions(+), 480 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/c2dc7538/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog250.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog250.java b/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog250.java
index 3b2cdd3..837f340 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog250.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog250.java
@@ -136,6 +136,7 @@ public class UpgradeCatalog250 extends AbstractUpgradeCatalog {
     updateAMSConfigs();
     updateKafkaConfigs();
     updateHiveLlapConfigs();
+    updateTablesForZeppelinViewRemoval();
   }
 
   protected void updateHostVersionTable() throws SQLException {
@@ -227,6 +228,11 @@ public class UpgradeCatalog250 extends AbstractUpgradeCatalog {
     }
   }
 
+  protected void updateTablesForZeppelinViewRemoval() throws SQLException {
+    dbAccessor.executeQuery("DELETE from viewinstance WHERE view_name='ZEPPELIN{1.0.0}'", true);
+    dbAccessor.executeQuery("DELETE from viewmain WHERE view_name='ZEPPELIN{1.0.0}'", true);
+    dbAccessor.executeQuery("DELETE from viewparameter WHERE view_name='ZEPPELIN{1.0.0}'", true);
+  }
 
   protected String updateAmsEnvContent(String content) {
     if (content == null) {

http://git-wip-us.apache.org/repos/asf/ambari/blob/c2dc7538/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog250Test.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog250Test.java b/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog250Test.java
index 978e2dc..0b2b32d 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog250Test.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog250Test.java
@@ -210,16 +210,18 @@ public class UpgradeCatalog250Test {
   @Test
   public void testExecuteDMLUpdates() throws Exception {
     Method updateAmsConfigs = UpgradeCatalog250.class.getDeclaredMethod("updateAMSConfigs");
-    Method addNewConfigurationsFromXml = AbstractUpgradeCatalog.class.getDeclaredMethod("addNewConfigurationsFromXml");
     Method updateKafkaConfigs = UpgradeCatalog250.class.getDeclaredMethod("updateKafkaConfigs");
     Method updateHiveLlapConfigs = UpgradeCatalog250.class.getDeclaredMethod("updateHiveLlapConfigs");
+    Method addNewConfigurationsFromXml = AbstractUpgradeCatalog.class.getDeclaredMethod("addNewConfigurationsFromXml");
+    Method updateTablesForZeppelinViewRemoval = UpgradeCatalog250.class.getDeclaredMethod("updateTablesForZeppelinViewRemoval");
 
     UpgradeCatalog250 upgradeCatalog250 = createMockBuilder(UpgradeCatalog250.class)
-        .addMockedMethod(updateAmsConfigs)
-        .addMockedMethod(addNewConfigurationsFromXml)
-        .addMockedMethod(updateKafkaConfigs)
-        .addMockedMethod(updateHiveLlapConfigs)
-        .createMock();
+      .addMockedMethod(updateAmsConfigs)
+      .addMockedMethod(updateKafkaConfigs)
+      .addMockedMethod(updateHiveLlapConfigs)
+      .addMockedMethod(addNewConfigurationsFromXml)
+      .addMockedMethod(updateTablesForZeppelinViewRemoval)
+      .createMock();
 
     upgradeCatalog250.updateAMSConfigs();
     expectLastCall().once();
@@ -233,6 +235,9 @@ public class UpgradeCatalog250Test {
     upgradeCatalog250.updateHiveLlapConfigs();
     expectLastCall().once();
 
+    upgradeCatalog250.updateTablesForZeppelinViewRemoval();
+    expectLastCall().once();
+
     replay(upgradeCatalog250);
 
     upgradeCatalog250.executeDMLUpdates();

http://git-wip-us.apache.org/repos/asf/ambari/blob/c2dc7538/contrib/views/pom.xml
----------------------------------------------------------------------
diff --git a/contrib/views/pom.xml b/contrib/views/pom.xml
index fb7d8fa..ea426cd 100644
--- a/contrib/views/pom.xml
+++ b/contrib/views/pom.xml
@@ -46,7 +46,6 @@
     <module>tez</module>
     <module>hawq</module>
     <module>storm</module>
-    <module>zeppelin</module>
     <module>hueambarimigration</module>
     <module>hive-next</module>
     <module>hive</module>

http://git-wip-us.apache.org/repos/asf/ambari/blob/c2dc7538/contrib/views/zeppelin/pom.xml
----------------------------------------------------------------------
diff --git a/contrib/views/zeppelin/pom.xml b/contrib/views/zeppelin/pom.xml
deleted file mode 100644
index 2a52ce7..0000000
--- a/contrib/views/zeppelin/pom.xml
+++ /dev/null
@@ -1,190 +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.
--->
-<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"
-         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
-  <modelVersion>4.0.0</modelVersion>
-  <groupId>org.apache.ambari.contrib.views</groupId>
-  <artifactId>zeppelin-view</artifactId>
-  <version>1.0.0.0</version>
-  <name>Zeppelin</name>
-
-  <parent>
-    <groupId>org.apache.ambari.contrib.views</groupId>
-    <artifactId>ambari-contrib-views</artifactId>
-    <version>2.0.0.0-SNAPSHOT</version>
-  </parent>
-
-  <dependencies>
-    <dependency>
-      <groupId>junit</groupId>
-      <artifactId>junit</artifactId>
-      <version>4.8.1</version>
-      <scope>test</scope>
-    </dependency>
-    <dependency>
-      <groupId>org.easymock</groupId>
-      <artifactId>easymock</artifactId>
-      <version>3.1</version>
-      <scope>test</scope>
-    </dependency>
-    <dependency>
-      <groupId>org.apache.ambari</groupId>
-      <artifactId>ambari-views</artifactId>
-      <version>${ambari.version}</version>
-    </dependency>
-    <dependency>
-      <groupId>com.sun.jersey</groupId>
-      <artifactId>jersey-server</artifactId>
-      <version>1.8</version>
-    </dependency>
-    <dependency>
-      <groupId>javax.servlet</groupId>
-      <artifactId>servlet-api</artifactId>
-      <version>2.5</version>
-      <scope>provided</scope>
-    </dependency>
-
-
-    <dependency>
-      <groupId>commons-configuration</groupId>
-      <artifactId>commons-configuration</artifactId>
-      <version>1.6</version>
-    </dependency>
-    <dependency>
-      <groupId>org.apache.commons</groupId>
-      <artifactId>commons-csv</artifactId>
-      <version>1.0</version>
-    </dependency>
-    <dependency>
-      <groupId>org.apache.commons</groupId>
-      <artifactId>commons-collections4</artifactId>
-      <version>4.0</version>
-    </dependency>
-
-    <dependency>
-      <groupId>org.slf4j</groupId>
-      <artifactId>slf4j-api</artifactId>
-      <version>1.7.5</version>
-    </dependency>
-
-    <dependency>
-      <groupId>org.apache.ambari.contrib.views</groupId>
-      <artifactId>ambari-views-utils</artifactId>
-      <version>2.0.0.0-SNAPSHOT</version>
-    </dependency>
-    <dependency>
-      <groupId>org.json</groupId>
-      <artifactId>json</artifactId>
-      <version>20160212</version>
-    </dependency>
-
-    <dependency>
-      <groupId>org.apache.httpcomponents</groupId>
-      <artifactId>httpclient</artifactId>
-      <version>4.5.2</version>
-    </dependency>
-
-
-  </dependencies>
-
-  <properties>
-    <ambari.dir>${project.parent.parent.parent.basedir}</ambari.dir>
-    <hive-version>1.0.0</hive-version>
-    <ambari.version>2.0.0.0-SNAPSHOT</ambari.version>
-  </properties>
-  <build>
-    <plugins>
-
-      <!-- Building frontend -->
-      <plugin>
-        <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-compiler-plugin</artifactId>
-        <version>3.1</version>
-        <configuration>
-          <source>1.7</source>
-          <target>1.7</target>
-        </configuration>
-      </plugin>
-      <plugin>
-        <artifactId>maven-dependency-plugin</artifactId>
-        <executions>
-          <execution>
-            <phase>generate-resources</phase>
-            <goals>
-              <goal>copy-dependencies</goal>
-            </goals>
-            <configuration>
-              <outputDirectory>${project.build.directory}/lib</outputDirectory>
-              <includeScope>runtime</includeScope>
-            </configuration>
-          </execution>
-          <execution>
-            <id>copy-artifact</id>
-            <phase>package</phase>
-            <goals>
-              <goal>copy</goal>
-            </goals>
-            <configuration>
-              <artifactItems>
-                <artifactItem>
-                  <groupId>${project.groupId}</groupId>
-                  <artifactId>${project.artifactId}</artifactId>
-                  <version>${project.version}</version>
-                  <type>${project.packaging}</type>
-                </artifactItem>
-              </artifactItems>
-              <outputDirectory>${views.jars.dir.rel}</outputDirectory>
-            </configuration>
-          </execution>
-        </executions>
-      </plugin>
-      <plugin>
-        <groupId>org.vafer</groupId>
-        <artifactId>jdeb</artifactId>
-        <version>1.0.1</version>
-        <executions>
-          <execution>
-            <phase>none</phase>
-            <goals>
-              <goal>jdeb</goal>
-            </goals>
-          </execution>
-        </executions>
-        <configuration>
-          <submodules>false</submodules>
-        </configuration>
-      </plugin>
-    </plugins>
-    <resources>
-      <resource>
-        <directory>src/main/resources</directory>
-        <filtering>true</filtering>
-        <includes>
-          <include>WEB-INF/web.xml</include>
-          <include>META-INF/**/*</include>
-          <include>view.xml</include>
-          <include>WEB-INF/index.jsp</include>
-        </includes>
-      </resource>
-      <resource>
-        <targetPath>WEB-INF/lib</targetPath>
-        <filtering>false</filtering>
-        <directory>target/lib</directory>
-      </resource>
-    </resources>
-  </build>
-</project>

http://git-wip-us.apache.org/repos/asf/ambari/blob/c2dc7538/contrib/views/zeppelin/src/main/java/org/apache/ambari/view/zeppelin/ZeppelinServiceCheck.java
----------------------------------------------------------------------
diff --git a/contrib/views/zeppelin/src/main/java/org/apache/ambari/view/zeppelin/ZeppelinServiceCheck.java b/contrib/views/zeppelin/src/main/java/org/apache/ambari/view/zeppelin/ZeppelinServiceCheck.java
deleted file mode 100644
index 8f94260..0000000
--- a/contrib/views/zeppelin/src/main/java/org/apache/ambari/view/zeppelin/ZeppelinServiceCheck.java
+++ /dev/null
@@ -1,55 +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
- * <p>
- * http://www.apache.org/licenses/LICENSE-2.0
- * <p>
- * 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.view.zeppelin;
-
-import org.apache.http.HttpResponse;
-import org.apache.http.client.HttpClient;
-import org.apache.http.client.methods.HttpGet;
-import org.apache.http.impl.client.HttpClientBuilder;
-import org.json.JSONObject;
-
-import javax.servlet.ServletConfig;
-import javax.servlet.ServletException;
-import javax.servlet.http.HttpServlet;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import java.io.IOException;
-import java.io.PrintWriter;
-
-
-public class ZeppelinServiceCheck {
-    static String check(String host, String port) {
-        String url = "http://" + host + ":" + port;
-        JSONObject json = new JSONObject();
-        json.put("url", url);
-        try {
-            HttpClient httpclient = HttpClientBuilder.create().build();
-            HttpGet httpget = new HttpGet(url);
-            HttpResponse httpresponse = httpclient.execute(httpget);
-            if (httpresponse.getStatusLine().getStatusCode() == 200) {
-                json.put("status", "SUCCESS");
-                json.put("message", "Zeppelin is running");
-            }
-        } catch (Exception e) {
-            json.put("status", "ERROR");
-            json.put("message", "Zeppelin is not running");
-        }
-        return json.toString();
-    }
-}

http://git-wip-us.apache.org/repos/asf/ambari/blob/c2dc7538/contrib/views/zeppelin/src/main/java/org/apache/ambari/view/zeppelin/ZeppelinServlet.java
----------------------------------------------------------------------
diff --git a/contrib/views/zeppelin/src/main/java/org/apache/ambari/view/zeppelin/ZeppelinServlet.java b/contrib/views/zeppelin/src/main/java/org/apache/ambari/view/zeppelin/ZeppelinServlet.java
deleted file mode 100644
index ab61a3d..0000000
--- a/contrib/views/zeppelin/src/main/java/org/apache/ambari/view/zeppelin/ZeppelinServlet.java
+++ /dev/null
@@ -1,113 +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
- * <p>
- * http://www.apache.org/licenses/LICENSE-2.0
- * <p>
- * 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.view.zeppelin;
-
-import org.apache.ambari.view.ViewContext;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import javax.servlet.ServletConfig;
-import javax.servlet.ServletContext;
-import javax.servlet.ServletException;
-import javax.servlet.http.HttpServlet;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import java.io.IOException;
-import java.io.PrintWriter;
-import java.util.List;
-
-
-public class ZeppelinServlet extends HttpServlet {
-  private ViewContext viewContext;
-  private final static Logger LOG = LoggerFactory.getLogger(ZeppelinServlet.class);
-
-  @Override
-  public void init(ServletConfig config) throws ServletException {
-    super.init(config);
-
-    ServletContext context = config.getServletContext();
-    viewContext = (ViewContext) context.getAttribute(ViewContext.CONTEXT_ATTRIBUTE);
-  }
-
-  public void service(HttpServletRequest req,
-                      HttpServletResponse res) throws IOException {
-    res.setContentType("text/html");
-    PrintWriter out = res.getWriter();
-    String publicName = "";
-    String port = "";
-    try {
-      port = viewContext.getProperties().get("zeppelin.server.port");
-      if (viewContext.getCluster() != null) {
-        List<String> hostsForServiceComponents = viewContext.getCluster().getHostsForServiceComponent
-            ("ZEPPELIN", "ZEPPELIN_MASTER");
-        publicName = hostsForServiceComponents.get(0);
-      } else {
-        publicName = viewContext.getProperties().get("zeppelin.host.publicname");
-      }
-    } catch (Exception e) {
-      LOG.error("Zeppelin view servlet failed", e);
-    }
-    out.println("<html lang=\"en\">" +
-        "<head>" +
-        "    <meta charset=\"utf-8\"/>" +
-        "    <link rel=\"stylesheet\" href=\"/stylesheets/vendor.css\">" +
-        "</head>" +
-        "<body>" +
-        "" +
-        "<div class=\"container-fluid\" id=\"messageContainer\" style=\"display:none;\">" +
-        "    <h1>Welcome to the Zeppelin View</h1>" +
-        "    <h3>Service check failed</h3>" +
-        "" +
-        "    <table class=\"table\">" +
-        "        <tbody>" +
-        "        <tr>" +
-        "            <td>zeppelin service is not running</td>" +
-        "        </tr>" +
-        "        </tbody>" +
-        "    </table>" +
-        "" +
-        "</div>" +
-        "" +
-        "<iframe id='zeppelinIFrame' width=\"100%\" seamless=\"seamless\" style=\"border: 0px;\"></iframe>" +
-        "<script>" +
-        "var $ = jQuery = parent.jQuery;" +
-        "var iframe = document.querySelector('#zeppelinIFrame');" +
-        "var messageContainer = document.querySelector('#messageContainer');" +
-        "" +
-        "var serviceCheckResponse = $.parseJSON(' " + ZeppelinServiceCheck.check(publicName, port) + "');" +
-        "" +
-        "if (serviceCheckResponse.status === \"SUCCESS\") {" +
-        "    messageContainer.style.display = \"none\";" +
-        "    iframe.style.display = \"block\";" +
-        "    iframe.src = serviceCheckResponse.url;" +
-        "    iframe.height = window.innerHeight;" +
-        "} else {" +
-        "    messageContainer.style.display = \"block\";" +
-        "    iframe.style.display = \"none\";" +
-        "}" +
-        "" +
-        "$(window).resize(function () {" +
-        "    iframe.height = window.innerHeight;" +
-        "});" +
-        "</script>" +
-        "</body>" +
-        "</html>");
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/ambari/blob/c2dc7538/contrib/views/zeppelin/src/main/resources/WEB-INF/web.xml
----------------------------------------------------------------------
diff --git a/contrib/views/zeppelin/src/main/resources/WEB-INF/web.xml b/contrib/views/zeppelin/src/main/resources/WEB-INF/web.xml
deleted file mode 100644
index 6b2d156..0000000
--- a/contrib/views/zeppelin/src/main/resources/WEB-INF/web.xml
+++ /dev/null
@@ -1,40 +0,0 @@
-<?xml version="1.0" encoding="ISO-8859-1" ?>
-
-<!--
-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. Kerberos, LDAP, Custom. Binary/Htt
--->
-
-<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
-         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-         xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
-         version="2.4">
-
-  <display-name>Zeppelin view servlet</display-name>
-  <description>
-    This is the Zeppelin view servlet application.
-  </description>
-
-  <servlet>
-    <servlet-name>ZeppelinServlet</servlet-name>
-    <servlet-class>org.apache.ambari.view.zeppelin.ZeppelinServlet</servlet-class>
-  </servlet>
-
-  <servlet-mapping>
-    <servlet-name>ZeppelinServlet</servlet-name>
-    <url-pattern>/</url-pattern>
-  </servlet-mapping>
-
-</web-app>

http://git-wip-us.apache.org/repos/asf/ambari/blob/c2dc7538/contrib/views/zeppelin/src/main/resources/view.log4j.properties
----------------------------------------------------------------------
diff --git a/contrib/views/zeppelin/src/main/resources/view.log4j.properties b/contrib/views/zeppelin/src/main/resources/view.log4j.properties
deleted file mode 100644
index 15d264e..0000000
--- a/contrib/views/zeppelin/src/main/resources/view.log4j.properties
+++ /dev/null
@@ -1,27 +0,0 @@
-# Copyright 2011 The Apache Software Foundation
-#
-# 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.
-
-log4j.appender.zeppelinView=org.apache.log4j.RollingFileAppender
-log4j.appender.zeppelinView.File=${ambari.log.dir}/zeppelin-view/zeppelin-view.log
-log4j.appender.zeppelinView.MaxFileSize=80MB
-log4j.appender.zeppelinView.MaxBackupIndex=60
-log4j.appender.zeppelinView.layout=org.apache.log4j.PatternLayout
-log4j.appender.zeppelinView.layout.ConversionPattern=%d{DATE} %5p [%t] [%X{viewName} %X{viewVersion} %X{viewInstanceName}] %c{1}:%L - %m%n
-
-log4j.logger.org.apache.ambari.view.zeppelin=INFO,zeppelinView
-log4j.additivity.org.apache.ambari.view.zeppelin=false
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/c2dc7538/contrib/views/zeppelin/src/main/resources/view.xml
----------------------------------------------------------------------
diff --git a/contrib/views/zeppelin/src/main/resources/view.xml b/contrib/views/zeppelin/src/main/resources/view.xml
deleted file mode 100644
index 197c397..0000000
--- a/contrib/views/zeppelin/src/main/resources/view.xml
+++ /dev/null
@@ -1,48 +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. Kerberos, LDAP, Custom. Binary/Htt
--->
-<view>
-  <name>ZEPPELIN</name>
-  <label>Zeppelin View!</label>
-  <version>1.0.0</version>
-  <build>${env.BUILD_NUMBER}</build>
-  <description>Ambari view for Apache Zeppelin</description>
-
-  <parameter>
-    <name>zeppelin.server.port</name>
-    <description>Zeppelin Http port (example: 9995).</description>
-    <label>Zeppelin Http port</label>
-    <cluster-config>zeppelin-config/zeppelin.server.port</cluster-config>
-    <required>true</required>
-  </parameter>
-  <parameter>
-    <name>zeppelin.host.publicname</name>
-    <description>Zeppelin host name</description>
-    <label>Zeppelin host name</label>
-    <cluster-config>fake</cluster-config>
-    <required>true</required>
-  </parameter>
-
-  <auto-instance>
-    <name>AUTO_ZEPPELIN_INSTANCE</name>
-    <label>Zeppelin View</label>
-    <description>This view instance is auto created when the Zeppelin service is added to a cluster.</description>
-    <stack-id>HDP-2.*</stack-id>
-    <services>
-      <service>ZEPPELIN</service>
-    </services>
-  </auto-instance>
-</view>
\ No newline at end of file


[34/50] [abbrv] ambari git commit: AMBARI-19051. Stage is sometimes marked as failed on command reschedule. (mpapirkovskyy)

Posted by nc...@apache.org.
AMBARI-19051. Stage is sometimes marked as failed on command reschedule. (mpapirkovskyy)


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

Branch: refs/heads/branch-dev-patch-upgrade
Commit: d24beb17e238391b196a2bfae1217035678a0a14
Parents: 615438b
Author: Myroslav Papirkovskyi <mp...@hortonworks.com>
Authored: Thu Dec 1 18:48:25 2016 +0200
Committer: Myroslav Papirkovskyi <mp...@hortonworks.com>
Committed: Fri Dec 2 09:51:16 2016 +0200

----------------------------------------------------------------------
 .../src/main/python/ambari_agent/ActionQueue.py | 11 +++++
 .../test/python/ambari_agent/TestActionQueue.py | 48 ++++++++++++++++++++
 2 files changed, 59 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/d24beb17/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 4416b9a..cb4fcb9 100644
--- a/ambari-agent/src/main/python/ambari_agent/ActionQueue.py
+++ b/ambari-agent/src/main/python/ambari_agent/ActionQueue.py
@@ -300,6 +300,7 @@ class ActionQueue(threading.Thread):
 
     logger.info("Command execution metadata - taskId = {taskId}, retry enabled = {retryAble}, max retry duration (sec) = {retryDuration}, log_output = {log_command_output}".
                  format(taskId=taskId, retryAble=retryAble, retryDuration=retryDuration, log_command_output=log_command_output))
+    command_canceled = False
     while retryDuration >= 0:
       numAttempts += 1
       start = 0
@@ -328,6 +329,7 @@ class ActionQueue(threading.Thread):
           status = self.FAILED_STATUS
           if (commandresult['exitcode'] == -signal.SIGTERM) or (commandresult['exitcode'] == -signal.SIGKILL):
             logger.info('Command with taskId = {cid} was canceled!'.format(cid=taskId))
+            command_canceled = True
             break
 
       if status != self.COMPLETED_STATUS and retryAble and retryDuration > 0:
@@ -344,6 +346,15 @@ class ActionQueue(threading.Thread):
                     .format(cid=taskId, status=status, retryAble=retryAble, retryDuration=retryDuration, delay=delay))
         break
 
+    # do not fail task which was rescheduled from server
+    if command_canceled:
+      with self.commandQueue.mutex:
+        for com in self.commandQueue.queue:
+          if com['taskId'] == command['taskId']:
+            logger.info('Command with taskId = {cid} was rescheduled by server. '
+                        'Fail report on cancelled command won\'t be sent with heartbeat.'.format(cid=taskId))
+            return
+
     # final result to stdout
     commandresult['stdout'] += '\n\nCommand completed successfully!\n' if status == self.COMPLETED_STATUS else '\n\nCommand failed after ' + str(numAttempts) + ' tries\n'
     logger.info('Command with taskId = {cid} completed successfully!'.format(cid=taskId) if status == self.COMPLETED_STATUS else 'Command with taskId = {cid} failed after {attempts} tries'.format(cid=taskId, attempts=numAttempts))

http://git-wip-us.apache.org/repos/asf/ambari/blob/d24beb17/ambari-agent/src/test/python/ambari_agent/TestActionQueue.py
----------------------------------------------------------------------
diff --git a/ambari-agent/src/test/python/ambari_agent/TestActionQueue.py b/ambari-agent/src/test/python/ambari_agent/TestActionQueue.py
index 4a63f7c..65127f2 100644
--- a/ambari-agent/src/test/python/ambari_agent/TestActionQueue.py
+++ b/ambari-agent/src/test/python/ambari_agent/TestActionQueue.py
@@ -27,6 +27,7 @@ import os, errno, time, pprint, tempfile, threading
 import sys
 from threading import Thread
 import copy
+import signal
 
 from mock.mock import patch, MagicMock, call
 from ambari_agent.CustomServiceOrchestrator import CustomServiceOrchestrator
@@ -690,6 +691,53 @@ class TestActionQueue(TestCase):
     report = actionQueue.result()
     self.assertEqual(len(report['reports']), 0)
 
+  def test_cancel_with_reschedule_command(self):
+    config = AmbariConfig()
+    tempdir = tempfile.gettempdir()
+    config.set('agent', 'prefix', tempdir)
+    config.set('agent', 'cache_dir', "/var/lib/ambari-agent/cache")
+    config.set('agent', 'tolerate_download_failures', "true")
+    dummy_controller = MagicMock()
+    actionQueue = ActionQueue(config, dummy_controller)
+    unfreeze_flag = threading.Event()
+    python_execution_result_dict = {
+      'stdout': 'out',
+      'stderr': 'stderr',
+      'structuredOut' : '',
+      'status' : '',
+      'exitcode' : -signal.SIGTERM
+    }
+
+    def side_effect(command, tmpoutfile, tmperrfile, override_output_files=True, retry=False):
+      unfreeze_flag.wait()
+      return python_execution_result_dict
+    def patched_aq_execute_command(command):
+      # We have to perform patching for separate thread in the same thread
+      with patch.object(CustomServiceOrchestrator, "runCommand") as runCommand_mock:
+        runCommand_mock.side_effect = side_effect
+        actionQueue.execute_command(command)
+
+    # We call method in a separate thread
+    execution_thread = Thread(target = patched_aq_execute_command ,
+                              args = (self.datanode_install_command, ))
+    execution_thread.start()
+    #  check in progress report
+    # wait until ready
+    while True:
+      time.sleep(0.1)
+      report = actionQueue.result()
+      if len(report['reports']) != 0:
+        break
+
+    unfreeze_flag.set()
+    # wait until ready
+    while len(report['reports']) != 0:
+      time.sleep(0.1)
+      report = actionQueue.result()
+
+    # check report
+    self.assertEqual(len(report['reports']), 0)
+
 
   @patch.object(OSCheck, "os_distribution", new = MagicMock(return_value = os_distro_value))
   @patch.object(CustomServiceOrchestrator, "runCommand")


[24/50] [abbrv] ambari git commit: AMBARI-18736. Perf: Simulate alerts for multiple Ambari Agents running on single Host.(vbrodetskyi)

Posted by nc...@apache.org.
AMBARI-18736. Perf: Simulate alerts for multiple Ambari Agents running on single Host.(vbrodetskyi)


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

Branch: refs/heads/branch-dev-patch-upgrade
Commit: ef63373ef2fa886d819589b8500e4c1c81390a87
Parents: 9a72a60
Author: Vitaly Brodetskyi <vb...@hortonworks.com>
Authored: Thu Dec 1 16:38:58 2016 +0200
Committer: Vitaly Brodetskyi <vb...@hortonworks.com>
Committed: Thu Dec 1 16:38:58 2016 +0200

----------------------------------------------------------------------
 .../simulate_perf_cluster_alert_behaviour.py    |  108 ++
 .../stacks/PERF/1.0/services/HAPPY/alerts.json  |   20 +
 .../HAPPY/configuration/happy-alert-config.xml  |   75 +
 .../stacks/PERF/1.0/services/HAPPY/metainfo.xml |    5 +
 .../HAPPY/package/alerts/alert_happy_process.py |   59 +
 .../stacks/PERF/1.0/services/HBASE/alerts.json  |  110 +-
 .../HBASE/configuration/hbase-alert-config.xml  |   75 +
 .../stacks/PERF/1.0/services/HBASE/metainfo.xml |    1 +
 .../package/alerts/hbase_master_process.py      |   59 +
 .../alerts/hbase_regionserver_process.py        |   59 +
 .../stacks/PERF/1.0/services/HDFS/alerts.json   | 1728 +-----------------
 .../HDFS/configuration/hdfs-alert-config.xml    |   75 +
 .../stacks/PERF/1.0/services/HDFS/metainfo.xml  |    1 +
 .../package/alerts/alert_checkpoint_time.py     |   38 +-
 .../alerts/alert_datanode_unmounted_data_dir.py |   47 +-
 .../package/alerts/alert_ha_namenode_health.py  |   75 -
 .../package/alerts/alert_metrics_deviation.py   |   85 -
 .../package/alerts/alert_nfs_gateway_process.py |   59 +
 .../package/alerts/alert_snamenode_process.py   |   59 +
 .../package/alerts/alert_upgrade_finalized.py   |   49 +-
 .../stacks/PERF/1.0/services/SLEEPY/alerts.json |   20 +
 .../configuration/sleepy-alert-config.xml       |   75 +
 .../PERF/1.0/services/SLEEPY/metainfo.xml       |    5 +
 .../package/alerts/alert_sleepy_process.py      |   59 +
 .../stacks/PERF/1.0/services/SNOW/alerts.json   |   20 +
 .../SNOW/configuration/snow-alert-config.xml    |   75 +
 .../stacks/PERF/1.0/services/SNOW/metainfo.xml  |    5 +
 .../SNOW/package/alerts/alert_snow_process.py   |   59 +
 .../stacks/PERF/1.0/services/YARN/alerts.json   |  361 +---
 .../YARN/configuration/yarn-alert-config.xml    |   75 +
 .../stacks/PERF/1.0/services/YARN/metainfo.xml  |    3 +
 .../package/alerts/alert_history_process.py     |   59 +
 .../package/alerts/alert_nodemanager_health.py  |   36 +-
 .../alerts/alert_nodemanagers_summary.py        |   68 -
 .../alerts/alert_resourcemanager_process.py     |   59 +
 .../package/alerts/alert_timeline_process.py    |   59 +
 .../PERF/1.0/services/ZOOKEEPER/alerts.json     |   20 +
 .../ZOOKEEPER/configuration/zk-alert-config.xml |   75 +
 .../PERF/1.0/services/ZOOKEEPER/metainfo.xml    |    4 +
 .../package/alerts/alert_zk_server_process.py   |   59 +
 40 files changed, 1510 insertions(+), 2473 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/ef63373e/ambari-common/src/main/python/resource_management/libraries/functions/simulate_perf_cluster_alert_behaviour.py
----------------------------------------------------------------------
diff --git a/ambari-common/src/main/python/resource_management/libraries/functions/simulate_perf_cluster_alert_behaviour.py b/ambari-common/src/main/python/resource_management/libraries/functions/simulate_perf_cluster_alert_behaviour.py
new file mode 100644
index 0000000..736e5e3
--- /dev/null
+++ b/ambari-common/src/main/python/resource_management/libraries/functions/simulate_perf_cluster_alert_behaviour.py
@@ -0,0 +1,108 @@
+#!/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.
+"""
+__all__ = ["simulate_perf_cluster_alert_behaviour"]
+
+import logging
+import random
+import time
+
+from datetime import datetime
+from resource_management.core.exceptions import Fail
+
+RESULT_CODE_OK = 'OK'
+RESULT_CODE_CRITICAL = 'CRITICAL'
+RESULT_CODE_UNKNOWN = 'UNKNOWN'
+
+OK_MESSAGE = 'Ok'
+FAIL_MESSAGE = 'Expected Fail'
+UNKNOWN_MESSAGE = 'Expected Unknown'
+
+logger = logging.getLogger('ambari_alerts')
+
+return_values_map = {"true":[RESULT_CODE_OK, OK_MESSAGE], "false":[RESULT_CODE_CRITICAL, FAIL_MESSAGE],
+                     "none":[RESULT_CODE_UNKNOWN, UNKNOWN_MESSAGE]}
+
+def simulate_perf_cluster_alert_behaviour(alert_behaviour_properties, configurations):
+  """
+  Returns a tuple containing the result code and a pre-formatted result label
+
+  Keyword arguments:
+  configurations (dictionary): a mapping of configuration key to value
+  parameters (dictionary): a mapping of script parameter key to value
+  host_name (string): the name of this host where the alert is running
+  """
+  alert_behaviour_type=None
+  alert_behaviour_type_key=alert_behaviour_properties["alert_behaviour_type"]
+  if alert_behaviour_type_key in configurations:
+    alert_behaviour_type = configurations[alert_behaviour_type_key].lower()
+
+  if alert_behaviour_type == "percentage":
+    alert_success_percentage=None
+    alert_success_percentage_key=alert_behaviour_properties["alert_success_percentage"]
+
+    if alert_success_percentage_key in configurations:
+      alert_success_percentage = configurations[alert_success_percentage_key]
+
+    if alert_success_percentage:
+      random_number = random.uniform(0, 100)
+      if random_number <= int(alert_success_percentage):
+        return (RESULT_CODE_OK, [OK_MESSAGE])
+      else:
+        return (RESULT_CODE_CRITICAL, [FAIL_MESSAGE])
+    else:
+      raise Fail("Percentage behaviour was set but alert.success.percentage was not set!")
+  elif alert_behaviour_type == "timeout":
+    alert_timeout_return_value=None
+    alert_timeout_secs=None
+    alert_timeout_return_value_key=alert_behaviour_properties["alert_timeout_return_value"]
+    alert_timeout_secs_key=alert_behaviour_properties["alert_timeout_secs"]
+
+    if alert_timeout_return_value_key in configurations:
+      alert_timeout_return_value = configurations[alert_timeout_return_value_key].lower()
+
+    if alert_timeout_secs_key in configurations:
+      alert_timeout_secs = configurations[alert_timeout_secs_key]
+
+    if alert_timeout_return_value and alert_timeout_secs:
+      logger.info("Sleeping for {0} seconds".format(alert_timeout_secs))
+      print "Sleeping for {0} seconds".format(alert_timeout_secs)
+      time.sleep(int(alert_timeout_secs))
+      return (return_values_map[alert_timeout_return_value][0], [return_values_map[alert_timeout_return_value][1]])
+    else:
+      raise Fail("Timeout behaviour was set but alert.timeout.return.value/alert.timeout.secs were not set!")
+  elif alert_behaviour_type == "flip":
+    alert_flip_interval_mins=None
+    alert_flip_interval_mins_key=alert_behaviour_properties["alert_flip_interval_mins"]
+
+    if alert_flip_interval_mins_key in configurations:
+      alert_flip_interval_mins = configurations[alert_flip_interval_mins_key]
+
+    if alert_flip_interval_mins:
+      curr_time = datetime.utcnow()
+      return_value = ((curr_time.minute / int(alert_flip_interval_mins)) % 2) == 0
+      return (return_values_map[str(return_value).lower()][0], [return_values_map[str(return_value).lower()][1]])
+    else:
+      raise Fail("Flip behaviour was set but alert.flip.interval.mins was not set!")
+
+
+
+  result_code = RESULT_CODE_OK
+  label = OK_MESSAGE
+  return (result_code, [label])
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/ef63373e/ambari-server/src/main/resources/stacks/PERF/1.0/services/HAPPY/alerts.json
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/PERF/1.0/services/HAPPY/alerts.json b/ambari-server/src/main/resources/stacks/PERF/1.0/services/HAPPY/alerts.json
new file mode 100644
index 0000000..848a60d
--- /dev/null
+++ b/ambari-server/src/main/resources/stacks/PERF/1.0/services/HAPPY/alerts.json
@@ -0,0 +1,20 @@
+{
+    "HAPPY": {
+
+        "HAPPY": [
+            {
+                "name": "happy_process",
+                "label": "Happy Process",
+                "description": "Alert for happy component process status",
+                "interval": 1,
+                "scope": "HOST",
+                "enabled": true,
+                "source": {
+                    "type": "SCRIPT",
+                    "path": "PERF/1.0/services/HAPPY/package/alerts/alert_happy_process.py",
+                    "parameters": []
+                }
+            }
+        ]
+    }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/ef63373e/ambari-server/src/main/resources/stacks/PERF/1.0/services/HAPPY/configuration/happy-alert-config.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/PERF/1.0/services/HAPPY/configuration/happy-alert-config.xml b/ambari-server/src/main/resources/stacks/PERF/1.0/services/HAPPY/configuration/happy-alert-config.xml
new file mode 100644
index 0000000..760e706
--- /dev/null
+++ b/ambari-server/src/main/resources/stacks/PERF/1.0/services/HAPPY/configuration/happy-alert-config.xml
@@ -0,0 +1,75 @@
+<?xml version="1.0"?>
+<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
+<!--
+    Licensed to the Apache Software Foundation (ASF) under one or more
+    contributor license agreements.  See the NOTICE file distributed with
+    this work for additional information regarding copyright ownership.
+    The ASF licenses this file to You under the Apache License, Version 2.0
+    (the "License"); you may not use this file except in compliance with
+    the License.  You may obtain a copy of the License at
+
+        http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+-->
+
+<configuration xmlns:xi="http://www.w3.org/2001/XInclude" supports_final="true">
+
+    <property>
+        <name>alert.behavior.type</name>
+        <value>percentage</value>
+        <description>
+            This property describes type of alert behaviour.
+            There are three types percentage, timeout, flip.
+        </description>
+    </property>
+
+
+    <property>
+        <name>alert.success.percentage</name>
+        <value>100</value>
+        <description>
+            This property will be actual only when alert.behaviour.type
+            set to "percentage". Here you should set percent of successful
+            alert checks.
+        </description>
+    </property>
+
+
+    <property>
+        <name>alert.timeout.return.value</name>
+        <value>false</value>
+        <description>
+            This property will be actual only when alert.behaviour.type
+            set to "timeout". Here you should set result which alert will
+            return after timeout, false|true|none.
+        </description>
+    </property>
+
+    <property>
+        <name>alert.timeout.secs</name>
+        <value>120</value>
+        <description>
+            This property will be actual only when alert.behaviour.type
+            set to "timeout". Here you should set number of seconds for
+            alert to sleep.
+        </description>
+    </property>
+
+
+    <property>
+        <name>alert.flip.interval.mins</name>
+        <value>3</value>
+        <description>
+            This property will be actual only when alert.behaviour.type
+            set to "flip". Here you should set number of minutes at which
+            the alert should flip from true|false.
+        </description>
+    </property>
+
+
+</configuration>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/ef63373e/ambari-server/src/main/resources/stacks/PERF/1.0/services/HAPPY/metainfo.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/PERF/1.0/services/HAPPY/metainfo.xml b/ambari-server/src/main/resources/stacks/PERF/1.0/services/HAPPY/metainfo.xml
index 36a2168..53cc11b 100644
--- a/ambari-server/src/main/resources/stacks/PERF/1.0/services/HAPPY/metainfo.xml
+++ b/ambari-server/src/main/resources/stacks/PERF/1.0/services/HAPPY/metainfo.xml
@@ -52,6 +52,11 @@
           <default>true</default>
         </theme>
       </themes>
+
+      <configuration-dependencies>
+        <config-type>happy-alert-config</config-type>
+      </configuration-dependencies>
+
     </service>
   </services>
 </metainfo>

http://git-wip-us.apache.org/repos/asf/ambari/blob/ef63373e/ambari-server/src/main/resources/stacks/PERF/1.0/services/HAPPY/package/alerts/alert_happy_process.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/PERF/1.0/services/HAPPY/package/alerts/alert_happy_process.py b/ambari-server/src/main/resources/stacks/PERF/1.0/services/HAPPY/package/alerts/alert_happy_process.py
new file mode 100644
index 0000000..469179c
--- /dev/null
+++ b/ambari-server/src/main/resources/stacks/PERF/1.0/services/HAPPY/package/alerts/alert_happy_process.py
@@ -0,0 +1,59 @@
+#!/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.
+"""
+
+import logging
+
+from resource_management.libraries.functions.simulate_perf_cluster_alert_behaviour import simulate_perf_cluster_alert_behaviour
+
+ALERT_BEHAVIOUR_TYPE = "{{happy-alert-config/alert.behavior.type}}"
+
+ALERT_SUCCESS_PERCENTAGE = "{{happy-alert-config/alert.success.percentage}}"
+
+ALERT_TIMEOUT_RETURN_VALUE = "{{happy-alert-config/alert.timeout.return.value}}"
+ALERT_TIMEOUT_SECS = "{{happy-alert-config/alert.timeout.secs}}"
+
+ALERT_FLIP_INTERVAL_MINS = "{{happy-alert-config/alert.flip.interval.mins}}"
+
+logger = logging.getLogger('ambari_alerts')
+
+alert_behaviour_properties = {"alert_behaviour_type" : ALERT_BEHAVIOUR_TYPE, "alert_success_percentage" : ALERT_SUCCESS_PERCENTAGE,
+                              "alert_timeout_return_value" : ALERT_TIMEOUT_RETURN_VALUE, "alert_timeout_secs" : ALERT_TIMEOUT_SECS,
+                              "alert_flip_interval_mins" : ALERT_FLIP_INTERVAL_MINS}
+
+def get_tokens():
+  """
+  Returns a tuple of tokens in the format {{site/property}} that will be used
+  to build the dictionary passed into execute
+  """
+  return (ALERT_BEHAVIOUR_TYPE, ALERT_SUCCESS_PERCENTAGE, ALERT_TIMEOUT_RETURN_VALUE, ALERT_TIMEOUT_SECS,
+          ALERT_FLIP_INTERVAL_MINS)
+
+
+def execute(configurations={}, parameters={}, host_name=None):
+  """
+  Returns a tuple containing the result code and a pre-formatted result label
+
+  Keyword arguments:
+  configurations (dictionary): a mapping of configuration key to value
+  parameters (dictionary): a mapping of script parameter key to value
+  host_name (string): the name of this host where the alert is running
+  """
+
+  return simulate_perf_cluster_alert_behaviour(alert_behaviour_properties, configurations)
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/ef63373e/ambari-server/src/main/resources/stacks/PERF/1.0/services/HBASE/alerts.json
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/PERF/1.0/services/HBASE/alerts.json b/ambari-server/src/main/resources/stacks/PERF/1.0/services/HBASE/alerts.json
index 1b3ae25..24141e8 100644
--- a/ambari-server/src/main/resources/stacks/PERF/1.0/services/HBASE/alerts.json
+++ b/ambari-server/src/main/resources/stacks/PERF/1.0/services/HBASE/alerts.json
@@ -1,98 +1,18 @@
 {
   "HBASE": {
-    "service": [
-      {
-        "name": "hbase_regionserver_process_percent",
-        "label": "Percent RegionServers Available",
-        "description": "This service-level alert is triggered if the configured percentage of RegionServer processes cannot be determined to be up and listening on the network for the configured warning and critical thresholds. It aggregates the results of RegionServer process down checks.",
-        "interval": 1,
-        "scope": "SERVICE",
-        "enabled": true,
-        "source": {
-          "type": "AGGREGATE",
-          "alert_name": "hbase_regionserver_process",
-          "reporting": {
-            "ok": {
-              "text": "affected: [{1}], total: [{0}]"
-            },
-            "warning": {
-              "text": "affected: [{1}], total: [{0}]",
-              "value": 10
-            },
-            "critical": {
-              "text": "affected: [{1}], total: [{0}]",
-              "value": 30
-            },
-            "units" : "%",
-            "type": "PERCENT"
-          }
-        }
-      }    
-    ],
+
     "HBASE_MASTER": [
       {
         "name": "hbase_master_process",
         "label": "HBase Master Process",
         "description": "This alert is triggered if the HBase master processes cannot be confirmed to be up and listening on the network for the configured critical threshold, given in seconds.",
         "interval": 1,
-        "scope": "ANY",
-        "source": {
-          "type": "PORT",
-          "uri": "{{hbase-site/hbase.master.port}}",
-          "default_port": 60000,
-          "reporting": {
-            "ok": {
-              "text": "TCP OK - {0:.3f}s response on port {1}"
-            },
-            "warning": {
-              "text": "TCP OK - {0:.3f}s response on port {1}",
-              "value": 1.5
-            },
-            "critical": {
-              "text": "Connection failed: {0} to {1}:{2}",
-              "value": 5.0
-            }
-          }
-        }
-      },
-      {
-        "name": "hbase_master_cpu",
-        "label": "HBase Master CPU Utilization",
-        "description": "This host-level alert is triggered if CPU utilization of the HBase Master exceeds certain warning and critical thresholds. It checks the HBase Master JMX Servlet for the SystemCPULoad property. The threshold values are in percent.",
-        "interval": 5,
-        "scope": "ANY",
+        "scope": "HOST",
         "enabled": true,
         "source": {
-          "type": "METRIC",
-          "uri": {
-            "http": "{{hbase-site/hbase.master.info.port}}",
-            "default_port": 60010,
-            "connection_timeout": 5.0,
-            "kerberos_keytab": "{{hbase-site/hbase.security.authentication.spnego.kerberos.principal}}",
-            "kerberos_principal": "{{hbase-site/hbase.security.authentication.spnego.kerberos.keytab}}"
-          },
-          "reporting": {
-            "ok": {
-              "text": "{1} CPU, load {0:.1%}"
-            },
-            "warning": {
-              "text": "{1} CPU, load {0:.1%}",
-              "value": 200
-            },
-            "critical": {
-              "text": "{1} CPU, load {0:.1%}",
-              "value": 250
-            },
-            "units" : "%",
-            "type": "PERCENT"
-          },
-          "jmx": {
-            "property_list": [
-              "java.lang:type=OperatingSystem/SystemCpuLoad",
-              "java.lang:type=OperatingSystem/AvailableProcessors"
-            ],
-            "value": "{0} * 100"
-          }
+          "type": "SCRIPT",
+          "path": "PERF/1.0/services/HBASE/package/alerts/hbase_master_process.py",
+          "parameters": []
         }
       }
     ],
@@ -103,23 +23,11 @@
         "description": "This host-level alert is triggered if the RegionServer processes cannot be confirmed to be up and listening on the network for the configured critical threshold, given in seconds.",
         "interval": 1,
         "scope": "HOST",
+        "enabled": true,
         "source": {
-          "type": "PORT",
-          "uri": "{{hbase-site/hbase.regionserver.info.port}}",
-          "default_port": 60030,
-          "reporting": {
-            "ok": {
-              "text": "TCP OK - {0:.3f}s response on port {1}"
-            },
-            "warning": {
-              "text": "TCP OK - {0:.3f}s response on port {1}",
-              "value": 1.5
-            },
-            "critical": {
-              "text": "Connection failed: {0} to {1}:{2}",
-              "value": 5.0
-            }
-          }
+          "type": "SCRIPT",
+          "path": "PERF/1.0/services/HBASE/package/alerts/hbase_regionserver_process.py",
+          "parameters": []
         }
       }
     ]

http://git-wip-us.apache.org/repos/asf/ambari/blob/ef63373e/ambari-server/src/main/resources/stacks/PERF/1.0/services/HBASE/configuration/hbase-alert-config.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/PERF/1.0/services/HBASE/configuration/hbase-alert-config.xml b/ambari-server/src/main/resources/stacks/PERF/1.0/services/HBASE/configuration/hbase-alert-config.xml
new file mode 100644
index 0000000..760e706
--- /dev/null
+++ b/ambari-server/src/main/resources/stacks/PERF/1.0/services/HBASE/configuration/hbase-alert-config.xml
@@ -0,0 +1,75 @@
+<?xml version="1.0"?>
+<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
+<!--
+    Licensed to the Apache Software Foundation (ASF) under one or more
+    contributor license agreements.  See the NOTICE file distributed with
+    this work for additional information regarding copyright ownership.
+    The ASF licenses this file to You under the Apache License, Version 2.0
+    (the "License"); you may not use this file except in compliance with
+    the License.  You may obtain a copy of the License at
+
+        http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+-->
+
+<configuration xmlns:xi="http://www.w3.org/2001/XInclude" supports_final="true">
+
+    <property>
+        <name>alert.behavior.type</name>
+        <value>percentage</value>
+        <description>
+            This property describes type of alert behaviour.
+            There are three types percentage, timeout, flip.
+        </description>
+    </property>
+
+
+    <property>
+        <name>alert.success.percentage</name>
+        <value>100</value>
+        <description>
+            This property will be actual only when alert.behaviour.type
+            set to "percentage". Here you should set percent of successful
+            alert checks.
+        </description>
+    </property>
+
+
+    <property>
+        <name>alert.timeout.return.value</name>
+        <value>false</value>
+        <description>
+            This property will be actual only when alert.behaviour.type
+            set to "timeout". Here you should set result which alert will
+            return after timeout, false|true|none.
+        </description>
+    </property>
+
+    <property>
+        <name>alert.timeout.secs</name>
+        <value>120</value>
+        <description>
+            This property will be actual only when alert.behaviour.type
+            set to "timeout". Here you should set number of seconds for
+            alert to sleep.
+        </description>
+    </property>
+
+
+    <property>
+        <name>alert.flip.interval.mins</name>
+        <value>3</value>
+        <description>
+            This property will be actual only when alert.behaviour.type
+            set to "flip". Here you should set number of minutes at which
+            the alert should flip from true|false.
+        </description>
+    </property>
+
+
+</configuration>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/ef63373e/ambari-server/src/main/resources/stacks/PERF/1.0/services/HBASE/metainfo.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/PERF/1.0/services/HBASE/metainfo.xml b/ambari-server/src/main/resources/stacks/PERF/1.0/services/HBASE/metainfo.xml
index b304706..f1f4b7d 100644
--- a/ambari-server/src/main/resources/stacks/PERF/1.0/services/HBASE/metainfo.xml
+++ b/ambari-server/src/main/resources/stacks/PERF/1.0/services/HBASE/metainfo.xml
@@ -168,6 +168,7 @@
       <osSpecifics></osSpecifics>
 
       <configuration-dependencies>
+        <config-type>hbase-alert-config</config-type>
         <config-type>core-site</config-type> <!-- hbase puts core-site in it's folder -->
         <config-type>hbase-policy</config-type>
         <config-type>hbase-site</config-type>

http://git-wip-us.apache.org/repos/asf/ambari/blob/ef63373e/ambari-server/src/main/resources/stacks/PERF/1.0/services/HBASE/package/alerts/hbase_master_process.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/PERF/1.0/services/HBASE/package/alerts/hbase_master_process.py b/ambari-server/src/main/resources/stacks/PERF/1.0/services/HBASE/package/alerts/hbase_master_process.py
new file mode 100644
index 0000000..7662c1f
--- /dev/null
+++ b/ambari-server/src/main/resources/stacks/PERF/1.0/services/HBASE/package/alerts/hbase_master_process.py
@@ -0,0 +1,59 @@
+#!/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.
+"""
+
+import logging
+
+from resource_management.libraries.functions.simulate_perf_cluster_alert_behaviour import simulate_perf_cluster_alert_behaviour
+
+ALERT_BEHAVIOUR_TYPE = "{{hbase-alert-config/alert.behavior.type}}"
+
+ALERT_SUCCESS_PERCENTAGE = "{{hbase-alert-config/alert.success.percentage}}"
+
+ALERT_TIMEOUT_RETURN_VALUE = "{{hbase-alert-config/alert.timeout.return.value}}"
+ALERT_TIMEOUT_SECS = "{{hbase-alert-config/alert.timeout.secs}}"
+
+ALERT_FLIP_INTERVAL_MINS = "{{hbase-alert-config/alert.flip.interval.mins}}"
+
+logger = logging.getLogger('ambari_alerts')
+
+alert_behaviour_properties = {"alert_behaviour_type" : ALERT_BEHAVIOUR_TYPE, "alert_success_percentage" : ALERT_SUCCESS_PERCENTAGE,
+                              "alert_timeout_return_value" : ALERT_TIMEOUT_RETURN_VALUE, "alert_timeout_secs" : ALERT_TIMEOUT_SECS,
+                              "alert_flip_interval_mins" : ALERT_FLIP_INTERVAL_MINS}
+
+def get_tokens():
+  """
+  Returns a tuple of tokens in the format {{site/property}} that will be used
+  to build the dictionary passed into execute
+  """
+  return (ALERT_BEHAVIOUR_TYPE, ALERT_SUCCESS_PERCENTAGE, ALERT_TIMEOUT_RETURN_VALUE, ALERT_TIMEOUT_SECS,
+          ALERT_FLIP_INTERVAL_MINS)
+
+
+def execute(configurations={}, parameters={}, host_name=None):
+  """
+  Returns a tuple containing the result code and a pre-formatted result label
+
+  Keyword arguments:
+  configurations (dictionary): a mapping of configuration key to value
+  parameters (dictionary): a mapping of script parameter key to value
+  host_name (string): the name of this host where the alert is running
+  """
+
+  return simulate_perf_cluster_alert_behaviour(alert_behaviour_properties, configurations)
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/ef63373e/ambari-server/src/main/resources/stacks/PERF/1.0/services/HBASE/package/alerts/hbase_regionserver_process.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/PERF/1.0/services/HBASE/package/alerts/hbase_regionserver_process.py b/ambari-server/src/main/resources/stacks/PERF/1.0/services/HBASE/package/alerts/hbase_regionserver_process.py
new file mode 100644
index 0000000..7662c1f
--- /dev/null
+++ b/ambari-server/src/main/resources/stacks/PERF/1.0/services/HBASE/package/alerts/hbase_regionserver_process.py
@@ -0,0 +1,59 @@
+#!/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.
+"""
+
+import logging
+
+from resource_management.libraries.functions.simulate_perf_cluster_alert_behaviour import simulate_perf_cluster_alert_behaviour
+
+ALERT_BEHAVIOUR_TYPE = "{{hbase-alert-config/alert.behavior.type}}"
+
+ALERT_SUCCESS_PERCENTAGE = "{{hbase-alert-config/alert.success.percentage}}"
+
+ALERT_TIMEOUT_RETURN_VALUE = "{{hbase-alert-config/alert.timeout.return.value}}"
+ALERT_TIMEOUT_SECS = "{{hbase-alert-config/alert.timeout.secs}}"
+
+ALERT_FLIP_INTERVAL_MINS = "{{hbase-alert-config/alert.flip.interval.mins}}"
+
+logger = logging.getLogger('ambari_alerts')
+
+alert_behaviour_properties = {"alert_behaviour_type" : ALERT_BEHAVIOUR_TYPE, "alert_success_percentage" : ALERT_SUCCESS_PERCENTAGE,
+                              "alert_timeout_return_value" : ALERT_TIMEOUT_RETURN_VALUE, "alert_timeout_secs" : ALERT_TIMEOUT_SECS,
+                              "alert_flip_interval_mins" : ALERT_FLIP_INTERVAL_MINS}
+
+def get_tokens():
+  """
+  Returns a tuple of tokens in the format {{site/property}} that will be used
+  to build the dictionary passed into execute
+  """
+  return (ALERT_BEHAVIOUR_TYPE, ALERT_SUCCESS_PERCENTAGE, ALERT_TIMEOUT_RETURN_VALUE, ALERT_TIMEOUT_SECS,
+          ALERT_FLIP_INTERVAL_MINS)
+
+
+def execute(configurations={}, parameters={}, host_name=None):
+  """
+  Returns a tuple containing the result code and a pre-formatted result label
+
+  Keyword arguments:
+  configurations (dictionary): a mapping of configuration key to value
+  parameters (dictionary): a mapping of script parameter key to value
+  host_name (string): the name of this host where the alert is running
+  """
+
+  return simulate_perf_cluster_alert_behaviour(alert_behaviour_properties, configurations)
\ No newline at end of file


[13/50] [abbrv] ambari git commit: AMBARI-19037. Clean up logs for the usage of taskId for easy lookup of command progress and status (smohanty)

Posted by nc...@apache.org.
AMBARI-19037. Clean up logs for the usage of taskId for easy lookup of command progress and status (smohanty)


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

Branch: refs/heads/branch-dev-patch-upgrade
Commit: 32c9f5a83bef6bca90ebecb7721de256c19061c7
Parents: 15f843b
Author: Sumit Mohanty <sm...@hortonworks.com>
Authored: Wed Nov 30 14:45:40 2016 -0800
Committer: Sumit Mohanty <sm...@hortonworks.com>
Committed: Wed Nov 30 14:45:40 2016 -0800

----------------------------------------------------------------------
 ambari-agent/src/main/python/ambari_agent/ActionQueue.py  | 10 +++++-----
 .../main/python/ambari_agent/CustomServiceOrchestrator.py |  4 ++--
 .../org/apache/ambari/server/agent/HeartBeatHandler.java  |  2 +-
 .../apache/ambari/server/agent/HeartbeatProcessor.java    |  2 +-
 .../server/state/services/RetryUpgradeActionService.java  |  2 +-
 5 files changed, 10 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/32c9f5a8/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 a9f1084..4416b9a 100644
--- a/ambari-agent/src/main/python/ambari_agent/ActionQueue.py
+++ b/ambari-agent/src/main/python/ambari_agent/ActionQueue.py
@@ -128,7 +128,7 @@ class ActionQueue(threading.Thread):
   def cancel(self, commands):
     for command in commands:
 
-      logger.info("Canceling command {tid}".format(tid = str(command['target_task_id'])))
+      logger.info("Canceling command with taskId = {tid}".format(tid = str(command['target_task_id'])))
       logger.debug(pprint.pformat(command))
 
       task_id = command['target_task_id']
@@ -327,7 +327,7 @@ class ActionQueue(threading.Thread):
         else:
           status = self.FAILED_STATUS
           if (commandresult['exitcode'] == -signal.SIGTERM) or (commandresult['exitcode'] == -signal.SIGKILL):
-            logger.info('Command {cid} was canceled!'.format(cid=taskId))
+            logger.info('Command with taskId = {cid} was canceled!'.format(cid=taskId))
             break
 
       if status != self.COMPLETED_STATUS and retryAble and retryDuration > 0:
@@ -336,17 +336,17 @@ class ActionQueue(threading.Thread):
           delay = retryDuration
         retryDuration -= delay  # allow one last attempt
         commandresult['stderr'] += "\n\nCommand failed. Retrying command execution ...\n\n"
-        logger.info("Retrying command id {cid} after a wait of {delay}".format(cid=taskId, delay=delay))
+        logger.info("Retrying command with taskId = {cid} after a wait of {delay}".format(cid=taskId, delay=delay))
         time.sleep(delay)
         continue
       else:
-        logger.info("Quit retrying for command id {cid}. Status: {status}, retryAble: {retryAble}, retryDuration (sec): {retryDuration}, last delay (sec): {delay}"
+        logger.info("Quit retrying for command with taskId = {cid}. Status: {status}, retryAble: {retryAble}, retryDuration (sec): {retryDuration}, last delay (sec): {delay}"
                     .format(cid=taskId, status=status, retryAble=retryAble, retryDuration=retryDuration, delay=delay))
         break
 
     # final result to stdout
     commandresult['stdout'] += '\n\nCommand completed successfully!\n' if status == self.COMPLETED_STATUS else '\n\nCommand failed after ' + str(numAttempts) + ' tries\n'
-    logger.info('Command {cid} completed successfully!'.format(cid=taskId) if status == self.COMPLETED_STATUS else 'Command {cid} failed after {attempts} tries'.format(cid=taskId, attempts=numAttempts))
+    logger.info('Command with taskId = {cid} completed successfully!'.format(cid=taskId) if status == self.COMPLETED_STATUS else 'Command with taskId = {cid} failed after {attempts} tries'.format(cid=taskId, attempts=numAttempts))
 
     roleResult = self.commandStatuses.generate_report_template(command)
     roleResult.update({

http://git-wip-us.apache.org/repos/asf/ambari/blob/32c9f5a8/ambari-agent/src/main/python/ambari_agent/CustomServiceOrchestrator.py
----------------------------------------------------------------------
diff --git a/ambari-agent/src/main/python/ambari_agent/CustomServiceOrchestrator.py b/ambari-agent/src/main/python/ambari_agent/CustomServiceOrchestrator.py
index ebd3506..7d61611 100644
--- a/ambari-agent/src/main/python/ambari_agent/CustomServiceOrchestrator.py
+++ b/ambari-agent/src/main/python/ambari_agent/CustomServiceOrchestrator.py
@@ -97,12 +97,12 @@ class CustomServiceOrchestrator():
       if task_id in self.commands_in_progress.keys():
         pid = self.commands_in_progress.get(task_id)
         self.commands_in_progress[task_id] = reason
-        logger.info("Canceling command with task_id - {tid}, " \
+        logger.info("Canceling command with taskId = {tid}, " \
                     "reason - {reason} . Killing process {pid}"
                     .format(tid=str(task_id), reason=reason, pid=pid))
         shell.kill_process_with_children(pid)
       else: 
-        logger.warn("Unable to find pid by taskId = %s" % task_id)
+        logger.warn("Unable to find process associated with taskId = %s" % task_id)
 
   def get_py_executor(self, forced_command_name):
     """

http://git-wip-us.apache.org/repos/asf/ambari/blob/32c9f5a8/ambari-server/src/main/java/org/apache/ambari/server/agent/HeartBeatHandler.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/agent/HeartBeatHandler.java b/ambari-server/src/main/java/org/apache/ambari/server/agent/HeartBeatHandler.java
index a25b875..75bef30 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/agent/HeartBeatHandler.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/agent/HeartBeatHandler.java
@@ -329,7 +329,7 @@ public class HeartBeatHandler {
           case BACKGROUND_EXECUTION_COMMAND:
           case EXECUTION_COMMAND: {
             ExecutionCommand ec = (ExecutionCommand)ac;
-            LOG.info("HeartBeatHandler.sendCommands: sending ExecutionCommand for host {}, role {}, roleCommand {}, and command ID {}, task ID {}",
+            LOG.info("HeartBeatHandler.sendCommands: sending ExecutionCommand for host {}, role {}, roleCommand {}, and command ID {}, taskId {}",
                      ec.getHostname(), ec.getRole(), ec.getRoleCommand(), ec.getCommandId(), ec.getTaskId());
             Map<String, String> hlp = ec.getHostLevelParams();
             if (hlp != null) {

http://git-wip-us.apache.org/repos/asf/ambari/blob/32c9f5a8/ambari-server/src/main/java/org/apache/ambari/server/agent/HeartbeatProcessor.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/agent/HeartbeatProcessor.java b/ambari-server/src/main/java/org/apache/ambari/server/agent/HeartbeatProcessor.java
index 2448c99..8f4782e 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/agent/HeartbeatProcessor.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/agent/HeartbeatProcessor.java
@@ -552,7 +552,7 @@ public class HeartbeatProcessor extends AbstractService{
             }
 
             LOG.error("Operation failed - may be retried. Service component host: "
-                + schName + ", host: " + hostname + " Action id " + report.getActionId() + " and Task id " + report.getTaskId());
+                + schName + ", host: " + hostname + " Action id " + report.getActionId() + " and taskId " + report.getTaskId());
             if (actionManager.isInProgressCommand(report)) {
               scHost.handleEvent(new ServiceComponentHostOpFailedEvent
                   (schName, hostname, now));

http://git-wip-us.apache.org/repos/asf/ambari/blob/32c9f5a8/ambari-server/src/main/java/org/apache/ambari/server/state/services/RetryUpgradeActionService.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/state/services/RetryUpgradeActionService.java b/ambari-server/src/main/java/org/apache/ambari/server/state/services/RetryUpgradeActionService.java
index 72b8ab7..1ea5558 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/state/services/RetryUpgradeActionService.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/state/services/RetryUpgradeActionService.java
@@ -199,7 +199,7 @@ public class RetryUpgradeActionService extends AbstractScheduledService {
     List<HostRoleCommandEntity> holdingCommands = m_hostRoleCommandDAO.findByRequestIdAndStatuses(requestId, HOLDING_STATUSES);
     if (holdingCommands.size() > 0) {
       for (HostRoleCommandEntity hrc : holdingCommands) {
-        LOG.debug("Comparing task id: {}, original start time: {}, now: {}",
+        LOG.debug("Comparing taskId: {}, original start time: {}, now: {}",
             hrc.getTaskId(), hrc.getOriginalStartTime(), now);
 
         /*


[15/50] [abbrv] ambari git commit: AMBARI-19040. Fix NPE in UpgradeCatalog250Test.testExecuteDMLUpdates (rlevas)

Posted by nc...@apache.org.
AMBARI-19040. Fix NPE in UpgradeCatalog250Test.testExecuteDMLUpdates (rlevas)


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

Branch: refs/heads/branch-dev-patch-upgrade
Commit: 7f04e79ab33dc173eb174fd9fcc60bbb54d2c947
Parents: 1e65ba6
Author: Robert Levas <rl...@hortonworks.com>
Authored: Wed Nov 30 20:38:34 2016 -0500
Committer: Robert Levas <rl...@hortonworks.com>
Committed: Wed Nov 30 20:38:34 2016 -0500

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


http://git-wip-us.apache.org/repos/asf/ambari/blob/7f04e79a/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog250Test.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog250Test.java b/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog250Test.java
index 14fc20b..978e2dc 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog250Test.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog250Test.java
@@ -212,11 +212,13 @@ public class UpgradeCatalog250Test {
     Method updateAmsConfigs = UpgradeCatalog250.class.getDeclaredMethod("updateAMSConfigs");
     Method addNewConfigurationsFromXml = AbstractUpgradeCatalog.class.getDeclaredMethod("addNewConfigurationsFromXml");
     Method updateKafkaConfigs = UpgradeCatalog250.class.getDeclaredMethod("updateKafkaConfigs");
+    Method updateHiveLlapConfigs = UpgradeCatalog250.class.getDeclaredMethod("updateHiveLlapConfigs");
 
     UpgradeCatalog250 upgradeCatalog250 = createMockBuilder(UpgradeCatalog250.class)
         .addMockedMethod(updateAmsConfigs)
         .addMockedMethod(addNewConfigurationsFromXml)
         .addMockedMethod(updateKafkaConfigs)
+        .addMockedMethod(updateHiveLlapConfigs)
         .createMock();
 
     upgradeCatalog250.updateAMSConfigs();
@@ -228,6 +230,9 @@ public class UpgradeCatalog250Test {
     upgradeCatalog250.updateKafkaConfigs();
     expectLastCall().once();
 
+    upgradeCatalog250.updateHiveLlapConfigs();
+    expectLastCall().once();
+
     replay(upgradeCatalog250);
 
     upgradeCatalog250.executeDMLUpdates();


[12/50] [abbrv] ambari git commit: AMBARI-19023. After adding an Atlas server the first restart command fails since stop doesn't have any configs; if no pid dir exists during stop, perform no-op (alejandro)

Posted by nc...@apache.org.
AMBARI-19023. After adding an Atlas server the first restart command fails since stop doesn't have any configs; if no pid dir exists during stop, perform no-op (alejandro)


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

Branch: refs/heads/branch-dev-patch-upgrade
Commit: 15f843bbb0679d93f836c0fa4a3b23370b1ae91c
Parents: 72b940e
Author: Alejandro Fernandez <af...@hortonworks.com>
Authored: Tue Nov 29 17:10:16 2016 -0800
Committer: Alejandro Fernandez <af...@hortonworks.com>
Committed: Wed Nov 30 13:48:07 2016 -0800

----------------------------------------------------------------------
 .../0.1.0.2.3/package/scripts/metadata_server.py  | 18 ++++++++++++++++++
 .../stacks/2.3/ATLAS/test_metadata_server.py      |  5 ++++-
 2 files changed, 22 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/15f843bb/ambari-server/src/main/resources/common-services/ATLAS/0.1.0.2.3/package/scripts/metadata_server.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/ATLAS/0.1.0.2.3/package/scripts/metadata_server.py b/ambari-server/src/main/resources/common-services/ATLAS/0.1.0.2.3/package/scripts/metadata_server.py
index a469ebb..36d990d 100644
--- a/ambari-server/src/main/resources/common-services/ATLAS/0.1.0.2.3/package/scripts/metadata_server.py
+++ b/ambari-server/src/main/resources/common-services/ATLAS/0.1.0.2.3/package/scripts/metadata_server.py
@@ -16,6 +16,10 @@ See the License for the specific language governing permissions and
 limitations under the License.
 
 """
+# Python Imports
+import os
+
+# Local Imports
 from metadata import metadata
 from resource_management import Fail
 from resource_management.libraries.functions import conf_select, stack_select
@@ -124,6 +128,20 @@ class MetadataServer(Script):
     env.set_params(params)
     daemon_cmd = format('source {params.conf_dir}/atlas-env.sh; {params.metadata_stop_script}')
 
+    # If the pid dir doesn't exist, this means either
+    # 1. The user just added Atlas service and issued a restart command (stop+start). So stop should be a no-op
+    # since there's nothing to stop.
+    # OR
+    # 2. The user changed the value of the pid dir config and incorrectly issued a restart command.
+    # In which case the stop command cannot do anything since Ambari doesn't know which process to kill.
+    # The start command will spawn another instance.
+    # The user should have issued a stop, changed the config, and then started it.
+    if not os.path.isdir(params.pid_dir):
+      Logger.info("*******************************************************************")
+      Logger.info("Will skip the stop command since this is the first time stopping/restarting Atlas "
+                  "and the pid dir does not exist, %s\n" % params.pid_dir)
+      return
+
     try:
       Execute(daemon_cmd,
               user=params.metadata_user,

http://git-wip-us.apache.org/repos/asf/ambari/blob/15f843bb/ambari-server/src/test/python/stacks/2.3/ATLAS/test_metadata_server.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/stacks/2.3/ATLAS/test_metadata_server.py b/ambari-server/src/test/python/stacks/2.3/ATLAS/test_metadata_server.py
index 585dc94..f2fec70 100644
--- a/ambari-server/src/test/python/stacks/2.3/ATLAS/test_metadata_server.py
+++ b/ambari-server/src/test/python/stacks/2.3/ATLAS/test_metadata_server.py
@@ -366,7 +366,10 @@ class TestMetadataServer(RMFTestCase):
                               user = 'atlas',
     )
 
-  def test_stop_default(self):
+  @patch('os.path.isdir')
+  def test_stop_default(self, is_dir_mock):
+    is_dir_mock.return_value = True
+
     self.executeScript(self.COMMON_SERVICES_PACKAGE_DIR + "/scripts/metadata_server.py",
                        classname = "MetadataServer",
                        command = "stop",


[31/50] [abbrv] ambari git commit: AMBARI-19032 HDFS Metric alerts turns to UNKNOWN state with error "'NoneType' object has no attribute 'split'" (dsen)

Posted by nc...@apache.org.
AMBARI-19032 HDFS Metric alerts turns to UNKNOWN state with error "'NoneType' object has no attribute 'split'" (dsen)


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

Branch: refs/heads/branch-dev-patch-upgrade
Commit: 406b245ef9ed3a43fdf4d974dc1a7fc467c576a4
Parents: 63c0f2e
Author: Dmytro Sen <ds...@apache.org>
Authored: Thu Dec 1 22:15:26 2016 +0200
Committer: Dmytro Sen <ds...@apache.org>
Committed: Thu Dec 1 22:15:26 2016 +0200

----------------------------------------------------------------------
 .../ambari_commons/ambari_metrics_helper.py     | 45 +++++++++++---------
 .../timeline/AbstractTimelineMetricsSink.java   |  6 +--
 .../AbstractTimelineMetricSinkTest.java         | 10 ++---
 .../timeline/HadoopTimelineMetricsSink.java     |  4 +-
 .../timeline/HadoopTimelineMetricsSinkTest.java |  6 +--
 .../src/main/python/core/config_reader.py       |  9 ++--
 .../src/test/python/core/TestEmitter.py         |  2 +-
 .../1.6.1.2.2.0/package/scripts/params.py       |  2 +-
 .../0.1.0/package/scripts/params.py             |  2 +-
 .../0.1.0/package/scripts/service_check.py      |  2 +-
 .../FLUME/1.4.0.2.0/package/scripts/params.py   |  2 +-
 .../0.96.0.2.0/package/scripts/params_linux.py  |  2 +-
 .../package/alerts/alert_metrics_deviation.py   |  2 +-
 .../KAFKA/0.8.1/package/scripts/params.py       |  2 +-
 .../STORM/0.9.1/package/scripts/params_linux.py |  2 +-
 .../2.0.6/hooks/before-START/scripts/params.py  |  2 +-
 .../2.1/hooks/before-START/scripts/params.py    |  4 +-
 17 files changed, 51 insertions(+), 53 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/406b245e/ambari-common/src/main/python/ambari_commons/ambari_metrics_helper.py
----------------------------------------------------------------------
diff --git a/ambari-common/src/main/python/ambari_commons/ambari_metrics_helper.py b/ambari-common/src/main/python/ambari_commons/ambari_metrics_helper.py
index 2eb0b6d..f6f4068 100644
--- a/ambari-common/src/main/python/ambari_commons/ambari_metrics_helper.py
+++ b/ambari-common/src/main/python/ambari_commons/ambari_metrics_helper.py
@@ -22,38 +22,41 @@ import os
 import random
 from resource_management.libraries.functions import conf_select
 
-DEFAULT_COLLECTOR_SUFFIX = '.sink.timeline.collector'
+DEFAULT_COLLECTOR_SUFFIX = '.sink.timeline.collector.hosts'
 DEFAULT_METRICS2_PROPERTIES_FILE_NAME = 'hadoop-metrics2.properties'
 
 def select_metric_collector_for_sink(sink_name):
-    # TODO check '*' sink_name
+  # TODO check '*' sink_name
 
-    all_collectors_string = get_metric_collectors_from_properties_file(sink_name)
+  all_collectors_string = get_metric_collectors_from_properties_file(sink_name)
+  if all_collectors_string:
     all_collectors_list = all_collectors_string.split(',')
     return select_metric_collector_hosts_from_hostnames(all_collectors_list)
+  else:
+    return 'localhost'
 
 def select_metric_collector_hosts_from_hostnames(hosts):
-    return get_random_host(hosts)
+  return get_random_host(hosts)
 
 def get_random_host(hosts):
-    return random.choice(hosts)
+  return random.choice(hosts)
 
 def get_metric_collectors_from_properties_file(sink_name):
-    hadoop_conf_dir = conf_select.get_hadoop_conf_dir()
-    props = load_properties_from_file(os.path.join(hadoop_conf_dir, DEFAULT_METRICS2_PROPERTIES_FILE_NAME))
-    return props.get(sink_name + DEFAULT_COLLECTOR_SUFFIX)
+  hadoop_conf_dir = conf_select.get_hadoop_conf_dir()
+  props = load_properties_from_file(os.path.join(hadoop_conf_dir, DEFAULT_METRICS2_PROPERTIES_FILE_NAME))
+  return props.get(sink_name + DEFAULT_COLLECTOR_SUFFIX)
 
 def load_properties_from_file(filepath, sep='=', comment_char='#'):
-    """
-    Read the file passed as parameter as a properties file.
-    """
-    props = {}
-    with open(filepath, "rt") as f:
-        for line in f:
-            l = line.strip()
-            if l and not l.startswith(comment_char):
-                key_value = l.split(sep)
-                key = key_value[0].strip()
-                value = sep.join(key_value[1:]).strip('" \t')
-                props[key] = value
-    return props
+  """
+  Read the file passed as parameter as a properties file.
+  """
+  props = {}
+  with open(filepath, "rt") as f:
+    for line in f:
+        l = line.strip()
+        if l and not l.startswith(comment_char):
+          key_value = l.split(sep)
+          key = key_value[0].strip()
+          value = sep.join(key_value[1:]).strip('" \t')
+          props[key] = value
+  return props

http://git-wip-us.apache.org/repos/asf/ambari/blob/406b245e/ambari-metrics/ambari-metrics-common/src/main/java/org/apache/hadoop/metrics2/sink/timeline/AbstractTimelineMetricsSink.java
----------------------------------------------------------------------
diff --git a/ambari-metrics/ambari-metrics-common/src/main/java/org/apache/hadoop/metrics2/sink/timeline/AbstractTimelineMetricsSink.java b/ambari-metrics/ambari-metrics-common/src/main/java/org/apache/hadoop/metrics2/sink/timeline/AbstractTimelineMetricsSink.java
index 769d0c1..2c0c822 100644
--- a/ambari-metrics/ambari-metrics-common/src/main/java/org/apache/hadoop/metrics2/sink/timeline/AbstractTimelineMetricsSink.java
+++ b/ambari-metrics/ambari-metrics-common/src/main/java/org/apache/hadoop/metrics2/sink/timeline/AbstractTimelineMetricsSink.java
@@ -477,7 +477,7 @@ public abstract class AbstractTimelineMetricsSink {
     return sb.toString();
   }
   /**
-   * Parses input Sting of format "['host1', 'host2']" into Collection of hostnames
+   * Parses input Sting of format "host1,host2" into Collection of hostnames
    */
   public Collection<String> parseHostsStringIntoCollection(String hostsString) {
     Set<String> hosts = new HashSet<>();
@@ -487,10 +487,8 @@ public abstract class AbstractTimelineMetricsSink {
       return hosts;
     }
 
-    String[] untrimmedHosts = hostsString.split(",");
 
-    for (String host : untrimmedHosts) {
-      host = StringUtils.substringBetween(host, "'");
+    for (String host : hostsString.split(",")) {
       if (StringUtils.isEmpty(host))
         continue;
       hosts.add(host.trim());

http://git-wip-us.apache.org/repos/asf/ambari/blob/406b245e/ambari-metrics/ambari-metrics-common/src/test/java/org/apache/hadoop/metrics2/sink/timeline/availability/AbstractTimelineMetricSinkTest.java
----------------------------------------------------------------------
diff --git a/ambari-metrics/ambari-metrics-common/src/test/java/org/apache/hadoop/metrics2/sink/timeline/availability/AbstractTimelineMetricSinkTest.java b/ambari-metrics/ambari-metrics-common/src/test/java/org/apache/hadoop/metrics2/sink/timeline/availability/AbstractTimelineMetricSinkTest.java
index 5e016f8..9b0cdbe 100644
--- a/ambari-metrics/ambari-metrics-common/src/test/java/org/apache/hadoop/metrics2/sink/timeline/availability/AbstractTimelineMetricSinkTest.java
+++ b/ambari-metrics/ambari-metrics-common/src/test/java/org/apache/hadoop/metrics2/sink/timeline/availability/AbstractTimelineMetricSinkTest.java
@@ -32,21 +32,21 @@ public class AbstractTimelineMetricSinkTest {
     AbstractTimelineMetricsSink sink = new TestTimelineMetricsSink();
     Collection<String> hosts;
 
-    hosts = sink.parseHostsStringIntoCollection("[]");
+    hosts = sink.parseHostsStringIntoCollection("");
     Assert.assertTrue(hosts.isEmpty());
 
-    hosts = sink.parseHostsStringIntoCollection("[u'test1.123.abc.def.local']");
+    hosts = sink.parseHostsStringIntoCollection("test1.123.abc.def.local");
     Assert.assertTrue(hosts.size() == 1);
     Assert.assertTrue(hosts.contains("test1.123.abc.def.local"));
 
-    hosts = sink.parseHostsStringIntoCollection("['test1.123.abc.def.local']");
+    hosts = sink.parseHostsStringIntoCollection("test1.123.abc.def.local ");
     Assert.assertTrue(hosts.size() == 1);
     Assert.assertTrue(hosts.contains("test1.123.abc.def.local"));
 
-    hosts = sink.parseHostsStringIntoCollection("[u'test1.123.abc.def.local', u'test1.456.abc.def.local']");
+    hosts = sink.parseHostsStringIntoCollection("test1.123.abc.def.local,test1.456.abc.def.local");
     Assert.assertTrue(hosts.size() == 2);
 
-    hosts = sink.parseHostsStringIntoCollection("['test1.123.abc.def.local', 'test1.456.abc.def.local']");
+    hosts = sink.parseHostsStringIntoCollection("test1.123.abc.def.local, test1.456.abc.def.local");
     Assert.assertTrue(hosts.size() == 2);
     Assert.assertTrue(hosts.contains("test1.123.abc.def.local"));
     Assert.assertTrue(hosts.contains("test1.456.abc.def.local"));

http://git-wip-us.apache.org/repos/asf/ambari/blob/406b245e/ambari-metrics/ambari-metrics-hadoop-sink/src/main/java/org/apache/hadoop/metrics2/sink/timeline/HadoopTimelineMetricsSink.java
----------------------------------------------------------------------
diff --git a/ambari-metrics/ambari-metrics-hadoop-sink/src/main/java/org/apache/hadoop/metrics2/sink/timeline/HadoopTimelineMetricsSink.java b/ambari-metrics/ambari-metrics-hadoop-sink/src/main/java/org/apache/hadoop/metrics2/sink/timeline/HadoopTimelineMetricsSink.java
index 2bfc6db..7c85171 100644
--- a/ambari-metrics/ambari-metrics-hadoop-sink/src/main/java/org/apache/hadoop/metrics2/sink/timeline/HadoopTimelineMetricsSink.java
+++ b/ambari-metrics/ambari-metrics-hadoop-sink/src/main/java/org/apache/hadoop/metrics2/sink/timeline/HadoopTimelineMetricsSink.java
@@ -194,13 +194,13 @@ public class HadoopTimelineMetricsSink extends AbstractTimelineMetricsSink imple
   }
 
   /**
-   * Parses input Stings array of format "['host1'", '"host2']" into Collection of hostnames
+   * Parses input Stings array of format "host1,host2" into Collection of hostnames
    */
   protected Collection<String> parseHostsStringArrayIntoCollection(String[] hostStrings) {
     Collection<String> result = new HashSet<>();
     if (hostStrings == null) return result;
     for (String s : hostStrings) {
-      result.addAll(parseHostsStringIntoCollection(s));
+      result.add(s.trim());
     }
     return result;
   }

http://git-wip-us.apache.org/repos/asf/ambari/blob/406b245e/ambari-metrics/ambari-metrics-hadoop-sink/src/test/java/org/apache/hadoop/metrics2/sink/timeline/HadoopTimelineMetricsSinkTest.java
----------------------------------------------------------------------
diff --git a/ambari-metrics/ambari-metrics-hadoop-sink/src/test/java/org/apache/hadoop/metrics2/sink/timeline/HadoopTimelineMetricsSinkTest.java b/ambari-metrics/ambari-metrics-hadoop-sink/src/test/java/org/apache/hadoop/metrics2/sink/timeline/HadoopTimelineMetricsSinkTest.java
index 3259c18..5777639 100644
--- a/ambari-metrics/ambari-metrics-hadoop-sink/src/test/java/org/apache/hadoop/metrics2/sink/timeline/HadoopTimelineMetricsSinkTest.java
+++ b/ambari-metrics/ambari-metrics-hadoop-sink/src/test/java/org/apache/hadoop/metrics2/sink/timeline/HadoopTimelineMetricsSinkTest.java
@@ -99,7 +99,7 @@ public class HadoopTimelineMetricsSinkTest {
     expect(conf.getString("slave.host.name")).andReturn("localhost").anyTimes();
     expect(conf.getParent()).andReturn(null).anyTimes();
     expect(conf.getPrefix()).andReturn("service").anyTimes();
-    expect(conf.getStringArray(eq(COLLECTOR_HOSTS_PROPERTY))).andReturn(new String[]{"['localhost", "'localhost2']"}).anyTimes();
+    expect(conf.getStringArray(eq(COLLECTOR_HOSTS_PROPERTY))).andReturn(new String[]{"localhost"," localhost2"}).anyTimes();
     expect(conf.getString(eq("serviceName-prefix"), eq(""))).andReturn("").anyTimes();
     expect(conf.getString(eq(COLLECTOR_PROTOCOL), eq("http"))).andReturn("http").anyTimes();
     expect(conf.getString(eq(COLLECTOR_PORT), eq("6188"))).andReturn("6188").anyTimes();
@@ -171,7 +171,7 @@ public class HadoopTimelineMetricsSinkTest {
     expect(conf.getString("slave.host.name")).andReturn("localhost").anyTimes();
     expect(conf.getParent()).andReturn(null).anyTimes();
     expect(conf.getPrefix()).andReturn("service").anyTimes();
-    expect(conf.getStringArray(eq(COLLECTOR_HOSTS_PROPERTY))).andReturn(new String[]{"['localhost", "'localhost2']"}).anyTimes();
+    expect(conf.getStringArray(eq(COLLECTOR_HOSTS_PROPERTY))).andReturn(new String[]{"localhost", "localhost2"}).anyTimes();
     expect(conf.getString(eq("serviceName-prefix"), eq(""))).andReturn("").anyTimes();
     expect(conf.getString(eq(COLLECTOR_PROTOCOL), eq("http"))).andReturn("http").anyTimes();
     expect(conf.getString(eq(COLLECTOR_PORT), eq("6188"))).andReturn("6188").anyTimes();
@@ -301,7 +301,7 @@ public class HadoopTimelineMetricsSinkTest {
     expect(conf.getString("slave.host.name")).andReturn("localhost").anyTimes();
     expect(conf.getParent()).andReturn(null).anyTimes();
     expect(conf.getPrefix()).andReturn("service").anyTimes();
-    expect(conf.getStringArray(eq(COLLECTOR_HOSTS_PROPERTY))).andReturn(new String[]{"['localhost", "'localhost2']"}).anyTimes();
+    expect(conf.getStringArray(eq(COLLECTOR_HOSTS_PROPERTY))).andReturn(new String[]{"localhost", "localhost2"}).anyTimes();
     expect(conf.getString(eq("serviceName-prefix"), eq(""))).andReturn("").anyTimes();
     expect(conf.getString(eq(COLLECTOR_PROTOCOL), eq("http"))).andReturn("http").anyTimes();
     expect(conf.getString(eq(COLLECTOR_PORT), eq("6188"))).andReturn("6188").anyTimes();

http://git-wip-us.apache.org/repos/asf/ambari/blob/406b245e/ambari-metrics/ambari-metrics-host-monitoring/src/main/python/core/config_reader.py
----------------------------------------------------------------------
diff --git a/ambari-metrics/ambari-metrics-host-monitoring/src/main/python/core/config_reader.py b/ambari-metrics/ambari-metrics-host-monitoring/src/main/python/core/config_reader.py
index 890d3ce..b84979a 100644
--- a/ambari-metrics/ambari-metrics-host-monitoring/src/main/python/core/config_reader.py
+++ b/ambari-metrics/ambari-metrics-host-monitoring/src/main/python/core/config_reader.py
@@ -102,7 +102,7 @@ config_content = """
 [default]
 debug_level = INFO
 hostname = localhost
-metrics_servers = ['localhost','host1','host2']
+metrics_servers = localhost
 enable_time_threshold = false
 enable_value_threshold = false
 
@@ -217,10 +217,7 @@ class Configuration:
 
   def get_metrics_collector_hosts(self):
     hosts = self.get("default", "metrics_servers", "localhost")
-    if hosts is not "localhost":
-      return ast.literal_eval(hosts)
-    else:
-      return hosts
+    return hosts.split(",")
 
   def get_failover_strategy(self):
     return self.get("collector", "failover_strategy", ROUND_ROBIN_FAILOVER_STRATEGY)
@@ -256,4 +253,4 @@ class Configuration:
     return self._ca_cert_file_path
 
   def get_disk_metrics_skip_pattern(self):
-    return self.get("default", "skip_disk_patterns")
\ No newline at end of file
+    return self.get("default", "skip_disk_patterns")

http://git-wip-us.apache.org/repos/asf/ambari/blob/406b245e/ambari-metrics/ambari-metrics-host-monitoring/src/test/python/core/TestEmitter.py
----------------------------------------------------------------------
diff --git a/ambari-metrics/ambari-metrics-host-monitoring/src/test/python/core/TestEmitter.py b/ambari-metrics/ambari-metrics-host-monitoring/src/test/python/core/TestEmitter.py
index de97292..4056ae3 100644
--- a/ambari-metrics/ambari-metrics-host-monitoring/src/test/python/core/TestEmitter.py
+++ b/ambari-metrics/ambari-metrics-host-monitoring/src/test/python/core/TestEmitter.py
@@ -83,7 +83,7 @@ class TestEmitter(TestCase):
     emitter.RETRY_SLEEP_INTERVAL = .001
     emitter.submit_metrics()
 
-    self.assertEqual(request_mock.call_count, 9)
+    self.assertEqual(request_mock.call_count, 3)
     self.assertUrlData(request_mock)
 
   def assertUrlData(self, request_mock):

http://git-wip-us.apache.org/repos/asf/ambari/blob/406b245e/ambari-server/src/main/resources/common-services/ACCUMULO/1.6.1.2.2.0/package/scripts/params.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/ACCUMULO/1.6.1.2.2.0/package/scripts/params.py b/ambari-server/src/main/resources/common-services/ACCUMULO/1.6.1.2.2.0/package/scripts/params.py
index e00c1f5..53cf002 100644
--- a/ambari-server/src/main/resources/common-services/ACCUMULO/1.6.1.2.2.0/package/scripts/params.py
+++ b/ambari-server/src/main/resources/common-services/ACCUMULO/1.6.1.2.2.0/package/scripts/params.py
@@ -122,7 +122,7 @@ info_num_logs = config['configurations']['accumulo-log4j']['info_num_logs']
 # metrics2 properties
 ganglia_server_hosts = default('/clusterHostInfo/ganglia_server_host', []) # is not passed when ganglia is not present
 ganglia_server_host = '' if len(ganglia_server_hosts) == 0 else ganglia_server_hosts[0]
-ams_collector_hosts = default("/clusterHostInfo/metrics_collector_hosts", [])
+ams_collector_hosts = ",".join(default("/clusterHostInfo/metrics_collector_hosts", []))
 has_metric_collector = not len(ams_collector_hosts) == 0
 if has_metric_collector:
   if 'cluster-env' in config['configurations'] and \

http://git-wip-us.apache.org/repos/asf/ambari/blob/406b245e/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/package/scripts/params.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/package/scripts/params.py b/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/package/scripts/params.py
index acc3763..4bda033 100644
--- a/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/package/scripts/params.py
+++ b/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/package/scripts/params.py
@@ -58,7 +58,7 @@ ams_pid_dir = status_params.ams_collector_pid_dir
 
 ams_collector_script = "/usr/sbin/ambari-metrics-collector"
 ams_collector_pid_dir = status_params.ams_collector_pid_dir
-ams_collector_hosts = default("/clusterHostInfo/metrics_collector_hosts", [])
+ams_collector_hosts = ",".join(default("/clusterHostInfo/metrics_collector_hosts", []))
 failover_strategy_blacklisted_interval_seconds = default("/configurations/ams-env/failover_strategy_blacklisted_interval", "600")
 failover_strategy = default("/configurations/ams-site/failover.strategy", "round-robin")
 if default("/configurations/ams-site/timeline.metrics.service.http.policy", "HTTP_ONLY") == "HTTPS_ONLY":

http://git-wip-us.apache.org/repos/asf/ambari/blob/406b245e/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/package/scripts/service_check.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/package/scripts/service_check.py b/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/package/scripts/service_check.py
index 56ca4a1..b4e9b8f 100644
--- a/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/package/scripts/service_check.py
+++ b/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/package/scripts/service_check.py
@@ -146,7 +146,7 @@ class AMSServiceCheck(Script):
 
     results = execute_in_parallel(self.service_check_for_single_host, params.ams_collector_hosts, params)
 
-    for host in params.ams_collector_hosts:
+    for host in str(params.ams_collector_hosts).split(","):
       if host in results:
         if results[host].status == SUCCESS:
           Logger.info("Ambari Metrics service check passed on host " + host)

http://git-wip-us.apache.org/repos/asf/ambari/blob/406b245e/ambari-server/src/main/resources/common-services/FLUME/1.4.0.2.0/package/scripts/params.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/FLUME/1.4.0.2.0/package/scripts/params.py b/ambari-server/src/main/resources/common-services/FLUME/1.4.0.2.0/package/scripts/params.py
index 008e9d6..a44b461 100644
--- a/ambari-server/src/main/resources/common-services/FLUME/1.4.0.2.0/package/scripts/params.py
+++ b/ambari-server/src/main/resources/common-services/FLUME/1.4.0.2.0/package/scripts/params.py
@@ -85,7 +85,7 @@ hostname = None
 if config.has_key('hostname'):
   hostname = config['hostname']
 
-ams_collector_hosts = default("/clusterHostInfo/metrics_collector_hosts", [])
+ams_collector_hosts = ",".join(default("/clusterHostInfo/metrics_collector_hosts", []))
 has_metric_collector = not len(ams_collector_hosts) == 0
 metric_collector_port = None
 if has_metric_collector:

http://git-wip-us.apache.org/repos/asf/ambari/blob/406b245e/ambari-server/src/main/resources/common-services/HBASE/0.96.0.2.0/package/scripts/params_linux.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/HBASE/0.96.0.2.0/package/scripts/params_linux.py b/ambari-server/src/main/resources/common-services/HBASE/0.96.0.2.0/package/scripts/params_linux.py
index 1f32c41..f47dc8f 100644
--- a/ambari-server/src/main/resources/common-services/HBASE/0.96.0.2.0/package/scripts/params_linux.py
+++ b/ambari-server/src/main/resources/common-services/HBASE/0.96.0.2.0/package/scripts/params_linux.py
@@ -151,7 +151,7 @@ has_ganglia_server = not len(ganglia_server_hosts) == 0
 if has_ganglia_server:
   ganglia_server_host = ganglia_server_hosts[0]
 
-ams_collector_hosts = default("/clusterHostInfo/metrics_collector_hosts", [])
+ams_collector_hosts = ",".join(default("/clusterHostInfo/metrics_collector_hosts", []))
 has_metric_collector = not len(ams_collector_hosts) == 0
 if has_metric_collector:
   if 'cluster-env' in config['configurations'] and \

http://git-wip-us.apache.org/repos/asf/ambari/blob/406b245e/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/alerts/alert_metrics_deviation.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/alerts/alert_metrics_deviation.py b/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/alerts/alert_metrics_deviation.py
index 4efdae5..8a06f56 100644
--- a/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/alerts/alert_metrics_deviation.py
+++ b/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/alerts/alert_metrics_deviation.py
@@ -178,7 +178,7 @@ def execute(configurations={}, parameters={}, host_name=None):
     else:
       collector_webapp_address = configurations[METRICS_COLLECTOR_WEBAPP_ADDRESS_KEY].split(":")
       if valid_collector_webapp_address(collector_webapp_address):
-        collector_host = select_metric_collector_for_sink(app_id.lower()).split(":")[0]
+        collector_host = select_metric_collector_for_sink(app_id.lower())
         collector_port = int(collector_webapp_address[1])
       else:
         return (RESULT_STATE_UNKNOWN, ['{0} value should be set as "fqdn_hostname:port", but set to {1}'.format(

http://git-wip-us.apache.org/repos/asf/ambari/blob/406b245e/ambari-server/src/main/resources/common-services/KAFKA/0.8.1/package/scripts/params.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/KAFKA/0.8.1/package/scripts/params.py b/ambari-server/src/main/resources/common-services/KAFKA/0.8.1/package/scripts/params.py
index 0cb88fe..5635fe3 100644
--- a/ambari-server/src/main/resources/common-services/KAFKA/0.8.1/package/scripts/params.py
+++ b/ambari-server/src/main/resources/common-services/KAFKA/0.8.1/package/scripts/params.py
@@ -120,7 +120,7 @@ metric_truststore_path= default("/configurations/ams-ssl-client/ssl.client.trust
 metric_truststore_type= default("/configurations/ams-ssl-client/ssl.client.truststore.type", "")
 metric_truststore_password= default("/configurations/ams-ssl-client/ssl.client.truststore.password", "")
 
-ams_collector_hosts = default("/clusterHostInfo/metrics_collector_hosts", [])
+ams_collector_hosts = ",".join(default("/clusterHostInfo/metrics_collector_hosts", []))
 has_metric_collector = not len(ams_collector_hosts) == 0
 
 if has_metric_collector:

http://git-wip-us.apache.org/repos/asf/ambari/blob/406b245e/ambari-server/src/main/resources/common-services/STORM/0.9.1/package/scripts/params_linux.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/STORM/0.9.1/package/scripts/params_linux.py b/ambari-server/src/main/resources/common-services/STORM/0.9.1/package/scripts/params_linux.py
index e753e98..aca0681 100644
--- a/ambari-server/src/main/resources/common-services/STORM/0.9.1/package/scripts/params_linux.py
+++ b/ambari-server/src/main/resources/common-services/STORM/0.9.1/package/scripts/params_linux.py
@@ -170,7 +170,7 @@ if stack_supports_storm_kerberos:
   else:
     storm_thrift_transport = config['configurations']['storm-site']['_storm.thrift.nonsecure.transport']
 
-ams_collector_hosts = default("/clusterHostInfo/metrics_collector_hosts", [])
+ams_collector_hosts = ",".join(default("/clusterHostInfo/metrics_collector_hosts", []))
 has_metric_collector = not len(ams_collector_hosts) == 0
 metric_collector_port = None
 if has_metric_collector:

http://git-wip-us.apache.org/repos/asf/ambari/blob/406b245e/ambari-server/src/main/resources/stacks/HDP/2.0.6/hooks/before-START/scripts/params.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.0.6/hooks/before-START/scripts/params.py b/ambari-server/src/main/resources/stacks/HDP/2.0.6/hooks/before-START/scripts/params.py
index 4603c8b..4a5ee25 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.0.6/hooks/before-START/scripts/params.py
+++ b/ambari-server/src/main/resources/stacks/HDP/2.0.6/hooks/before-START/scripts/params.py
@@ -90,7 +90,7 @@ jtnode_host = default("/clusterHostInfo/jtnode_host", [])
 namenode_host = default("/clusterHostInfo/namenode_host", [])
 zk_hosts = default("/clusterHostInfo/zookeeper_hosts", [])
 ganglia_server_hosts = default("/clusterHostInfo/ganglia_server_host", [])
-ams_collector_hosts = default("/clusterHostInfo/metrics_collector_hosts", [])
+ams_collector_hosts = ",".join(default("/clusterHostInfo/metrics_collector_hosts", []))
 
 has_namenode = not len(namenode_host) == 0
 has_resourcemanager = not len(rm_host) == 0

http://git-wip-us.apache.org/repos/asf/ambari/blob/406b245e/ambari-server/src/main/resources/stacks/HDPWIN/2.1/hooks/before-START/scripts/params.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDPWIN/2.1/hooks/before-START/scripts/params.py b/ambari-server/src/main/resources/stacks/HDPWIN/2.1/hooks/before-START/scripts/params.py
index 7cd9340..a22eb90 100644
--- a/ambari-server/src/main/resources/stacks/HDPWIN/2.1/hooks/before-START/scripts/params.py
+++ b/ambari-server/src/main/resources/stacks/HDPWIN/2.1/hooks/before-START/scripts/params.py
@@ -22,14 +22,14 @@ import nturl2path
 from ambari_commons.ambari_metrics_helper import select_metric_collector_hosts_from_hostnames
 
 config = Script.get_config()
-ams_collector_hosts = default("/clusterHostInfo/metrics_collector_hosts", [])
+ams_collector_hosts = ",".join(default("/clusterHostInfo/metrics_collector_hosts", []))
 has_metric_collector = not len(ams_collector_hosts) == 0
 if has_metric_collector:
   if 'cluster-env' in config['configurations'] and \
       'metrics_collector_vip_host' in config['configurations']['cluster-env']:
     metric_collector_host = config['configurations']['cluster-env']['metrics_collector_vip_host']
   else:
-    metric_collector_host = select_metric_collector_hosts_from_hostnames(ams_collector_hosts)
+    metric_collector_host = select_metric_collector_hosts_from_hostnames(ams_collector_hosts.split(","))
   if 'cluster-env' in config['configurations'] and \
       'metrics_collector_vip_port' in config['configurations']['cluster-env']:
     metric_collector_port = config['configurations']['cluster-env']['metrics_collector_vip_port']


[41/50] [abbrv] ambari git commit: AMBARI-18944 - Improve remoteIp in audit log (Wang Yaoxin via jonathanhurley)

Posted by nc...@apache.org.
AMBARI-18944 - Improve remoteIp in audit log (Wang Yaoxin via jonathanhurley)


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

Branch: refs/heads/branch-dev-patch-upgrade
Commit: f4ea309196a2c02b88f5e5ce062200d50d888005
Parents: ae3ff2a
Author: Jonathan Hurley <jh...@hortonworks.com>
Authored: Fri Dec 2 10:18:35 2016 -0500
Committer: Jonathan Hurley <jh...@hortonworks.com>
Committed: Fri Dec 2 10:19:41 2016 -0500

----------------------------------------------------------------------
 .../apache/ambari/server/utils/RequestUtils.java  | 10 ++++++++++
 .../ambari/server/utils/RequestUtilsTest.java     | 18 ++++++++++++++++++
 2 files changed, 28 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/f4ea3091/ambari-server/src/main/java/org/apache/ambari/server/utils/RequestUtils.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/utils/RequestUtils.java b/ambari-server/src/main/java/org/apache/ambari/server/utils/RequestUtils.java
index 0ac782f..dbb0f11 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/utils/RequestUtils.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/utils/RequestUtils.java
@@ -50,6 +50,9 @@ public class RequestUtils {
     if (isRemoteAddressUnknown(ip)) {
       ip = request.getRemoteAddr();
     }
+    if (containsMultipleRemoteAddresses(ip)) {
+       ip = ip.substring(0, ip.indexOf(","));
+    }
     return ip;
   }
 
@@ -76,6 +79,13 @@ public class RequestUtils {
   }
 
   /**
+   * Checks if ip contains multiple IP addresses
+   */
+  private static boolean containsMultipleRemoteAddresses(String ip) {
+    return ip != null && ip.indexOf(",") > 0;
+  }
+
+  /**
    * Checks if RequestContextHolder contains a valid HTTP request
    * @return
    */

http://git-wip-us.apache.org/repos/asf/ambari/blob/f4ea3091/ambari-server/src/test/java/org/apache/ambari/server/utils/RequestUtilsTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/utils/RequestUtilsTest.java b/ambari-server/src/test/java/org/apache/ambari/server/utils/RequestUtilsTest.java
index 595127e..f36858e 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/utils/RequestUtilsTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/utils/RequestUtilsTest.java
@@ -30,6 +30,7 @@ import org.junit.Test;
 public class RequestUtilsTest {
 
   public static final String REMOTE_ADDRESS = "12.13.14.15";
+  public static final String REMOTE_ADDRESS_MULTIPLE = "12.13.14.15,12.13.14.16";
 
   @Test
   public void testGetRemoteAddress() {
@@ -49,6 +50,23 @@ public class RequestUtilsTest {
   }
 
   @Test
+  public void testGetMultipleRemoteAddress() {
+    // GIVEN
+    HttpServletRequest mockedRequest = createMock(HttpServletRequest.class);
+    expect(mockedRequest.getHeader("X-Forwarded-For")).andReturn(null);
+    expect(mockedRequest.getHeader("Proxy-Client-IP")).andReturn("unknown");
+    expect(mockedRequest.getHeader("WL-Proxy-Client-IP")).andReturn("");
+    expect(mockedRequest.getHeader("HTTP_CLIENT_IP")).andReturn("unknown");
+    expect(mockedRequest.getHeader("HTTP_X_FORWARDED_FOR")).andReturn(REMOTE_ADDRESS_MULTIPLE);
+    replay(mockedRequest);
+    // WHEN
+    String remoteAddress = RequestUtils.getRemoteAddress(mockedRequest);
+    // THEN
+    assertEquals(REMOTE_ADDRESS, remoteAddress);
+    verify(mockedRequest);
+  }
+
+  @Test
   public void testGetRemoteAddressFoundFirstHeader() {
     // GIVEN
     HttpServletRequest mockedRequest = createMock(HttpServletRequest.class);


[03/50] [abbrv] ambari git commit: AMBARI-19026. Add Host Wizard: validation failed on Assign Slaves step (alexantonenko)

Posted by nc...@apache.org.
AMBARI-19026. Add Host Wizard: validation failed on Assign Slaves step (alexantonenko)


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

Branch: refs/heads/branch-dev-patch-upgrade
Commit: 28d783486cb5f4f659126c77792fe44f39f43584
Parents: 89780fa
Author: Alex Antonenko <hi...@gmail.com>
Authored: Wed Nov 30 15:56:48 2016 +0200
Committer: Alex Antonenko <hi...@gmail.com>
Committed: Wed Nov 30 15:56:57 2016 +0200

----------------------------------------------------------------------
 .../app/controllers/wizard/step6_controller.js  | 58 +++++++++++---------
 .../test/controllers/wizard/step6_test.js       |  6 +-
 2 files changed, 36 insertions(+), 28 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/28d78348/ambari-web/app/controllers/wizard/step6_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/wizard/step6_controller.js b/ambari-web/app/controllers/wizard/step6_controller.js
index dfd0687..745ecc7 100644
--- a/ambari-web/app/controllers/wizard/step6_controller.js
+++ b/ambari-web/app/controllers/wizard/step6_controller.js
@@ -351,29 +351,36 @@ App.WizardStep6Controller = Em.Controller.extend(App.HostComponentValidationMixi
   },
 
   /**
-   * Get active host names
-   * @return {string[]}
-   * @method getHostNames
-   */
-  getHostNames: function () {
-    var hostInfo = this.get('content.hosts');
-    var hostNames = [];
-    //flag identify whether get all hosts or only uninstalled(newly added) hosts
-    var getUninstalledHosts = this.get('content.controllerName') !== 'addServiceController';
-
-    for (var index in hostInfo) {
-      if (hostInfo.hasOwnProperty(index)) {
-        if (hostInfo[index].bootStatus === 'REGISTERED') {
-          if (!getUninstalledHosts || !hostInfo[index].isInstalled) {
-            hostNames.push(hostInfo[index].name);
-          }
-        }
-      }
-    }
-    return hostNames;
+   * Returns list of new hosts
+   *
+   * @param {object[]} [allHosts=null]
+   * @return {object[]}
+   */
+  getNewHosts: function(allHosts) {
+    var hosts = allHosts || this.getAllHosts();
+    return hosts.filterProperty('isInstalled', false);
   },
 
   /**
+   * Returns list of registered hosts
+   *
+   * @return {object[{hostName, isInstalled}]}
+   */
+  getAllHosts: function() {
+    var self = this;
+    var hosts = self.get('content.hosts');
+    return Em.keys(this.get('content.hosts')).reduce(function(res, hostName) {
+      var host = hosts[hostName];
+      if (Em.get(host, 'bootStatus') !== 'REGISTERED') {
+        return res;
+      }
+      return res.concat({
+        hostName: hostName,
+        isInstalled: Em.getWithDefault(host, 'isInstalled', false)
+      });
+    }, []);
+  },
+  /**
    * Load all data needed for this module. Then it automatically renders in template
    * @method render
    */
@@ -382,9 +389,10 @@ App.WizardStep6Controller = Em.Controller.extend(App.HostComponentValidationMixi
       masterHosts = [],
       headers = this.get('headers'),
       masterHostNames = this.get('content.masterComponentHosts').mapProperty('hostName').uniq(),
-      masterHostNamesMap = masterHostNames.toWickMap();
+      masterHostNamesMap = masterHostNames.toWickMap(),
+      hosts = this.get('isAddHostWizard') ? this.getNewHosts() : this.getAllHosts();
 
-    this.getHostNames().forEach(function (_hostName) {
+    hosts.mapProperty('hostName').forEach(function (_hostName) {
       var hasMaster = masterHostNamesMap[_hostName];
 
       var obj = {
@@ -403,7 +411,7 @@ App.WizardStep6Controller = Em.Controller.extend(App.HostComponentValidationMixi
       };
 
       if (hasMaster) {
-        masterHosts.pushObject(obj)
+        masterHosts.pushObject(obj);
       } else {
         hostsObj.pushObject(obj);
       }
@@ -640,7 +648,7 @@ App.WizardStep6Controller = Em.Controller.extend(App.HostComponentValidationMixi
     var selectedServices = App.StackService.find().filterProperty('isSelected').mapProperty('serviceName');
     var installedServices = App.StackService.find().filterProperty('isInstalled').mapProperty('serviceName');
     var services = installedServices.concat(selectedServices).uniq();
-    var hostNames = this.get('hosts').mapProperty('hostName');
+    var hostNames = this.getAllHosts().mapProperty('hostName');
 
     var bluePrintsForValidation = this.getValidationBlueprint();
     this.set('content.recommendationsHostGroups', bluePrintsForValidation);
@@ -660,7 +668,7 @@ App.WizardStep6Controller = Em.Controller.extend(App.HostComponentValidationMixi
     var slaveBlueprint = this.getCurrentBlueprint();
     var masterBlueprint = null;
     var invisibleInstalledMasters = [];
-    var hostNames = this.get('hosts').mapProperty('hostName');
+    var hostNames = this.getAllHosts().mapProperty('hostName');
     var invisibleSlavesAndClients = App.StackServiceComponent.find().filter(function (component) {
       return component.get("isSlave") && component.get("isShownOnInstallerSlaveClientPage") === false ||
         component.get("isClient") && component.get("isRequiredOnAllHosts");

http://git-wip-us.apache.org/repos/asf/ambari/blob/28d78348/ambari-web/test/controllers/wizard/step6_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/wizard/step6_test.js b/ambari-web/test/controllers/wizard/step6_test.js
index b2bc879..851b984 100644
--- a/ambari-web/test/controllers/wizard/step6_test.js
+++ b/ambari-web/test/controllers/wizard/step6_test.js
@@ -972,7 +972,7 @@ describe('App.WizardStep6Controller', function () {
       });
   });
 
-  describe('#getHostNames', function () {
+  describe('#getAllHosts', function () {
     var tests = Em.A([
       {
         hosts: {
@@ -1010,8 +1010,8 @@ describe('App.WizardStep6Controller', function () {
     tests.forEach(function (test) {
       it(test.m, function () {
         controller.set('content.hosts', test.hosts);
-        var r = controller.getHostNames();
-        expect(r).to.eql(test.e);
+        var r = controller.getAllHosts();
+        expect(r.mapProperty('hostName')).to.eql(test.e);
       });
     });
   });


[10/50] [abbrv] ambari git commit: Revert "AMBARI-19020. Ubuntu14/16 Add Support for Zookeeper on HDP 2.5 (Duc Le via ncole)"

Posted by nc...@apache.org.
Revert "AMBARI-19020. Ubuntu14/16 Add Support for Zookeeper on HDP 2.5 (Duc Le via ncole)"

This reverts commit 3a14b4afc9572b9aeb0310cdc0cd80700f27ee8d.


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

Branch: refs/heads/branch-dev-patch-upgrade
Commit: 4bfbf281ce17eacc2243962191dfb41c38c962b3
Parents: 0afdf65
Author: Nate Cole <nc...@hortonworks.com>
Authored: Wed Nov 30 14:52:23 2016 -0500
Committer: Nate Cole <nc...@hortonworks.com>
Committed: Wed Nov 30 14:52:48 2016 -0500

----------------------------------------------------------------------
 .../stacks/HDP/2.5/services/ZOOKEEPER/metainfo.xml     | 13 -------------
 1 file changed, 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/4bfbf281/ambari-server/src/main/resources/stacks/HDP/2.5/services/ZOOKEEPER/metainfo.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.5/services/ZOOKEEPER/metainfo.xml b/ambari-server/src/main/resources/stacks/HDP/2.5/services/ZOOKEEPER/metainfo.xml
index 9b9477e..de8ebd9 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.5/services/ZOOKEEPER/metainfo.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.5/services/ZOOKEEPER/metainfo.xml
@@ -21,19 +21,6 @@
     <service>
       <name>ZOOKEEPER</name>
       <version>3.4.6.2.5</version>
-      <osSpecifics>
-        <osSpecific>
-          <osFamily>ubuntu14,ubuntu16</osFamily>
-          <packages>
-            <package>
-              <name>zookeeper-${stack_version}</name>
-            </package>
-            <package>
-              <name>zookeeper-${stack_version}-server</name>
-            </package>
-          </packages>
-        </osSpecific>
-      </osSpecifics>
     </service>
   </services>
 </metainfo>


[17/50] [abbrv] ambari git commit: AMBARI-19033. Log Search: Cannot increase the number of shards per node for solr collections (oleewere)

Posted by nc...@apache.org.
AMBARI-19033. Log Search: Cannot increase the number of shards per node for solr collections (oleewere)

Change-Id: I44fa2c96befa2eff3d6f2acfb608eff8ed45f021


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

Branch: refs/heads/branch-dev-patch-upgrade
Commit: 195b7456c0b4dc15833b502463daba7b29a51bee
Parents: 337c5f2
Author: oleewere <ol...@gmail.com>
Authored: Thu Dec 1 11:34:45 2016 +0100
Committer: oleewere <ol...@gmail.com>
Committed: Thu Dec 1 11:37:16 2016 +0100

----------------------------------------------------------------------
 .../ambari/logsearch/dao/SolrCollectionDao.java | 64 ++++++++++++++++++--
 1 file changed, 59 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/195b7456/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/dao/SolrCollectionDao.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/dao/SolrCollectionDao.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/dao/SolrCollectionDao.java
index 834ba38..da76924 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/dao/SolrCollectionDao.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/dao/SolrCollectionDao.java
@@ -20,8 +20,12 @@ package org.apache.ambari.logsearch.dao;
 
 import org.apache.ambari.logsearch.conf.SolrPropsConfig;
 import org.apache.commons.lang.StringUtils;
+import org.apache.http.HttpResponse;
+import org.apache.http.client.methods.HttpGet;
+import org.apache.http.impl.client.CloseableHttpClient;
 import org.apache.solr.client.solrj.SolrServerException;
 import org.apache.solr.client.solrj.impl.CloudSolrClient;
+import org.apache.solr.client.solrj.impl.HttpClientUtil;
 import org.apache.solr.client.solrj.request.CollectionAdminRequest;
 import org.apache.solr.client.solrj.response.CollectionAdminResponse;
 import org.apache.solr.common.SolrException;
@@ -33,6 +37,7 @@ import org.slf4j.LoggerFactory;
 import static org.apache.ambari.logsearch.solr.SolrConstants.CommonLogConstants.ROUTER_FIELD;
 
 import javax.inject.Named;
+import javax.ws.rs.core.Response;
 import java.io.IOException;
 import java.util.ArrayList;
 import java.util.Collection;
@@ -45,6 +50,8 @@ class SolrCollectionDao {
   private static final Logger LOG = LoggerFactory.getLogger(SolrCollectionDao.class);
 
   private static final int SETUP_RETRY_SECOND = 30;
+  private static final String MODIFY_COLLECTION_QUERY = "/admin/collections?action=MODIFYCOLLECTION&collection=%s&%s=%d";
+  private static final String MAX_SHARDS_PER_NODE = "maxShardsPerNode";
 
   /**
    * This will try to get the collections from the Solr. Ping doesn't work if
@@ -189,7 +196,16 @@ class SolrCollectionDao {
       }
     } else {
       LOG.info("Collection " + solrPropsConfig.getCollection() + " is already there. Will check whether it has the required shards");
-      Collection<String> existingShards = getShards(solrClient, solrPropsConfig);
+      Collection<Slice> slices = getSlices(solrClient, solrPropsConfig);
+      Collection<String> existingShards = getShards(slices, solrPropsConfig);
+      if (existingShards.size() < shardsList.size()) {
+        try {
+          updateMaximumNumberOfShardsPerCore(slices, solrPropsConfig);
+        } catch (Throwable t) {
+          returnValue = false;
+          LOG.error(String.format("Exception during updating collection (%s)", t));
+        }
+      }
       for (String shard : shardsList) {
         if (!existingShards.contains(shard)) {
           try {
@@ -216,10 +232,44 @@ class SolrCollectionDao {
     return returnValue;
   }
 
-  private Collection<String> getShards(CloudSolrClient solrClient, SolrPropsConfig solrPropsConfig) {
-    Collection<String> list = new HashSet<>();
+  private String getRandomBaseUrl(Collection<Slice> slices) {
+    String coreUrl = null;
+    if (slices != null) {
+      for (Slice slice : slices) {
+        if (!slice.getReplicas().isEmpty()) {
+          Replica replica = slice.getReplicas().iterator().next();
+          coreUrl = replica.getStr("base_url");
+          if (coreUrl != null) {
+            break;
+          }
+        }
+      }
+    }
+    return coreUrl;
+  }
+
+  private void updateMaximumNumberOfShardsPerCore(Collection<Slice> slices, SolrPropsConfig solrPropsConfig) throws IOException {
+    String baseUrl = getRandomBaseUrl(slices);
+    if (baseUrl != null) {
+      CloseableHttpClient httpClient = HttpClientUtil.createClient(null);
+      HttpGet request = new HttpGet(baseUrl + String.format(MODIFY_COLLECTION_QUERY,
+        solrPropsConfig.getCollection(), MAX_SHARDS_PER_NODE, calculateMaxShardsPerNode(solrPropsConfig)));
+      HttpResponse response = httpClient.execute(request);
+      if (response.getStatusLine().getStatusCode() != Response.Status.OK.getStatusCode()) {
+        throw new IllegalStateException(String.format("Cannot update collection (%s) - increase max number of nodes per core", solrPropsConfig.getCollection()));
+      }
+    } else {
+      throw new IllegalStateException(String.format("Cannot get any core url for updating collection (%s)", solrPropsConfig.getCollection()));
+    }
+  }
+
+  private Collection<Slice> getSlices(CloudSolrClient solrClient, SolrPropsConfig solrPropsConfig) {
     ZkStateReader reader = solrClient.getZkStateReader();
-    Collection<Slice> slices = reader.getClusterState().getSlices(solrPropsConfig.getCollection());
+    return reader.getClusterState().getSlices(solrPropsConfig.getCollection());
+  }
+
+  private Collection<String> getShards(Collection<Slice> slices, SolrPropsConfig solrPropsConfig) {
+    Collection<String> list = new HashSet<>();
     for (Slice slice : slices) {
       for (Replica replica : slice.getReplicas()) {
         LOG.info("colName=" + solrPropsConfig.getCollection() + ", slice.name=" + slice.getName() + ", slice.state=" + slice.getState() +
@@ -245,7 +295,7 @@ class SolrCollectionDao {
     collectionCreateRequest.setNumShards(solrPropsConfig.getNumberOfShards());
     collectionCreateRequest.setReplicationFactor(solrPropsConfig.getReplicationFactor());
     collectionCreateRequest.setConfigName(solrPropsConfig.getConfigName());
-    collectionCreateRequest.setMaxShardsPerNode(solrPropsConfig.getReplicationFactor() * solrPropsConfig.getNumberOfShards());
+    collectionCreateRequest.setMaxShardsPerNode(calculateMaxShardsPerNode(solrPropsConfig));
     CollectionAdminResponse createResponse = collectionCreateRequest.process(solrClient);
     if (createResponse.getStatus() != 0) {
       LOG.error("Error creating collection. collectionName=" + solrPropsConfig.getCollection() + ", response=" + createResponse);
@@ -256,4 +306,8 @@ class SolrCollectionDao {
       return true;
     }
   }
+
+  private Integer calculateMaxShardsPerNode(SolrPropsConfig solrPropsConfig) {
+    return solrPropsConfig.getReplicationFactor() * solrPropsConfig.getNumberOfShards();
+  }
 }


[33/50] [abbrv] ambari git commit: AMBARI-18888: Ambari-agent: Create configuration files with JCEKS information

Posted by nc...@apache.org.
AMBARI-18888: Ambari-agent: Create configuration files with JCEKS information


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

Branch: refs/heads/branch-dev-patch-upgrade
Commit: 615438b272e6bd8efd37481ef684ae7d68921e64
Parents: 7577ebb
Author: Nahappan Somasundaram <ns...@hortonworks.com>
Authored: Tue Nov 29 13:36:16 2016 -0800
Committer: Nahappan Somasundaram <ns...@hortonworks.com>
Committed: Thu Dec 1 13:58:54 2016 -0800

----------------------------------------------------------------------
 ambari-agent/conf/unix/ambari-agent.ini         |   3 +
 .../ambari_agent/CustomServiceOrchestrator.py   | 120 +++++++++++++++++++
 ambari-agent/src/packages/tarball/all.xml       |  30 +++++
 .../ambari/server/agent/ExecutionCommand.java   |  28 +++++
 .../ambari/server/agent/HeartBeatHandler.java   |  10 +-
 .../server/agent/TestHeartbeatHandler.java      |  28 +++--
 6 files changed, 210 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/615438b2/ambari-agent/conf/unix/ambari-agent.ini
----------------------------------------------------------------------
diff --git a/ambari-agent/conf/unix/ambari-agent.ini b/ambari-agent/conf/unix/ambari-agent.ini
index 61948d4..d6fcf5f 100644
--- a/ambari-agent/conf/unix/ambari-agent.ini
+++ b/ambari-agent/conf/unix/ambari-agent.ini
@@ -46,6 +46,9 @@ keysdir=/var/lib/ambari-agent/keys
 server_crt=ca.crt
 passphrase_env_var_name=AMBARI_PASSPHRASE
 ssl_verify_cert=0
+credential_lib_dir=/var/lib/ambari-agent/cred/lib
+credential_conf_dir=/var/lib/ambari-agent/cred/conf
+credential_shell_cmd=org.apache.hadoop.security.alias.CredentialShell
 
 [services]
 pidLookupPath=/var/run/

http://git-wip-us.apache.org/repos/asf/ambari/blob/615438b2/ambari-agent/src/main/python/ambari_agent/CustomServiceOrchestrator.py
----------------------------------------------------------------------
diff --git a/ambari-agent/src/main/python/ambari_agent/CustomServiceOrchestrator.py b/ambari-agent/src/main/python/ambari_agent/CustomServiceOrchestrator.py
index 7d61611..1eab0a5 100644
--- a/ambari-agent/src/main/python/ambari_agent/CustomServiceOrchestrator.py
+++ b/ambari-agent/src/main/python/ambari_agent/CustomServiceOrchestrator.py
@@ -29,6 +29,8 @@ from FileCache import FileCache
 from AgentException import AgentException
 from PythonExecutor import PythonExecutor
 from PythonReflectiveExecutor import PythonReflectiveExecutor
+from resource_management.core.utils import PasswordString
+import subprocess
 import Constants
 import hostname
 
@@ -65,6 +67,11 @@ class CustomServiceOrchestrator():
   REFLECTIVELY_RUN_COMMANDS = FREQUENT_COMMANDS # -- commands which run a lot and often (this increases their speed)
   DONT_BACKUP_LOGS_FOR_COMMANDS = FREQUENT_COMMANDS
 
+  # Path where hadoop credential JARS will be available
+  DEFAULT_CREDENTIAL_SHELL_LIB_PATH = '/var/lib/ambari-agent/cred/lib'
+  DEFAULT_CREDENTIAL_CONF_DIR = '/var/lib/ambari-agent/cred/conf'
+  DEFAULT_CREDENTIAL_SHELL_CMD = 'org.apache.hadoop.security.alias.CredentialShell'
+
   def __init__(self, config, controller):
     self.config = config
     self.tmp_dir = config.get('agent', 'prefix')
@@ -78,6 +85,14 @@ class CustomServiceOrchestrator():
     # cache reset will be called on every agent registration
     controller.registration_listeners.append(self.file_cache.reset)
 
+    # Construct the hadoop credential lib JARs path
+    self.credential_shell_lib_path = os.path.join(config.get('security', 'credential_lib_dir',
+                                                             self.DEFAULT_CREDENTIAL_SHELL_LIB_PATH), '*')
+
+    self.credential_conf_dir = config.get('security', 'credential_conf_dir', self.DEFAULT_CREDENTIAL_CONF_DIR)
+
+    self.credential_shell_cmd = config.get('security', 'credential_shell_cmd', self.DEFAULT_CREDENTIAL_SHELL_CMD)
+
     # Clean up old status command files if any
     try:
       os.unlink(self.status_commands_stdout)
@@ -114,6 +129,102 @@ class CustomServiceOrchestrator():
     else:
       return PythonExecutor(self.tmp_dir, self.config)
 
+  def getProviderDirectory(self, service_name):
+    """
+    Gets the path to the service conf folder where the JCEKS file will be created.
+
+    :param service_name: Name of the service, for example, HIVE
+    :return: lower case path to the service conf folder
+    """
+
+    # The stack definition scripts of the service can move the
+    # JCEKS file around to where it wants, which is usually
+    # /etc/<service_name>/conf
+
+    conf_dir = os.path.join(self.credential_conf_dir, service_name.lower())
+    if not os.path.exists(conf_dir):
+      os.makedirs(conf_dir, 0644)
+
+    return conf_dir
+
+  def getAffectedConfigTypes(self, commandJson):
+    """
+    Gets the affected config types for the service in this command
+
+    :param commandJson:
+    :return:
+    """
+    return commandJson.get('configuration_attributes')
+
+  def getCredentialProviderPropertyName(self):
+    """
+    Gets the property name used by the hadoop credential provider
+    :return:
+    """
+    return 'hadoop.security.credential.provider.path'
+
+  def generateJceks(self, commandJson):
+    """
+    Generates the JCEKS file with passwords for the service specified in commandJson
+
+    :param commandJson: command JSON
+    :return: An exit value from the external process that generated the JCEKS file. None if
+    there are no passwords in the JSON.
+    """
+    cmd_result = None
+    roleCommand = None
+    if 'roleCommand' in commandJson:
+      roleCommand = commandJson['roleCommand']
+
+    logger.info('generateJceks: roleCommand={0}'.format(roleCommand))
+
+    # Password properties for a config type, if present,
+    # are under configuration_attributes:config_type:hidden:{prop1:attributes1, prop2, attributes2}
+    passwordProperties = {}
+    config_types = self.getAffectedConfigTypes(commandJson)
+    for config_type in config_types:
+      elem = config_types.get(config_type)
+      hidden = elem.get('hidden')
+      if hidden is not None:
+        passwordProperties[config_type] = hidden
+
+    # Set up the variables for the external command to generate a JCEKS file
+    java_home = commandJson['hostLevelParams']['java_home']
+    java_bin = '{java_home}/bin/java'.format(java_home=java_home)
+
+    cs_lib_path = self.credential_shell_lib_path
+    serviceName = commandJson['serviceName']
+
+    # Gather the password values and remove them from the configuration
+    configs = commandJson.get('configurations')
+    for key, value in passwordProperties.items():
+      config = configs.get(key)
+      if config is not None:
+        file_path = os.path.join(self.getProviderDirectory(serviceName), "{0}.jceks".format(key))
+        if os.path.exists(file_path):
+          os.remove(file_path)
+        provider_path = 'jceks://file{file_path}'.format(file_path=file_path)
+        logger.info('provider_path={0}'.format(provider_path))
+        for alias in value:
+          pwd = config.get(alias)
+          if pwd is not None:
+            # Remove the clear text password
+            config.pop(alias, None)
+            # Add JCEKS provider path instead
+            config[self.getCredentialProviderPropertyName()] = provider_path
+            logger.debug("config={0}".format(config))
+            protected_pwd = PasswordString(pwd)
+            # Generate the JCEKS file
+            cmd = (java_bin, '-cp', cs_lib_path, self.credential_shell_cmd, 'create',
+                   alias, '-value', protected_pwd, '-provider', provider_path)
+            logger.info(cmd)
+            cmd_result = subprocess.call(cmd)
+            logger.info('cmd_result = {0}'.format(cmd_result))
+            os.chmod(file_path, 0644) # group and others should have read access so that the service user can read
+
+    return cmd_result
+
+
   def runCommand(self, command, tmpoutfile, tmperrfile, forced_command_name=None,
                  override_output_files=True, retry=False):
     """
@@ -179,6 +290,15 @@ class CustomServiceOrchestrator():
         handle.on_background_command_started = self.map_task_to_process
         del command['__handle']
 
+      # If command contains credentialStoreEnabled, then
+      # generate the JCEKS file for the configurations.
+      credentialStoreEnabled = False
+      if 'credentialStoreEnabled' in command:
+        credentialStoreEnabled = (command['credentialStoreEnabled'] == "true")
+
+      if credentialStoreEnabled == True:
+        self.generateJceks(command)
+
       json_path = self.dump_command_to_json(command, retry)
       pre_hook_tuple = self.resolve_hook_script_path(hook_dir,
           self.PRE_HOOK_PREFIX, command_name, script_type)

http://git-wip-us.apache.org/repos/asf/ambari/blob/615438b2/ambari-agent/src/packages/tarball/all.xml
----------------------------------------------------------------------
diff --git a/ambari-agent/src/packages/tarball/all.xml b/ambari-agent/src/packages/tarball/all.xml
index c481208..f8a54e3 100644
--- a/ambari-agent/src/packages/tarball/all.xml
+++ b/ambari-agent/src/packages/tarball/all.xml
@@ -190,4 +190,34 @@
       <outputDirectory>/var/lib/${project.artifactId}/data</outputDirectory>
     </file>
   </files>
+  <moduleSets>
+    <moduleSet>
+      <binaries>
+        <includeDependencies>false</includeDependencies>
+        <outputDirectory>/var/lib/${project.artifactId}/cred/lib</outputDirectory>
+        <unpack>false</unpack>
+        <directoryMode>755</directoryMode>
+        <fileMode>644</fileMode>
+        <dependencySets>
+          <dependencySet>
+            <outputDirectory>/var/lib/${project.artifactId}/cred/lib</outputDirectory>
+            <unpack>false</unpack>
+            <includes>
+              <include>commons-cli:commons-cli</include>
+              <include>commons-collections:commons-collections</include>
+              <include>commons-configuration:commons-configuration</include>
+              <include>commons-io:commons-io:jar:${commons.io.version}</include>
+              <include>commons-lang:commons-lang</include>
+              <include>commons-logging:commons-logging</include>
+              <include>com.google.guava:guava</include>
+              <include>org.slf4j:slf4j-api</include>
+              <include>org.apache.hadoop:hadoop-common</include>
+              <include>org.apache.hadoop:hadoop-auth</include>
+              <include>org.apache.htrace:htrace-core</include>
+            </includes>
+          </dependencySet>
+        </dependencySets>
+      </binaries>
+    </moduleSet>
+  </moduleSets>
 </assembly>

http://git-wip-us.apache.org/repos/asf/ambari/blob/615438b2/ambari-server/src/main/java/org/apache/ambari/server/agent/ExecutionCommand.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/agent/ExecutionCommand.java b/ambari-server/src/main/java/org/apache/ambari/server/agent/ExecutionCommand.java
index 29737ee..7353366 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/agent/ExecutionCommand.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/agent/ExecutionCommand.java
@@ -112,6 +112,13 @@ public class ExecutionCommand extends AgentCommand {
   @SerializedName("availableServices")
   private Map<String, String> availableServices = new HashMap<>();
 
+  /**
+   * "true" or "false" indicating whether this
+   * service is enabled for credential store use.
+   */
+  @SerializedName("credentialStoreEnabled")
+  private String credentialStoreEnabled;
+
   public String getCommandId() {
     return commandId;
   }
@@ -295,6 +302,27 @@ public class ExecutionCommand extends AgentCommand {
 	this.serviceType = serviceType;
   }
 
+  /**
+   * Get a value indicating whether this service is enabled
+   * for credential store use.
+   *
+   * @return "true" or "false", any other value is
+   * considered as "false"
+   */
+  public String getCredentialStoreEnabled() {
+    return credentialStoreEnabled;
+  }
+
+  /**
+   * Set a value indicating whether this service is enabled
+   * for credential store use.
+   *
+   * @param credentialStoreEnabled
+   */
+  public void setCredentialStoreEnabled(String credentialStoreEnabled) {
+    this.credentialStoreEnabled = credentialStoreEnabled;
+  }
+
   public String getComponentName() {
     return componentName;
   }

http://git-wip-us.apache.org/repos/asf/ambari/blob/615438b2/ambari-server/src/main/java/org/apache/ambari/server/agent/HeartBeatHandler.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/agent/HeartBeatHandler.java b/ambari-server/src/main/java/org/apache/ambari/server/agent/HeartBeatHandler.java
index 75bef30..48d11c4 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/agent/HeartBeatHandler.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/agent/HeartBeatHandler.java
@@ -329,7 +329,15 @@ public class HeartBeatHandler {
           case BACKGROUND_EXECUTION_COMMAND:
           case EXECUTION_COMMAND: {
             ExecutionCommand ec = (ExecutionCommand)ac;
-            LOG.info("HeartBeatHandler.sendCommands: sending ExecutionCommand for host {}, role {}, roleCommand {}, and command ID {}, taskId {}",
+            /*
+             * Set the value of credentialStore enabled before sending the command to agent.
+             */
+            Cluster cluster = clusterFsm.getCluster(ec.getClusterName());
+            Service service = cluster.getService(ec.getServiceName());
+            if (service != null) {
+              ec.setCredentialStoreEnabled(String.valueOf(service.isCredentialStoreEnabled()));
+            }
+            LOG.info("HeartBeatHandler.sendCommands: sending ExecutionCommand for host {}, role {}, roleCommand {}, and command ID {}, task ID {}",
                      ec.getHostname(), ec.getRole(), ec.getRoleCommand(), ec.getCommandId(), ec.getTaskId());
             Map<String, String> hlp = ec.getHostLevelParams();
             if (hlp != null) {

http://git-wip-us.apache.org/repos/asf/ambari/blob/615438b2/ambari-server/src/test/java/org/apache/ambari/server/agent/TestHeartbeatHandler.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/agent/TestHeartbeatHandler.java b/ambari-server/src/test/java/org/apache/ambari/server/agent/TestHeartbeatHandler.java
index a50a116..ac58f64 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/agent/TestHeartbeatHandler.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/agent/TestHeartbeatHandler.java
@@ -48,6 +48,7 @@ import java.io.File;
 import java.io.FileWriter;
 import java.io.IOException;
 import java.util.ArrayList;
+import java.util.Collection;
 import java.util.Collections;
 import java.util.Date;
 import java.util.HashMap;
@@ -171,22 +172,31 @@ public class TestHeartbeatHandler {
     ActionManager am = actionManagerTestHelper.getMockActionManager();
     expect(am.getTasks(anyObject(List.class))).andReturn(new ArrayList<HostRoleCommand>());
     replay(am);
+
+    Cluster cluster = heartbeatTestHelper.getDummyCluster();
+    Service hdfs = cluster.addService(HDFS);
+    hdfs.addServiceComponent(DATANODE);
+    hdfs.addServiceComponent(NAMENODE);
+    hdfs.addServiceComponent(SECONDARY_NAMENODE);
+    Collection<Host> hosts = cluster.getHosts();
+    assertEquals(hosts.size(), 1);
+
     Clusters fsm = clusters;
-    fsm.addHost(DummyHostname1);
-    Host hostObject = clusters.getHost(DummyHostname1);
+    Host hostObject = hosts.iterator().next();
     hostObject.setIPv4("ipv4");
     hostObject.setIPv6("ipv6");
     hostObject.setOsType(DummyOsType);
 
+    String hostname = hostObject.getHostName();
     ActionQueue aq = new ActionQueue();
 
     HeartBeatHandler handler = new HeartBeatHandler(fsm, aq, am, injector);
     Register reg = new Register();
     HostInfo hi = new HostInfo();
-    hi.setHostName(DummyHostname1);
+    hi.setHostName(hostname);
     hi.setOS(DummyOs);
     hi.setOSRelease(DummyOSRelease);
-    reg.setHostname(DummyHostname1);
+    reg.setHostname(hostname);
     reg.setHardwareProfile(hi);
     reg.setAgentVersion(metaInfo.getServerVersion());
     handler.handleRegistration(reg);
@@ -195,19 +205,21 @@ public class TestHeartbeatHandler {
 
     ExecutionCommand execCmd = new ExecutionCommand();
     execCmd.setRequestAndStage(2, 34);
-    execCmd.setHostname(DummyHostname1);
-    aq.enqueue(DummyHostname1, new ExecutionCommand());
+    execCmd.setHostname(hostname);
+    execCmd.setClusterName(cluster.getClusterName());
+    execCmd.setServiceName(HDFS);
+    aq.enqueue(hostname, execCmd);
     HeartBeat hb = new HeartBeat();
     hb.setResponseId(0);
     HostStatus hs = new HostStatus(Status.HEALTHY, DummyHostStatus);
     List<Alert> al = new ArrayList<Alert>();
     al.add(new Alert());
     hb.setNodeStatus(hs);
-    hb.setHostname(DummyHostname1);
+    hb.setHostname(hostname);
 
     handler.handleHeartBeat(hb);
     assertEquals(HostState.HEALTHY, hostObject.getState());
-    assertEquals(0, aq.dequeueAll(DummyHostname1).size());
+    assertEquals(0, aq.dequeueAll(hostname).size());
   }
 
 


[26/50] [abbrv] ambari git commit: AMBARI-18713. use exclude list of mount device types on docker containers (dgrinenko via dlysnichenko)

Posted by nc...@apache.org.
AMBARI-18713. use exclude list of mount device types on docker containers (dgrinenko via dlysnichenko)


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

Branch: refs/heads/branch-dev-patch-upgrade
Commit: bb8be5ba6a950b64382fb1a44f04c1dbf24db382
Parents: 9b21f30
Author: Lisnichenko Dmitro <dl...@hortonworks.com>
Authored: Thu Dec 1 17:36:15 2016 +0200
Committer: Lisnichenko Dmitro <dl...@hortonworks.com>
Committed: Thu Dec 1 17:36:15 2016 +0200

----------------------------------------------------------------------
 .../src/main/resources/scripts/stack_advisor.py |  11 +-
 .../HDP/2.0.6/configuration/cluster-env.xml     |  10 +
 .../stacks/HDP/2.0.6/services/stack_advisor.py  |  47 +-
 .../stacks/HDP/2.1/services/stack_advisor.py    |  20 +-
 .../stacks/HDP/2.2/services/stack_advisor.py    |   7 +
 .../src/main/resources/stacks/stack_advisor.py  | 209 ++++++++-
 .../stacks/2.0.6/common/test_stack_advisor.py   |  16 +-
 .../stacks/2.1/common/test_stack_advisor.py     |   2 +
 .../stacks/2.2/common/test_stack_advisor.py     |  17 +-
 .../test/python/stacks/test_stack_adviser.py    | 239 ++++++++++
 ambari-web/app/mixins.js                        |   1 -
 .../app/utils/configs/config_initializer.js     |  28 +-
 .../mount_points_based_initializer_mixin.js     | 340 --------------
 ambari-web/test/utils/ajax/ajax_test.js         |   9 +-
 .../utils/configs/config_initializer_test.js    | 457 -------------------
 15 files changed, 562 insertions(+), 851 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/bb8be5ba/ambari-server/src/main/resources/scripts/stack_advisor.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/scripts/stack_advisor.py b/ambari-server/src/main/resources/scripts/stack_advisor.py
index 5926c39..abfab87 100755
--- a/ambari-server/src/main/resources/scripts/stack_advisor.py
+++ b/ambari-server/src/main/resources/scripts/stack_advisor.py
@@ -70,13 +70,11 @@ def main(argv=None):
   if len(args) < 3:
     sys.stderr.write(USAGE)
     sys.exit(2)
-    pass
 
   action = args[0]
   if action not in ALL_ACTIONS:
     sys.stderr.write(USAGE)
     sys.exit(2)
-    pass
 
   hostsFile = args[1]
   servicesFile = args[2]
@@ -89,6 +87,7 @@ def main(argv=None):
   stackName = services["Versions"]["stack_name"]
   stackVersion = services["Versions"]["stack_version"]
   parentVersions = []
+
   if "stack_hierarchy" in services["Versions"]:
     parentVersions = services["Versions"]["stack_hierarchy"]["stack_versions"]
 
@@ -96,8 +95,9 @@ def main(argv=None):
 
   # Perform action
   actionDir = os.path.realpath(os.path.dirname(args[1]))
-  result = {}
-  result_file = "non_valid_result_file.json"
+
+  # filter
+  hosts = stackAdvisor.filterHostMounts(hosts, services)
 
   if action == RECOMMEND_COMPONENT_LAYOUT_ACTION:
     result = stackAdvisor.recommendComponentLayout(services, hosts)
@@ -111,12 +111,11 @@ def main(argv=None):
   elif action == RECOMMEND_CONFIGURATION_DEPENDENCIES:
     result = stackAdvisor.recommendConfigurationDependencies(services, hosts)
     result_file = os.path.join(actionDir, "configurations.json")
-  else: # action == VALIDATE_CONFIGURATIONS
+  else:  # action == VALIDATE_CONFIGURATIONS
     result = stackAdvisor.validateConfigurations(services, hosts)
     result_file = os.path.join(actionDir, "configurations-validation.json")
 
   dumpJson(result, result_file)
-  pass
 
 
 def instantiateStackAdvisor(stackName, stackVersion, parentVersions):

http://git-wip-us.apache.org/repos/asf/ambari/blob/bb8be5ba/ambari-server/src/main/resources/stacks/HDP/2.0.6/configuration/cluster-env.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.0.6/configuration/cluster-env.xml b/ambari-server/src/main/resources/stacks/HDP/2.0.6/configuration/cluster-env.xml
index cc6c8a3..93680bf 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.0.6/configuration/cluster-env.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.0.6/configuration/cluster-env.xml
@@ -280,4 +280,14 @@ gpgcheck=0</value>
     <description>YARN Memory widget should be hidden by default on the dashboard.</description>
     <on-ambari-upgrade add="true"/>
   </property>
+   <property>
+    <name>agent_mounts_ignore_list</name>
+    <value/>
+    <description>Comma separated list of the mounts which would be ignored by Ambari during property values suggestion by Stack Advisor</description>
+    <on-ambari-upgrade add="false"/>
+    <value-attributes>
+      <visible>true</visible>
+      <empty-value-valid>true</empty-value-valid>
+    </value-attributes>
+  </property>
 </configuration>

http://git-wip-us.apache.org/repos/asf/ambari/blob/bb8be5ba/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/stack_advisor.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/stack_advisor.py b/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/stack_advisor.py
index 83014b7..cda8d36 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/stack_advisor.py
+++ b/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/stack_advisor.py
@@ -101,9 +101,23 @@ class HDP206StackAdvisor(DefaultStackAdvisor):
       "HBASE": self.recommendHbaseConfigurations,
       "STORM": self.recommendStormConfigurations,
       "AMBARI_METRICS": self.recommendAmsConfigurations,
-      "RANGER": self.recommendRangerConfigurations
+      "RANGER": self.recommendRangerConfigurations,
+      "ZOOKEEPER": self.recommendZookeeperConfigurations,
+      "OOZIE": self.recommendOozieConfigurations
     }
 
+  def recommendOozieConfigurations(self, configurations, clusterData, services, hosts):
+    oozie_mount_properties = [
+      ("oozie_data_dir", "OOZIE_SERVER", "/hadoop/oozie/data", "single"),
+    ]
+    self.updateMountProperties("oozie-env", oozie_mount_properties, configurations, services, hosts)
+
+  def recommendZookeeperConfigurations(self, configurations, clusterData, services, hosts):
+    zk_mount_properties = [
+      ("dataDir", "ZOOKEEPER_SERVER", "/hadoop/zookeeper", "single"),
+    ]
+    self.updateMountProperties("zoo.cfg", zk_mount_properties, configurations, services, hosts)
+
   def recommendYARNConfigurations(self, configurations, clusterData, services, hosts):
     putYarnProperty = self.putProperty(configurations, "yarn-site", services)
     putYarnPropertyAttribute = self.putPropertyAttribute(configurations, "yarn-site")
@@ -116,6 +130,15 @@ class HDP206StackAdvisor(DefaultStackAdvisor):
     putYarnProperty('yarn.scheduler.maximum-allocation-mb', int(configurations["yarn-site"]["properties"]["yarn.nodemanager.resource.memory-mb"]))
     putYarnEnvProperty('min_user_id', self.get_system_min_uid())
 
+    yarn_mount_properties = [
+      ("yarn.nodemanager.local-dirs", "NODEMANAGER", "/hadoop/yarn/local", "multi"),
+      ("yarn.nodemanager.log-dirs", "NODEMANAGER", "/hadoop/yarn/log", "multi"),
+      ("yarn.timeline-service.leveldb-timeline-store.path", "APP_TIMELINE_SERVER", "/hadoop/yarn/timeline", "single"),
+      ("yarn.timeline-service.leveldb-state-store.path", "APP_TIMELINE_SERVER", "/hadoop/yarn/timeline", "single")
+    ]
+
+    self.updateMountProperties("yarn-site", yarn_mount_properties, configurations, services, hosts)
+
     sc_queue_name = self.recommendYarnQueue(services, "yarn-env", "service_check.queue.name")
     if sc_queue_name is not None:
       putYarnEnvProperty("service_check.queue.name", sc_queue_name)
@@ -146,6 +169,13 @@ class HDP206StackAdvisor(DefaultStackAdvisor):
     putMapredProperty('mapreduce.map.java.opts', "-Xmx" + str(int(round(0.8 * clusterData['mapMemory']))) + "m")
     putMapredProperty('mapreduce.reduce.java.opts', "-Xmx" + str(int(round(0.8 * clusterData['reduceMemory']))) + "m")
     putMapredProperty('mapreduce.task.io.sort.mb', min(int(round(0.4 * clusterData['mapMemory'])), 1024))
+
+    mapred_mounts = [
+      ("mapred.local.dir", ["TASKTRACKER", "NODEMANAGER"], "/hadoop/mapred", "multi")
+    ]
+
+    self.updateMountProperties("mapred-site", mapred_mounts, configurations, services, hosts)
+
     mr_queue = self.recommendYarnQueue(services, "mapred-site", "mapreduce.job.queuename")
     if mr_queue is not None:
       putMapredProperty("mapreduce.job.queuename", mr_queue)
@@ -393,12 +423,15 @@ class HDP206StackAdvisor(DefaultStackAdvisor):
       if len(namenodes.split(',')) > 1:
         putHDFSSitePropertyAttributes("dfs.namenode.rpc-address", "delete", "true")
 
-    #Initialize default 'dfs.datanode.data.dir' if needed
-    if (not hdfsSiteProperties) or ('dfs.datanode.data.dir' not in hdfsSiteProperties):
-      dataDirs = '/hadoop/hdfs/data'
-      putHDFSSiteProperty('dfs.datanode.data.dir', dataDirs)
-    else:
-      dataDirs = hdfsSiteProperties['dfs.datanode.data.dir'].split(",")
+    hdfs_mount_properties = [
+      ("dfs.datanode.data.dir", "DATANODE", "/hadoop/hdfs/data", "multi"),
+      ("dfs.namenode.name.dir", "DATANODE", "/hadoop/hdfs/namenode", "multi"),
+      ("dfs.namenode.checkpoint.dir", "SECONDARY_NAMENODE", "/hadoop/hdfs/namesecondary", "single")
+    ]
+
+    self.updateMountProperties("hdfs-site", hdfs_mount_properties, configurations, services, hosts)
+
+    dataDirs = hdfsSiteProperties['dfs.datanode.data.dir'].split(",")
 
     # dfs.datanode.du.reserved should be set to 10-15% of volume size
     # For each host selects maximum size of the volume. Then gets minimum for all hosts.

http://git-wip-us.apache.org/repos/asf/ambari/blob/bb8be5ba/ambari-server/src/main/resources/stacks/HDP/2.1/services/stack_advisor.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.1/services/stack_advisor.py b/ambari-server/src/main/resources/stacks/HDP/2.1/services/stack_advisor.py
index 9678dc1..17225d0 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.1/services/stack_advisor.py
+++ b/ambari-server/src/main/resources/stacks/HDP/2.1/services/stack_advisor.py
@@ -24,12 +24,30 @@ class HDP21StackAdvisor(HDP206StackAdvisor):
     childRecommendConfDict = {
       "OOZIE": self.recommendOozieConfigurations,
       "HIVE": self.recommendHiveConfigurations,
-      "TEZ": self.recommendTezConfigurations
+      "TEZ": self.recommendTezConfigurations,
+      "STORM": self.recommendStormConfigurations,
+      "FALCON": self.recommendFalconConfigurations
     }
     parentRecommendConfDict.update(childRecommendConfDict)
     return parentRecommendConfDict
 
+  def recommendStormConfigurations(self, configurations, clusterData, services, hosts):
+    storm_mounts = [
+      ("storm.local.dir", ["NODEMANAGER", "NIMBUS"], "/hadoop/storm", "single")
+    ]
+
+    self.updateMountProperties("storm-site", storm_mounts, configurations, services, hosts)
+
+  def recommendFalconConfigurations(self, configurations, clusterData, services, hosts):
+    falcon_mounts = [
+      ("*.falcon.graph.storage.directory", "FALCON_SERVER", "/hadoop/falcon/data/lineage/graphdb", "single")
+    ]
+
+    self.updateMountProperties("falcon-startup.properties", falcon_mounts, configurations, services, hosts)
+
   def recommendOozieConfigurations(self, configurations, clusterData, services, hosts):
+    super(HDP21StackAdvisor, self).recommendOozieConfigurations(configurations, clusterData, services, hosts)
+
     oozieSiteProperties = getSiteProperties(services['configurations'], 'oozie-site')
     oozieEnvProperties = getSiteProperties(services['configurations'], 'oozie-env')
     putOozieProperty = self.putProperty(configurations, "oozie-site", services)

http://git-wip-us.apache.org/repos/asf/ambari/blob/bb8be5ba/ambari-server/src/main/resources/stacks/HDP/2.2/services/stack_advisor.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.2/services/stack_advisor.py b/ambari-server/src/main/resources/stacks/HDP/2.2/services/stack_advisor.py
index a8a75e5..feafc04 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.2/services/stack_advisor.py
+++ b/ambari-server/src/main/resources/stacks/HDP/2.2/services/stack_advisor.py
@@ -44,10 +44,17 @@ class HDP22StackAdvisor(HDP21StackAdvisor):
       "RANGER": self.recommendRangerConfigurations,
       "LOGSEARCH" : self.recommendLogsearchConfigurations,
       "SPARK": self.recommendSparkConfigurations,
+      "KAFKA": self.recommendKafkaConfigurations,
     }
     parentRecommendConfDict.update(childRecommendConfDict)
     return parentRecommendConfDict
 
+  def recommendKafkaConfigurations(self, configurations, clusterData, services, hosts):
+    kafka_mounts = [
+      ("log.dirs", "KAFKA_BROKER", "/kafka-logs", "multi")
+    ]
+
+    self.updateMountProperties("kafka-broker", kafka_mounts, configurations, services, hosts)
 
   def recommendSparkConfigurations(self, configurations, clusterData, services, hosts):
     """

http://git-wip-us.apache.org/repos/asf/ambari/blob/bb8be5ba/ambari-server/src/main/resources/stacks/stack_advisor.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/stack_advisor.py b/ambari-server/src/main/resources/stacks/stack_advisor.py
index f6191f8..8148379 100644
--- a/ambari-server/src/main/resources/stacks/stack_advisor.py
+++ b/ambari-server/src/main/resources/stacks/stack_advisor.py
@@ -972,6 +972,18 @@ class DefaultStackAdvisor(StackAdvisor):
       return None
     return siteConfig.get("properties")
 
+  def getServicesSiteProperties(self, services, siteName):
+    if not services:
+      return None
+
+    configurations = services.get("configurations")
+    if not configurations:
+      return None
+    siteConfig = configurations.get(siteName)
+    if siteConfig is None:
+      return None
+    return siteConfig.get("properties")
+
   def putProperty(self, config, configType, services=None):
     userConfigs = {}
     changedConfigs = []
@@ -1040,14 +1052,27 @@ class DefaultStackAdvisor(StackAdvisor):
       config[configType]["property_attributes"][key][attribute] = attributeValue if isinstance(attributeValue, list) else str(attributeValue)
     return appendPropertyAttribute
 
-
-  """
-  Returns the hosts which are running the given component.
-  """
   def getHosts(self, componentsList, componentName):
+    """
+    Returns the hosts which are running the given component.
+    """
     hostNamesList = [component["hostnames"] for component in componentsList if component["component_name"] == componentName]
     return hostNamesList[0] if len(hostNamesList) > 0 else []
 
+  def getMountPoints(self, hosts):
+    """
+    Return list of mounts available on the hosts
+
+    :type hosts dict
+    """
+    mount_points = []
+
+    for item in hosts["items"]:
+      if "disk_info" in item["Hosts"]:
+        mount_points.append(item["Hosts"]["disk_info"])
+
+    return mount_points
+
   def isSecurityEnabled(self, services):
     """
     Determines if security is enabled by testing the value of cluster-env/security enabled.
@@ -1084,3 +1109,179 @@ class DefaultStackAdvisor(StackAdvisor):
 
   def getServiceNames(self, services):
     return [service["StackServices"]["service_name"] for service in services["services"]]
+
+  def filterHostMounts(self, hosts, services):
+    """
+    Filter mounts on the host using agent_mounts_ignore_list, by excluding and record with mount-point
+     mentioned in agent_mounts_ignore_list.
+
+    This function updates hosts dictionary
+
+    Example:
+
+      agent_mounts_ignore_list : "/run/secrets"
+
+      Hosts record :
+
+       "disk_info" : [
+          {
+              ...
+            "mountpoint" : "/"
+          },
+          {
+              ...
+            "mountpoint" : "/run/secrets"
+          }
+        ]
+
+      Result would be :
+
+        "disk_info" : [
+          {
+              ...
+            "mountpoint" : "/"
+          }
+        ]
+
+    :type hosts dict
+    :type services dict
+    """
+    if not services or "items" not in hosts:
+      return hosts
+
+    banned_filesystems = ["devtmpfs", "tmpfs", "vboxsf", "cdfs"]
+    banned_mount_points = ["/etc/resolv.conf", "/etc/hostname", "/boot", "/mnt", "/tmp", "/run/secrets"]
+
+    cluster_env = self.getServicesSiteProperties(services, "cluster-env")
+    ignore_list = []
+
+    if cluster_env and "agent_mounts_ignore_list" in cluster_env and cluster_env["agent_mounts_ignore_list"].strip():
+      ignore_list = [x.strip() for x in cluster_env["agent_mounts_ignore_list"].strip().split(",")]
+
+    ignore_list.extend(banned_mount_points)
+
+    for host in hosts["items"]:
+      if "Hosts" not in host and "disk_info" not in host["Hosts"]:
+        continue
+
+      host = host["Hosts"]
+      disk_info = []
+
+      for disk in host["disk_info"]:
+        if disk["mountpoint"] not in ignore_list\
+          and disk["type"].lower() not in banned_filesystems:
+          disk_info.append(disk)
+
+      host["disk_info"] = disk_info
+
+    return hosts
+
+  def __getSameHostMounts(self, hosts):
+    """
+    Return list of the mounts which are same and present on all hosts
+
+    :type hosts dict
+    :rtype list
+    """
+    if not hosts:
+      return None
+
+    hostMounts = self.getMountPoints(hosts)
+    mounts = []
+    for m in hostMounts:
+      host_mounts = set([item["mountpoint"] for item in m])
+      mounts = host_mounts if not mounts else mounts & host_mounts
+
+    return sorted(mounts)
+
+  def getMountPathVariations(self, initial_value, component_name, services, hosts):
+    """
+    Recommends best fitted mount by prefixing path with it.
+
+    :return return list of paths with properly selected paths. If no recommendation possible,
+     would be returned empty list
+
+    :type initial_value str
+    :type component_name str
+    :type services dict
+    :type hosts dict
+    :rtype list
+    """
+    available_mounts = []
+
+    if not initial_value:
+      return available_mounts
+
+    mounts = self.__getSameHostMounts(hosts)
+    sep = "/"
+
+    if not mounts:
+      return available_mounts
+
+    for mount in mounts:
+      new_mount = initial_value if mount == "/" else os.path.join(mount + sep, initial_value.lstrip(sep))
+      if new_mount not in available_mounts:
+        available_mounts.append(new_mount)
+
+    # no list transformations after filling the list, because this will cause item order change
+    return available_mounts
+
+  def getMountPathVariation(self, initial_value, component_name, services, hosts):
+    """
+    Recommends best fitted mount by prefixing path with it.
+
+    :return return list of paths with properly selected paths. If no recommendation possible,
+     would be returned empty list
+
+    :type initial_value str
+        :type component_name str
+    :type services dict
+    :type hosts dict
+    :rtype str
+    """
+    try:
+      return [self.getMountPathVariations(initial_value, component_name, services, hosts)[0]]
+    except IndexError:
+      return []
+
+  def updateMountProperties(self, siteConfig, propertyDefinitions, configurations,  services, hosts):
+    """
+    Update properties according to recommendations for available mount-points
+
+    propertyDefinitions is an array of set : property name, component name, initial value, recommendation type
+
+     Where,
+
+       property name - name of the property
+       component name, name of the component to which belongs this property
+       initial value - initial path
+       recommendation type - could be "multi" or "single". This describes recommendation strategy, to use only one disk
+        or use all available space on the host
+
+    :type propertyDefinitions list
+    :type siteConfig str
+    :type configurations dict
+    :type services dict
+    :type hosts dict
+    """
+
+    props = self.getServicesSiteProperties(services, siteConfig)
+    put_f = self.putProperty(configurations, siteConfig, services)
+
+    for prop_item in propertyDefinitions:
+      name, component, default_value, rc_type = prop_item
+      recommendation = None
+
+      if props is None or name not in props:
+        if rc_type == "multi":
+          recommendation = self.getMountPathVariations(default_value, component, services, hosts)
+        else:
+          recommendation = self.getMountPathVariation(default_value, component, services, hosts)
+      elif props and name in props and props[name] == default_value:
+        if rc_type == "multi":
+          recommendation = self.getMountPathVariations(default_value, component, services, hosts)
+        else:
+          recommendation = self.getMountPathVariation(default_value, component, services, hosts)
+
+      if recommendation:
+        put_f(name, ",".join(recommendation))

http://git-wip-us.apache.org/repos/asf/ambari/blob/bb8be5ba/ambari-server/src/test/python/stacks/2.0.6/common/test_stack_advisor.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/stacks/2.0.6/common/test_stack_advisor.py b/ambari-server/src/test/python/stacks/2.0.6/common/test_stack_advisor.py
index 9595b9e..4b3397f 100644
--- a/ambari-server/src/test/python/stacks/2.0.6/common/test_stack_advisor.py
+++ b/ambari-server/src/test/python/stacks/2.0.6/common/test_stack_advisor.py
@@ -1195,8 +1195,10 @@ class TestHDP206StackAdvisor(TestCase):
                   {'properties':
                      {'falcon_user': 'falcon'}},
                 'hdfs-site':
-                  {'properties': 
+                  {'properties':
                      {'dfs.datanode.data.dir': '/hadoop/hdfs/data',
+                      'dfs.namenode.name.dir': '/hadoop/hdfs/namenode',
+                      'dfs.namenode.checkpoint.dir': '/hadoop/hdfs/namesecondary',
                       'dfs.datanode.du.reserved': '10240000000'}},
                 'hive-env':
                   {'properties':
@@ -1330,6 +1332,8 @@ class TestHDP206StackAdvisor(TestCase):
                 'hdfs-site':
                   {'properties':
                      {'dfs.datanode.data.dir': '/hadoop/hdfs/data',
+                      'dfs.namenode.name.dir': '/hadoop/hdfs/namenode',
+                      'dfs.namenode.checkpoint.dir': '/hadoop/hdfs/namesecondary',
                       'dfs.datanode.du.reserved': '10240000000'}},
                 'hive-env':
                   {'properties':
@@ -1463,8 +1467,10 @@ class TestHDP206StackAdvisor(TestCase):
                      {'hive_user': 'hive',
                       'webhcat_user': 'webhcat'}},
                 'hdfs-site':
-                  {'properties': 
+                  {'properties':
                      {'dfs.datanode.data.dir': '/hadoop/hdfs/data',
+                      'dfs.namenode.name.dir': '/hadoop/hdfs/namenode',
+                      'dfs.namenode.checkpoint.dir': '/hadoop/hdfs/namesecondary',
                       'dfs.datanode.du.reserved': '10240000000'}},
                 'hadoop-env':
                   {'properties':
@@ -1484,10 +1490,12 @@ class TestHDP206StackAdvisor(TestCase):
 
     expected["hdfs-site"] = {
       'properties': {
-        'dfs.datanode.data.dir': '/hadoop/hdfs/data',
         'dfs.datanode.du.reserved': '10240000000',
         'dfs.internal.nameservices': 'mycluster',
-        'dfs.ha.namenodes.mycluster': 'nn1,nn2'
+        'dfs.ha.namenodes.mycluster': 'nn1,nn2',
+        'dfs.datanode.data.dir': '/hadoop/hdfs/data',
+        'dfs.namenode.name.dir': '/hadoop/hdfs/namenode',
+        'dfs.namenode.checkpoint.dir': '/hadoop/hdfs/namesecondary',
       },
       'property_attributes': {
         'dfs.namenode.rpc-address': {

http://git-wip-us.apache.org/repos/asf/ambari/blob/bb8be5ba/ambari-server/src/test/python/stacks/2.1/common/test_stack_advisor.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/stacks/2.1/common/test_stack_advisor.py b/ambari-server/src/test/python/stacks/2.1/common/test_stack_advisor.py
index 7835262..f9fb1f5 100644
--- a/ambari-server/src/test/python/stacks/2.1/common/test_stack_advisor.py
+++ b/ambari-server/src/test/python/stacks/2.1/common/test_stack_advisor.py
@@ -487,6 +487,8 @@ class TestHDP21StackAdvisor(TestCase):
       "hdfs-site": {
         "properties": {
           'dfs.datanode.data.dir': '/hadoop/hdfs/data',
+          'dfs.namenode.name.dir': '/hadoop/hdfs/namenode',
+          'dfs.namenode.checkpoint.dir': '/hadoop/hdfs/namesecondary',
           'dfs.datanode.du.reserved': '10240000000'
         }
       }

http://git-wip-us.apache.org/repos/asf/ambari/blob/bb8be5ba/ambari-server/src/test/python/stacks/2.2/common/test_stack_advisor.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/stacks/2.2/common/test_stack_advisor.py b/ambari-server/src/test/python/stacks/2.2/common/test_stack_advisor.py
index 3cd05d3..c8da075 100644
--- a/ambari-server/src/test/python/stacks/2.2/common/test_stack_advisor.py
+++ b/ambari-server/src/test/python/stacks/2.2/common/test_stack_advisor.py
@@ -3068,7 +3068,9 @@ class TestHDP22StackAdvisor(TestCase):
           'dfs.namenode.safemode.threshold-pct': '1.000',
           'dfs.datanode.failed.volumes.tolerated': '1',
           'dfs.namenode.handler.count': '25',
-          'dfs.datanode.data.dir': '/path/1,/path/2,/path/3,/path/4'
+          'dfs.datanode.data.dir': '/path/1,/path/2,/path/3,/path/4',
+          'dfs.namenode.name.dir': '/hadoop/hdfs/namenode',
+          'dfs.namenode.checkpoint.dir': '/hadoop/hdfs/namesecondary'
         },
         'property_attributes': {
           'dfs.datanode.failed.volumes.tolerated': {'maximum': '4'},
@@ -3743,7 +3745,11 @@ class TestHDP22StackAdvisor(TestCase):
           "yarn.nodemanager.linux-container-executor.cgroups.hierarchy": "/yarn",
           "yarn.scheduler.maximum-allocation-mb": "39424",
           "yarn.nodemanager.linux-container-executor.resources-handler.class": "org.apache.hadoop.yarn.server.nodemanager.util.CgroupsLCEResourcesHandler",
-          "hadoop.registry.rm.enabled": "false"
+          "hadoop.registry.rm.enabled": "false",
+          "yarn.timeline-service.leveldb-state-store.path": "/hadoop/yarn/timeline",
+          "yarn.timeline-service.leveldb-timeline-store.path": "/hadoop/yarn/timeline",
+          "yarn.nodemanager.local-dirs": "/hadoop/yarn/local,/dev/shm/hadoop/yarn/local,/vagrant/hadoop/yarn/local",
+          "yarn.nodemanager.log-dirs": "/hadoop/yarn/log,/dev/shm/hadoop/yarn/log,/vagrant/hadoop/yarn/log"
         },
         "property_attributes": {
           "yarn.scheduler.minimum-allocation-vcores": {
@@ -3789,7 +3795,6 @@ class TestHDP22StackAdvisor(TestCase):
           "yarn.nodemanager.linux-container-executor.group": "hadoop",
           "yarn.nodemanager.container-executor.class": "org.apache.hadoop.yarn.server.nodemanager.DefaultContainerExecutor",
           "yarn.nodemanager.linux-container-executor.cgroups.mount-path": "/cgroup",
-          "yarn.nodemanager.linux-container-executor.group": "hadoop",
           "yarn.nodemanager.linux-container-executor.cgroups.mount": "true",
           "yarn.nodemanager.resource.memory-mb": "39424",
           "yarn.scheduler.minimum-allocation-mb": "3584",
@@ -3799,7 +3804,11 @@ class TestHDP22StackAdvisor(TestCase):
           "yarn.nodemanager.linux-container-executor.cgroups.hierarchy": "/yarn",
           "yarn.scheduler.maximum-allocation-mb": "39424",
           "yarn.nodemanager.linux-container-executor.resources-handler.class": "org.apache.hadoop.yarn.server.nodemanager.util.CgroupsLCEResourcesHandler",
-          "hadoop.registry.rm.enabled": "false"
+          "hadoop.registry.rm.enabled": "false",
+          "yarn.timeline-service.leveldb-state-store.path": "/hadoop/yarn/timeline",
+          "yarn.timeline-service.leveldb-timeline-store.path": "/hadoop/yarn/timeline",
+          "yarn.nodemanager.local-dirs": "/hadoop/yarn/local,/dev/shm/hadoop/yarn/local,/vagrant/hadoop/yarn/local",
+          "yarn.nodemanager.log-dirs": "/hadoop/yarn/log,/dev/shm/hadoop/yarn/log,/vagrant/hadoop/yarn/log"
         },
         "property_attributes": {
           "yarn.nodemanager.linux-container-executor.cgroups.mount": {

http://git-wip-us.apache.org/repos/asf/ambari/blob/bb8be5ba/ambari-server/src/test/python/stacks/test_stack_adviser.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/stacks/test_stack_adviser.py b/ambari-server/src/test/python/stacks/test_stack_adviser.py
new file mode 100644
index 0000000..8146a0c
--- /dev/null
+++ b/ambari-server/src/test/python/stacks/test_stack_adviser.py
@@ -0,0 +1,239 @@
+"""
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+"""
+
+import os
+from unittest import TestCase
+
+
+class TestBasicAdvisor(TestCase):
+  def setUp(self):
+    import imp
+    self.maxDiff = None
+    self.testDirectory = os.path.dirname(os.path.abspath(__file__))
+    stackAdvisorPath = os.path.abspath(os.path.join(self.testDirectory, '../../../main/resources/stacks/stack_advisor.py'))
+
+    default_sa_classname = 'DefaultStackAdvisor'
+
+    with open(stackAdvisorPath, 'rb') as fp:
+      stack_advisor_impl = imp.load_module('stack_advisor', fp, stackAdvisorPath, ('.py', 'rb', imp.PY_SOURCE))
+
+    clazz = getattr(stack_advisor_impl, default_sa_classname)
+    self.stackAdvisor = clazz()
+
+  def test_filterHostMounts(self):
+
+    filtered_mount = "/data"
+
+    hosts = {
+      "items": [
+        {
+          "Hosts": {
+            "cpu_count": 4,
+            "total_mem": 50331648,
+            "disk_info": [
+              {"mountpoint": "/", "type": "ext3"},
+              {"mountpoint": "/dev/shm", "type": "ext3"},
+              {"mountpoint": "/vagrant", "type": "vboxsf"},
+              {"mountpoint": "/dev/shm", "type": "ext3"},
+              {"mountpoint": "/vagrant", "type": "ext3"},
+              {"mountpoint": filtered_mount, "type": "ext3"},
+            ],
+            "public_host_name": "c6401.ambari.apache.org",
+            "host_name": "c6401.ambari.apache.org"
+          },
+        },
+        {
+          "Hosts": {
+            "cpu_count": 4,
+            "total_mem": 50331648,
+            "disk_info": [
+              {"mountpoint": "/", "type": "ext3"},
+              {"mountpoint": "/dev/shm1", "type": "ext3"},
+              {"mountpoint": "/vagrant1", "type": "ext3"},
+              {"mountpoint": filtered_mount, "type": "ext3"}
+            ],
+            "public_host_name": "c6402.ambari.apache.org",
+            "host_name": "c6402.ambari.apache.org"
+          },
+        }
+      ]
+    }
+
+    services = {
+      "Versions": {
+        "parent_stack_version": "2.5",
+        "stack_name": "HDP",
+        "stack_version": "2.6",
+        "stack_hierarchy": {
+          "stack_name": "HDP",
+          "stack_versions": ["2.5", "2.4", "2.3", "2.2", "2.1", "2.0.6"]
+        }
+      },
+      "services": [
+      ],
+      "configurations": {
+        "cluster-env": {
+          "properties": {
+            "agent_mounts_ignore_list": filtered_mount
+          }
+        }
+      }
+    }
+
+    filtered_hosts = self.stackAdvisor.filterHostMounts(hosts, services)
+
+    for host in filtered_hosts["items"]:
+      self.assertEquals(False, filtered_mount in host["Hosts"]["disk_info"])
+
+  def test_getMountPathVariations(self):
+
+    filtered_mount = "/data"
+
+    hosts = {
+      "items": [
+        {
+          "Hosts": {
+            "cpu_count": 4,
+            "total_mem": 50331648,
+            "disk_info": [
+              {"mountpoint": "/", "type": "ext3"},
+              {"mountpoint": "/dev/shm", "type": "ext3"},
+              {"mountpoint": "/vagrant", "type": "vboxsf"},
+              {"mountpoint": "/dev/shm", "type": "ext3"},
+              {"mountpoint": "/vagrant", "type": "ext3"},
+              {"mountpoint": filtered_mount, "type": "ext3"},
+            ],
+            "public_host_name": "c6401.ambari.apache.org",
+            "host_name": "c6401.ambari.apache.org"
+          },
+        },
+        {
+          "Hosts": {
+            "cpu_count": 4,
+            "total_mem": 50331648,
+            "disk_info": [
+              {"mountpoint": "/", "type": "ext3"},
+              {"mountpoint": "/dev/shm1", "type": "ext3"},
+              {"mountpoint": "/vagrant1", "type": "ext3"},
+              {"mountpoint": filtered_mount, "type": "ext3"}
+            ],
+            "public_host_name": "c6402.ambari.apache.org",
+            "host_name": "c6402.ambari.apache.org"
+          },
+        }
+      ]
+    }
+
+    services = {
+      "Versions": {
+        "parent_stack_version": "2.5",
+        "stack_name": "HDP",
+        "stack_version": "2.6",
+        "stack_hierarchy": {
+          "stack_name": "HDP",
+          "stack_versions": ["2.5", "2.4", "2.3", "2.2", "2.1", "2.0.6"]
+        }
+      },
+      "services": [
+      ],
+      "configurations": {
+        "cluster-env": {
+          "properties": {
+            "agent_mounts_ignore_list": filtered_mount
+          }
+        }
+      }
+    }
+
+    hosts = self.stackAdvisor.filterHostMounts(hosts, services)
+    avail_mounts = self.stackAdvisor.getMountPathVariations("/test/folder", "DATANODE", services, hosts)
+
+    self.assertEquals(True, avail_mounts is not None)
+    self.assertEquals(1, len(avail_mounts))
+    self.assertEquals("/test/folder", avail_mounts[0])
+
+  def test_updateMountProperties(self):
+    hosts = {
+      "items": [
+        {
+          "Hosts": {
+            "cpu_count": 4,
+            "total_mem": 50331648,
+            "disk_info": [
+              {"mountpoint": "/", "type": "ext3"},
+              {"mountpoint": "/dev/shm", "type": "ext3"},
+              {"mountpoint": "/vagrant", "type": "vboxsf"},
+              {"mountpoint": "/dev/shm", "type": "ext3"},
+              {"mountpoint": "/vagrant", "type": "ext3"},
+              {"mountpoint": "/data", "type": "ext3"},
+            ],
+            "public_host_name": "c6401.ambari.apache.org",
+            "host_name": "c6401.ambari.apache.org"
+          },
+        },
+        {
+          "Hosts": {
+            "cpu_count": 4,
+            "total_mem": 50331648,
+            "disk_info": [
+              {"mountpoint": "/", "type": "ext3"},
+              {"mountpoint": "/dev/shm1", "type": "ext3"},
+              {"mountpoint": "/vagrant", "type": "vboxsf"},
+              {"mountpoint": "/data", "type": "ext3"}
+            ],
+            "public_host_name": "c6402.ambari.apache.org",
+            "host_name": "c6402.ambari.apache.org"
+          },
+        }
+      ]
+    }
+
+    services = {
+      "Versions": {
+        "parent_stack_version": "2.5",
+        "stack_name": "HDP",
+        "stack_version": "2.6",
+        "stack_hierarchy": {
+          "stack_name": "HDP",
+          "stack_versions": ["2.5", "2.4", "2.3", "2.2", "2.1", "2.0.6"]
+        }
+      },
+      "services": [
+      ],
+      "configurations": {
+        "cluster-env": {
+          "properties": {
+            "agent_mounts_ignore_list": ""
+          }
+        },
+        "some-site": {
+          "path_prop": "/test"
+        }
+      }
+    }
+
+    pathProperties = [
+      ("path_prop", "DATANODE", "/test", "multi"),
+    ]
+
+    configurations = {}
+    hosts = self.stackAdvisor.filterHostMounts(hosts, services)
+
+    self.stackAdvisor.updateMountProperties("some-site", pathProperties, configurations, services, hosts)
+
+    self.assertEquals("/test,/data/test", configurations["some-site"]["properties"]["path_prop"])

http://git-wip-us.apache.org/repos/asf/ambari/blob/bb8be5ba/ambari-web/app/mixins.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/mixins.js b/ambari-web/app/mixins.js
index 594ed74..7b4d6b4 100644
--- a/ambari-web/app/mixins.js
+++ b/ambari-web/app/mixins.js
@@ -69,4 +69,3 @@ require('mixins/common/widgets/widget_mixin');
 require('mixins/common/widgets/widget_section');
 require('mixins/unit_convert/base_unit_convert_mixin');
 require('mixins/unit_convert/convert_unit_widget_view_mixin');
-require('utils/configs/mount_points_based_initializer_mixin');

http://git-wip-us.apache.org/repos/asf/ambari/blob/bb8be5ba/ambari-web/app/utils/configs/config_initializer.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/utils/configs/config_initializer.js b/ambari-web/app/utils/configs/config_initializer.js
index cb5b41f..de9ca7e 100644
--- a/ambari-web/app/utils/configs/config_initializer.js
+++ b/ambari-web/app/utils/configs/config_initializer.js
@@ -20,7 +20,6 @@ var App = require('app');
 var stringUtils = require('utils/string_utils');
 
 require('utils/configs/config_initializer_class');
-require('utils/configs/mount_points_based_initializer_mixin');
 require('utils/configs/hosts_based_initializer_mixin');
 
 /**
@@ -53,7 +52,7 @@ function getZKBasedConfig() {
  *
  * @instance ConfigInitializer
  */
-App.ConfigInitializer = App.ConfigInitializerClass.create(App.MountPointsBasedInitializerMixin, App.HostsBasedInitializerMixin, {
+App.ConfigInitializer = App.ConfigInitializerClass.create(App.HostsBasedInitializerMixin, {
 
   initializers: function() {
     return {
@@ -111,26 +110,7 @@ App.ConfigInitializer = App.ConfigInitializerClass.create(App.MountPointsBasedIn
       'templeton.zookeeper.hosts': getZKBasedConfig(),
       'hadoop.registry.zk.quorum': getZKBasedConfig(),
       'hive.cluster.delegation.token.store.zookeeper.connectString': getZKBasedConfig(),
-      'instance.zookeeper.host': getZKBasedConfig(),
-
-      'dfs.name.dir': this.getMultipleMountPointsConfig('NAMENODE', 'file'),
-      'dfs.namenode.name.dir': this.getMultipleMountPointsConfig('NAMENODE', 'file'),
-      'dfs.data.dir': this.getMultipleMountPointsConfig('DATANODE', 'file'),
-      'dfs.datanode.data.dir': this.getMultipleMountPointsConfig('DATANODE', 'file'),
-      'yarn.nodemanager.local-dirs': this.getMultipleMountPointsConfig('NODEMANAGER'),
-      'yarn.nodemanager.log-dirs': this.getMultipleMountPointsConfig('NODEMANAGER'),
-      'mapred.local.dir': this.getMultipleMountPointsConfig(['TASKTRACKER', 'NODEMANAGER']),
-      'log.dirs': this.getMultipleMountPointsConfig('KAFKA_BROKER'),
-
-      'fs.checkpoint.dir': this.getSingleMountPointConfig('SECONDARY_NAMENODE', 'file'),
-      'dfs.namenode.checkpoint.dir': this.getSingleMountPointConfig('SECONDARY_NAMENODE', 'file'),
-      'yarn.timeline-service.leveldb-timeline-store.path': this.getSingleMountPointConfig('APP_TIMELINE_SERVER'),
-      'yarn.timeline-service.leveldb-state-store.path': this.getSingleMountPointConfig('APP_TIMELINE_SERVER'),
-      'dataDir': this.getSingleMountPointConfig('ZOOKEEPER_SERVER'),
-      'oozie_data_dir': this.getSingleMountPointConfig('OOZIE_SERVER'),
-      'storm.local.dir': this.getSingleMountPointConfig(['NODEMANAGER', 'NIMBUS']),
-      '*.falcon.graph.storage.directory': this.getSingleMountPointConfig('FALCON_SERVER'),
-      '*.falcon.graph.serialize.path': this.getSingleMountPointConfig('FALCON_SERVER')
+      'instance.zookeeper.host': getZKBasedConfig()
     }
   }.property(''),
 
@@ -146,9 +126,7 @@ App.ConfigInitializer = App.ConfigInitializerClass.create(App.MountPointsBasedIn
   },
 
   initializerTypes: [
-    {name: 'zookeeper_based', method: '_initAsZookeeperServersList'},
-    {name: 'single_mountpoint', method: '_initAsSingleMountPoint'},
-    {name: 'multiple_mountpoints', method: '_initAsMultipleMountPoints'}
+    {name: 'zookeeper_based', method: '_initAsZookeeperServersList'}
   ],
 
   /**

http://git-wip-us.apache.org/repos/asf/ambari/blob/bb8be5ba/ambari-web/app/utils/configs/mount_points_based_initializer_mixin.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/utils/configs/mount_points_based_initializer_mixin.js b/ambari-web/app/utils/configs/mount_points_based_initializer_mixin.js
deleted file mode 100644
index 59a3985..0000000
--- a/ambari-web/app/utils/configs/mount_points_based_initializer_mixin.js
+++ /dev/null
@@ -1,340 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-var App = require('app');
-
-/**
- * Regexp used to determine if mount point is windows-like
- *
- * @type {RegExp}
- */
-var winRegex = /^([a-z]):\\?$/;
-
-App.MountPointsBasedInitializerMixin = Em.Mixin.create({
-
-  /**
-   * Map for methods used as value-modifiers for configProperties with values as mount point(s)
-   * Used if mount point is win-like (@see winRegex)
-   * Key: id
-   * Value: method-name
-   *
-   * @type {{default: string, file: string, slashes: string}}
-   */
-  winReplacersMap: {
-    default: '_defaultWinReplace',
-    file: '_winReplaceWithFile',
-    slashes: '_defaultWinReplaceWithAdditionalSlashes'
-  },
-
-  /**
-   * Initializer for configs with value as one of the possible mount points
-   * Only hosts that contains on the components from <code>initializer.components</code> are processed
-   * Hosts with Windows needs additional processing (@see winReplacersMap)
-   * Value example: '/', '/some/cool/dir'
-   *
-   * @param {configProperty} configProperty
-   * @param {topologyLocalDB} localDB
-   * @param {object} dependencies
-   * @param {object} initializer
-   * @return {Object}
-   */
-  _initAsSingleMountPoint: function (configProperty, localDB, dependencies, initializer) {
-    var hostsInfo = this._updateHostInfo(localDB.hosts);
-    var setOfHostNames = this._getSetOfHostNames(localDB, initializer);
-    var winReplacersMap = this.get('winReplacersMap');
-    // In Add Host Wizard, if we did not select this slave component for any host, then we don't process any further.
-    if (!setOfHostNames.length) {
-      return configProperty;
-    }
-    var allMountPoints = this._getAllMountPoints(setOfHostNames, hostsInfo, localDB);
-
-    var mPoint = allMountPoints[0].mountpoint;
-    if (mPoint === "/") {
-      mPoint = Em.get(configProperty, 'recommendedValue');
-    }
-    else {
-      var mp = mPoint.toLowerCase();
-      if (winRegex.test(mp)) {
-        var methodName = winReplacersMap[initializer.winReplacer];
-        mPoint = this[methodName].call(this, configProperty, mp);
-      }
-      else {
-        mPoint = mPoint + Em.get(configProperty, 'recommendedValue');
-      }
-    }
-    Em.setProperties(configProperty, {
-      value: mPoint,
-      recommendedValue: mPoint
-    });
-
-    return configProperty;
-  },
-
-  /**
-   * Initializer for configs with value as all of the possible mount points
-   * Only hosts that contains on the components from <code>initializer.components</code> are processed
-   * Hosts with Windows needs additional processing (@see winReplacersMap)
-   * Value example: '/\n/some/cool/dir' (`\n` - is divider)
-   *
-   * @param {Object} configProperty
-   * @param {topologyLocalDB} localDB
-   * @param {object} dependencies
-   * @param {object} initializer
-   * @return {Object}
-   */
-  _initAsMultipleMountPoints: function (configProperty, localDB, dependencies, initializer) {
-    var hostsInfo = this._updateHostInfo(localDB.hosts);
-    var self = this;
-    var setOfHostNames = this._getSetOfHostNames(localDB, initializer);
-    var winReplacersMap = this.get('winReplacersMap');
-    // In Add Host Wizard, if we did not select this slave component for any host, then we don't process any further.
-    if (!setOfHostNames.length) {
-      return configProperty;
-    }
-
-    var allMountPoints = this._getAllMountPoints(setOfHostNames, hostsInfo, localDB);
-    var mPoint = '';
-
-    allMountPoints.forEach(function (eachDrive) {
-      if (eachDrive.mountpoint === '/') {
-        mPoint += Em.get(configProperty, 'recommendedValue') + "\n";
-      }
-      else {
-        var mp = eachDrive.mountpoint.toLowerCase();
-        if (winRegex.test(mp)) {
-          var methodName = winReplacersMap[initializer.winReplacer];
-          mPoint += self[methodName].call(this, configProperty, mp);
-        }
-        else {
-          mPoint += eachDrive.mountpoint + Em.get(configProperty, 'recommendedValue') + "\n";
-        }
-      }
-    }, this);
-
-    Em.setProperties(configProperty, {
-      value: mPoint,
-      recommendedValue: mPoint
-    });
-
-    return configProperty;
-  },
-
-  /**
-   * Replace drive-based windows-path with 'file:///'
-   *
-   * @param {configProperty} configProperty
-   * @param {string} mountPoint
-   * @returns {string}
-   * @private
-   */
-  _winReplaceWithFile: function (configProperty, mountPoint) {
-    var winDriveUrl = mountPoint.toLowerCase().replace(winRegex, 'file:///$1:');
-    return winDriveUrl + Em.get(configProperty, 'recommendedValue') + '\n';
-  },
-
-  /**
-   * Replace drive-based windows-path
-   *
-   * @param {configProperty} configProperty
-   * @param {string} mountPoint
-   * @returns {string}
-   * @private
-   */
-  _defaultWinReplace: function (configProperty, mountPoint) {
-    var winDrive = mountPoint.toLowerCase().replace(winRegex, '$1:');
-    var winDir = Em.get(configProperty, 'recommendedValue').replace(/\//g, '\\');
-    return winDrive + winDir + '\n';
-  },
-
-  /**
-   * Same to <code>_defaultWinReplace</code>, but with extra-slash in the end
-   *
-   * @param {configProperty} configProperty
-   * @param {string} mountPoint
-   * @returns {string}
-   * @private
-   */
-  _defaultWinReplaceWithAdditionalSlashes: function (configProperty, mountPoint) {
-    var winDrive = mountPoint.toLowerCase().replace(winRegex, '$1:');
-    var winDir = Em.get(configProperty, 'recommendedValue').replace(/\//g, '\\\\');
-    return winDrive + winDir + '\n';
-  },
-
-  /**
-   * Update information from localDB using <code>App.Host</code>-model
-   *
-   * @param {object} hostsInfo
-   * @returns {object}
-   * @private
-   */
-  _updateHostInfo: function (hostsInfo) {
-    App.Host.find().forEach(function (item) {
-      if (!hostsInfo[item.get('id')]) {
-        hostsInfo[item.get('id')] = {
-          name: item.get('id'),
-          cpu: item.get('cpu'),
-          memory: item.get('memory'),
-          disk_info: item.get('diskInfo'),
-          bootStatus: "REGISTERED",
-          isInstalled: true
-        };
-      }
-    });
-    return hostsInfo;
-  },
-
-  /**
-   * Determines if mount point is valid
-   * Criterias:
-   * <ul>
-   *   <li>Should has available space</li>
-   *   <li>Should not be home-dir</li>
-   *   <li>Should not be docker-dir</li>
-   *   <li>Should not be boot-dir</li>
-   *   <li>Should not be dev-dir</li>
-   *   <li>Valid mount point started from /usr/hdp/ should be /usr/hdp/current
-   *       or /usr/hdp/<STACK_VERSION_NUMBER> e.g. /usr/hdp/2.5.0.0
-   *   </li>
-   * </ul>
-   *
-   * @param {{mountpoint: string, available: number}} mPoint
-   * @returns {function} true - valid, false - invalid
-   * @private
-   */
-  _filterMountPoint: function (localDB) {
-    var stackVersionNumber = [Em.getWithDefault(localDB.selectedStack || {}, 'repository_version', null)].compact();
-    return function(mPoint) {
-      var isAvailable = mPoint.available !== 0;
-      if (!isAvailable) {
-        return false;
-      }
-
-      var stackRoot = '/usr/hdp';
-      var notHome = !['/', '/home'].contains(mPoint.mountpoint);
-      var notDocker = !['/etc/resolv.conf', '/etc/hostname', '/etc/hosts'].contains(mPoint.mountpoint);
-      var notBoot = mPoint.mountpoint && !(mPoint.mountpoint.startsWith('/boot')
-                                           || mPoint.mountpoint.startsWith('/mnt')
-                                           || mPoint.mountpoint.startsWith('/tmp'));
-      var notDev = !(['devtmpfs', 'tmpfs', 'vboxsf', 'CDFS'].contains(mPoint.type));
-      var validStackRootMount = !(mPoint.mountpoint.startsWith(stackRoot) && !['current'].concat(stackVersionNumber).filter(function(i) {
-        return mPoint.mountpoint === stackRoot + '/' + i;
-      }).length);
-
-      return notHome && notDocker && notBoot && notDev && validStackRootMount;
-    };
-  },
-
-  /**
-   * Get list of hostNames from localDB which contains needed components
-   *
-   * @param {topologyLocalDB} localDB
-   * @param {object} initializer
-   * @returns {string[]}
-   * @private
-   */
-  _getSetOfHostNames: function (localDB, initializer) {
-    var masterComponentHostsInDB = Em.getWithDefault(localDB, 'masterComponentHosts', []);
-    var slaveComponentHostsInDB = Em.getWithDefault(localDB, 'slaveComponentHosts', []);
-    var hosts = masterComponentHostsInDB.filter(function (master) {
-      return initializer.components.contains(master.component);
-    }).mapProperty('hostName');
-
-    var sHosts = slaveComponentHostsInDB.find(function (slave) {
-      return initializer.components.contains(slave.componentName);
-    });
-    if (sHosts) {
-      hosts = hosts.concat(sHosts.hosts.mapProperty('hostName'));
-    }
-    return hosts;
-  },
-
-  /**
-   * Get list of all unique valid mount points for hosts
-   *
-   * @param {string[]} setOfHostNames
-   * @param {object} hostsInfo
-   * @param {topologyLocalDB} localDB
-   * @returns {string[]}
-   * @private
-   */
-  _getAllMountPoints: function (setOfHostNames, hostsInfo, localDB) {
-    var allMountPoints = [],
-        mountPointFilter = this._filterMountPoint(localDB);
-    for (var i = 0; i < setOfHostNames.length; i++) {
-      var hostname = setOfHostNames[i];
-      var mountPointsPerHost = hostsInfo[hostname].disk_info;
-      var mountPointAsRoot = mountPointsPerHost.findProperty('mountpoint', '/');
-
-      // If Server does not send any host details information then atleast one mountpoint should be presumed as root
-      // This happens in a single container Linux Docker environment.
-      if (!mountPointAsRoot) {
-        mountPointAsRoot = {
-          mountpoint: '/'
-        };
-      }
-
-      mountPointsPerHost.filter(mountPointFilter).forEach(function (mPoint) {
-        if( !allMountPoints.findProperty("mountpoint", mPoint.mountpoint)) {
-          allMountPoints.push(mPoint);
-        }
-      }, this);
-    }
-
-    if (!allMountPoints.length) {
-      allMountPoints.push(mountPointAsRoot);
-    }
-    return allMountPoints;
-  },
-
-  /**
-   * Settings for <code>single_mountpoint</code>-initializer
-   * Used for configs with value as one of the possible mount points
-   *
-   * @see _initAsSingleMountPoint
-   * @param {string|string[]} components
-   * @param {string} winReplacer
-   * @returns {{components: string[], winReplacer: string, type: string}}
-   */
-  getSingleMountPointConfig: function (components, winReplacer) {
-    winReplacer = winReplacer || 'default';
-    return {
-      components: Em.makeArray(components),
-      winReplacer: winReplacer,
-      type: 'single_mountpoint'
-    };
-  },
-
-  /**
-   * Settings for <code>multiple_mountpoints</code>-initializer
-   * Used for configs with value as all of the possible mount points
-   *
-   * @see _initAsMultipleMountPoints
-   * @param {string|string[]} components
-   * @param {string} winReplacer
-   * @returns {{components: string[], winReplacer: string, type: string}}
-   */
-  getMultipleMountPointsConfig: function (components, winReplacer) {
-    winReplacer = winReplacer || 'default';
-    return {
-      components: Em.makeArray(components),
-      winReplacer: winReplacer,
-      type: 'multiple_mountpoints'
-    };
-  }
-
-});

http://git-wip-us.apache.org/repos/asf/ambari/blob/bb8be5ba/ambari-web/test/utils/ajax/ajax_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/utils/ajax/ajax_test.js b/ambari-web/test/utils/ajax/ajax_test.js
index d252c3d..3556e1e 100644
--- a/ambari-web/test/utils/ajax/ajax_test.js
+++ b/ambari-web/test/utils/ajax/ajax_test.js
@@ -29,11 +29,16 @@ describe('App.ajax', function() {
 
   beforeEach(function() {
     App.ajax.send.restore();
+    sinon.stub(App.logger, 'setTimer');
     sinon.spy(App.ajax, 'send'); // no sense to test stubbed function, so going to spy on it
     App.set('apiPrefix', '/api/v1');
     App.set('clusterName', 'tdk');
   });
 
+  afterEach(function() {
+    App.logger.setTimer.restore();
+  });
+
   describe('#send', function() {
     it('Without sender', function() {
       expect(App.ajax.send({})).to.equal(null);
@@ -168,7 +173,7 @@ describe('App.ajax', function() {
       });
     });
   });
-  
+
   describe('#abortRequests', function () {
 
     var xhr = {
@@ -198,6 +203,6 @@ describe('App.ajax', function() {
     it('should clear requests array', function () {
       expect(requests).to.have.length(0);
     });
-    
+
   });
 });

http://git-wip-us.apache.org/repos/asf/ambari/blob/bb8be5ba/ambari-web/test/utils/configs/config_initializer_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/utils/configs/config_initializer_test.js b/ambari-web/test/utils/configs/config_initializer_test.js
index 19ba03d..544ab1d 100644
--- a/ambari-web/test/utils/configs/config_initializer_test.js
+++ b/ambari-web/test/utils/configs/config_initializer_test.js
@@ -905,312 +905,6 @@ describe('App.ConfigInitializer', function () {
 
   });
 
-  describe('config with mount points', function () {
-
-    var localDB = {
-        masterComponentHosts: [
-          {
-            component: 'NAMENODE',
-            hostName: 'h0'
-          },
-          {
-            component: 'SECONDARY_NAMENODE',
-            hostName: 'h4'
-          },
-          {
-            component: 'APP_TIMELINE_SERVER',
-            hostName: 'h0'
-          },
-          {
-            component: 'ZOOKEEPER_SERVER',
-            hostName: 'h0'
-          },
-          {
-            component: 'ZOOKEEPER_SERVER',
-            hostName: 'h1'
-          },
-          {
-            component: 'OOZIE_SERVER',
-            hostName: 'h0'
-          },
-          {
-            component: 'OOZIE_SERVER',
-            hostName: 'h1'
-          },
-          {
-            component: 'NIMBUS',
-            hostName: 'h2'
-          },
-          {
-            component: 'FALCON_SERVER',
-            hostName: 'h3'
-          },
-          {
-            component: 'KAFKA_BROKER',
-            hostName: 'h0'
-          },
-          {
-            component: 'KAFKA_BROKER',
-            hostName: 'h1'
-          }
-        ],
-        slaveComponentHosts: [
-          {
-            componentName: 'DATANODE',
-            hosts: [
-              {
-                hostName: 'h0'
-              },
-              {
-                hostName: 'h1'
-              }
-            ]
-          },
-          {
-            componentName: 'TASKTRACKER',
-            hosts: [
-              {
-                hostName: 'h0'
-              },
-              {
-                hostName: 'h1'
-              }
-            ]
-          },
-          {
-            componentName: 'NODEMANAGER',
-            hosts: [
-              {
-                hostName: 'h0'
-              },
-              {
-                hostName: 'h1'
-              },
-              {
-                hostName: 'h4'
-              }
-            ]
-          },
-          {
-            componentName: 'HBASE_REGIONSERVER',
-            hosts: [
-              {
-                hostName: 'h0'
-              },
-              {
-                hostName: 'h1'
-              }
-            ]
-          },
-          {
-            componentName: 'SUPERVISOR',
-            hosts: [
-              {
-                hostName: 'h0'
-              },
-              {
-                hostName: 'h1'
-              }
-            ]
-          }
-        ],
-        hosts: {
-          h0: {
-            disk_info: [
-              {
-                mountpoint: '/'
-              },
-              {
-                mountpoint: '/home'
-              },
-              {
-                mountpoint: '/boot'
-              },
-              {
-                mountpoint: '/boot/efi'
-              },
-              {
-                mountpoint: '/mnt'
-              },
-              {
-                mountpoint: '/mnt/efi'
-              },
-              {
-                mountpoint: '/media/disk0',
-                available: '100000000'
-              },
-              {
-                mountpoint: '/mount0',
-                available: '100000000'
-              }
-            ]
-          },
-          h4: {
-            disk_info: [
-              {
-                mountpoint: 'c:',
-                available: '100000000'
-              }
-            ]
-          }
-        }
-      },
-      cases = [
-        {
-          name: 'dfs.namenode.name.dir',
-          isOnlyFirstOneNeeded: false,
-          value: '/media/disk0/default\n/mount0/default\n'
-        },
-        {
-          name: 'dfs.name.dir',
-          isOnlyFirstOneNeeded: false,
-          value: '/media/disk0/default\n/mount0/default\n'
-        },
-        {
-          name: 'fs.checkpoint.dir',
-          isOnlyFirstOneNeeded: true,
-          value: 'file:///c:/default\n'
-        },
-        {
-          name: 'dfs.namenode.checkpoint.dir',
-          isOnlyFirstOneNeeded: true,
-          value: 'file:///c:/default\n'
-        },
-        {
-          name: 'dfs.data.dir',
-          isOnlyFirstOneNeeded: false,
-          value: '/media/disk0/default\n/mount0/default\n/media/disk1/default\n/mount1/default\n'
-        },
-        {
-          name: 'dfs.datanode.data.dir',
-          isOnlyFirstOneNeeded: false,
-          value: '/media/disk0/default\n/mount0/default\n/media/disk1/default\n/mount1/default\n'
-        },
-        {
-          name: 'mapred.local.dir',
-          isOnlyFirstOneNeeded: false,
-          value: '/media/disk0/default\n/mount0/default\n/media/disk1/default\n/mount1/default\n'
-        },
-        {
-          name: 'yarn.nodemanager.log-dirs',
-          isOnlyFirstOneNeeded: false,
-          value: '/media/disk0/default\n/mount0/default\n/media/disk1/default\n/mount1/default\nc:\\default\n'
-        },
-        {
-          name: 'yarn.nodemanager.local-dirs',
-          isOnlyFirstOneNeeded: false,
-          value: '/media/disk0/default\n/mount0/default\n/media/disk1/default\n/mount1/default\nc:\\default\n'
-        },
-        {
-          name: 'yarn.timeline-service.leveldb-timeline-store.path',
-          isOnlyFirstOneNeeded: true,
-          value: '/media/disk0/default'
-        },
-        {
-          name: 'yarn.timeline-service.leveldb-state-store.path',
-          isOnlyFirstOneNeeded: true,
-          value: '/media/disk0/default'
-        },
-        {
-          name: 'dataDir',
-          isOnlyFirstOneNeeded: true,
-          value: '/media/disk0/default'
-        },
-        {
-          name: 'oozie_data_dir',
-          isOnlyFirstOneNeeded: true,
-          value: '/media/disk0/default'
-        },
-        {
-          name: 'storm.local.dir',
-          isOnlyFirstOneNeeded: true,
-          value: '/media/disk0/default'
-        },
-        {
-          name: '*.falcon.graph.storage.directory',
-          isOnlyFirstOneNeeded: true,
-          value: '/default'
-        },
-        {
-          name: '*.falcon.graph.serialize.path',
-          isOnlyFirstOneNeeded: true,
-          value: '/default'
-        },
-        {
-          name: 'log.dirs',
-          isOnlyFirstOneNeeded: false,
-          value: '/media/disk0/default\n/mount0/default\n/media/disk1/default\n/mount1/default\n'
-        }
-      ];
-
-    beforeEach(function () {
-      sinon.stub(App.Host, 'find').returns([
-        Em.Object.create({
-          id: 'h1',
-          diskInfo: [
-            {
-              mountpoint: '/media/disk1',
-              type: 'devtmpfs'
-            },
-            {
-              mountpoint: '/media/disk1',
-              type: 'tmpfs'
-            },
-            {
-              mountpoint: '/media/disk1',
-              type: 'vboxsf'
-            },
-            {
-              mountpoint: '/media/disk1',
-              type: 'CDFS'
-            },
-            {
-              mountpoint: '/media/disk1',
-              available: '0'
-            },
-            {
-              mountpoint: '/media/disk1',
-              available: '100000000'
-            },
-            {
-              mountpoint: '/mount1',
-              available: '100000000'
-            }
-          ]
-        }),
-        Em.Object.create({
-          id: 'h2',
-          diskInfo: [
-            {
-              mountpoint: '/'
-            }
-          ]
-        }),
-        Em.Object.create({
-          id: 'h3',
-          diskInfo: []
-        })
-      ]);
-    });
-
-    afterEach(function () {
-      App.Host.find.restore();
-    });
-
-    cases.forEach(function (item) {
-      it(item.name, function () {
-        serviceConfigProperty.setProperties({
-          name: item.name,
-          recommendedValue: '/default'
-        });
-        App.ConfigInitializer.initialValue(serviceConfigProperty, localDB, {});
-        expect(serviceConfigProperty.get('value')).to.equal(item.value);
-        expect(serviceConfigProperty.get('recommendedValue')).to.equal(item.value);
-      });
-    });
-
-  });
-
   describe('initializerTypes', function () {
     var types = App.ConfigInitializer.get('initializerTypes');
     Em.keys(types).forEach(function(type) {
@@ -1257,155 +951,4 @@ describe('App.ConfigInitializer', function () {
 
   });
 
-  describe('#_filterMountPoint', function() {
-    [
-      {
-        mPoint: {
-          mountpoint: '/'
-        },
-        localDB: {},
-        e: false
-      },
-      {
-        mPoint: {
-          mountpoint: '/home'
-        },
-        localDB: {},
-        e: false
-      },
-      {
-        mPoint: {
-          mountpoint: '/etc/resolv.conf'
-        },
-        localDB: {},
-        e: false
-      },
-      {
-        mPoint: {
-          mountpoint: '/etc/hostname'
-        },
-        localDB: {},
-        e: false
-      },
-      {
-        mPoint: {
-          mountpoint: '/etc/hosts'
-        },
-        localDB: {},
-        e: false
-      },
-      {
-        mPoint: {
-          mountpoint: '/boot'
-        },
-        localDB: {},
-        e: false
-      },
-      {
-        mPoint: {
-          mountpoint: '/mnt'
-        },
-        localDB: {},
-        e: false
-      },
-      {
-        mPoint: {
-          mountpoint: '/tmp'
-        },
-        localDB: {},
-        e: false
-      },
-      {
-        mPoint: {
-          mountpoint: '/some-dir',
-          type: 'devtmpfs'
-        },
-        localDB: {},
-        e: false
-      },
-      {
-        mPoint: {
-          mountpoint: '/some-dir',
-          type: 'tmpfs'
-        },
-        localDB: {},
-        e: false
-      },
-      {
-        mPoint: {
-          mountpoint: '/some-dir',
-          type: 'vboxsf'
-        },
-        localDB: {},
-        e: false
-      },
-      {
-        mPoint: {
-          mountpoint: '/some-dir',
-          type: 'CDFS'
-        },
-        localDB: {},
-        e: false
-      },
-      {
-        mPoint: {
-          mountpoint: '/usr/hdp'
-        },
-        localDB: {},
-        e: false
-      },
-      {
-        mPoint: {
-          mountpoint: '/usr/hdp/1'
-        },
-        localDB: {},
-        e: false
-      },
-      {
-        mPoint: {
-          mountpoint: '/usr/hdp/current'
-        },
-        localDB: {},
-        e: true
-      },
-      {
-        mPoint: {
-          mountpoint: '/usr/hdp/2.5'
-        },
-        localDB: {
-          selectedStack: {
-            repository_version: '2.5'
-          }
-        },
-        e: true
-      },
-      {
-        mPoint: {
-          mountpoint: '/usr/hdp/2.5.0'
-        },
-        localDB: {
-          selectedStack: {
-            repository_version: '2.5'
-          }
-        },
-        e: false
-      },
-      {
-        mPoint: {
-          mountpoint: '/normal/directory'
-        },
-        localDB: {
-          selectedStack: {
-            repository_version: '2.5'
-          }
-        },
-        e: true
-      }
-    ].forEach(function(test) {
-      it('mount point "{0}" should be {1}'.format(test.mPoint.mountpoint, test.e ? 'valid' : 'invalid'), function() {
-        var fFn = App.ConfigInitializer._filterMountPoint(test.localDB);
-        expect(fFn(test.mPoint)).to.be.equal(test.e);
-      });
-    });
-  });
 });


[11/50] [abbrv] ambari git commit: AMBARI-18994. In HA cluster copy the hdfs-site.xml and hbase-site.xml to Ranger conf directory (Mugdha Varadkar via smohanty)

Posted by nc...@apache.org.
AMBARI-18994. In HA cluster copy the hdfs-site.xml and hbase-site.xml to Ranger conf directory (Mugdha Varadkar via smohanty)


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

Branch: refs/heads/branch-dev-patch-upgrade
Commit: 72b940e725658599f055a1c1eaadaa2a9c65075b
Parents: 4bfbf28
Author: Sumit Mohanty <sm...@hortonworks.com>
Authored: Wed Nov 30 12:51:46 2016 -0800
Committer: Sumit Mohanty <sm...@hortonworks.com>
Committed: Wed Nov 30 12:52:22 2016 -0800

----------------------------------------------------------------------
 .../RANGER/0.4.0/package/scripts/params.py      | 14 +++++++++++++
 .../0.4.0/package/scripts/setup_ranger_xml.py   | 21 ++++++++++++++++++++
 .../common-services/RANGER/0.6.0/metainfo.xml   |  2 ++
 3 files changed, 37 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/72b940e7/ambari-server/src/main/resources/common-services/RANGER/0.4.0/package/scripts/params.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/RANGER/0.4.0/package/scripts/params.py b/ambari-server/src/main/resources/common-services/RANGER/0.4.0/package/scripts/params.py
index 6debaf1..e27b363 100644
--- a/ambari-server/src/main/resources/common-services/RANGER/0.4.0/package/scripts/params.py
+++ b/ambari-server/src/main/resources/common-services/RANGER/0.4.0/package/scripts/params.py
@@ -385,3 +385,17 @@ if audit_solr_enabled and is_solrCloud_enabled:
   # Check external solrCloud
   if is_external_solrCloud_enabled and is_external_solrCloud_kerberos:
     ranger_is_solr_kerberised = "true"
+
+hbase_master_hosts = default("/clusterHostInfo/hbase_master_hosts", [])
+is_hbase_ha_enabled = True if len(hbase_master_hosts) > 1 else False
+is_namenode_ha_enabled = True if len(namenode_hosts) > 1 else False
+ranger_hbase_plugin_enabled = False
+ranger_hdfs_plugin_enabled = False
+
+
+if is_hbase_ha_enabled:
+  if not is_empty(config['configurations']['ranger-hbase-plugin-properties']['ranger-hbase-plugin-enabled']):
+    ranger_hbase_plugin_enabled = config['configurations']['ranger-hbase-plugin-properties']['ranger-hbase-plugin-enabled'].lower() == 'yes'
+if is_namenode_ha_enabled:
+  if not is_empty(config['configurations']['ranger-hdfs-plugin-properties']['ranger-hdfs-plugin-enabled']):
+    ranger_hdfs_plugin_enabled = config['configurations']['ranger-hdfs-plugin-properties']['ranger-hdfs-plugin-enabled'].lower() == 'yes'
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/72b940e7/ambari-server/src/main/resources/common-services/RANGER/0.4.0/package/scripts/setup_ranger_xml.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/RANGER/0.4.0/package/scripts/setup_ranger_xml.py b/ambari-server/src/main/resources/common-services/RANGER/0.4.0/package/scripts/setup_ranger_xml.py
index 316d207..8036f28 100644
--- a/ambari-server/src/main/resources/common-services/RANGER/0.4.0/package/scripts/setup_ranger_xml.py
+++ b/ambari-server/src/main/resources/common-services/RANGER/0.4.0/package/scripts/setup_ranger_xml.py
@@ -216,6 +216,27 @@ def setup_ranger_admin(upgrade_type=None):
 
   create_core_site_xml(ranger_conf)
 
+  if params.stack_supports_ranger_kerberos and params.security_enabled:
+    if params.is_hbase_ha_enabled and params.ranger_hbase_plugin_enabled:
+      XmlConfig("hbase-site.xml",
+        conf_dir=ranger_conf,
+        configurations=params.config['configurations']['hbase-site'],
+        configuration_attributes=params.config['configuration_attributes']['hbase-site'],
+        owner=params.unix_user,
+        group=params.unix_group,
+        mode=0644
+      )
+
+    if params.is_namenode_ha_enabled and params.ranger_hdfs_plugin_enabled:
+      XmlConfig("hdfs-site.xml",
+        conf_dir=ranger_conf,
+        configurations=params.config['configurations']['hdfs-site'],
+        configuration_attributes=params.config['configuration_attributes']['hdfs-site'],
+        owner=params.unix_user,
+        group=params.unix_group,
+        mode=0644
+      )
+
 def setup_ranger_db(stack_version=None):
   import params
   

http://git-wip-us.apache.org/repos/asf/ambari/blob/72b940e7/ambari-server/src/main/resources/common-services/RANGER/0.6.0/metainfo.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/RANGER/0.6.0/metainfo.xml b/ambari-server/src/main/resources/common-services/RANGER/0.6.0/metainfo.xml
index f330bc9..12fde7e 100644
--- a/ambari-server/src/main/resources/common-services/RANGER/0.6.0/metainfo.xml
+++ b/ambari-server/src/main/resources/common-services/RANGER/0.6.0/metainfo.xml
@@ -110,6 +110,8 @@
       <configuration-dependencies>
         <config-type>admin-log4j</config-type>
         <config-type>usersync-log4j</config-type>
+        <config-type>ranger-hdfs-plugin-properties</config-type>
+        <config-type>ranger-hbase-plugin-properties</config-type>
       </configuration-dependencies>
 
     </service>


[16/50] [abbrv] ambari git commit: AMBARI-19042: Ambari-server: OOZIE stack definition changes required to support credential store

Posted by nc...@apache.org.
AMBARI-19042: Ambari-server: OOZIE stack definition changes required to support credential store


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

Branch: refs/heads/branch-dev-patch-upgrade
Commit: 337c5f29fd31fa8b7f8391d81125dc1e5eef160c
Parents: 7f04e79
Author: Nahappan Somasundaram <ns...@hortonworks.com>
Authored: Wed Nov 30 17:50:21 2016 -0800
Committer: Nahappan Somasundaram <ns...@hortonworks.com>
Committed: Wed Nov 30 22:07:14 2016 -0800

----------------------------------------------------------------------
 .../main/resources/stacks/HDP/2.5/services/OOZIE/metainfo.xml    | 4 ++++
 1 file changed, 4 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/337c5f29/ambari-server/src/main/resources/stacks/HDP/2.5/services/OOZIE/metainfo.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.5/services/OOZIE/metainfo.xml b/ambari-server/src/main/resources/stacks/HDP/2.5/services/OOZIE/metainfo.xml
index 027e8b4..df1092a 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.5/services/OOZIE/metainfo.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.5/services/OOZIE/metainfo.xml
@@ -20,6 +20,10 @@
   <services>
     <service>
       <name>OOZIE</name>
+      <credential-store>
+        <supported>true</supported>
+        <enabled>false</enabled>
+      </credential-store>
       <extends>common-services/OOZIE/4.2.0.2.5</extends>
       <themes>
         <theme>


[39/50] [abbrv] ambari git commit: AMBARI-18951. Force InnoDB usage for MySQL. Fix for MySQL < 5.6. (mpapirkovskyy)

Posted by nc...@apache.org.
AMBARI-18951. Force InnoDB usage for MySQL. Fix for MySQL < 5.6. (mpapirkovskyy)


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

Branch: refs/heads/branch-dev-patch-upgrade
Commit: 80084a9d8de9110365c6f1ef68362b502e07cf28
Parents: e242fc0
Author: Myroslav Papirkovskyi <mp...@hortonworks.com>
Authored: Fri Dec 2 16:41:40 2016 +0200
Committer: Myroslav Papirkovskyi <mp...@hortonworks.com>
Committed: Fri Dec 2 16:52:55 2016 +0200

----------------------------------------------------------------------
 .../src/main/resources/Ambari-DDL-MySQL-CREATE.sql       | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/80084a9d/ambari-server/src/main/resources/Ambari-DDL-MySQL-CREATE.sql
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/Ambari-DDL-MySQL-CREATE.sql b/ambari-server/src/main/resources/Ambari-DDL-MySQL-CREATE.sql
index b01ed2f..82ce31e 100644
--- a/ambari-server/src/main/resources/Ambari-DDL-MySQL-CREATE.sql
+++ b/ambari-server/src/main/resources/Ambari-DDL-MySQL-CREATE.sql
@@ -26,7 +26,16 @@ delimiter ;
 
 # USE @schema;
 
-SET default_storage_engine=INNODB;
+-- Set default_storage_engine to InnoDB
+-- storage_engine variable should be used for versions prior to MySQL 5.6
+set @version_short = substring_index(@@version, '.', 2);
+set @major = cast(substring_index(@version_short, '.', 1) as SIGNED);
+set @minor = cast(substring_index(@version_short, '.', -1) as SIGNED);
+set @engine_stmt = IF(@major >= 5 AND @minor>=6, 'SET default_storage_engine=INNODB', 'SET storage_engine=INNODB');
+prepare statement from @engine_stmt;
+execute statement;
+DEALLOCATE PREPARE statement;
+
 
 CREATE TABLE stack(
   stack_id BIGINT NOT NULL,


[22/50] [abbrv] ambari git commit: AMBARI-18736. Perf: Simulate alerts for multiple Ambari Agents running on single Host.(vbrodetskyi)

Posted by nc...@apache.org.
http://git-wip-us.apache.org/repos/asf/ambari/blob/ef63373e/ambari-server/src/main/resources/stacks/PERF/1.0/services/HDFS/package/alerts/alert_metrics_deviation.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/PERF/1.0/services/HDFS/package/alerts/alert_metrics_deviation.py b/ambari-server/src/main/resources/stacks/PERF/1.0/services/HDFS/package/alerts/alert_metrics_deviation.py
deleted file mode 100644
index 0946c85..0000000
--- a/ambari-server/src/main/resources/stacks/PERF/1.0/services/HDFS/package/alerts/alert_metrics_deviation.py
+++ /dev/null
@@ -1,85 +0,0 @@
-#!/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.
-"""
-
-import logging
-
-RESULT_STATE_OK = 'OK'
-RESULT_STATE_CRITICAL = 'CRITICAL'
-RESULT_STATE_WARNING = 'WARNING'
-RESULT_STATE_UNKNOWN = 'UNKNOWN'
-RESULT_STATE_SKIPPED = 'SKIPPED'
-
-OK_MESSAGE = 'Ok'
-
-HDFS_SITE_KEY = '{{hdfs-site}}'
-NAMESERVICE_KEY = '{{hdfs-site/dfs.internal.nameservices}}'
-NN_HTTP_ADDRESS_KEY = '{{hdfs-site/dfs.namenode.http-address}}'
-NN_HTTPS_ADDRESS_KEY = '{{hdfs-site/dfs.namenode.https-address}}'
-DFS_POLICY_KEY = '{{hdfs-site/dfs.http.policy}}'
-
-KERBEROS_KEYTAB = '{{hdfs-site/dfs.web.authentication.kerberos.keytab}}'
-KERBEROS_PRINCIPAL = '{{hdfs-site/dfs.web.authentication.kerberos.principal}}'
-SECURITY_ENABLED_KEY = '{{cluster-env/security_enabled}}'
-SMOKEUSER_KEY = '{{cluster-env/smokeuser}}'
-EXECUTABLE_SEARCH_PATHS = '{{kerberos-env/executable_search_paths}}'
-
-METRICS_COLLECTOR_WEBAPP_ADDRESS_KEY = '{{ams-site/timeline.metrics.service.webapp.address}}'
-METRICS_COLLECTOR_VIP_HOST_KEY = '{{cluster-env/metrics_collector_vip_host}}'
-METRICS_COLLECTOR_VIP_PORT_KEY = '{{cluster-env/metrics_collector_vip_port}}'
-
-logger = logging.getLogger()
-
-
-def get_tokens():
-  """
-  Returns a tuple of tokens in the format {{site/property}} that will be used
-  to build the dictionary passed into execute
-  """
-  return (HDFS_SITE_KEY, NAMESERVICE_KEY, NN_HTTP_ADDRESS_KEY, DFS_POLICY_KEY,
-          EXECUTABLE_SEARCH_PATHS, NN_HTTPS_ADDRESS_KEY, SMOKEUSER_KEY,
-          KERBEROS_KEYTAB, KERBEROS_PRINCIPAL, SECURITY_ENABLED_KEY,
-          METRICS_COLLECTOR_VIP_HOST_KEY, METRICS_COLLECTOR_VIP_PORT_KEY,
-          METRICS_COLLECTOR_WEBAPP_ADDRESS_KEY)
-
-def execute(configurations={}, parameters={}, host_name=None):
-  """
-  Returns a tuple containing the result code and a pre-formatted result label
-
-  Keyword arguments:
-  configurations : a mapping of configuration key to value
-  parameters : a mapping of script parameter key to value
-  host_name : the name of this host where the alert is running
-
-  :type configurations dict
-  :type parameters dict
-  :type host_name str
-  """
-
-  #parse configuration
-  if configurations is None:
-    return (RESULT_STATE_UNKNOWN, ['There were no configurations supplied to the script.'])
-
-  # hdfs-site is required
-  if not HDFS_SITE_KEY in configurations:
-    return (RESULT_STATE_UNKNOWN, ['{0} is a required parameter for the script'.format(HDFS_SITE_KEY)])
-
-  result_code = RESULT_STATE_OK
-  label = OK_MESSAGE
-  return (result_code, [label])
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/ef63373e/ambari-server/src/main/resources/stacks/PERF/1.0/services/HDFS/package/alerts/alert_nfs_gateway_process.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/PERF/1.0/services/HDFS/package/alerts/alert_nfs_gateway_process.py b/ambari-server/src/main/resources/stacks/PERF/1.0/services/HDFS/package/alerts/alert_nfs_gateway_process.py
new file mode 100644
index 0000000..73bc168
--- /dev/null
+++ b/ambari-server/src/main/resources/stacks/PERF/1.0/services/HDFS/package/alerts/alert_nfs_gateway_process.py
@@ -0,0 +1,59 @@
+#!/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.
+"""
+
+import logging
+
+from resource_management.libraries.functions.simulate_perf_cluster_alert_behaviour import simulate_perf_cluster_alert_behaviour
+
+ALERT_BEHAVIOUR_TYPE = "{{hdfs-alert-config/alert.behavior.type}}"
+
+ALERT_SUCCESS_PERCENTAGE = "{{hdfs-alert-config/alert.success.percentage}}"
+
+ALERT_TIMEOUT_RETURN_VALUE = "{{hdfs-alert-config/alert.timeout.return.value}}"
+ALERT_TIMEOUT_SECS = "{{hdfs-alert-config/alert.timeout.secs}}"
+
+ALERT_FLIP_INTERVAL_MINS = "{{hdfs-alert-config/alert.flip.interval.mins}}"
+
+logger = logging.getLogger('ambari_alerts')
+
+alert_behaviour_properties = {"alert_behaviour_type" : ALERT_BEHAVIOUR_TYPE, "alert_success_percentage" : ALERT_SUCCESS_PERCENTAGE,
+                              "alert_timeout_return_value" : ALERT_TIMEOUT_RETURN_VALUE, "alert_timeout_secs" : ALERT_TIMEOUT_SECS,
+                              "alert_flip_interval_mins" : ALERT_FLIP_INTERVAL_MINS}
+
+def get_tokens():
+  """
+  Returns a tuple of tokens in the format {{site/property}} that will be used
+  to build the dictionary passed into execute
+  """
+  return (ALERT_BEHAVIOUR_TYPE, ALERT_SUCCESS_PERCENTAGE, ALERT_TIMEOUT_RETURN_VALUE, ALERT_TIMEOUT_SECS,
+          ALERT_FLIP_INTERVAL_MINS)
+
+
+def execute(configurations={}, parameters={}, host_name=None):
+  """
+  Returns a tuple containing the result code and a pre-formatted result label
+
+  Keyword arguments:
+  configurations (dictionary): a mapping of configuration key to value
+  parameters (dictionary): a mapping of script parameter key to value
+  host_name (string): the name of this host where the alert is running
+  """
+
+  return simulate_perf_cluster_alert_behaviour(alert_behaviour_properties, configurations)
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/ef63373e/ambari-server/src/main/resources/stacks/PERF/1.0/services/HDFS/package/alerts/alert_snamenode_process.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/PERF/1.0/services/HDFS/package/alerts/alert_snamenode_process.py b/ambari-server/src/main/resources/stacks/PERF/1.0/services/HDFS/package/alerts/alert_snamenode_process.py
new file mode 100644
index 0000000..73bc168
--- /dev/null
+++ b/ambari-server/src/main/resources/stacks/PERF/1.0/services/HDFS/package/alerts/alert_snamenode_process.py
@@ -0,0 +1,59 @@
+#!/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.
+"""
+
+import logging
+
+from resource_management.libraries.functions.simulate_perf_cluster_alert_behaviour import simulate_perf_cluster_alert_behaviour
+
+ALERT_BEHAVIOUR_TYPE = "{{hdfs-alert-config/alert.behavior.type}}"
+
+ALERT_SUCCESS_PERCENTAGE = "{{hdfs-alert-config/alert.success.percentage}}"
+
+ALERT_TIMEOUT_RETURN_VALUE = "{{hdfs-alert-config/alert.timeout.return.value}}"
+ALERT_TIMEOUT_SECS = "{{hdfs-alert-config/alert.timeout.secs}}"
+
+ALERT_FLIP_INTERVAL_MINS = "{{hdfs-alert-config/alert.flip.interval.mins}}"
+
+logger = logging.getLogger('ambari_alerts')
+
+alert_behaviour_properties = {"alert_behaviour_type" : ALERT_BEHAVIOUR_TYPE, "alert_success_percentage" : ALERT_SUCCESS_PERCENTAGE,
+                              "alert_timeout_return_value" : ALERT_TIMEOUT_RETURN_VALUE, "alert_timeout_secs" : ALERT_TIMEOUT_SECS,
+                              "alert_flip_interval_mins" : ALERT_FLIP_INTERVAL_MINS}
+
+def get_tokens():
+  """
+  Returns a tuple of tokens in the format {{site/property}} that will be used
+  to build the dictionary passed into execute
+  """
+  return (ALERT_BEHAVIOUR_TYPE, ALERT_SUCCESS_PERCENTAGE, ALERT_TIMEOUT_RETURN_VALUE, ALERT_TIMEOUT_SECS,
+          ALERT_FLIP_INTERVAL_MINS)
+
+
+def execute(configurations={}, parameters={}, host_name=None):
+  """
+  Returns a tuple containing the result code and a pre-formatted result label
+
+  Keyword arguments:
+  configurations (dictionary): a mapping of configuration key to value
+  parameters (dictionary): a mapping of script parameter key to value
+  host_name (string): the name of this host where the alert is running
+  """
+
+  return simulate_perf_cluster_alert_behaviour(alert_behaviour_properties, configurations)
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/ef63373e/ambari-server/src/main/resources/stacks/PERF/1.0/services/HDFS/package/alerts/alert_upgrade_finalized.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/PERF/1.0/services/HDFS/package/alerts/alert_upgrade_finalized.py b/ambari-server/src/main/resources/stacks/PERF/1.0/services/HDFS/package/alerts/alert_upgrade_finalized.py
index 0dff200..73bc168 100644
--- a/ambari-server/src/main/resources/stacks/PERF/1.0/services/HDFS/package/alerts/alert_upgrade_finalized.py
+++ b/ambari-server/src/main/resources/stacks/PERF/1.0/services/HDFS/package/alerts/alert_upgrade_finalized.py
@@ -20,32 +20,30 @@ limitations under the License.
 
 import logging
 
-RESULT_STATE_OK = 'OK'
+from resource_management.libraries.functions.simulate_perf_cluster_alert_behaviour import simulate_perf_cluster_alert_behaviour
 
-OK_MESSAGE = 'Ok'
+ALERT_BEHAVIOUR_TYPE = "{{hdfs-alert-config/alert.behavior.type}}"
 
-NN_HTTP_ADDRESS_KEY = '{{hdfs-site/dfs.namenode.http-address}}'
-NN_HTTPS_ADDRESS_KEY = '{{hdfs-site/dfs.namenode.https-address}}'
-NN_HTTP_POLICY_KEY = '{{hdfs-site/dfs.http.policy}}'
+ALERT_SUCCESS_PERCENTAGE = "{{hdfs-alert-config/alert.success.percentage}}"
 
-HDFS_SITE_KEY = '{{hdfs-site}}'
-KERBEROS_KEYTAB = '{{hdfs-site/dfs.web.authentication.kerberos.keytab}}'
-KERBEROS_PRINCIPAL = '{{hdfs-site/dfs.web.authentication.kerberos.principal}}'
-SECURITY_ENABLED_KEY = '{{cluster-env/security_enabled}}'
-SMOKEUSER_KEY = "{{cluster-env/smokeuser}}"
-EXECUTABLE_SEARCH_PATHS = '{{kerberos-env/executable_search_paths}}'
+ALERT_TIMEOUT_RETURN_VALUE = "{{hdfs-alert-config/alert.timeout.return.value}}"
+ALERT_TIMEOUT_SECS = "{{hdfs-alert-config/alert.timeout.secs}}"
+
+ALERT_FLIP_INTERVAL_MINS = "{{hdfs-alert-config/alert.flip.interval.mins}}"
 
 logger = logging.getLogger('ambari_alerts')
 
+alert_behaviour_properties = {"alert_behaviour_type" : ALERT_BEHAVIOUR_TYPE, "alert_success_percentage" : ALERT_SUCCESS_PERCENTAGE,
+                              "alert_timeout_return_value" : ALERT_TIMEOUT_RETURN_VALUE, "alert_timeout_secs" : ALERT_TIMEOUT_SECS,
+                              "alert_flip_interval_mins" : ALERT_FLIP_INTERVAL_MINS}
+
 def get_tokens():
   """
   Returns a tuple of tokens in the format {{site/property}} that will be used
   to build the dictionary passed into execute
-
-  :rtype tuple
   """
-  return (HDFS_SITE_KEY, NN_HTTP_ADDRESS_KEY, NN_HTTPS_ADDRESS_KEY, NN_HTTP_POLICY_KEY, EXECUTABLE_SEARCH_PATHS,
-          KERBEROS_KEYTAB, KERBEROS_PRINCIPAL, SECURITY_ENABLED_KEY, SMOKEUSER_KEY)
+  return (ALERT_BEHAVIOUR_TYPE, ALERT_SUCCESS_PERCENTAGE, ALERT_TIMEOUT_RETURN_VALUE, ALERT_TIMEOUT_SECS,
+          ALERT_FLIP_INTERVAL_MINS)
 
 
 def execute(configurations={}, parameters={}, host_name=None):
@@ -53,22 +51,9 @@ def execute(configurations={}, parameters={}, host_name=None):
   Returns a tuple containing the result code and a pre-formatted result label
 
   Keyword arguments:
-  configurations : a mapping of configuration key to value
-  parameters : a mapping of script parameter key to value
-  host_name : the name of this host where the alert is running
-
-  :type configurations dict
-  :type parameters dict
-  :type host_name str
+  configurations (dictionary): a mapping of configuration key to value
+  parameters (dictionary): a mapping of script parameter key to value
+  host_name (string): the name of this host where the alert is running
   """
 
-  if configurations is None:
-    return (('UNKNOWN', ['There were no configurations supplied to the script.']))
-
-  # hdfs-site is required
-  if not HDFS_SITE_KEY in configurations:
-    return 'SKIPPED', ['{0} is a required parameter for the script'.format(HDFS_SITE_KEY)]
-
-  result_code = RESULT_STATE_OK
-  label = OK_MESSAGE
-  return (result_code, [label])
\ No newline at end of file
+  return simulate_perf_cluster_alert_behaviour(alert_behaviour_properties, configurations)
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/ef63373e/ambari-server/src/main/resources/stacks/PERF/1.0/services/SLEEPY/alerts.json
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/PERF/1.0/services/SLEEPY/alerts.json b/ambari-server/src/main/resources/stacks/PERF/1.0/services/SLEEPY/alerts.json
new file mode 100644
index 0000000..a1b075a
--- /dev/null
+++ b/ambari-server/src/main/resources/stacks/PERF/1.0/services/SLEEPY/alerts.json
@@ -0,0 +1,20 @@
+{
+    "SLEEPY": {
+
+        "SLEEPY": [
+            {
+                "name": "sleepy_process",
+                "label": "Sleepy Process",
+                "description": "Alert for sleepy component process status",
+                "interval": 1,
+                "scope": "HOST",
+                "enabled": true,
+                "source": {
+                    "type": "SCRIPT",
+                    "path": "PERF/1.0/services/SLEEPY/package/alerts/alert_sleepy_process.py",
+                    "parameters": []
+                }
+            }
+        ]
+    }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/ef63373e/ambari-server/src/main/resources/stacks/PERF/1.0/services/SLEEPY/configuration/sleepy-alert-config.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/PERF/1.0/services/SLEEPY/configuration/sleepy-alert-config.xml b/ambari-server/src/main/resources/stacks/PERF/1.0/services/SLEEPY/configuration/sleepy-alert-config.xml
new file mode 100644
index 0000000..760e706
--- /dev/null
+++ b/ambari-server/src/main/resources/stacks/PERF/1.0/services/SLEEPY/configuration/sleepy-alert-config.xml
@@ -0,0 +1,75 @@
+<?xml version="1.0"?>
+<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
+<!--
+    Licensed to the Apache Software Foundation (ASF) under one or more
+    contributor license agreements.  See the NOTICE file distributed with
+    this work for additional information regarding copyright ownership.
+    The ASF licenses this file to You under the Apache License, Version 2.0
+    (the "License"); you may not use this file except in compliance with
+    the License.  You may obtain a copy of the License at
+
+        http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+-->
+
+<configuration xmlns:xi="http://www.w3.org/2001/XInclude" supports_final="true">
+
+    <property>
+        <name>alert.behavior.type</name>
+        <value>percentage</value>
+        <description>
+            This property describes type of alert behaviour.
+            There are three types percentage, timeout, flip.
+        </description>
+    </property>
+
+
+    <property>
+        <name>alert.success.percentage</name>
+        <value>100</value>
+        <description>
+            This property will be actual only when alert.behaviour.type
+            set to "percentage". Here you should set percent of successful
+            alert checks.
+        </description>
+    </property>
+
+
+    <property>
+        <name>alert.timeout.return.value</name>
+        <value>false</value>
+        <description>
+            This property will be actual only when alert.behaviour.type
+            set to "timeout". Here you should set result which alert will
+            return after timeout, false|true|none.
+        </description>
+    </property>
+
+    <property>
+        <name>alert.timeout.secs</name>
+        <value>120</value>
+        <description>
+            This property will be actual only when alert.behaviour.type
+            set to "timeout". Here you should set number of seconds for
+            alert to sleep.
+        </description>
+    </property>
+
+
+    <property>
+        <name>alert.flip.interval.mins</name>
+        <value>3</value>
+        <description>
+            This property will be actual only when alert.behaviour.type
+            set to "flip". Here you should set number of minutes at which
+            the alert should flip from true|false.
+        </description>
+    </property>
+
+
+</configuration>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/ef63373e/ambari-server/src/main/resources/stacks/PERF/1.0/services/SLEEPY/metainfo.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/PERF/1.0/services/SLEEPY/metainfo.xml b/ambari-server/src/main/resources/stacks/PERF/1.0/services/SLEEPY/metainfo.xml
index 470d809..5b4dbd4 100644
--- a/ambari-server/src/main/resources/stacks/PERF/1.0/services/SLEEPY/metainfo.xml
+++ b/ambari-server/src/main/resources/stacks/PERF/1.0/services/SLEEPY/metainfo.xml
@@ -52,6 +52,11 @@
           <default>true</default>
         </theme>
       </themes>
+
+      <configuration-dependencies>
+        <config-type>sleepy-alert-config</config-type>
+      </configuration-dependencies>
+
     </service>
   </services>
 </metainfo>

http://git-wip-us.apache.org/repos/asf/ambari/blob/ef63373e/ambari-server/src/main/resources/stacks/PERF/1.0/services/SLEEPY/package/alerts/alert_sleepy_process.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/PERF/1.0/services/SLEEPY/package/alerts/alert_sleepy_process.py b/ambari-server/src/main/resources/stacks/PERF/1.0/services/SLEEPY/package/alerts/alert_sleepy_process.py
new file mode 100644
index 0000000..6005459
--- /dev/null
+++ b/ambari-server/src/main/resources/stacks/PERF/1.0/services/SLEEPY/package/alerts/alert_sleepy_process.py
@@ -0,0 +1,59 @@
+#!/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.
+"""
+
+import logging
+
+from resource_management.libraries.functions.simulate_perf_cluster_alert_behaviour import simulate_perf_cluster_alert_behaviour
+
+ALERT_BEHAVIOUR_TYPE = "{{sleepy-alert-config/alert.behavior.type}}"
+
+ALERT_SUCCESS_PERCENTAGE = "{{sleepy-alert-config/alert.success.percentage}}"
+
+ALERT_TIMEOUT_RETURN_VALUE = "{{sleepy-alert-config/alert.timeout.return.value}}"
+ALERT_TIMEOUT_SECS = "{{sleepy-alert-config/alert.timeout.secs}}"
+
+ALERT_FLIP_INTERVAL_MINS = "{{sleepy-alert-config/alert.flip.interval.mins}}"
+
+logger = logging.getLogger('ambari_alerts')
+
+alert_behaviour_properties = {"alert_behaviour_type" : ALERT_BEHAVIOUR_TYPE, "alert_success_percentage" : ALERT_SUCCESS_PERCENTAGE,
+                              "alert_timeout_return_value" : ALERT_TIMEOUT_RETURN_VALUE, "alert_timeout_secs" : ALERT_TIMEOUT_SECS,
+                              "alert_flip_interval_mins" : ALERT_FLIP_INTERVAL_MINS}
+
+def get_tokens():
+  """
+  Returns a tuple of tokens in the format {{site/property}} that will be used
+  to build the dictionary passed into execute
+  """
+  return (ALERT_BEHAVIOUR_TYPE, ALERT_SUCCESS_PERCENTAGE, ALERT_TIMEOUT_RETURN_VALUE, ALERT_TIMEOUT_SECS,
+          ALERT_FLIP_INTERVAL_MINS)
+
+
+def execute(configurations={}, parameters={}, host_name=None):
+  """
+  Returns a tuple containing the result code and a pre-formatted result label
+
+  Keyword arguments:
+  configurations (dictionary): a mapping of configuration key to value
+  parameters (dictionary): a mapping of script parameter key to value
+  host_name (string): the name of this host where the alert is running
+  """
+
+  return simulate_perf_cluster_alert_behaviour(alert_behaviour_properties, configurations)
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/ef63373e/ambari-server/src/main/resources/stacks/PERF/1.0/services/SNOW/alerts.json
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/PERF/1.0/services/SNOW/alerts.json b/ambari-server/src/main/resources/stacks/PERF/1.0/services/SNOW/alerts.json
new file mode 100644
index 0000000..c05127c
--- /dev/null
+++ b/ambari-server/src/main/resources/stacks/PERF/1.0/services/SNOW/alerts.json
@@ -0,0 +1,20 @@
+{
+    "SNOW": {
+
+        "SNOW_WHITE": [
+            {
+                "name": "snow_process",
+                "label": "Snow Process",
+                "description": "Alert for snow component process status",
+                "interval": 1,
+                "scope": "HOST",
+                "enabled": true,
+                "source": {
+                    "type": "SCRIPT",
+                    "path": "PERF/1.0/services/SNOW/package/alerts/alert_snow_process.py",
+                    "parameters": []
+                }
+            }
+        ]
+    }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/ef63373e/ambari-server/src/main/resources/stacks/PERF/1.0/services/SNOW/configuration/snow-alert-config.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/PERF/1.0/services/SNOW/configuration/snow-alert-config.xml b/ambari-server/src/main/resources/stacks/PERF/1.0/services/SNOW/configuration/snow-alert-config.xml
new file mode 100644
index 0000000..760e706
--- /dev/null
+++ b/ambari-server/src/main/resources/stacks/PERF/1.0/services/SNOW/configuration/snow-alert-config.xml
@@ -0,0 +1,75 @@
+<?xml version="1.0"?>
+<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
+<!--
+    Licensed to the Apache Software Foundation (ASF) under one or more
+    contributor license agreements.  See the NOTICE file distributed with
+    this work for additional information regarding copyright ownership.
+    The ASF licenses this file to You under the Apache License, Version 2.0
+    (the "License"); you may not use this file except in compliance with
+    the License.  You may obtain a copy of the License at
+
+        http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+-->
+
+<configuration xmlns:xi="http://www.w3.org/2001/XInclude" supports_final="true">
+
+    <property>
+        <name>alert.behavior.type</name>
+        <value>percentage</value>
+        <description>
+            This property describes type of alert behaviour.
+            There are three types percentage, timeout, flip.
+        </description>
+    </property>
+
+
+    <property>
+        <name>alert.success.percentage</name>
+        <value>100</value>
+        <description>
+            This property will be actual only when alert.behaviour.type
+            set to "percentage". Here you should set percent of successful
+            alert checks.
+        </description>
+    </property>
+
+
+    <property>
+        <name>alert.timeout.return.value</name>
+        <value>false</value>
+        <description>
+            This property will be actual only when alert.behaviour.type
+            set to "timeout". Here you should set result which alert will
+            return after timeout, false|true|none.
+        </description>
+    </property>
+
+    <property>
+        <name>alert.timeout.secs</name>
+        <value>120</value>
+        <description>
+            This property will be actual only when alert.behaviour.type
+            set to "timeout". Here you should set number of seconds for
+            alert to sleep.
+        </description>
+    </property>
+
+
+    <property>
+        <name>alert.flip.interval.mins</name>
+        <value>3</value>
+        <description>
+            This property will be actual only when alert.behaviour.type
+            set to "flip". Here you should set number of minutes at which
+            the alert should flip from true|false.
+        </description>
+    </property>
+
+
+</configuration>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/ef63373e/ambari-server/src/main/resources/stacks/PERF/1.0/services/SNOW/metainfo.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/PERF/1.0/services/SNOW/metainfo.xml b/ambari-server/src/main/resources/stacks/PERF/1.0/services/SNOW/metainfo.xml
index cbb57f6..21e685a 100644
--- a/ambari-server/src/main/resources/stacks/PERF/1.0/services/SNOW/metainfo.xml
+++ b/ambari-server/src/main/resources/stacks/PERF/1.0/services/SNOW/metainfo.xml
@@ -52,6 +52,11 @@
           <default>true</default>
         </theme>
       </themes>
+
+      <configuration-dependencies>
+        <config-type>snow-alert-config</config-type>
+      </configuration-dependencies>
+
     </service>
   </services>
 </metainfo>

http://git-wip-us.apache.org/repos/asf/ambari/blob/ef63373e/ambari-server/src/main/resources/stacks/PERF/1.0/services/SNOW/package/alerts/alert_snow_process.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/PERF/1.0/services/SNOW/package/alerts/alert_snow_process.py b/ambari-server/src/main/resources/stacks/PERF/1.0/services/SNOW/package/alerts/alert_snow_process.py
new file mode 100644
index 0000000..2df652c
--- /dev/null
+++ b/ambari-server/src/main/resources/stacks/PERF/1.0/services/SNOW/package/alerts/alert_snow_process.py
@@ -0,0 +1,59 @@
+#!/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.
+"""
+
+import logging
+
+from resource_management.libraries.functions.simulate_perf_cluster_alert_behaviour import simulate_perf_cluster_alert_behaviour
+
+ALERT_BEHAVIOUR_TYPE = "{{snow-alert-config/alert.behavior.type}}"
+
+ALERT_SUCCESS_PERCENTAGE = "{{snow-alert-config/alert.success.percentage}}"
+
+ALERT_TIMEOUT_RETURN_VALUE = "{{snow-alert-config/alert.timeout.return.value}}"
+ALERT_TIMEOUT_SECS = "{{snow-alert-config/alert.timeout.secs}}"
+
+ALERT_FLIP_INTERVAL_MINS = "{{snow-alert-config/alert.flip.interval.mins}}"
+
+logger = logging.getLogger('ambari_alerts')
+
+alert_behaviour_properties = {"alert_behaviour_type" : ALERT_BEHAVIOUR_TYPE, "alert_success_percentage" : ALERT_SUCCESS_PERCENTAGE,
+                              "alert_timeout_return_value" : ALERT_TIMEOUT_RETURN_VALUE, "alert_timeout_secs" : ALERT_TIMEOUT_SECS,
+                              "alert_flip_interval_mins" : ALERT_FLIP_INTERVAL_MINS}
+
+def get_tokens():
+  """
+  Returns a tuple of tokens in the format {{site/property}} that will be used
+  to build the dictionary passed into execute
+  """
+  return (ALERT_BEHAVIOUR_TYPE, ALERT_SUCCESS_PERCENTAGE, ALERT_TIMEOUT_RETURN_VALUE, ALERT_TIMEOUT_SECS,
+          ALERT_FLIP_INTERVAL_MINS)
+
+
+def execute(configurations={}, parameters={}, host_name=None):
+  """
+  Returns a tuple containing the result code and a pre-formatted result label
+
+  Keyword arguments:
+  configurations (dictionary): a mapping of configuration key to value
+  parameters (dictionary): a mapping of script parameter key to value
+  host_name (string): the name of this host where the alert is running
+  """
+
+  return simulate_perf_cluster_alert_behaviour(alert_behaviour_properties, configurations)
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/ef63373e/ambari-server/src/main/resources/stacks/PERF/1.0/services/YARN/alerts.json
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/PERF/1.0/services/YARN/alerts.json b/ambari-server/src/main/resources/stacks/PERF/1.0/services/YARN/alerts.json
index c4a58bb..67cf881 100644
--- a/ambari-server/src/main/resources/stacks/PERF/1.0/services/YARN/alerts.json
+++ b/ambari-server/src/main/resources/stacks/PERF/1.0/services/YARN/alerts.json
@@ -1,185 +1,25 @@
 {
   "MAPREDUCE2": {
-    "service": [],
     "HISTORYSERVER": [
       {
-        "name": "mapreduce_history_server_webui",
-        "label": "History Server Web UI",
-        "description": "This host-level alert is triggered if the History Server Web UI is unreachable.",
+        "name": "mapreduce_history_process",
+        "label": "History Server process",
+        "description": "Alert for history server process status",
         "interval": 1,
-        "scope": "ANY",
-        "source": {
-          "type": "WEB",
-          "uri": {
-            "http": "{{mapred-site/mapreduce.jobhistory.webapp.address}}",
-            "https": "{{mapred-site/mapreduce.jobhistory.webapp.https.address}}",
-            "https_property": "{{mapred-site/mapreduce.jobhistory.http.policy}}",
-            "https_property_value": "HTTPS_ONLY",
-            "kerberos_keytab": "{{mapred-site/mapreduce.jobhistory.webapp.spnego-keytab-file}}",
-            "kerberos_principal": "{{mapred-site/mapreduce.jobhistory.webapp.spnego-principal}}",
-            "connection_timeout": 5.0
-          },
-          "reporting": {
-            "ok": {
-              "text": "HTTP {0} response in {2:.3f}s"
-            },
-            "warning":{
-              "text": "HTTP {0} response from {1} in {2:.3f}s ({3})"
-            },
-            "critical": {
-              "text": "Connection failed to {1} ({3})"
-            }
-          }
-        }
-      },
-      {
-        "name": "mapreduce_history_server_cpu",
-        "label": "History Server CPU Utilization",
-        "description": "This host-level alert is triggered if the percent of CPU utilization on the History Server exceeds the configured critical threshold. The threshold values are in percent.",
-        "interval": 5,
-        "scope": "ANY",
-        "enabled": true,
-        "source": {
-          "type": "METRIC",
-          "uri": {
-            "http": "{{mapred-site/mapreduce.jobhistory.webapp.address}}",
-            "kerberos_keytab": "{{mapred-site/mapreduce.jobhistory.webapp.spnego-keytab-file}}",
-            "kerberos_principal": "{{mapred-site/mapreduce.jobhistory.webapp.spnego-principal}}",
-            "https": "{{mapred-site/mapreduce.jobhistory.webapp.https.address}}",
-            "https_property": "{{mapred-site/mapreduce.jobhistory.http.policy}}",
-            "https_property_value": "HTTPS_ONLY",
-            "connection_timeout": 5.0
-          },
-          "reporting": {
-            "ok": {
-              "text": "{1} CPU, load {0:.1%}"
-            },
-            "warning": {
-              "text": "{1} CPU, load {0:.1%}",
-              "value": 200
-            },
-            "critical": {
-              "text": "{1} CPU, load {0:.1%}",
-              "value": 250
-            },
-            "units" : "%",
-            "type": "PERCENT"
-          },
-          "jmx": {
-            "property_list": [
-              "java.lang:type=OperatingSystem/SystemCpuLoad",
-              "java.lang:type=OperatingSystem/AvailableProcessors"
-            ],
-            "value": "{0} * 100"
-          }
-        }
-      },
-      {
-        "name": "mapreduce_history_server_rpc_latency",
-        "label": "History Server RPC Latency",
-        "description": "This host-level alert is triggered if the History Server operations RPC latency exceeds the configured critical threshold. Typically an increase in the RPC processing time increases the RPC queue length, causing the average queue wait time to increase for operations. The threshold values are in milliseconds.",
-        "interval": 5,
-        "scope": "ANY",
+        "scope": "HOST",
         "enabled": true,
         "source": {
-          "type": "METRIC",
-          "uri": {
-            "http": "{{mapred-site/mapreduce.jobhistory.webapp.address}}",
-            "https": "{{mapred-site/mapreduce.jobhistory.webapp.https.address}}",
-            "kerberos_keytab": "{{mapred-site/mapreduce.jobhistory.webapp.spnego-keytab-file}}",
-            "kerberos_principal": "{{mapred-site/mapreduce.jobhistory.webapp.spnego-principal}}",
-            "https_property": "{{mapred-site/mapreduce.jobhistory.http.policy}}",
-            "https_property_value": "HTTPS_ONLY",
-            "connection_timeout": 5.0
-          },
-          "reporting": {
-            "ok": {
-              "text": "Average Queue Time:[{0}], Average Processing Time:[{1}]"
-            },
-            "warning": {
-              "text": "Average Queue Time:[{0}], Average Processing Time:[{1}]",
-              "value": 3000
-            },          
-            "critical": {
-              "text": "Average Queue Time:[{0}], Average Processing Time:[{1}]",
-              "value": 5000
-            },
-            "units" : "ms"
-          },
-          "jmx": {
-            "property_list": [
-              "Hadoop:service=JobHistoryServer,name=RpcActivityForPort*/RpcQueueTimeAvgTime",
-              "Hadoop:service=JobHistoryServer,name=RpcActivityForPort*/RpcProcessingTimeAvgTime"
-            ],
-            "value": "{0}"
-          }
+          "type": "SCRIPT",
+          "path": "PERF/1.0/services/YARN/package/alerts/alert_history_process.py",
+          "parameters": []
         }
       }
     ]
   },
   "YARN": {
-    "service": [
-      {
-        "name": "yarn_nodemanager_webui_percent",
-        "label": "Percent NodeManagers Available",
-        "description": "This alert is triggered if the number of down NodeManagers in the cluster is greater than the configured critical threshold. It aggregates the results of NodeManager process checks.",
-        "interval": 1,
-        "scope": "SERVICE",
-        "enabled": true,
-        "source": {
-          "type": "AGGREGATE",
-          "alert_name": "yarn_nodemanager_webui",
-          "reporting": {
-            "ok": {
-              "text": "affected: [{1}], total: [{0}]"
-            },
-            "warning": {
-              "text": "affected: [{1}], total: [{0}]",
-              "value": 10
-            },
-            "critical": {
-              "text": "affected: [{1}], total: [{0}]",
-              "value": 30
-            },
-            "units" : "%",
-            "type": "PERCENT"
-          }
-        }
-      }
-    ],
+
     "NODEMANAGER": [
       {
-        "name": "yarn_nodemanager_webui",
-        "label": "NodeManager Web UI",
-        "description": "This host-level alert is triggered if the NodeManager Web UI is unreachable.",
-        "interval": 1,
-        "scope": "HOST",
-        "source": {
-          "type": "WEB",
-          "uri": {
-            "http": "{{yarn-site/yarn.nodemanager.webapp.address}}",
-            "https": "{{yarn-site/yarn.nodemanager.webapp.https.address}}",
-            "https_property": "{{yarn-site/yarn.http.policy}}",
-            "https_property_value": "HTTPS_ONLY",
-            "default_port": 8042,
-            "kerberos_keytab": "{{yarn-site/yarn.nodemanager.webapp.spnego-keytab-file}}",
-            "kerberos_principal": "{{yarn-site/yarn.nodemanager.webapp.spnego-principal}}",
-            "connection_timeout": 5.0
-          },
-          "reporting": {
-            "ok": {
-              "text": "HTTP {0} response in {2:.3f}s"
-            },
-            "warning":{
-              "text": "HTTP {0} response from {1} in {2:.3f}s ({3})"
-            },
-            "critical": {
-              "text": "Connection failed to {1} ({3})"
-            }
-          }
-        }
-      },
-      {
         "name": "yarn_nodemanager_health",
         "label": "NodeManager Health",
         "description": "This host-level alert checks the node health property available from the NodeManager component.",
@@ -188,7 +28,7 @@
         "enabled": true,
         "source": {
           "type": "SCRIPT",
-          "path": "YARN/2.1.0.2.0/package/alerts/alert_nodemanager_health.py",
+          "path": "PERF/1.0/services/YARN/package/alerts/alert_nodemanager_health.py",
           "parameters": [
             {
               "name": "connection.timeout",
@@ -205,186 +45,31 @@
     ],
     "RESOURCEMANAGER": [
       {
-        "name": "yarn_resourcemanager_webui",
-        "label": "ResourceManager Web UI",
-        "description": "This host-level alert is triggered if the ResourceManager Web UI is unreachable.",
+        "name": "yarn_resourcemanager_process",
+        "label": "ResourceManager process",
+        "description": "Alert for resourcemanager process status",
         "interval": 1,
-        "scope": "ANY",
-        "source": {
-          "type": "WEB",
-          "uri": {
-            "http": "{{yarn-site/yarn.resourcemanager.webapp.address}}",
-            "https": "{{yarn-site/yarn.resourcemanager.webapp.https.address}}",
-            "https_property": "{{yarn-site/yarn.http.policy}}",
-            "https_property_value": "HTTPS_ONLY",
-            "kerberos_keytab": "{{yarn-site/yarn.resourcemanager.webapp.spnego-keytab-file}}",
-            "kerberos_principal": "{{yarn-site/yarn.resourcemanager.webapp.spnego-principal}}",
-            "connection_timeout": 5.0,
-            "high_availability": {
-              "alias_key" : "{{yarn-site/yarn.resourcemanager.ha.rm-ids}}",
-              "http_pattern" : "{{yarn-site/yarn.resourcemanager.webapp.address.{{alias}}}}",
-              "https_pattern" : "{{yarn-site/yarn.resourcemanager.webapp.https.address.{{alias}}}}"
-            }
-          },
-          "reporting": {
-            "ok": {
-              "text": "HTTP {0} response in {2:.3f}s"
-            },
-            "warning":{
-              "text": "HTTP {0} response from {1} in {2:.3f}s ({3})"
-            },
-            "critical": {
-              "text": "Connection failed to {1} ({3})"
-            }
-          }
-        }
-      },
-      {
-        "name": "yarn_resourcemanager_cpu",
-        "label": "ResourceManager CPU Utilization",
-        "description": "This host-level alert is triggered if CPU utilization of the ResourceManager exceeds certain warning and critical thresholds. It checks the ResourceManager JMX Servlet for the SystemCPULoad property. The threshold values are in percent.",
-        "interval": 5,
-        "scope": "ANY",
-        "enabled": true,
-        "source": {
-          "type": "METRIC",
-          "uri": {
-            "http": "{{yarn-site/yarn.resourcemanager.webapp.address}}",
-            "https": "{{yarn-site/yarn.resourcemanager.webapp.https.address}}",
-            "kerberos_keytab": "{{yarn-site/yarn.resourcemanager.webapp.spnego-keytab-file}}",
-            "kerberos_principal": "{{yarn-site/yarn.resourcemanager.webapp.spnego-principal}}",
-            "https_property": "{{yarn-site/yarn.http.policy}}",
-            "https_property_value": "HTTPS_ONLY",
-            "connection_timeout": 5.0,
-            "high_availability": {
-              "alias_key" : "{{yarn-site/yarn.resourcemanager.ha.rm-ids}}",
-              "http_pattern" : "{{yarn-site/yarn.resourcemanager.webapp.address.{{alias}}}}",
-              "https_pattern" : "{{yarn-site/yarn.resourcemanager.webapp.https.address.{{alias}}}}"
-            }
-          },
-          "reporting": {
-            "ok": {
-              "text": "{1} CPU, load {0:.1%}"
-            },
-            "warning": {
-              "text": "{1} CPU, load {0:.1%}",
-              "value": 200
-            },
-            "critical": {
-              "text": "{1} CPU, load {0:.1%}",
-              "value": 250
-            },
-            "units" : "%",
-            "type": "PERCENT"
-          },
-          "jmx": {
-            "property_list": [
-              "java.lang:type=OperatingSystem/SystemCpuLoad",
-              "java.lang:type=OperatingSystem/AvailableProcessors"
-            ],
-            "value": "{0} * 100"
-          }
-        }
-      },
-      {
-        "name": "yarn_resourcemanager_rpc_latency",
-        "label": "ResourceManager RPC Latency",
-        "description": "This host-level alert is triggered if the ResourceManager operations RPC latency exceeds the configured critical threshold. Typically an increase in the RPC processing time increases the RPC queue length, causing the average queue wait time to increase for ResourceManager operations. The threshold values are in milliseconds.",
-        "interval": 5,
-        "scope": "ANY",
-        "enabled": true,
-        "source": {
-          "type": "METRIC",
-          "uri": {
-            "http": "{{yarn-site/yarn.resourcemanager.webapp.address}}",
-            "https": "{{yarn-site/yarn.resourcemanager.webapp.https.address}}",
-            "kerberos_keytab": "{{yarn-site/yarn.resourcemanager.webapp.spnego-keytab-file}}",
-            "kerberos_principal": "{{yarn-site/yarn.resourcemanager.webapp.spnego-principal}}",
-            "https_property": "{{yarn-site/yarn.http.policy}}",
-            "https_property_value": "HTTPS_ONLY",
-            "connection_timeout": 5.0,
-            "high_availability": {
-              "alias_key" : "{{yarn-site/yarn.resourcemanager.ha.rm-ids}}",
-              "http_pattern" : "{{yarn-site/yarn.resourcemanager.webapp.address.{{alias}}}}",
-              "https_pattern" : "{{yarn-site/yarn.resourcemanager.webapp.https.address.{{alias}}}}"
-            }
-          },
-          "reporting": {
-            "ok": {
-              "text": "Average Queue Time:[{0}], Average Processing Time:[{1}]"
-            },
-            "warning": {
-              "text": "Average Queue Time:[{0}], Average Processing Time:[{1}]",
-              "value": 3000
-            },          
-            "critical": {
-              "text": "Average Queue Time:[{0}], Average Processing Time:[{1}]",
-              "value": 5000
-            },
-            "units" : "ms"
-          },
-          "jmx": {
-            "property_list": [
-              "Hadoop:service=ResourceManager,name=RpcActivityForPort*/RpcQueueTimeAvgTime",
-              "Hadoop:service=ResourceManager,name=RpcActivityForPort*/RpcProcessingTimeAvgTime"
-            ],
-            "value": "{0}"
-          }
-        }
-      },
-      {
-        "name": "nodemanager_health_summary",
-        "label": "NodeManager Health Summary",
-        "description": "This service-level alert is triggered if there are unhealthy NodeManagers",
-        "interval": 1,
-        "scope": "SERVICE",
+        "scope": "HOST",
         "enabled": true,
         "source": {
           "type": "SCRIPT",
-          "path": "YARN/2.1.0.2.0/package/alerts/alert_nodemanagers_summary.py",
-          "parameters": [
-            {
-              "name": "connection.timeout",
-              "display_name": "Connection Timeout",
-              "value": 5.0,
-              "type": "NUMERIC",
-              "description": "The maximum time before this alert is considered to be CRITICAL",
-              "units": "seconds",
-              "threshold": "CRITICAL"
-            }
-          ]
+          "path": "PERF/1.0/services/YARN/package/alerts/alert_resourcemanager_process.py",
+          "parameters": []
         }
       }
     ],
     "APP_TIMELINE_SERVER": [
       {
-        "name": "yarn_app_timeline_server_webui",
-        "label": "App Timeline Web UI",
-        "description": "This host-level alert is triggered if the App Timeline Server Web UI is unreachable.",
+        "name": "yarn_app_timeline_server_process",
+        "label": "App Timeline process",
+        "description": "Alert for app timeline server process status",
         "interval": 1,
-        "scope": "ANY",
+        "scope": "HOST",
+        "enabled": true,
         "source": {
-          "type": "WEB",
-          "uri": {
-            "http": "{{yarn-site/yarn.timeline-service.webapp.address}}/ws/v1/timeline",
-            "https": "{{yarn-site/yarn.timeline-service.webapp.https.address}}/ws/v1/timeline",
-            "https_property": "{{yarn-site/yarn.http.policy}}",
-            "https_property_value": "HTTPS_ONLY",
-            "kerberos_keytab": "{{yarn-site/yarn.timeline-service.http-authentication.kerberos.keytab}}",
-            "kerberos_principal": "{{yarn-site/yarn.timeline-service.http-authentication.kerberos.principal}}",
-            "connection_timeout": 5.0
-          },
-          "reporting": {
-            "ok": {
-              "text": "HTTP {0} response in {2:.3f}s"
-            },
-            "warning":{
-              "text": "HTTP {0} response from {1} in {2:.3f}s ({3})"
-            },
-            "critical": {
-              "text": "Connection failed to {1} ({3})"
-            }
-          }
+          "type": "SCRIPT",
+          "path": "PERF/1.0/services/YARN/package/alerts/alert_timeline_process.py",
+          "parameters": []
         }
       }
     ]

http://git-wip-us.apache.org/repos/asf/ambari/blob/ef63373e/ambari-server/src/main/resources/stacks/PERF/1.0/services/YARN/configuration/yarn-alert-config.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/PERF/1.0/services/YARN/configuration/yarn-alert-config.xml b/ambari-server/src/main/resources/stacks/PERF/1.0/services/YARN/configuration/yarn-alert-config.xml
new file mode 100644
index 0000000..760e706
--- /dev/null
+++ b/ambari-server/src/main/resources/stacks/PERF/1.0/services/YARN/configuration/yarn-alert-config.xml
@@ -0,0 +1,75 @@
+<?xml version="1.0"?>
+<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
+<!--
+    Licensed to the Apache Software Foundation (ASF) under one or more
+    contributor license agreements.  See the NOTICE file distributed with
+    this work for additional information regarding copyright ownership.
+    The ASF licenses this file to You under the Apache License, Version 2.0
+    (the "License"); you may not use this file except in compliance with
+    the License.  You may obtain a copy of the License at
+
+        http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+-->
+
+<configuration xmlns:xi="http://www.w3.org/2001/XInclude" supports_final="true">
+
+    <property>
+        <name>alert.behavior.type</name>
+        <value>percentage</value>
+        <description>
+            This property describes type of alert behaviour.
+            There are three types percentage, timeout, flip.
+        </description>
+    </property>
+
+
+    <property>
+        <name>alert.success.percentage</name>
+        <value>100</value>
+        <description>
+            This property will be actual only when alert.behaviour.type
+            set to "percentage". Here you should set percent of successful
+            alert checks.
+        </description>
+    </property>
+
+
+    <property>
+        <name>alert.timeout.return.value</name>
+        <value>false</value>
+        <description>
+            This property will be actual only when alert.behaviour.type
+            set to "timeout". Here you should set result which alert will
+            return after timeout, false|true|none.
+        </description>
+    </property>
+
+    <property>
+        <name>alert.timeout.secs</name>
+        <value>120</value>
+        <description>
+            This property will be actual only when alert.behaviour.type
+            set to "timeout". Here you should set number of seconds for
+            alert to sleep.
+        </description>
+    </property>
+
+
+    <property>
+        <name>alert.flip.interval.mins</name>
+        <value>3</value>
+        <description>
+            This property will be actual only when alert.behaviour.type
+            set to "flip". Here you should set number of minutes at which
+            the alert should flip from true|false.
+        </description>
+    </property>
+
+
+</configuration>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/ef63373e/ambari-server/src/main/resources/stacks/PERF/1.0/services/YARN/metainfo.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/PERF/1.0/services/YARN/metainfo.xml b/ambari-server/src/main/resources/stacks/PERF/1.0/services/YARN/metainfo.xml
index 8b18e73..bb2191b 100644
--- a/ambari-server/src/main/resources/stacks/PERF/1.0/services/YARN/metainfo.xml
+++ b/ambari-server/src/main/resources/stacks/PERF/1.0/services/YARN/metainfo.xml
@@ -122,6 +122,7 @@
           -->
 
           <configuration-dependencies>
+            <config-type>yarn-alert-config</config-type>
             <config-type>capacity-scheduler</config-type>
             <config-type>hdfs-site</config-type>
           </configuration-dependencies>
@@ -193,6 +194,7 @@
       </components>
 
       <configuration-dependencies>
+        <config-type>yarn-alert-config</config-type>
         <config-type>yarn-site</config-type>
         <config-type>yarn-env</config-type>
         <config-type>hdfs-site</config-type>
@@ -324,6 +326,7 @@
       </requiredServices>
 
       <configuration-dependencies>
+        <config-type>yarn-alert-config</config-type>
         <config-type>hdfs-site</config-type>
         <config-type>hadoop-env</config-type>
         <config-type>core-site</config-type>

http://git-wip-us.apache.org/repos/asf/ambari/blob/ef63373e/ambari-server/src/main/resources/stacks/PERF/1.0/services/YARN/package/alerts/alert_history_process.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/PERF/1.0/services/YARN/package/alerts/alert_history_process.py b/ambari-server/src/main/resources/stacks/PERF/1.0/services/YARN/package/alerts/alert_history_process.py
new file mode 100644
index 0000000..8733679
--- /dev/null
+++ b/ambari-server/src/main/resources/stacks/PERF/1.0/services/YARN/package/alerts/alert_history_process.py
@@ -0,0 +1,59 @@
+#!/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.
+"""
+
+import logging
+
+from resource_management.libraries.functions.simulate_perf_cluster_alert_behaviour import simulate_perf_cluster_alert_behaviour
+
+ALERT_BEHAVIOUR_TYPE = "{{yarn-alert-config/alert.behavior.type}}"
+
+ALERT_SUCCESS_PERCENTAGE = "{{yarn-alert-config/alert.success.percentage}}"
+
+ALERT_TIMEOUT_RETURN_VALUE = "{{yarn-alert-config/alert.timeout.return.value}}"
+ALERT_TIMEOUT_SECS = "{{yarn-alert-config/alert.timeout.secs}}"
+
+ALERT_FLIP_INTERVAL_MINS = "{{yarn-alert-config/alert.flip.interval.mins}}"
+
+logger = logging.getLogger('ambari_alerts')
+
+alert_behaviour_properties = {"alert_behaviour_type" : ALERT_BEHAVIOUR_TYPE, "alert_success_percentage" : ALERT_SUCCESS_PERCENTAGE,
+                              "alert_timeout_return_value" : ALERT_TIMEOUT_RETURN_VALUE, "alert_timeout_secs" : ALERT_TIMEOUT_SECS,
+                              "alert_flip_interval_mins" : ALERT_FLIP_INTERVAL_MINS}
+
+def get_tokens():
+  """
+  Returns a tuple of tokens in the format {{site/property}} that will be used
+  to build the dictionary passed into execute
+  """
+  return (ALERT_BEHAVIOUR_TYPE, ALERT_SUCCESS_PERCENTAGE, ALERT_TIMEOUT_RETURN_VALUE, ALERT_TIMEOUT_SECS,
+          ALERT_FLIP_INTERVAL_MINS)
+
+
+def execute(configurations={}, parameters={}, host_name=None):
+  """
+  Returns a tuple containing the result code and a pre-formatted result label
+
+  Keyword arguments:
+  configurations (dictionary): a mapping of configuration key to value
+  parameters (dictionary): a mapping of script parameter key to value
+  host_name (string): the name of this host where the alert is running
+  """
+
+  return simulate_perf_cluster_alert_behaviour(alert_behaviour_properties, configurations)
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/ef63373e/ambari-server/src/main/resources/stacks/PERF/1.0/services/YARN/package/alerts/alert_nodemanager_health.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/PERF/1.0/services/YARN/package/alerts/alert_nodemanager_health.py b/ambari-server/src/main/resources/stacks/PERF/1.0/services/YARN/package/alerts/alert_nodemanager_health.py
index d2cfe26..8733679 100644
--- a/ambari-server/src/main/resources/stacks/PERF/1.0/services/YARN/package/alerts/alert_nodemanager_health.py
+++ b/ambari-server/src/main/resources/stacks/PERF/1.0/services/YARN/package/alerts/alert_nodemanager_health.py
@@ -20,33 +20,31 @@ limitations under the License.
 
 import logging
 
-RESULT_CODE_OK = 'OK'
-RESULT_CODE_CRITICAL = 'CRITICAL'
-RESULT_CODE_UNKNOWN = 'UNKNOWN'
+from resource_management.libraries.functions.simulate_perf_cluster_alert_behaviour import simulate_perf_cluster_alert_behaviour
 
-OK_MESSAGE = 'NodeManager Healthy'
+ALERT_BEHAVIOUR_TYPE = "{{yarn-alert-config/alert.behavior.type}}"
 
-NODEMANAGER_HTTP_ADDRESS_KEY = '{{yarn-site/yarn.nodemanager.webapp.address}}'
-NODEMANAGER_HTTPS_ADDRESS_KEY = '{{yarn-site/yarn.nodemanager.webapp.https.address}}'
-YARN_HTTP_POLICY_KEY = '{{yarn-site/yarn.http.policy}}'
+ALERT_SUCCESS_PERCENTAGE = "{{yarn-alert-config/alert.success.percentage}}"
 
-KERBEROS_KEYTAB = '{{yarn-site/yarn.nodemanager.webapp.spnego-keytab-file}}'
-KERBEROS_PRINCIPAL = '{{yarn-site/yarn.nodemanager.webapp.spnego-principal}}'
-SECURITY_ENABLED_KEY = '{{cluster-env/security_enabled}}'
-SMOKEUSER_KEY = '{{cluster-env/smokeuser}}'
-EXECUTABLE_SEARCH_PATHS = '{{kerberos-env/executable_search_paths}}'
+ALERT_TIMEOUT_RETURN_VALUE = "{{yarn-alert-config/alert.timeout.return.value}}"
+ALERT_TIMEOUT_SECS = "{{yarn-alert-config/alert.timeout.secs}}"
+
+ALERT_FLIP_INTERVAL_MINS = "{{yarn-alert-config/alert.flip.interval.mins}}"
 
 logger = logging.getLogger('ambari_alerts')
 
+alert_behaviour_properties = {"alert_behaviour_type" : ALERT_BEHAVIOUR_TYPE, "alert_success_percentage" : ALERT_SUCCESS_PERCENTAGE,
+                              "alert_timeout_return_value" : ALERT_TIMEOUT_RETURN_VALUE, "alert_timeout_secs" : ALERT_TIMEOUT_SECS,
+                              "alert_flip_interval_mins" : ALERT_FLIP_INTERVAL_MINS}
 
 def get_tokens():
   """
   Returns a tuple of tokens in the format {{site/property}} that will be used
   to build the dictionary passed into execute
   """
-  return (NODEMANAGER_HTTP_ADDRESS_KEY,NODEMANAGER_HTTPS_ADDRESS_KEY, EXECUTABLE_SEARCH_PATHS,
-  YARN_HTTP_POLICY_KEY, SMOKEUSER_KEY, KERBEROS_KEYTAB, KERBEROS_PRINCIPAL, SECURITY_ENABLED_KEY)
-  
+  return (ALERT_BEHAVIOUR_TYPE, ALERT_SUCCESS_PERCENTAGE, ALERT_TIMEOUT_RETURN_VALUE, ALERT_TIMEOUT_SECS,
+          ALERT_FLIP_INTERVAL_MINS)
+
 
 def execute(configurations={}, parameters={}, host_name=None):
   """
@@ -57,11 +55,5 @@ def execute(configurations={}, parameters={}, host_name=None):
   parameters (dictionary): a mapping of script parameter key to value
   host_name (string): the name of this host where the alert is running
   """
-  result_code = RESULT_CODE_UNKNOWN
-
-  if configurations is None:
-    return (result_code, ['There were no configurations supplied to the script.'])
 
-  result_code = RESULT_CODE_OK
-  label = OK_MESSAGE
-  return (result_code, [label])
+  return simulate_perf_cluster_alert_behaviour(alert_behaviour_properties, configurations)
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/ef63373e/ambari-server/src/main/resources/stacks/PERF/1.0/services/YARN/package/alerts/alert_nodemanagers_summary.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/PERF/1.0/services/YARN/package/alerts/alert_nodemanagers_summary.py b/ambari-server/src/main/resources/stacks/PERF/1.0/services/YARN/package/alerts/alert_nodemanagers_summary.py
deleted file mode 100644
index 81527f6..0000000
--- a/ambari-server/src/main/resources/stacks/PERF/1.0/services/YARN/package/alerts/alert_nodemanagers_summary.py
+++ /dev/null
@@ -1,68 +0,0 @@
-#!/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.
-"""
-
-import logging
-
-RESULT_CODE_OK = 'OK'
-RESULT_CODE_CRITICAL = 'CRITICAL'
-RESULT_CODE_UNKNOWN = 'UNKNOWN'
-
-OK_MESSAGE = 'All NodeManagers are healthy'
-
-NODEMANAGER_HTTP_ADDRESS_KEY = '{{yarn-site/yarn.resourcemanager.webapp.address}}'
-NODEMANAGER_HTTPS_ADDRESS_KEY = '{{yarn-site/yarn.resourcemanager.webapp.https.address}}'
-YARN_HTTP_POLICY_KEY = '{{yarn-site/yarn.http.policy}}'
-
-KERBEROS_KEYTAB = '{{yarn-site/yarn.nodemanager.webapp.spnego-keytab-file}}'
-KERBEROS_PRINCIPAL = '{{yarn-site/yarn.nodemanager.webapp.spnego-principal}}'
-SECURITY_ENABLED_KEY = '{{cluster-env/security_enabled}}'
-SMOKEUSER_KEY = '{{cluster-env/smokeuser}}'
-EXECUTABLE_SEARCH_PATHS = '{{kerberos-env/executable_search_paths}}'
-
-logger = logging.getLogger('ambari_alerts')
-
-
-def get_tokens():
-  """
-  Returns a tuple of tokens in the format {{site/property}} that will be used
-  to build the dictionary passed into execute
-  """
-  return NODEMANAGER_HTTP_ADDRESS_KEY, NODEMANAGER_HTTPS_ADDRESS_KEY, EXECUTABLE_SEARCH_PATHS, \
-    YARN_HTTP_POLICY_KEY, SMOKEUSER_KEY, KERBEROS_KEYTAB, KERBEROS_PRINCIPAL, SECURITY_ENABLED_KEY
-
-
-def execute(configurations={}, parameters={}, host_name=None):
-  """
-  Returns a tuple containing the result code and a pre-formatted result label
-
-  Keyword arguments:
-  configurations (dictionary): a mapping of configuration key to value
-  parameters (dictionary): a mapping of script parameter key to value
-  host_name (string): the name of this host where the alert is running
-  """
-  result_code = RESULT_CODE_UNKNOWN
-
-  if configurations is None:
-    return (result_code, ['There were no configurations supplied to the script.'])
-
-  result_code = RESULT_CODE_OK
-  label = OK_MESSAGE
-
-  return (result_code, [label])

http://git-wip-us.apache.org/repos/asf/ambari/blob/ef63373e/ambari-server/src/main/resources/stacks/PERF/1.0/services/YARN/package/alerts/alert_resourcemanager_process.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/PERF/1.0/services/YARN/package/alerts/alert_resourcemanager_process.py b/ambari-server/src/main/resources/stacks/PERF/1.0/services/YARN/package/alerts/alert_resourcemanager_process.py
new file mode 100644
index 0000000..8733679
--- /dev/null
+++ b/ambari-server/src/main/resources/stacks/PERF/1.0/services/YARN/package/alerts/alert_resourcemanager_process.py
@@ -0,0 +1,59 @@
+#!/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.
+"""
+
+import logging
+
+from resource_management.libraries.functions.simulate_perf_cluster_alert_behaviour import simulate_perf_cluster_alert_behaviour
+
+ALERT_BEHAVIOUR_TYPE = "{{yarn-alert-config/alert.behavior.type}}"
+
+ALERT_SUCCESS_PERCENTAGE = "{{yarn-alert-config/alert.success.percentage}}"
+
+ALERT_TIMEOUT_RETURN_VALUE = "{{yarn-alert-config/alert.timeout.return.value}}"
+ALERT_TIMEOUT_SECS = "{{yarn-alert-config/alert.timeout.secs}}"
+
+ALERT_FLIP_INTERVAL_MINS = "{{yarn-alert-config/alert.flip.interval.mins}}"
+
+logger = logging.getLogger('ambari_alerts')
+
+alert_behaviour_properties = {"alert_behaviour_type" : ALERT_BEHAVIOUR_TYPE, "alert_success_percentage" : ALERT_SUCCESS_PERCENTAGE,
+                              "alert_timeout_return_value" : ALERT_TIMEOUT_RETURN_VALUE, "alert_timeout_secs" : ALERT_TIMEOUT_SECS,
+                              "alert_flip_interval_mins" : ALERT_FLIP_INTERVAL_MINS}
+
+def get_tokens():
+  """
+  Returns a tuple of tokens in the format {{site/property}} that will be used
+  to build the dictionary passed into execute
+  """
+  return (ALERT_BEHAVIOUR_TYPE, ALERT_SUCCESS_PERCENTAGE, ALERT_TIMEOUT_RETURN_VALUE, ALERT_TIMEOUT_SECS,
+          ALERT_FLIP_INTERVAL_MINS)
+
+
+def execute(configurations={}, parameters={}, host_name=None):
+  """
+  Returns a tuple containing the result code and a pre-formatted result label
+
+  Keyword arguments:
+  configurations (dictionary): a mapping of configuration key to value
+  parameters (dictionary): a mapping of script parameter key to value
+  host_name (string): the name of this host where the alert is running
+  """
+
+  return simulate_perf_cluster_alert_behaviour(alert_behaviour_properties, configurations)
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/ef63373e/ambari-server/src/main/resources/stacks/PERF/1.0/services/YARN/package/alerts/alert_timeline_process.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/PERF/1.0/services/YARN/package/alerts/alert_timeline_process.py b/ambari-server/src/main/resources/stacks/PERF/1.0/services/YARN/package/alerts/alert_timeline_process.py
new file mode 100644
index 0000000..8733679
--- /dev/null
+++ b/ambari-server/src/main/resources/stacks/PERF/1.0/services/YARN/package/alerts/alert_timeline_process.py
@@ -0,0 +1,59 @@
+#!/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.
+"""
+
+import logging
+
+from resource_management.libraries.functions.simulate_perf_cluster_alert_behaviour import simulate_perf_cluster_alert_behaviour
+
+ALERT_BEHAVIOUR_TYPE = "{{yarn-alert-config/alert.behavior.type}}"
+
+ALERT_SUCCESS_PERCENTAGE = "{{yarn-alert-config/alert.success.percentage}}"
+
+ALERT_TIMEOUT_RETURN_VALUE = "{{yarn-alert-config/alert.timeout.return.value}}"
+ALERT_TIMEOUT_SECS = "{{yarn-alert-config/alert.timeout.secs}}"
+
+ALERT_FLIP_INTERVAL_MINS = "{{yarn-alert-config/alert.flip.interval.mins}}"
+
+logger = logging.getLogger('ambari_alerts')
+
+alert_behaviour_properties = {"alert_behaviour_type" : ALERT_BEHAVIOUR_TYPE, "alert_success_percentage" : ALERT_SUCCESS_PERCENTAGE,
+                              "alert_timeout_return_value" : ALERT_TIMEOUT_RETURN_VALUE, "alert_timeout_secs" : ALERT_TIMEOUT_SECS,
+                              "alert_flip_interval_mins" : ALERT_FLIP_INTERVAL_MINS}
+
+def get_tokens():
+  """
+  Returns a tuple of tokens in the format {{site/property}} that will be used
+  to build the dictionary passed into execute
+  """
+  return (ALERT_BEHAVIOUR_TYPE, ALERT_SUCCESS_PERCENTAGE, ALERT_TIMEOUT_RETURN_VALUE, ALERT_TIMEOUT_SECS,
+          ALERT_FLIP_INTERVAL_MINS)
+
+
+def execute(configurations={}, parameters={}, host_name=None):
+  """
+  Returns a tuple containing the result code and a pre-formatted result label
+
+  Keyword arguments:
+  configurations (dictionary): a mapping of configuration key to value
+  parameters (dictionary): a mapping of script parameter key to value
+  host_name (string): the name of this host where the alert is running
+  """
+
+  return simulate_perf_cluster_alert_behaviour(alert_behaviour_properties, configurations)
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/ef63373e/ambari-server/src/main/resources/stacks/PERF/1.0/services/ZOOKEEPER/alerts.json
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/PERF/1.0/services/ZOOKEEPER/alerts.json b/ambari-server/src/main/resources/stacks/PERF/1.0/services/ZOOKEEPER/alerts.json
new file mode 100644
index 0000000..4af7ae9
--- /dev/null
+++ b/ambari-server/src/main/resources/stacks/PERF/1.0/services/ZOOKEEPER/alerts.json
@@ -0,0 +1,20 @@
+{
+    "ZOOKEEPER": {
+
+        "ZOOKEEPER_SERVER": [
+            {
+                "name": "zookeeper_server_process",
+                "label": "Zookeeper server Process",
+                "description": "Alert for zk server component process status",
+                "interval": 1,
+                "scope": "HOST",
+                "enabled": true,
+                "source": {
+                    "type": "SCRIPT",
+                    "path": "PERF/1.0/services/ZOOKEEPER/package/alerts/alert_zk_server_process.py",
+                    "parameters": []
+                }
+            }
+        ]
+    }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/ef63373e/ambari-server/src/main/resources/stacks/PERF/1.0/services/ZOOKEEPER/configuration/zk-alert-config.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/PERF/1.0/services/ZOOKEEPER/configuration/zk-alert-config.xml b/ambari-server/src/main/resources/stacks/PERF/1.0/services/ZOOKEEPER/configuration/zk-alert-config.xml
new file mode 100644
index 0000000..760e706
--- /dev/null
+++ b/ambari-server/src/main/resources/stacks/PERF/1.0/services/ZOOKEEPER/configuration/zk-alert-config.xml
@@ -0,0 +1,75 @@
+<?xml version="1.0"?>
+<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
+<!--
+    Licensed to the Apache Software Foundation (ASF) under one or more
+    contributor license agreements.  See the NOTICE file distributed with
+    this work for additional information regarding copyright ownership.
+    The ASF licenses this file to You under the Apache License, Version 2.0
+    (the "License"); you may not use this file except in compliance with
+    the License.  You may obtain a copy of the License at
+
+        http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+-->
+
+<configuration xmlns:xi="http://www.w3.org/2001/XInclude" supports_final="true">
+
+    <property>
+        <name>alert.behavior.type</name>
+        <value>percentage</value>
+        <description>
+            This property describes type of alert behaviour.
+            There are three types percentage, timeout, flip.
+        </description>
+    </property>
+
+
+    <property>
+        <name>alert.success.percentage</name>
+        <value>100</value>
+        <description>
+            This property will be actual only when alert.behaviour.type
+            set to "percentage". Here you should set percent of successful
+            alert checks.
+        </description>
+    </property>
+
+
+    <property>
+        <name>alert.timeout.return.value</name>
+        <value>false</value>
+        <description>
+            This property will be actual only when alert.behaviour.type
+            set to "timeout". Here you should set result which alert will
+            return after timeout, false|true|none.
+        </description>
+    </property>
+
+    <property>
+        <name>alert.timeout.secs</name>
+        <value>120</value>
+        <description>
+            This property will be actual only when alert.behaviour.type
+            set to "timeout". Here you should set number of seconds for
+            alert to sleep.
+        </description>
+    </property>
+
+
+    <property>
+        <name>alert.flip.interval.mins</name>
+        <value>3</value>
+        <description>
+            This property will be actual only when alert.behaviour.type
+            set to "flip". Here you should set number of minutes at which
+            the alert should flip from true|false.
+        </description>
+    </property>
+
+
+</configuration>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/ef63373e/ambari-server/src/main/resources/stacks/PERF/1.0/services/ZOOKEEPER/metainfo.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/PERF/1.0/services/ZOOKEEPER/metainfo.xml b/ambari-server/src/main/resources/stacks/PERF/1.0/services/ZOOKEEPER/metainfo.xml
index 62ea041..57667bb 100644
--- a/ambari-server/src/main/resources/stacks/PERF/1.0/services/ZOOKEEPER/metainfo.xml
+++ b/ambari-server/src/main/resources/stacks/PERF/1.0/services/ZOOKEEPER/metainfo.xml
@@ -43,6 +43,10 @@
         </component>
       </components>
 
+      <configuration-dependencies>
+        <config-type>zk-alert-config</config-type>
+      </configuration-dependencies>
+
       <!-- No packages to install. -->
       <osSpecifics></osSpecifics>
     </service>

http://git-wip-us.apache.org/repos/asf/ambari/blob/ef63373e/ambari-server/src/main/resources/stacks/PERF/1.0/services/ZOOKEEPER/package/alerts/alert_zk_server_process.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/PERF/1.0/services/ZOOKEEPER/package/alerts/alert_zk_server_process.py b/ambari-server/src/main/resources/stacks/PERF/1.0/services/ZOOKEEPER/package/alerts/alert_zk_server_process.py
new file mode 100644
index 0000000..55bbbd1
--- /dev/null
+++ b/ambari-server/src/main/resources/stacks/PERF/1.0/services/ZOOKEEPER/package/alerts/alert_zk_server_process.py
@@ -0,0 +1,59 @@
+#!/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.
+"""
+
+import logging
+
+from resource_management.libraries.functions.simulate_perf_cluster_alert_behaviour import simulate_perf_cluster_alert_behaviour
+
+ALERT_BEHAVIOUR_TYPE = "{{zk-alert-config/alert.behavior.type}}"
+
+ALERT_SUCCESS_PERCENTAGE = "{{zk-alert-config/alert.success.percentage}}"
+
+ALERT_TIMEOUT_RETURN_VALUE = "{{zk-alert-config/alert.timeout.return.value}}"
+ALERT_TIMEOUT_SECS = "{{zk-alert-config/alert.timeout.secs}}"
+
+ALERT_FLIP_INTERVAL_MINS = "{{zk-alert-config/alert.flip.interval.mins}}"
+
+logger = logging.getLogger('ambari_alerts')
+
+alert_behaviour_properties = {"alert_behaviour_type" : ALERT_BEHAVIOUR_TYPE, "alert_success_percentage" : ALERT_SUCCESS_PERCENTAGE,
+                              "alert_timeout_return_value" : ALERT_TIMEOUT_RETURN_VALUE, "alert_timeout_secs" : ALERT_TIMEOUT_SECS,
+                              "alert_flip_interval_mins" : ALERT_FLIP_INTERVAL_MINS}
+
+def get_tokens():
+  """
+  Returns a tuple of tokens in the format {{site/property}} that will be used
+  to build the dictionary passed into execute
+  """
+  return (ALERT_BEHAVIOUR_TYPE, ALERT_SUCCESS_PERCENTAGE, ALERT_TIMEOUT_RETURN_VALUE, ALERT_TIMEOUT_SECS,
+          ALERT_FLIP_INTERVAL_MINS)
+
+
+def execute(configurations={}, parameters={}, host_name=None):
+  """
+  Returns a tuple containing the result code and a pre-formatted result label
+
+  Keyword arguments:
+  configurations (dictionary): a mapping of configuration key to value
+  parameters (dictionary): a mapping of script parameter key to value
+  host_name (string): the name of this host where the alert is running
+  """
+
+  return simulate_perf_cluster_alert_behaviour(alert_behaviour_properties, configurations)
\ No newline at end of file


[02/50] [abbrv] ambari git commit: AMBARI-19030 Service Auto Start operations are permitted during Upgrade (atkach)

Posted by nc...@apache.org.
AMBARI-19030 Service Auto Start operations are permitted during Upgrade (atkach)


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

Branch: refs/heads/branch-dev-patch-upgrade
Commit: 89780fabad715e971accb66c3c634cfe0030a91f
Parents: d369809
Author: Andrii Tkach <at...@apache.org>
Authored: Wed Nov 30 14:33:08 2016 +0200
Committer: Andrii Tkach <at...@apache.org>
Committed: Wed Nov 30 14:33:08 2016 +0200

----------------------------------------------------------------------
 .../templates/main/admin/service_auto_start.hbs | 24 +++++++++++---------
 ambari-web/app/views/main/admin.js              |  3 ++-
 .../app/views/main/admin/service_auto_start.js  |  5 ++++
 .../service_auto_start/component_auto_start.js  |  1 +
 4 files changed, 21 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/89780fab/ambari-web/app/templates/main/admin/service_auto_start.hbs
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates/main/admin/service_auto_start.hbs b/ambari-web/app/templates/main/admin/service_auto_start.hbs
index 7334995..c5a92cf 100644
--- a/ambari-web/app/templates/main/admin/service_auto_start.hbs
+++ b/ambari-web/app/templates/main/admin/service_auto_start.hbs
@@ -80,17 +80,19 @@
                     </tr>
                   {{/each}}
                 </tbody>
-                <tfoot>
-                  <tr>
-                    <td class="col-md-4"></td>
-                    <td class="col-md-8">
-                      <a href="#" class="enable-all-link" {{action enableAll tab target="controller"}}>
-                        {{t common.enableAll}}
-                      </a> |
-                      <a href="#" {{action disableAll tab target="controller"}}>{{t common.disableAll}}</a>
-                    </td>
-                  </tr>
-                </tfoot>
+                {{#isAuthorized "SERVICE.START_STOP, CLUSTER.MODIFY_CONFIGS"}}
+                  <tfoot>
+                    <tr>
+                      <td class="col-md-4"></td>
+                      <td class="col-md-8">
+                        <a href="#" class="enable-all-link" {{action enableAll tab target="controller"}}>
+                            {{t common.enableAll}}
+                        </a> |
+                        <a href="#" {{action disableAll tab target="controller"}}>{{t common.disableAll}}</a>
+                      </td>
+                    </tr>
+                  </tfoot>
+                {{/isAuthorized}}
               </table>
             </div>
           {{/each}}

http://git-wip-us.apache.org/repos/asf/ambari/blob/89780fab/ambari-web/app/views/main/admin.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/admin.js b/ambari-web/app/views/main/admin.js
index 704527b..0fa84e8 100644
--- a/ambari-web/app/views/main/admin.js
+++ b/ambari-web/app/views/main/admin.js
@@ -51,7 +51,8 @@ App.MainAdminView = Em.View.extend({
         items.push({
           name: 'serviceAutoStart',
           url: 'adminServiceAutoStart',
-          label: Em.I18n.t('admin.serviceAutoStart.title')
+          label: Em.I18n.t('admin.serviceAutoStart.title'),
+          disabled: App.get('upgradeInProgress') || App.get('upgradeHolding')
         });
       }
     }

http://git-wip-us.apache.org/repos/asf/ambari/blob/89780fab/ambari-web/app/views/main/admin/service_auto_start.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/admin/service_auto_start.js b/ambari-web/app/views/main/admin/service_auto_start.js
index 7b4e46c..1af9845 100644
--- a/ambari-web/app/views/main/admin/service_auto_start.js
+++ b/ambari-web/app/views/main/admin/service_auto_start.js
@@ -27,8 +27,12 @@ App.MainAdminServiceAutoStartView = Em.View.extend({
    */
   isLoaded: false,
 
+  isDisabled: false,
+
   didInsertElement: function () {
     var self = this;
+
+    this.set('isDisabled', !App.isAuthorized('SERVICE.START_STOP, CLUSTER.MODIFY_CONFIGS'));
     this.get('controller').load().then(function() {
       self.set('isLoaded', true);
       self.initSwitcher();
@@ -55,6 +59,7 @@ App.MainAdminServiceAutoStartView = Em.View.extend({
         offText: Em.I18n.t('common.disabled'),
         offColor: 'default',
         onColor: 'success',
+        disabled: this.get('isDisabled'),
         handleWidth: Math.max(Em.I18n.t('common.enabled').length, Em.I18n.t('common.disabled').length) * 8,
         onSwitchChange: function (event, state) {
           self.set('controller.servicesAutoStart', state);

http://git-wip-us.apache.org/repos/asf/ambari/blob/89780fab/ambari-web/app/views/main/admin/service_auto_start/component_auto_start.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/admin/service_auto_start/component_auto_start.js b/ambari-web/app/views/main/admin/service_auto_start/component_auto_start.js
index 8588b04..a1e09f2 100644
--- a/ambari-web/app/views/main/admin/service_auto_start/component_auto_start.js
+++ b/ambari-web/app/views/main/admin/service_auto_start/component_auto_start.js
@@ -45,6 +45,7 @@ App.MainAdminServiceAutoStartComponentView = Em.View.extend({
         offText: Em.I18n.t('common.disabled'),
         offColor: 'default',
         onColor: 'success',
+        disabled: this.get('parentView.isDisabled'),
         handleWidth: Math.max(Em.I18n.t('common.enabled').length, Em.I18n.t('common.disabled').length) * 8,
         onSwitchChange: function (event, state) {
           self.set('tab.enabledComponents', self.get('tab.enabledComponents') + (state ? 1 : -1));


[45/50] [abbrv] ambari git commit: AMBARI-19053. RU: wrong version exposed when Downgrade is going (ncole)

Posted by nc...@apache.org.
AMBARI-19053. RU: wrong version exposed when Downgrade is going (ncole)


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

Branch: refs/heads/branch-dev-patch-upgrade
Commit: 7eb2eaa73315189533e039b45cf90655adf25390
Parents: 232a9d8
Author: Nate Cole <nc...@hortonworks.com>
Authored: Thu Dec 1 16:26:21 2016 -0500
Committer: Nate Cole <nc...@hortonworks.com>
Committed: Fri Dec 2 11:19:20 2016 -0500

----------------------------------------------------------------------
 .../internal/UpgradeResourceProvider.java       | 24 ++++++++++++++++----
 .../internal/UpgradeResourceProviderTest.java   |  4 ++--
 2 files changed, 22 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/7eb2eaa7/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 9034989..5931743 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
@@ -758,13 +758,17 @@ public class UpgradeResourceProvider extends AbstractControllerResourceProvider
     upgradeContext.setSupportedServices(supportedServices);
     upgradeContext.setScope(scope);
 
+    String downgradeFromVersion = null;
+
     if (direction.isDowngrade()) {
       if (requestMap.containsKey(UPGRADE_FROM_VERSION)) {
-        upgradeContext.setDowngradeFromVersion((String) requestMap.get(UPGRADE_FROM_VERSION));
+        downgradeFromVersion = (String) requestMap.get(UPGRADE_FROM_VERSION);
       } else {
         UpgradeEntity lastUpgradeItemForCluster = s_upgradeDAO.findLastUpgradeForCluster(cluster.getClusterId());
-        upgradeContext.setDowngradeFromVersion(lastUpgradeItemForCluster.getToVersion());
+        downgradeFromVersion = lastUpgradeItemForCluster.getToVersion();
       }
+
+      upgradeContext.setDowngradeFromVersion(downgradeFromVersion);
     }
 
     // optionally skip failures - this can be supplied on either the request or
@@ -922,7 +926,13 @@ public class UpgradeResourceProvider extends AbstractControllerResourceProvider
     }
 
     UpgradeEntity entity = new UpgradeEntity();
-    entity.setFromVersion(cluster.getCurrentClusterVersion().getRepositoryVersion().getVersion());
+
+    if (null != downgradeFromVersion) {
+      entity.setFromVersion(downgradeFromVersion);
+    } else {
+      entity.setFromVersion(cluster.getCurrentClusterVersion().getRepositoryVersion().getVersion());
+    }
+
     entity.setToVersion(version);
     entity.setUpgradeGroups(groupEntities);
     entity.setClusterId(cluster.getClusterId());
@@ -931,7 +941,13 @@ public class UpgradeResourceProvider extends AbstractControllerResourceProvider
     entity.setUpgradeType(pack.getType());
     entity.setAutoSkipComponentFailures(skipComponentFailures);
     entity.setAutoSkipServiceCheckFailures(skipServiceCheckFailures);
-    entity.setDowngradeAllowed(pack.isDowngradeAllowed());
+
+    if (upgradeContext.getDirection().isDowngrade()) {
+      // !!! You can't downgrade a Downgrade, no matter what the upgrade pack says.
+      entity.setDowngradeAllowed(false);
+    } else {
+      entity.setDowngradeAllowed(pack.isDowngradeAllowed());
+    }
 
     req.getRequestStatusResponse();
     return createUpgradeInsideTransaction(cluster, req, entity);

http://git-wip-us.apache.org/repos/asf/ambari/blob/7eb2eaa7/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 14e3d08..8efcc61 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
@@ -708,7 +708,7 @@ public class UpgradeResourceProviderTest {
 
     UpgradeEntity entity = upgradeDao.findUpgrade(Long.parseLong(id));
     assertNotNull(entity);
-    assertEquals("2.1.1", entity.getFromVersion());
+    assertEquals("2.1.1.0", entity.getFromVersion());
     assertEquals("2.2.0.0", entity.getToVersion());
     assertEquals(Direction.DOWNGRADE, entity.getDirection());
 
@@ -1249,7 +1249,7 @@ public class UpgradeResourceProviderTest {
       Map<String, String> map = gson.<Map<String, String>> fromJson(se.getCommandParamsStage(),Map.class);
       assertTrue(map.containsKey("upgrade_direction"));
       assertEquals("upgrade", map.get("upgrade_direction"));
-      
+
       if(map.containsKey("upgrade_type")){
         assertEquals("rolling_upgrade", map.get("upgrade_type"));
       }


[14/50] [abbrv] ambari git commit: AMBARI-18755. Deployment failing at creating principal [addendum] (rlevas)

Posted by nc...@apache.org.
AMBARI-18755. Deployment failing at creating principal [addendum] (rlevas)


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

Branch: refs/heads/branch-dev-patch-upgrade
Commit: 1e65ba6943a10d04c38f780f476eca3806e2d9f3
Parents: 32c9f5a
Author: Robert Levas <rl...@hortonworks.com>
Authored: Wed Nov 30 19:16:53 2016 -0500
Committer: Robert Levas <rl...@hortonworks.com>
Committed: Wed Nov 30 19:16:53 2016 -0500

----------------------------------------------------------------------
 ambari-server/docs/configuration/index.md       | 33 +++++++++++++++-----
 .../server/configuration/Configuration.java     |  7 +++++
 .../kerberos/MITKerberosOperationHandler.java   | 22 +++++++++----
 .../ambari/server/utils/ShellCommandUtil.java   | 11 ++++++-
 .../MITKerberosOperationHandlerTest.java        | 23 ++++++++++++++
 .../server/utils/TestShellCommandUtil.java      | 13 +++++---
 6 files changed, 89 insertions(+), 20 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/1e65ba69/ambari-server/docs/configuration/index.md
----------------------------------------------------------------------
diff --git a/ambari-server/docs/configuration/index.md b/ambari-server/docs/configuration/index.md
index 77d3a4d..6ff263c 100644
--- a/ambari-server/docs/configuration/index.md
+++ b/ambari-server/docs/configuration/index.md
@@ -49,15 +49,17 @@ The following are the properties which can be used to configure Ambari.
 | agent.stack.retry.tries | The number of times an Ambari Agent should retry package installation when it fails due to a repository error. <br/><br/> This property is related to `agent.stack.retry.on_repo_unavailability`. |`5` | 
 | agent.task.timeout | The time, in seconds, before agent commands are killed. This does not include package installation commands. |`900` | 
 | agent.threadpool.size.max | The size of the Jetty connection pool used for handling incoming Ambari Agent requests. |`25` | 
+| alerts.ambari.snmp.dispatcher.udp.port | The UDP port to use when binding the Ambari SNMP dispatcher on Ambari Server startup. If no port is specified, then a random port will be used. | | 
 | alerts.cache.enabled | Determines whether current alerts should be cached. Enabling this can increase performance on large cluster, but can also result in lost alert data if the cache is not flushed frequently. |`false` | 
 | alerts.cache.flush.interval | The time, in minutes, after which cached alert information is flushed to the database<br/><br/> This property is related to `alerts.cache.enabled`. |`10` | 
 | alerts.cache.size | The size of the alert cache.<br/><br/> This property is related to `alerts.cache.enabled`. |`50000` | 
 | alerts.execution.scheduler.maxThreads | The number of threads used to handle alerts received from the Ambari Agents. The value should be increased as the size of the cluster increases. |`2` | 
 | alerts.snmp.dispatcher.udp.port | The UDP port to use when binding the SNMP dispatcher on Ambari Server startup. If no port is specified, then a random port will be used. | | 
-| alerts.ambari.snmp.dispatcher.udp.port | The UDP port to use when binding the SNMP dispatcher on Ambari Server startup. If no port is specified, then a random port will be used. | |
-| alerts.template.file | The full path to the XML file that describes the different alert templates. | |
+| alerts.template.file | The full path to the XML file that describes the different alert templates. | | 
 | ambari.display.url | The URL to use when creating messages which should include the Ambari Server URL.<br/><br/>The following are examples of valid values:<ul><li>`http://ambari.apache.org:8080`</ul> | | 
 | ambari.ldap.isConfigured | An internal property used for unit testing and development purposes. |`false` | 
+| ambari.post.user.creation.hook | The location of the post user creation hook on the ambari server hosting machine. |`/var/lib/ambari-server/resources/scripts/post-user-creation-hook.sh` | 
+| ambari.post.user.creation.hook.enabled | Indicates whether the post user creation is enabled or not. By default is false. |`false` | 
 | ambari.python.wrap | The name of the shell script used to wrap all invocations of Python by Ambari.  |`ambari-python-wrap` | 
 | anonymous.audit.name | The name of the user given to requests which are executed without any credentials. |`_anonymous` | 
 | api.authenticated.user | The username of the default user assumed to be executing API calls. When set, authentication is not required in order to login to Ambari or use the REST APIs.   | | 
@@ -105,6 +107,7 @@ The following are the properties which can be used to configure Ambari.
 | authentication.ldap.usernameAttribute | The attribute used for determining the user name, such as `uid`. |`uid` | 
 | authorization.ldap.adminGroupMappingRules | A comma-separate list of groups which would give a user administrative access to Ambari when syncing from LDAP. This is only used when `authorization.ldap.groupSearchFilter` is blank.<br/><br/>The following are examples of valid values:<ul><li>`administrators`<li>`Hadoop Admins,Hadoop Admins.*,DC Admins,.*Hadoop Operators`</ul> |`Ambari Administrators` | 
 | authorization.ldap.groupSearchFilter | The DN to use when searching for LDAP groups. | | 
+| auto.group.creation | The auto group creation by Ambari |`false` | 
 | bootstrap.dir | The directory on the Ambari Server file system used for storing Ambari Agent bootstrap information such as request responses. |`/var/run/ambari-server/bootstrap` | 
 | bootstrap.master_host_name | The host name of the Ambari Server which will be used by the Ambari Agents for communication. | | 
 | bootstrap.script | The location and name of the Python script used to bootstrap new Ambari Agent hosts. |`/usr/lib/python2.6/site-packages/ambari_server/bootstrap.py` | 
@@ -128,7 +131,10 @@ The following are the properties which can be used to configure Ambari.
 | db.oracle.jdbc.name | The name of the Oracle JDBC JAR connector. |`ojdbc6.jar` | 
 | default.kdcserver.port | The port used to communicate with the Kerberos Key Distribution Center. |`88` | 
 | extensions.path | The location on the Ambari Server where stack extensions exist.<br/><br/>The following are examples of valid values:<ul><li>`/var/lib/ambari-server/resources/extensions`</ul> | | 
+| http.cache-control | The value that will be used to set the `Cache-Control` HTTP response header. |`no-store` | 
+| http.pragma | The value that will be used to set the `PRAGMA` HTTP response header. |`no-cache` | 
 | http.strict-transport-security | When using SSL, this will be used to set the `Strict-Transport-Security` response header. |`max-age=31536000` | 
+| http.x-content-type-options | The value that will be used to set the `X-CONTENT-TYPE` HTTP response header. |`nosniff` | 
 | http.x-frame-options | The value that will be used to set the `X-Frame-Options` HTTP response header. |`DENY` | 
 | http.x-xss-protection | The value that will be used to set the `X-XSS-Protection` HTTP response header. |`1; mode=block` | 
 | java.home | The location of the JDK on the Ambari Agent hosts.<br/><br/>The following are examples of valid values:<ul><li>`/usr/jdk64/jdk1.7.0_45`</ul> | | 
@@ -138,6 +144,7 @@ The following are the properties which can be used to configure Ambari.
 | kerberos.check.jaas.configuration | Determines whether Kerberos-enabled Ambari deployments should use JAAS to validate login credentials. |`false` | 
 | kerberos.keytab.cache.dir | The location on the Ambari Server where Kerberos keytabs are cached. |`/var/lib/ambari-server/data/cache` | 
 | kerberos.operation.retries | The number of times failed kerberos operations should be retried to execute. |`3` | 
+| kerberos.operation.retry.timeout | The time to wait (in seconds) between failed kerberos operations retries. |`10` | 
 | ldap.sync.username.collision.behavior | Determines how to handle username collision while updating from LDAP.<br/><br/>The following are examples of valid values:<ul><li>`skip`<li>`convert`</ul> |`convert` | 
 | log4j.monitor.delay | Indicates the delay, in milliseconds, for the log4j monitor to check for changes |`300000` | 
 | metadata.path | The location on the Ambari Server where the stack resources exist.<br/><br/>The following are examples of valid values:<ul><li>`/var/lib/ambari-server/resources/stacks`</ul> | | 
@@ -146,8 +153,10 @@ The following are the properties which can be used to configure Ambari.
 | metrics.retrieval-service.request.ttl.enabled | Enables throttling requests to the same endpoint within a fixed amount of time. This property will prevent Ambari from making new metric requests to update the cache for URLs which have been recently retrieved.<br/><br/> This property is related to `metrics.retrieval-service.request.ttl`. |`true` | 
 | mpacks.staging.path | The Ambari Management Pack staging directory on the Ambari Server.<br/><br/>The following are examples of valid values:<ul><li>`/var/lib/ambari-server/resources/mpacks`</ul> | | 
 | packages.pre.installed | Determines whether Ambari Agent instances have already have the necessary stack software installed |`false` | 
+| pam.configuration | The PAM configuration file. | | 
 | proxy.allowed.hostports | A comma-separated whitelist of host and port values which Ambari Server can use to determine if a proxy value is valid. |`*:*` | 
 | recommendations.artifacts.lifetime | The amount of time that Recommendation API data is kept on the Ambari Server file system. This is specified using a `hdwmy` syntax for pairing the value with a time unit (hours, days, weeks, months, years)<br/><br/>The following are examples of valid values:<ul><li>`8h`<li>`2w`<li>`1m`</ul> |`1w` | 
+| recommendations.artifacts.rollover.max | Maximum number of recommendations artifacts at a given time<br/><br/>The following are examples of valid values:<ul><li>`50`<li>`10`<li>`100`</ul> |`100` | 
 | recommendations.dir | The directory on the Ambari Server file system used for storing Recommendation API artifacts. |`/var/run/ambari-server/stack-recommendations` | 
 | recovery.disabled_components | A comma-separated list of component names which are not included in automatic recovery attempts.<br/><br/>The following are examples of valid values:<ul><li>`NAMENODE,ZOOKEEPER_SERVER`</ul> | | 
 | recovery.enabled_components | A comma-separated list of component names which are included in automatic recovery attempts.<br/><br/>The following are examples of valid values:<ul><li>`NAMENODE,ZOOKEEPER_SERVER`</ul> | | 
@@ -222,17 +231,20 @@ The following are the properties which can be used to configure Ambari.
 | server.jdbc.user.passwd | The password for the user when logging into the database. |`bigdata` | 
 | server.locks.profiling | Enable the profiling of internal locks. |`false` | 
 | server.metrics.retrieval-service.thread.priority | The priority of threads used by the service which retrieves JMX and REST metrics directly from their respective endpoints. |`5` | 
-| server.metrics.retrieval-service.threadpool.size.core | The core number of threads used to retrieve JMX and REST metrics directly from their respective endpoints. |`16` | 
-| server.metrics.retrieval-service.threadpool.size.max | The maximum number of threads used to retrieve JMX and REST metrics directly from their respective endpoints. |`32` | 
-| server.metrics.retrieval-service.threadpool.worker.size | The number of queued requests allowed for JMX and REST metrics before discarding old requests which have not been fullfilled. |`320` | 
+| server.metrics.retrieval-service.threadpool.size.core | The core number of threads used to retrieve JMX and REST metrics directly from their respective endpoints. |`8` | 
+| server.metrics.retrieval-service.threadpool.size.max | The maximum number of threads used to retrieve JMX and REST metrics directly from their respective endpoints. |`16` | 
+| server.metrics.retrieval-service.threadpool.worker.size | The number of queued requests allowed for JMX and REST metrics before discarding old requests which have not been fullfilled. |`160` | 
 | server.operations.retry-attempts | The number of retry attempts for failed API and blueprint operations. |`0` | 
 | server.os_family | The operating system family for all hosts in the cluster. This is used when bootstrapping agents and when enabling Kerberos.<br/><br/>The following are examples of valid values:<ul><li>`redhat`<li>`ubuntu`</ul> | | 
 | server.os_type | The operating system version for all hosts in the cluster. This is used when bootstrapping agents and when enabling Kerberos.<br/><br/>The following are examples of valid values:<ul><li>`6`<li>`7`</ul> | | 
 | server.persistence.type | The type of database connection being used. Unless using an embedded PostgresSQL server, then this should be `remote`.<br/><br/>The following are examples of valid values:<ul><li>`local`<li>`remote`</ul> |`local` | 
 | server.property-provider.threadpool.completion.timeout | The maximum time, in milliseconds, that federated requests for data can execute before being terminated. Increasing this value could result in degraded performanc from the REST APIs. |`5000` | 
-| server.property-provider.threadpool.size.core | The core number of threads that will be used to retrieve data from federated datasources, such as remote JMX endpoints. |`16` | 
-| server.property-provider.threadpool.size.max | The maximum number of threads that will be used to retrieve data from federated datasources, such as remote JMX endpoints. |`32` | 
+| server.property-provider.threadpool.size.core | The core number of threads that will be used to retrieve data from federated datasources, such as remote JMX endpoints. |`8` | 
+| server.property-provider.threadpool.size.max | The maximum number of threads that will be used to retrieve data from federated datasources, such as remote JMX endpoints. |`16` | 
 | server.property-provider.threadpool.worker.size | The maximum size of pending federated datasource requests, such as those to JMX endpoints, which can be queued before rejecting new requests. |`2147483647` | 
+| server.requestlogs.namepattern | The pattern of request log file name |`ambari-access-yyyy_mm_dd.log` | 
+| server.requestlogs.path | The location on the Ambari Server where request logs can be created. | | 
+| server.requestlogs.retaindays | The number of days that request log would be retained. |`15` | 
 | server.script.timeout | The time, in milliseconds, until an external script is killed. |`5000` | 
 | server.stage.command.execution_type | How to execute commands in one stage |`STAGE` | 
 | server.stages.parallel | Determines whether operations in different execution requests can be run concurrently. |`true` | 
@@ -262,6 +274,8 @@ The following are the properties which can be used to configure Ambari.
 | stack.upgrade.bypass.prechecks | Determines whether pre-upgrade checks will be skipped when performing a rolling or express stack upgrade. |`false` | 
 | stackadvisor.script | The location and name of the Python stack advisor script executed when configuring services. |`/var/lib/ambari-server/resources/scripts/stack_advisor.py` | 
 | task.query.parameterlist.size | The maximum number of tasks which can be queried by ID from the database. |`999` | 
+| topology.task.creation.parallel | Indicates whether parallel topology task creation is enabled |`false` | 
+| topology.task.creation.parallel.threads | The number of threads to use for parallel topology task creation if enabled |`10` | 
 | view.extraction.threadpool.size.core | The number of threads used to extract Ambari Views when Ambari Server is starting up. |`10` | 
 | view.extraction.threadpool.size.max | The maximum number of threads used to extract Ambari Views when Ambari Server is starting up. |`20` | 
 | view.extraction.threadpool.timeout | The time, in milliseconds, that non-core threads will live when extraction views on Ambari Server startup. |`100000` | 
@@ -270,7 +284,10 @@ The following are the properties which can be used to configure Ambari.
 | views.ambari.request.connect.timeout.millis | The amount of time, in milliseconds, that a view will wait when trying to connect on HTTP(S) operations to the Ambari REST API. |`30000` | 
 | views.ambari.request.read.timeout.millis | The amount of time, in milliseconds, that a view will wait before terminating an HTTP(S) read request to the Ambari REST API. |`45000` | 
 | views.dir | The directory on the Ambari Server file system used for expanding Views and storing webapp work. |`/var/lib/ambari-server/resources/views` | 
+| views.http.cache-control | The value that will be used to set the `Cache-Control` HTTP response header for Ambari View requests. |`no-store` | 
+| views.http.pragma | The value that will be used to set the `PRAGMA` HTTP response header for Ambari View requests. |`no-cache` | 
 | views.http.strict-transport-security | The value that will be used to set the `Strict-Transport-Security` HTTP response header for Ambari View requests. |`max-age=31536000` | 
+| views.http.x-content-type-options | The value that will be used to set the `X-CONTENT-TYPE` HTTP response header for Ambari View requests. |`nosniff` | 
 | views.http.x-frame-options | The value that will be used to set the `X-Frame-Options` HTTP response header for Ambari View requests. |`SAMEORIGIN` | 
 | views.http.x-xss-protection | The value that will be used to set the `X-XSS-Protection` HTTP response header for Ambari View requests. |`1; mode=block` | 
 | views.remove.undeployed | Determines whether remove undeployed views from the Ambari database. |`false` | 
@@ -316,4 +333,4 @@ EclipseLink properties can also be configured using a prefix of `server.persiste
 ```
 server.persistence.properties.eclipselink.jdbc.batch-writing.size=25
 server.persistence.properties.eclipselink.profiler=QueryMonitor
-```
+```
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/1e65ba69/ambari-server/src/main/java/org/apache/ambari/server/configuration/Configuration.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/configuration/Configuration.java b/ambari-server/src/main/java/org/apache/ambari/server/configuration/Configuration.java
index 9be8751..526e5be 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/configuration/Configuration.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/configuration/Configuration.java
@@ -1410,6 +1410,9 @@ public class Configuration {
   public static final ConfigurationProperty<Integer> KERBEROS_OPERATION_RETRIES = new ConfigurationProperty<>(
       "kerberos.operation.retries", 3);
 
+  @Markdown(description = "The time to wait (in seconds) between failed kerberos operations retries.")
+  public static final ConfigurationProperty<Integer> KERBEROS_OPERATION_RETRY_TIMEOUT = new ConfigurationProperty<>(
+      "kerberos.operation.retry.timeout", 10);
   /**
    * The type of connection pool to use with JDBC connections to the database.
    */
@@ -5812,6 +5815,10 @@ public class Configuration {
     return Integer.valueOf(getProperty(KERBEROS_OPERATION_RETRIES));
   }
 
+  public int getKerberosOperationRetryTimeout() {
+    return Integer.valueOf(getProperty(KERBEROS_OPERATION_RETRY_TIMEOUT));
+  }
+
   /**
    * Return configured acceptors for agent api connector. Default = null
    */

http://git-wip-us.apache.org/repos/asf/ambari/blob/1e65ba69/ambari-server/src/main/java/org/apache/ambari/server/serveraction/kerberos/MITKerberosOperationHandler.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/serveraction/kerberos/MITKerberosOperationHandler.java b/ambari-server/src/main/java/org/apache/ambari/server/serveraction/kerberos/MITKerberosOperationHandler.java
index 2f756fb..4b20973 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/serveraction/kerberos/MITKerberosOperationHandler.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/serveraction/kerberos/MITKerberosOperationHandler.java
@@ -473,9 +473,11 @@ public class MITKerberosOperationHandler extends KerberosOperationHandler {
       }
       tries++;
 
-      try { Thread.sleep(3000); } catch (InterruptedException e) {}
+      try { Thread.sleep(1000 * configuration.getKerberosOperationRetryTimeout()); } catch (InterruptedException e) {}
 
-      String message = String.format("Retrying to execute kadmin after a wait of 3 seconds :\n\tCommand: %s", command);
+      String message = String.format("Retrying to execute kadmin after a wait of %d seconds :\n\tCommand: %s",
+          configuration.getKerberosOperationRetryTimeout(),
+          command);
       LOG.warn(message);
     }
 
@@ -521,8 +523,8 @@ public class MITKerberosOperationHandler extends KerberosOperationHandler {
     /**
      * The queue of responses to return
      */
-    private final Queue<String> responses = new LinkedList<String>();
-
+    private LinkedList<String> responses;
+    private Queue<String> currentResponses;
 
     /**
      * Constructor.
@@ -531,6 +533,7 @@ public class MITKerberosOperationHandler extends KerberosOperationHandler {
      * @param userPassword  the user's password (optional)
      */
     public InteractivePasswordHandler(String adminPassword, String userPassword) {
+      responses = new LinkedList<String>();
 
       if (adminPassword != null) {
         responses.offer(adminPassword);
@@ -540,16 +543,23 @@ public class MITKerberosOperationHandler extends KerberosOperationHandler {
         responses.offer(userPassword);
         responses.offer(userPassword);  // Add a 2nd time for the password "confirmation" request
       }
+
+      currentResponses = new LinkedList<String>(responses);
     }
 
     @Override
     public boolean done() {
-      return responses.size() == 0;
+      return currentResponses.size() == 0;
     }
 
     @Override
     public String getResponse(String query) {
-      return responses.poll();
+      return currentResponses.poll();
+    }
+
+    @Override
+    public void start() {
+      currentResponses = new LinkedList<String>(responses);
     }
   }
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/1e65ba69/ambari-server/src/main/java/org/apache/ambari/server/utils/ShellCommandUtil.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/utils/ShellCommandUtil.java b/ambari-server/src/main/java/org/apache/ambari/server/utils/ShellCommandUtil.java
index 99f47c5..3152a0c 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/utils/ShellCommandUtil.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/utils/ShellCommandUtil.java
@@ -434,6 +434,8 @@ public class ShellCommandUtil {
       BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(process.getOutputStream()));
       BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream));
 
+      interactiveHandler.start();
+
       while (!interactiveHandler.done()) {
         StringBuilder query = new StringBuilder();
 
@@ -546,11 +548,18 @@ public class ShellCommandUtil {
     boolean done();
 
     /**
-     * Gnven a query, returns the relative response to send to the shell command (via stdin)
+     * Given a query, returns the relative response to send to the shell command (via stdin)
      *
      * @param query a string containing the query that needs a response
      * @return a string or null if no response is needed
      */
     String getResponse(String query);
+
+    /**
+     * Starts or resets this handler.
+     * <p>
+     * It is expected that the caller calls this before using handler.
+     */
+    void start();
   }
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/1e65ba69/ambari-server/src/test/java/org/apache/ambari/server/serveraction/kerberos/MITKerberosOperationHandlerTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/serveraction/kerberos/MITKerberosOperationHandlerTest.java b/ambari-server/src/test/java/org/apache/ambari/server/serveraction/kerberos/MITKerberosOperationHandlerTest.java
index 4c40a5d..39f4201 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/serveraction/kerberos/MITKerberosOperationHandlerTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/serveraction/kerberos/MITKerberosOperationHandlerTest.java
@@ -70,6 +70,7 @@ public class MITKerberosOperationHandlerTest extends KerberosOperationHandlerTes
       protected void configure() {
         Configuration configuration = EasyMock.createNiceMock(Configuration.class);
         expect(configuration.getServerOsFamily()).andReturn("redhat6").anyTimes();
+        expect(configuration.getKerberosOperationRetryTimeout()).andReturn(1).anyTimes();
         replay(configuration);
 
         bind(Clusters.class).toInstance(EasyMock.createNiceMock(Clusters.class));
@@ -547,6 +548,28 @@ public class MITKerberosOperationHandlerTest extends KerberosOperationHandlerTes
     handler.close();
   }
 
+  @Test
+  public void testInteractivePasswordHandler() {
+    MITKerberosOperationHandler.InteractivePasswordHandler handler = new MITKerberosOperationHandler.InteractivePasswordHandler("admin_password", "user_password");
+
+    handler.start();
+    Assert.assertEquals("admin_password", handler.getResponse("password"));
+    Assert.assertFalse(handler.done());
+    Assert.assertEquals("user_password", handler.getResponse("password"));
+    Assert.assertFalse(handler.done());
+    Assert.assertEquals("user_password", handler.getResponse("password"));
+    Assert.assertTrue(handler.done());
+
+    // Test restarting
+    handler.start();
+    Assert.assertEquals("admin_password", handler.getResponse("password"));
+    Assert.assertFalse(handler.done());
+    Assert.assertEquals("user_password", handler.getResponse("password"));
+    Assert.assertFalse(handler.done());
+    Assert.assertEquals("user_password", handler.getResponse("password"));
+    Assert.assertTrue(handler.done());
+  }
+
   private MITKerberosOperationHandler createMock(){
     return createMock(false);
   }

http://git-wip-us.apache.org/repos/asf/ambari/blob/1e65ba69/ambari-server/src/test/java/org/apache/ambari/server/utils/TestShellCommandUtil.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/utils/TestShellCommandUtil.java b/ambari-server/src/test/java/org/apache/ambari/server/utils/TestShellCommandUtil.java
index 34ac91f..24af9bd 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/utils/TestShellCommandUtil.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/utils/TestShellCommandUtil.java
@@ -126,17 +126,20 @@ public class TestShellCommandUtil {
 
       @Override
       public String getResponse(String query) {
-        if(query.contains("Arg1")) {
+        if (query.contains("Arg1")) {
           return "a1";
-        }
-        else if(query.contains("Arg2")) {
+        } else if (query.contains("Arg2")) {
           done = true; // this is the last expected prompt
           return "a2";
-        }
-        else {
+        } else {
           return null;
         }
       }
+
+      @Override
+      public void start() {
+
+      }
     };
 
     ShellCommandUtil.Result result = ShellCommandUtil.runCommand(new String[]{"./src/test/resources/interactive_shell_test.sh"}, null, interactiveHandler, false);


[21/50] [abbrv] ambari git commit: AMBARI-19047. Select Versions page: 'Remove' tooltip does not disappear (onechiporenko)

Posted by nc...@apache.org.
AMBARI-19047. Select Versions page: 'Remove' tooltip does not disappear (onechiporenko)


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

Branch: refs/heads/branch-dev-patch-upgrade
Commit: 9a72a6009c922f26ee47f2841a5ce89089a24883
Parents: 7c07dd3
Author: Oleg Nechiporenko <on...@apache.org>
Authored: Wed Nov 30 13:19:43 2016 +0200
Committer: Oleg Nechiporenko <on...@apache.org>
Committed: Thu Dec 1 14:51:46 2016 +0200

----------------------------------------------------------------------
 ambari-web/app/templates/wizard/step1.hbs | 2 +-
 ambari-web/app/views/wizard/step1_view.js | 7 +++++++
 2 files changed, 8 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/9a72a600/ambari-web/app/templates/wizard/step1.hbs
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates/wizard/step1.hbs b/ambari-web/app/templates/wizard/step1.hbs
index 312898c..5297d12 100644
--- a/ambari-web/app/templates/wizard/step1.hbs
+++ b/ambari-web/app/templates/wizard/step1.hbs
@@ -165,7 +165,7 @@
                           </table>
                         </td>
                         <td class="col-sm-1">
-                          <a class="action" href="#" {{action "removeOS" operatingSystem target="controller"}}>
+                          <a class="action" href="#" {{action "removeOS" operatingSystem target="view"}}>
                             <span class="icon icon-minus" {{translateAttr title="common.remove"}}></span>
                           </a>
                         </td>

http://git-wip-us.apache.org/repos/asf/ambari/blob/9a72a600/ambari-web/app/views/wizard/step1_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/wizard/step1_view.js b/ambari-web/app/views/wizard/step1_view.js
index b7a57ca..d5cbbb5 100644
--- a/ambari-web/app/views/wizard/step1_view.js
+++ b/ambari-web/app/views/wizard/step1_view.js
@@ -51,6 +51,8 @@ App.WizardStep1View = Em.View.extend({
     $("[rel=skip-validation-tooltip]").tooltip('destroy');
     $("[rel=use-redhat-tooltip]").tooltip('destroy');
     $('.add-os-button,.redhat-label').tooltip('destroy');
+    $('.icon-undo').tooltip('destroy');
+    $('.action .icon').tooltip('destroy');
   },
 
   /**
@@ -68,6 +70,11 @@ App.WizardStep1View = Em.View.extend({
     });
   },
 
+  removeOS() {
+    $('.action .icon').tooltip('destroy');
+    return this.get('controller').removeOS(...arguments);
+  },
+
   /**
    * Disable submit button flag
    *


[19/50] [abbrv] ambari git commit: AMBARI-19034 Upgrade History Displays Wrong Upgrade Type (atkach)

Posted by nc...@apache.org.
AMBARI-19034 Upgrade History Displays Wrong Upgrade Type (atkach)


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

Branch: refs/heads/branch-dev-patch-upgrade
Commit: 4b387915117412b7153a7c36b3f26412538b756d
Parents: dc5f4e2
Author: Andrii Tkach <at...@apache.org>
Authored: Thu Dec 1 12:11:52 2016 +0200
Committer: Andrii Tkach <at...@apache.org>
Committed: Thu Dec 1 12:48:41 2016 +0200

----------------------------------------------------------------------
 .../admin/stack_upgrade_history_controller.js   |   2 +-
 .../app/mappers/stack_upgrade_history_mapper.js |   2 +-
 ambari-web/app/messages.js                      |   1 +
 .../stack_version/stack_upgrade_history.js      |   2 +-
 ambari-web/app/styles/stack_versions.less       |  16 +--
 .../upgrade_history_details_view.js             |   2 +-
 .../admin/stack_upgrade/upgrade_history_view.js | 120 ++++++++++---------
 7 files changed, 75 insertions(+), 70 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/4b387915/ambari-web/app/controllers/main/admin/stack_upgrade_history_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/admin/stack_upgrade_history_controller.js b/ambari-web/app/controllers/main/admin/stack_upgrade_history_controller.js
index 3a78e30..4c9abfe 100644
--- a/ambari-web/app/controllers/main/admin/stack_upgrade_history_controller.js
+++ b/ambari-web/app/controllers/main/admin/stack_upgrade_history_controller.js
@@ -213,5 +213,5 @@ App.MainAdminStackUpgradeHistoryController = Em.ArrayController.extend({
     } else {
       return ''
     }
-  }.property('upgradeData.Upgrade.request_status'),
+  }.property('upgradeData.Upgrade.request_status')
 });

http://git-wip-us.apache.org/repos/asf/ambari/blob/4b387915/ambari-web/app/mappers/stack_upgrade_history_mapper.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/mappers/stack_upgrade_history_mapper.js b/ambari-web/app/mappers/stack_upgrade_history_mapper.js
index 63088a7..823ae80 100644
--- a/ambari-web/app/mappers/stack_upgrade_history_mapper.js
+++ b/ambari-web/app/mappers/stack_upgrade_history_mapper.js
@@ -50,5 +50,5 @@ App.stackUpgradeHistoryMapper = App.QuickDataMapper.create({
     App.store.loadMany(this.get('model'), result);
     App.store.commit();
     App.set('isStackUpgradeHistoryLoaded',true);
-  },
+  }
 });

http://git-wip-us.apache.org/repos/asf/ambari/blob/4b387915/ambari-web/app/messages.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/messages.js b/ambari-web/app/messages.js
index a16d0ea..90ad70f 100644
--- a/ambari-web/app/messages.js
+++ b/ambari-web/app/messages.js
@@ -346,6 +346,7 @@ Em.I18n.translations = {
   'common.end.time': 'End Time',
   'common.rolling': 'Rolling',
   'common.express': 'Express',
+  'common.hostOrdered': 'Host Ordered',
   'common.rolling.downgrade': 'Rolling Downgrade',
   'common.express.downgrade': 'Express Downgrade',
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/4b387915/ambari-web/app/models/stack_version/stack_upgrade_history.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/models/stack_version/stack_upgrade_history.js b/ambari-web/app/models/stack_version/stack_upgrade_history.js
index d4a89dc..9e0439c 100644
--- a/ambari-web/app/models/stack_version/stack_upgrade_history.js
+++ b/ambari-web/app/models/stack_version/stack_upgrade_history.js
@@ -31,7 +31,7 @@ App.StackUpgradeHistory = DS.Model.extend({
   skipServiceCheckFailures: DS.attr('boolean'),
   endTime: DS.attr('number'),
   startTime: DS.attr('number'),
-  createTime: DS.attr('number'),
+  createTime: DS.attr('number')
 });
 
 App.StackUpgradeHistory.FIXTURES = [];

http://git-wip-us.apache.org/repos/asf/ambari/blob/4b387915/ambari-web/app/styles/stack_versions.less
----------------------------------------------------------------------
diff --git a/ambari-web/app/styles/stack_versions.less b/ambari-web/app/styles/stack_versions.less
index f67e03e..6698dfa 100644
--- a/ambari-web/app/styles/stack_versions.less
+++ b/ambari-web/app/styles/stack_versions.less
@@ -444,8 +444,14 @@
   .method-options {
     margin: 10px;
 
+    .method-option {
+      margin-bottom: 5px;
+    }
     .img-thumbnail {
-
+      background-color: #e4e4e4;
+      .method-name,.method-icon,.method-description {
+        color: #333;
+      }
       cursor: pointer;
       border: none;
       width: 99%;
@@ -464,18 +470,12 @@
       }
     }
 
-    .ROLLING, .NON_ROLLING {
-      background-color: #e4e4e4;
-      .method-name,.method-icon,.method-description {
-        color: #333;
-      }
-    }
     .ROLLING {
       .method-icon {
         margin-left: 88px;
       }
     }
-    .NON_ROLLING {
+    .NON_ROLLING, .HOST_ORDERED {
       .method-icon {
         margin-left: 94px;
       }

http://git-wip-us.apache.org/repos/asf/ambari/blob/4b387915/ambari-web/app/views/main/admin/stack_upgrade/upgrade_history_details_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/admin/stack_upgrade/upgrade_history_details_view.js b/ambari-web/app/views/main/admin/stack_upgrade/upgrade_history_details_view.js
index 983c26a..dae236b 100644
--- a/ambari-web/app/views/main/admin/stack_upgrade/upgrade_history_details_view.js
+++ b/ambari-web/app/views/main/admin/stack_upgrade/upgrade_history_details_view.js
@@ -81,5 +81,5 @@ App.MainAdminStackUpgradeHistoryDetailsView = Em.View.extend({
     } else {
       return "";
     }
-  }.property('controller.upgradeData.Upgrade.request_status', 'controller.isDowngrade'),
+  }.property('controller.upgradeData.Upgrade.request_status', 'controller.isDowngrade')
 });
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/4b387915/ambari-web/app/views/main/admin/stack_upgrade/upgrade_history_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/admin/stack_upgrade/upgrade_history_view.js b/ambari-web/app/views/main/admin/stack_upgrade/upgrade_history_view.js
index 31e1478..8817308 100644
--- a/ambari-web/app/views/main/admin/stack_upgrade/upgrade_history_view.js
+++ b/ambari-web/app/views/main/admin/stack_upgrade/upgrade_history_view.js
@@ -75,7 +75,21 @@ App.MainAdminStackUpgradeHistoryView = App.TableView.extend(App.TableServerViewM
       labelKey: 'admin.stackVersions.upgradeHistory.filter.failed.downgrade',
       value: 'DOWNGRADE_FAILED',
       isSelected: false
+    })
+  ],
+  upgradeMethods: [
+    Em.Object.create({
+      displayName: Em.I18n.t('common.rolling'),
+      type: 'ROLLING'
+    }),
+    Em.Object.create({
+      displayName: Em.I18n.t('common.express'),
+      type: 'NON_ROLLING'
     }),
+    Em.Object.create({
+      displayName: Em.I18n.t('common.hostOrdered'),
+      type: 'HOST_ORDERED'
+    })
   ],
 
   /**
@@ -83,7 +97,7 @@ App.MainAdminStackUpgradeHistoryView = App.TableView.extend(App.TableServerViewM
    */
   selectedCategory: Em.computed.findBy('categories', 'isSelected', true),
 
-  filteredCount: function(){
+  filteredCount: function () {
     var filteredContent = this.get('filteredContent').toArray();
     return filteredContent.length;
   }.property('filteredContent'),
@@ -92,13 +106,12 @@ App.MainAdminStackUpgradeHistoryView = App.TableView.extend(App.TableServerViewM
    * displaying content filtered by upgrade type and upgrade status.
    */
   filteredContent: function () {
-    var result = [];
     var filterValue = 'ALL';
     var category = this.get('selectedCategory');
-    if (category)
+    if (category) {
       filterValue = category.get('value');
-    var result = this.filterBy(filterValue);
-    return result.reverse();
+    }
+    return this.filterBy(filterValue).reverse();
   }.property('selectedCategory'),
 
   /**
@@ -107,28 +120,25 @@ App.MainAdminStackUpgradeHistoryView = App.TableView.extend(App.TableServerViewM
   pageContent: function () {
     var content = this.get('filteredContent').toArray();
     content = this.processForDisplay(content);
-    content = content.slice(this.get('startIndex') - 1, this.get('endIndex'))
+    content = content.slice(this.get('startIndex') - 1, this.get('endIndex'));
     return content;
   }.property('filteredContent', 'startIndex', 'endIndex'),
 
-  processForDisplay: function(content){
+  processForDisplay: function (content) {
     var processedContent = [];
-    content.forEach(function(item){
-      if('UPGRADE' == item.get('direction'))
-        item.set('directionLabel', Em.I18n.t('common.upgrade'));
-      else
-        item.set('directionLabel', Em.I18n.t('common.downgrade'));
-
-      if('NON_ROLLING' == item.get('upgradeType'))
-        item.set('upgradeTypeLabel', Em.I18n.t('common.express'));
-      else
-        item.set('upgradeTypeLabel', Em.I18n.t('common.rolling'));
-
-      item.set('startTimeLabel', date.startTime(item.get('startTime')));
-      item.set('endTimeLabel', date.startTime(item.get('endTime')));
-      item.set('duration', date.durationSummary(item.get('startTime'), item.get('endTime')));
+
+    content.forEach(function (item) {
+      var direction = item.get('direction') === 'UPGRADE' ? Em.I18n.t('common.upgrade') : Em.I18n.t('common.downgrade');
+      var method = this.get('upgradeMethods').findProperty('type', item.get('upgradeType'));
+      item.setProperties({
+        directionLabel: direction,
+        upgradeTypeLabel: method ? method.get('displayName') : method,
+        startTimeLabel: date.startTime(item.get('startTime')),
+        endTimeLabel: date.startTime(item.get('endTime')),
+        duration: date.durationSummary(item.get('startTime'), item.get('endTime'))
+      });
       processedContent.push(item);
-    },this);
+    }, this);
     return processedContent;
   },
 
@@ -170,9 +180,9 @@ App.MainAdminStackUpgradeHistoryView = App.TableView.extend(App.TableServerViewM
     }
   },
 
-  willInsertElement: function(){
+  willInsertElement: function () {
     var self = this;
-    this.get('controller').loadStackUpgradeHistoryToModel().done(function(){
+    this.get('controller').loadStackUpgradeHistoryToModel().done(function () {
       self.populateUpgradeHistorySummary();
     });
   },
@@ -181,31 +191,31 @@ App.MainAdminStackUpgradeHistoryView = App.TableView.extend(App.TableServerViewM
     this.observesCategories();
   },
 
-  observesCategories: function(){
+  observesCategories: function () {
     this.get('categories').forEach(function (category) {
       var label = Em.I18n.t(category.labelKey).format(this.filterBy(category.value).length);
       category.set('label', label)
     }, this);
   }.observes('isReady'),
 
-  filterBy: function(filterValue){
+  filterBy: function (filterValue) {
     if ('ALL' == filterValue) {
       var all_records = App.StackUpgradeHistory.find();
       return all_records.toArray();
     } else {
       var tokens = filterValue.split('_');
-      var direction_token = null
-      var status_token = null
+      var direction_token = null;
+      var status_token = null;
 
       if (tokens.length == 1) {
         direction_token = tokens[0]
       } else if (tokens.length > 1) {
-        direction_token = tokens[0]
-        status_token = tokens[1]
+        direction_token = tokens[0];
+        status_token = tokens[1];
       }
 
-      var result = []
-      App.StackUpgradeHistory.find().forEach(function(item){
+      var result = [];
+      App.StackUpgradeHistory.find().forEach(function (item) {
         var direction = item.get('direction');
         if (direction == direction_token) {
           if (status_token != null) {
@@ -224,46 +234,46 @@ App.MainAdminStackUpgradeHistoryView = App.TableView.extend(App.TableServerViewM
     }
   },
 
-  selectCategory: function(event){
+  selectCategory: function (event) {
     this.get('categories').filterProperty('isSelected').setEach('isSelected', false);
     event.context.set('isSelected', true);
   },
 
-  populateUpgradeHistorySummary: function(){
+  populateUpgradeHistorySummary: function () {
     this.set('isReady', false);
     var result = [
       Em.Object.create({
         direction: 'UPGRADE',
-        label:Em.I18n.t('common.upgrade'),
+        label: Em.I18n.t('common.upgrade'),
         hasSuccess: false,
-        success:0,
+        success: 0,
         hasAbort: false,
-        abort:0,
+        abort: 0
       }),
       Em.Object.create({
         direction: 'DOWNGRADE',
-        label:Em.I18n.t('common.downgrade'),
+        label: Em.I18n.t('common.downgrade'),
         hasSuccess: false,
-        success:0,
+        success: 0,
         hasAbort: false,
-        abort:0,
+        abort: 0
       })
     ];
 
-    App.StackUpgradeHistory.find().forEach(function(item){
+    App.StackUpgradeHistory.find().forEach(function (item) {
       var direction = item.get('direction');
       var status = item.get('requestStatus');
-      if('UPGRADE' == direction){
-        if('COMPLETED' == status){
+      if ('UPGRADE' == direction) {
+        if ('COMPLETED' == status) {
           result[0].set('success', result[0].get('success') + 1);
         } else if ('ABORTED' == status) {
           result[0].set('abort', result[0].get('abort') + 1);
         }
-      } else if('DOWNGRADE' == direction){
-        if('COMPLETED' == status){
-          result[1].set('success', result[1].get('success')+1);
-        } else if ('ABORTED' == status){
-          result[1].set('abort', result[1].get('abort')+1);
+      } else if ('DOWNGRADE' == direction) {
+        if ('COMPLETED' == status) {
+          result[1].set('success', result[1].get('success') + 1);
+        } else if ('ABORTED' == status) {
+          result[1].set('abort', result[1].get('abort') + 1);
         }
       }
     }, this);
@@ -279,23 +289,17 @@ App.MainAdminStackUpgradeHistoryView = App.TableView.extend(App.TableServerViewM
 
   showUpgradeHistoryRecord: function (event) {
     var record = event.context;
-    var title = '';
     var direction = App.format.normalizeName(record.get('direction'));
-    var type = record.get('upgradeType');
-    if ('ROLLING' === type) {
-      type = App.format.normalizeName(type);
-    } else if ('NON_ROLLING' === type) {
-      type = 'Express'
-    }
-
-    title = Em.I18n.t('admin.stackVersions.upgradeHistory.record.title').format(type, direction, record.get('fromVersion'));
+    var fromVersion = record.get('fromVersion');
+    var type = this.get('upgradeMethods').findProperty('type', record.get('upgradeType'));
+    var displayName = type ? type.get('displayName') : App.format.normalizeName(record.get('upgradeType'));
 
     this.get('controller').set('currentUpgradeRecord', record);
 
     App.ModalPopup.show({
       classNames: ['wizard-modal-wrapper'],
       modalDialogClasses: ['modal-xlg'],
-      header: title,
+      header: Em.I18n.t('admin.stackVersions.upgradeHistory.record.title').format(displayName, direction, fromVersion),
       bodyClass: App.MainAdminStackUpgradeHistoryDetailsView,
       primary: Em.I18n.t('common.dismiss'),
       secondary: null,


[08/50] [abbrv] ambari git commit: AMBARI-19020. Ubuntu14/16 Add Support for Zookeeper on HDP 2.5 (Duc Le via ncole)

Posted by nc...@apache.org.
AMBARI-19020. Ubuntu14/16 Add Support for Zookeeper on HDP 2.5 (Duc Le via ncole)


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

Branch: refs/heads/branch-dev-patch-upgrade
Commit: 3a14b4afc9572b9aeb0310cdc0cd80700f27ee8d
Parents: fff9980
Author: Nate Cole <nc...@hortonworks.com>
Authored: Wed Nov 30 12:49:48 2016 -0500
Committer: Nate Cole <nc...@hortonworks.com>
Committed: Wed Nov 30 12:53:00 2016 -0500

----------------------------------------------------------------------
 .../stacks/HDP/2.5/services/ZOOKEEPER/metainfo.xml     | 13 +++++++++++++
 1 file changed, 13 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/3a14b4af/ambari-server/src/main/resources/stacks/HDP/2.5/services/ZOOKEEPER/metainfo.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.5/services/ZOOKEEPER/metainfo.xml b/ambari-server/src/main/resources/stacks/HDP/2.5/services/ZOOKEEPER/metainfo.xml
index de8ebd9..9b9477e 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.5/services/ZOOKEEPER/metainfo.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.5/services/ZOOKEEPER/metainfo.xml
@@ -21,6 +21,19 @@
     <service>
       <name>ZOOKEEPER</name>
       <version>3.4.6.2.5</version>
+      <osSpecifics>
+        <osSpecific>
+          <osFamily>ubuntu14,ubuntu16</osFamily>
+          <packages>
+            <package>
+              <name>zookeeper-${stack_version}</name>
+            </package>
+            <package>
+              <name>zookeeper-${stack_version}-server</name>
+            </package>
+          </packages>
+        </osSpecific>
+      </osSpecifics>
     </service>
   </services>
 </metainfo>


[42/50] [abbrv] ambari git commit: AMBARI-19055 - Removing Tasks From host_role_command Causes Upgrades To Show As PENDING (jonathanhurley)

Posted by nc...@apache.org.
AMBARI-19055 - Removing Tasks From host_role_command Causes Upgrades To Show As PENDING (jonathanhurley)


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

Branch: refs/heads/branch-dev-patch-upgrade
Commit: 32840c1ed434ae4cc99e3ab6f7d3f2604fb69d06
Parents: f4ea309
Author: Jonathan Hurley <jh...@hortonworks.com>
Authored: Thu Dec 1 15:49:06 2016 -0500
Committer: Jonathan Hurley <jh...@hortonworks.com>
Committed: Fri Dec 2 10:19:41 2016 -0500

----------------------------------------------------------------------
 .../controller/internal/CalculatedStatus.java   | 52 +++++++++++++++-----
 .../internal/RequestResourceProvider.java       | 34 ++++++++-----
 .../internal/StageResourceProvider.java         |  2 +-
 .../internal/CalculatedStatusTest.java          | 31 ++++++++++++
 .../internal/RequestResourceProviderTest.java   | 12 +++--
 5 files changed, 103 insertions(+), 28 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/32840c1e/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/CalculatedStatus.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/CalculatedStatus.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/CalculatedStatus.java
index 3a86aef..3c415df 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/CalculatedStatus.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/CalculatedStatus.java
@@ -53,6 +53,17 @@ public class CalculatedStatus {
    */
   private final double percent;
 
+  /**
+   * A status which represents a COMPLETED state at 0%
+   */
+  public static final CalculatedStatus COMPLETED = new CalculatedStatus(HostRoleStatus.COMPLETED,
+      HostRoleStatus.COMPLETED, 100.0);
+
+  /**
+   * A status which represents a PENDING state at 0%
+   */
+  public static final CalculatedStatus PENDING = new CalculatedStatus(HostRoleStatus.PENDING,
+      HostRoleStatus.PENDING, 0.0);
 
   // ----- Constructors ------------------------------------------------------
 
@@ -79,12 +90,6 @@ public class CalculatedStatus {
     this.percent = percent;
   }
 
-  /**
-   * Static factory method to get Status that represents a Completed state
-   */
-  public static CalculatedStatus getCompletedStatus() {
-    return new CalculatedStatus(HostRoleStatus.COMPLETED, HostRoleStatus.COMPLETED, 100.0);
-  }
 
   // ----- CalculatedStatus --------------------------------------------------
 
@@ -291,14 +296,25 @@ public class CalculatedStatus {
   }
 
   /**
-   * Calculates the overall status of an upgrade.
-   * @param stageDto  the map of stage-to-summary value objects
-   * @param stageIds  the stage ids to consider from the value objects
+   * Calculates the overall status of an upgrade. If there are no tasks, then a
+   * status of {@link HostRoleStatus#COMPLETED} is returned.
+   *
+   * @param stageDto
+   *          the map of stage-to-summary value objects
+   * @param stageIds
+   *          the stage ids to consider from the value objects
    * @return the calculated status
    */
   public static CalculatedStatus statusFromStageSummary(Map<Long, HostRoleCommandStatusSummaryDTO> stageDto,
       Set<Long> stageIds) {
 
+    // if either are empty, then we have no tasks and therefore no status - we
+    // should return COMPLETED. This can happen if someone removes all tasks but
+    // leaves the stages and request
+    if (stageDto.isEmpty() || stageIds.isEmpty()) {
+      return COMPLETED;
+    }
+
     Collection<HostRoleStatus> stageStatuses = new HashSet<>();
     Collection<HostRoleStatus> stageDisplayStatuses = new HashSet<>();
     Collection<HostRoleStatus> taskStatuses = new ArrayList<>();
@@ -378,19 +394,28 @@ public class CalculatedStatus {
    */
   public static HostRoleStatus calculateSummaryStatusOfStage(Map<HostRoleStatus, Integer> counters,
       int total, boolean skippable) {
+
+    // when there are 0 tasks, return COMPLETED
+    if (total == 0) {
+      return HostRoleStatus.COMPLETED;
+    }
+
     if (counters.get(HostRoleStatus.PENDING) == total) {
       return HostRoleStatus.PENDING;
     }
+
     // By definition, any tasks in a future stage must be held in a PENDING status.
     if (counters.get(HostRoleStatus.HOLDING) > 0 || counters.get(HostRoleStatus.HOLDING_FAILED) > 0 || counters.get(HostRoleStatus.HOLDING_TIMEDOUT) > 0) {
       return counters.get(HostRoleStatus.HOLDING) > 0 ? HostRoleStatus.HOLDING :
       counters.get(HostRoleStatus.HOLDING_FAILED) > 0 ? HostRoleStatus.HOLDING_FAILED :
       HostRoleStatus.HOLDING_TIMEDOUT;
     }
+
     // Because tasks are not skippable, guaranteed to be FAILED
     if (counters.get(HostRoleStatus.FAILED) > 0 && !skippable) {
       return HostRoleStatus.FAILED;
     }
+
     // Because tasks are not skippable, guaranteed to be TIMEDOUT
     if (counters.get(HostRoleStatus.TIMEDOUT) > 0  && !skippable) {
       return HostRoleStatus.TIMEDOUT;
@@ -401,9 +426,11 @@ public class CalculatedStatus {
     if (counters.get(HostRoleStatus.ABORTED) > 0 && numActiveTasks == 0) {
       return HostRoleStatus.ABORTED;
     }
+
     if (counters.get(HostRoleStatus.COMPLETED) == total) {
       return HostRoleStatus.COMPLETED;
     }
+
     return HostRoleStatus.IN_PROGRESS;
   }
 
@@ -415,7 +442,8 @@ public class CalculatedStatus {
    *
    * @return summary request status based on statuses of tasks in different states.
    */
-  private static HostRoleStatus calculateSummaryStatusOfUpgrade(Map<HostRoleStatus, Integer> counters, int total) {
+  protected static HostRoleStatus calculateSummaryStatusOfUpgrade(
+      Map<HostRoleStatus, Integer> counters, int total) {
     return calculateSummaryStatusOfStage(counters, total, false);
   }
 
@@ -428,8 +456,8 @@ public class CalculatedStatus {
    *
    * @return summary request status based on statuses of tasks in different states.
    */
-  private static HostRoleStatus calculateSummaryDisplayStatus(Map<HostRoleStatus, Integer> counters,
-                                                              int total, boolean skippable) {
+  protected static HostRoleStatus calculateSummaryDisplayStatus(
+      Map<HostRoleStatus, Integer> counters, int total, boolean skippable) {
     return counters.get(HostRoleStatus.SKIPPED_FAILED) > 0 ? HostRoleStatus.SKIPPED_FAILED :
            counters.get(HostRoleStatus.FAILED) > 0 ? HostRoleStatus.FAILED:
            calculateSummaryStatusOfStage(counters, total, skippable);

http://git-wip-us.apache.org/repos/asf/ambari/blob/32840c1e/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/RequestResourceProvider.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/RequestResourceProvider.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/RequestResourceProvider.java
index 8c1bc57..0690ee7 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/RequestResourceProvider.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/RequestResourceProvider.java
@@ -69,10 +69,10 @@ import org.apache.ambari.server.state.Cluster;
 import org.apache.ambari.server.state.Clusters;
 import org.apache.ambari.server.topology.LogicalRequest;
 import org.apache.ambari.server.topology.TopologyManager;
+import org.apache.commons.lang.StringUtils;
 
 import com.google.common.collect.Sets;
 import com.google.inject.Inject;
-import org.apache.commons.lang.StringUtils;
 
 /**
  * Resource provider for request resources.
@@ -566,13 +566,18 @@ public class RequestResourceProvider extends AbstractControllerResourceProvider
 
     @Override
     public boolean equals(Object o) {
-      if (this == o) return true;
-      if (o == null || getClass() != o.getClass()) return false;
+      if (this == o) {
+        return true;
+      }
+      if (o == null || getClass() != o.getClass()) {
+        return false;
+      }
 
       ServiceComponentTuple that = (ServiceComponentTuple) o;
 
-      if (serviceName != null ? !serviceName.equals(that.serviceName) : that.serviceName != null)
+      if (serviceName != null ? !serviceName.equals(that.serviceName) : that.serviceName != null) {
         return false;
+      }
       return !(componentName != null ? !componentName.equals(that.componentName) : that.componentName != null);
 
     }
@@ -739,15 +744,20 @@ public class RequestResourceProvider extends AbstractControllerResourceProvider
     // get summaries from TopologyManager for logical requests
     summary.putAll(topologyManager.getStageSummaries(entity.getRequestId()));
 
+    // summary might be empty due to delete host have cleared all
+    // HostRoleCommands or due to hosts haven't registered yet with the cluster
+    // when the cluster is provisioned with a Blueprint
+    final CalculatedStatus status;
     LogicalRequest logicalRequest = topologyManager.getRequest(entity.getRequestId());
-
-    CalculatedStatus status = CalculatedStatus.statusFromStageSummary(summary, summary.keySet());
-    if (summary.isEmpty() && logicalRequest == null) {
-
-      // summary might be empty due to delete host have cleared all HostRoleCommands
-      // or due to hosts haven't registered yet with the cluster when the cluster is provisioned
-      // with a Blueprint
-      status = CalculatedStatus.getCompletedStatus();
+    if (summary.isEmpty() && null != logicalRequest) {
+      // in this case, it appears that there are no tasks but this is a logical
+      // topology request, so it's a matter of hosts simply not registering yet
+      // for tasks to be created
+      status = CalculatedStatus.PENDING;
+    } else {
+      // there are either tasks or this is not a logical request, so do normal
+      // status calculations
+      status = CalculatedStatus.statusFromStageSummary(summary, summary.keySet());
     }
 
     setResourceProperty(resource, REQUEST_STATUS_PROPERTY_ID, status.getStatus().toString(), requestedPropertyIds);

http://git-wip-us.apache.org/repos/asf/ambari/blob/32840c1e/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/StageResourceProvider.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/StageResourceProvider.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/StageResourceProvider.java
index 59dd9d9..a778882 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/StageResourceProvider.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/StageResourceProvider.java
@@ -339,7 +339,7 @@ public class StageResourceProvider extends AbstractControllerResourceProvider im
     CalculatedStatus status;
     if (summary.isEmpty()) {
       // Delete host might have cleared all HostRoleCommands
-      status = CalculatedStatus.getCompletedStatus();
+      status = CalculatedStatus.COMPLETED;
     } else {
       status = CalculatedStatus.statusFromStageSummary(summary, Collections.singleton(entity.getStageId()));
     }

http://git-wip-us.apache.org/repos/asf/ambari/blob/32840c1e/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/CalculatedStatusTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/CalculatedStatusTest.java b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/CalculatedStatusTest.java
index 6f592cd..a96f395 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/CalculatedStatusTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/CalculatedStatusTest.java
@@ -657,6 +657,37 @@ public class CalculatedStatusTest {
     assertEquals(HostRoleStatus.IN_PROGRESS, calc.getStatus());
   }
 
+  /**
+   * Tests that when there are no tasks and all counts are 0, that the returned
+   * status is {@link HostRoleStatus#COMPLETED}.
+   *
+   * @throws Exception
+   */
+  @Test
+  public void testGetCompletedStatusForNoTasks() throws Exception {
+    // no status / no tasks
+    CalculatedStatus status = CalculatedStatus.statusFromTaskEntities(
+        new ArrayList<HostRoleCommandEntity>(), false);
+
+    assertEquals(HostRoleStatus.COMPLETED, status.getStatus());
+
+    // empty summaries
+    status = CalculatedStatus.statusFromStageSummary(
+        new HashMap<Long, HostRoleCommandStatusSummaryDTO>(), new HashSet<Long>());
+
+    assertEquals(HostRoleStatus.COMPLETED, status.getStatus());
+
+    // generate a map of 0's - COMPLETED=0, IN_PROGRESS=0, etc
+    Map<HostRoleStatus, Integer> counts = CalculatedStatus.calculateStatusCounts(new ArrayList<HostRoleStatus>());
+    Map<HostRoleStatus, Integer> displayCounts = CalculatedStatus.calculateStatusCounts(new ArrayList<HostRoleStatus>());
+
+    HostRoleStatus hostRoleStatus = CalculatedStatus.calculateSummaryStatusOfUpgrade(counts, 0);
+    HostRoleStatus hostRoleDisplayStatus = CalculatedStatus.calculateSummaryDisplayStatus(displayCounts, 0, false);
+
+    assertEquals(HostRoleStatus.COMPLETED, hostRoleStatus);
+    assertEquals(HostRoleStatus.COMPLETED, hostRoleDisplayStatus);
+  }
+
   private Collection<HostRoleCommandEntity> getTaskEntities(HostRoleStatus... statuses) {
     Collection<HostRoleCommandEntity> entities = new LinkedList<HostRoleCommandEntity>();
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/32840c1e/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/RequestResourceProviderTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/RequestResourceProviderTest.java b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/RequestResourceProviderTest.java
index 5dfc74d..f7dff11 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/RequestResourceProviderTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/RequestResourceProviderTest.java
@@ -20,11 +20,10 @@ package org.apache.ambari.server.controller.internal;
 
 
 import static org.apache.ambari.server.controller.internal.HostComponentResourceProvider.HOST_COMPONENT_STALE_CONFIGS_PROPERTY_ID;
-import org.apache.ambari.server.topology.Blueprint;
 import static org.easymock.EasyMock.anyObject;
 import static org.easymock.EasyMock.capture;
-import static org.easymock.EasyMock.expect;
 import static org.easymock.EasyMock.eq;
+import static org.easymock.EasyMock.expect;
 import static org.easymock.EasyMock.newCapture;
 import static org.powermock.api.easymock.PowerMock.createMock;
 import static org.powermock.api.easymock.PowerMock.createNiceMock;
@@ -77,6 +76,7 @@ import org.apache.ambari.server.security.authorization.AuthorizationHelperInitia
 import org.apache.ambari.server.security.authorization.RoleAuthorization;
 import org.apache.ambari.server.state.Cluster;
 import org.apache.ambari.server.state.Clusters;
+import org.apache.ambari.server.topology.Blueprint;
 import org.apache.ambari.server.topology.ClusterTopology;
 import org.apache.ambari.server.topology.HostGroupInfo;
 import org.apache.ambari.server.topology.LogicalRequest;
@@ -1200,7 +1200,7 @@ public class RequestResourceProviderTest {
       }
     }
     Assert.assertNotNull(propertyIdToAssert);
-    Assert.assertEquals("true", (String) propertyValueToAssert);
+    Assert.assertEquals("true", propertyValueToAssert);
   }
 
   @Test
@@ -1624,6 +1624,12 @@ public class RequestResourceProviderTest {
     verify(managementController, actionManager, clusters, requestMock, requestDAO, hrcDAO);
   }
 
+  /**
+   * Tests that topology requests return different status (PENDING) if there are
+   * no tasks. Normal requests should return COMPLETED.
+   *
+   * @throws Exception
+   */
   @Test
   @PrepareForTest(AmbariServer.class)
   public void testGetLogicalRequestStatusWithNoTasks() throws Exception {


[43/50] [abbrv] ambari git commit: Revert "AMBARI-18888: Ambari-agent: Create configuration files with JCEKS information"

Posted by nc...@apache.org.
Revert "AMBARI-18888: Ambari-agent: Create configuration files with JCEKS information"

This reverts commit 615438b272e6bd8efd37481ef684ae7d68921e64.


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

Branch: refs/heads/branch-dev-patch-upgrade
Commit: 60a6bd4575fb87fc26c4a277cbabf850ef2089e1
Parents: 32840c1
Author: Jonathan Hurley <jh...@hortonworks.com>
Authored: Fri Dec 2 10:50:50 2016 -0500
Committer: Jonathan Hurley <jh...@hortonworks.com>
Committed: Fri Dec 2 10:50:50 2016 -0500

----------------------------------------------------------------------
 ambari-agent/conf/unix/ambari-agent.ini         |   3 -
 .../ambari_agent/CustomServiceOrchestrator.py   | 120 -------------------
 ambari-agent/src/packages/tarball/all.xml       |  30 -----
 .../ambari/server/agent/ExecutionCommand.java   |  28 -----
 .../ambari/server/agent/HeartBeatHandler.java   |  10 +-
 .../server/agent/TestHeartbeatHandler.java      |  28 ++---
 6 files changed, 9 insertions(+), 210 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/60a6bd45/ambari-agent/conf/unix/ambari-agent.ini
----------------------------------------------------------------------
diff --git a/ambari-agent/conf/unix/ambari-agent.ini b/ambari-agent/conf/unix/ambari-agent.ini
index d6fcf5f..61948d4 100644
--- a/ambari-agent/conf/unix/ambari-agent.ini
+++ b/ambari-agent/conf/unix/ambari-agent.ini
@@ -46,9 +46,6 @@ keysdir=/var/lib/ambari-agent/keys
 server_crt=ca.crt
 passphrase_env_var_name=AMBARI_PASSPHRASE
 ssl_verify_cert=0
-credential_lib_dir=/var/lib/ambari-agent/cred/lib
-credential_conf_dir=/var/lib/ambari-agent/cred/conf
-credential_shell_cmd=org.apache.hadoop.security.alias.CredentialShell
 
 [services]
 pidLookupPath=/var/run/

http://git-wip-us.apache.org/repos/asf/ambari/blob/60a6bd45/ambari-agent/src/main/python/ambari_agent/CustomServiceOrchestrator.py
----------------------------------------------------------------------
diff --git a/ambari-agent/src/main/python/ambari_agent/CustomServiceOrchestrator.py b/ambari-agent/src/main/python/ambari_agent/CustomServiceOrchestrator.py
index 1eab0a5..7d61611 100644
--- a/ambari-agent/src/main/python/ambari_agent/CustomServiceOrchestrator.py
+++ b/ambari-agent/src/main/python/ambari_agent/CustomServiceOrchestrator.py
@@ -29,8 +29,6 @@ from FileCache import FileCache
 from AgentException import AgentException
 from PythonExecutor import PythonExecutor
 from PythonReflectiveExecutor import PythonReflectiveExecutor
-from resource_management.core.utils import PasswordString
-import subprocess
 import Constants
 import hostname
 
@@ -67,11 +65,6 @@ class CustomServiceOrchestrator():
   REFLECTIVELY_RUN_COMMANDS = FREQUENT_COMMANDS # -- commands which run a lot and often (this increases their speed)
   DONT_BACKUP_LOGS_FOR_COMMANDS = FREQUENT_COMMANDS
 
-  # Path where hadoop credential JARS will be available
-  DEFAULT_CREDENTIAL_SHELL_LIB_PATH = '/var/lib/ambari-agent/cred/lib'
-  DEFAULT_CREDENTIAL_CONF_DIR = '/var/lib/ambari-agent/cred/conf'
-  DEFAULT_CREDENTIAL_SHELL_CMD = 'org.apache.hadoop.security.alias.CredentialShell'
-
   def __init__(self, config, controller):
     self.config = config
     self.tmp_dir = config.get('agent', 'prefix')
@@ -85,14 +78,6 @@ class CustomServiceOrchestrator():
     # cache reset will be called on every agent registration
     controller.registration_listeners.append(self.file_cache.reset)
 
-    # Construct the hadoop credential lib JARs path
-    self.credential_shell_lib_path = os.path.join(config.get('security', 'credential_lib_dir',
-                                                             self.DEFAULT_CREDENTIAL_SHELL_LIB_PATH), '*')
-
-    self.credential_conf_dir = config.get('security', 'credential_conf_dir', self.DEFAULT_CREDENTIAL_CONF_DIR)
-
-    self.credential_shell_cmd = config.get('security', 'credential_shell_cmd', self.DEFAULT_CREDENTIAL_SHELL_CMD)
-
     # Clean up old status command files if any
     try:
       os.unlink(self.status_commands_stdout)
@@ -129,102 +114,6 @@ class CustomServiceOrchestrator():
     else:
       return PythonExecutor(self.tmp_dir, self.config)
 
-  def getProviderDirectory(self, service_name):
-    """
-    Gets the path to the service conf folder where the JCEKS file will be created.
-
-    :param service_name: Name of the service, for example, HIVE
-    :return: lower case path to the service conf folder
-    """
-
-    # The stack definition scripts of the service can move the
-    # JCEKS file around to where it wants, which is usually
-    # /etc/<service_name>/conf
-
-    conf_dir = os.path.join(self.credential_conf_dir, service_name.lower())
-    if not os.path.exists(conf_dir):
-      os.makedirs(conf_dir, 0644)
-
-    return conf_dir
-
-  def getAffectedConfigTypes(self, commandJson):
-    """
-    Gets the affected config types for the service in this command
-
-    :param commandJson:
-    :return:
-    """
-    return commandJson.get('configuration_attributes')
-
-  def getCredentialProviderPropertyName(self):
-    """
-    Gets the property name used by the hadoop credential provider
-    :return:
-    """
-    return 'hadoop.security.credential.provider.path'
-
-  def generateJceks(self, commandJson):
-    """
-    Generates the JCEKS file with passwords for the service specified in commandJson
-
-    :param commandJson: command JSON
-    :return: An exit value from the external process that generated the JCEKS file. None if
-    there are no passwords in the JSON.
-    """
-    cmd_result = None
-    roleCommand = None
-    if 'roleCommand' in commandJson:
-      roleCommand = commandJson['roleCommand']
-
-    logger.info('generateJceks: roleCommand={0}'.format(roleCommand))
-
-    # Password properties for a config type, if present,
-    # are under configuration_attributes:config_type:hidden:{prop1:attributes1, prop2, attributes2}
-    passwordProperties = {}
-    config_types = self.getAffectedConfigTypes(commandJson)
-    for config_type in config_types:
-      elem = config_types.get(config_type)
-      hidden = elem.get('hidden')
-      if hidden is not None:
-        passwordProperties[config_type] = hidden
-
-    # Set up the variables for the external command to generate a JCEKS file
-    java_home = commandJson['hostLevelParams']['java_home']
-    java_bin = '{java_home}/bin/java'.format(java_home=java_home)
-
-    cs_lib_path = self.credential_shell_lib_path
-    serviceName = commandJson['serviceName']
-
-    # Gather the password values and remove them from the configuration
-    configs = commandJson.get('configurations')
-    for key, value in passwordProperties.items():
-      config = configs.get(key)
-      if config is not None:
-        file_path = os.path.join(self.getProviderDirectory(serviceName), "{0}.jceks".format(key))
-        if os.path.exists(file_path):
-          os.remove(file_path)
-        provider_path = 'jceks://file{file_path}'.format(file_path=file_path)
-        logger.info('provider_path={0}'.format(provider_path))
-        for alias in value:
-          pwd = config.get(alias)
-          if pwd is not None:
-            # Remove the clear text password
-            config.pop(alias, None)
-            # Add JCEKS provider path instead
-            config[self.getCredentialProviderPropertyName()] = provider_path
-            logger.debug("config={0}".format(config))
-            protected_pwd = PasswordString(pwd)
-            # Generate the JCEKS file
-            cmd = (java_bin, '-cp', cs_lib_path, self.credential_shell_cmd, 'create',
-                   alias, '-value', protected_pwd, '-provider', provider_path)
-            logger.info(cmd)
-            cmd_result = subprocess.call(cmd)
-            logger.info('cmd_result = {0}'.format(cmd_result))
-            os.chmod(file_path, 0644) # group and others should have read access so that the service user can read
-
-    return cmd_result
-
-
   def runCommand(self, command, tmpoutfile, tmperrfile, forced_command_name=None,
                  override_output_files=True, retry=False):
     """
@@ -290,15 +179,6 @@ class CustomServiceOrchestrator():
         handle.on_background_command_started = self.map_task_to_process
         del command['__handle']
 
-      # If command contains credentialStoreEnabled, then
-      # generate the JCEKS file for the configurations.
-      credentialStoreEnabled = False
-      if 'credentialStoreEnabled' in command:
-        credentialStoreEnabled = (command['credentialStoreEnabled'] == "true")
-
-      if credentialStoreEnabled == True:
-        self.generateJceks(command)
-
       json_path = self.dump_command_to_json(command, retry)
       pre_hook_tuple = self.resolve_hook_script_path(hook_dir,
           self.PRE_HOOK_PREFIX, command_name, script_type)

http://git-wip-us.apache.org/repos/asf/ambari/blob/60a6bd45/ambari-agent/src/packages/tarball/all.xml
----------------------------------------------------------------------
diff --git a/ambari-agent/src/packages/tarball/all.xml b/ambari-agent/src/packages/tarball/all.xml
index f8a54e3..c481208 100644
--- a/ambari-agent/src/packages/tarball/all.xml
+++ b/ambari-agent/src/packages/tarball/all.xml
@@ -190,34 +190,4 @@
       <outputDirectory>/var/lib/${project.artifactId}/data</outputDirectory>
     </file>
   </files>
-  <moduleSets>
-    <moduleSet>
-      <binaries>
-        <includeDependencies>false</includeDependencies>
-        <outputDirectory>/var/lib/${project.artifactId}/cred/lib</outputDirectory>
-        <unpack>false</unpack>
-        <directoryMode>755</directoryMode>
-        <fileMode>644</fileMode>
-        <dependencySets>
-          <dependencySet>
-            <outputDirectory>/var/lib/${project.artifactId}/cred/lib</outputDirectory>
-            <unpack>false</unpack>
-            <includes>
-              <include>commons-cli:commons-cli</include>
-              <include>commons-collections:commons-collections</include>
-              <include>commons-configuration:commons-configuration</include>
-              <include>commons-io:commons-io:jar:${commons.io.version}</include>
-              <include>commons-lang:commons-lang</include>
-              <include>commons-logging:commons-logging</include>
-              <include>com.google.guava:guava</include>
-              <include>org.slf4j:slf4j-api</include>
-              <include>org.apache.hadoop:hadoop-common</include>
-              <include>org.apache.hadoop:hadoop-auth</include>
-              <include>org.apache.htrace:htrace-core</include>
-            </includes>
-          </dependencySet>
-        </dependencySets>
-      </binaries>
-    </moduleSet>
-  </moduleSets>
 </assembly>

http://git-wip-us.apache.org/repos/asf/ambari/blob/60a6bd45/ambari-server/src/main/java/org/apache/ambari/server/agent/ExecutionCommand.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/agent/ExecutionCommand.java b/ambari-server/src/main/java/org/apache/ambari/server/agent/ExecutionCommand.java
index 7353366..29737ee 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/agent/ExecutionCommand.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/agent/ExecutionCommand.java
@@ -112,13 +112,6 @@ public class ExecutionCommand extends AgentCommand {
   @SerializedName("availableServices")
   private Map<String, String> availableServices = new HashMap<>();
 
-  /**
-   * "true" or "false" indicating whether this
-   * service is enabled for credential store use.
-   */
-  @SerializedName("credentialStoreEnabled")
-  private String credentialStoreEnabled;
-
   public String getCommandId() {
     return commandId;
   }
@@ -302,27 +295,6 @@ public class ExecutionCommand extends AgentCommand {
 	this.serviceType = serviceType;
   }
 
-  /**
-   * Get a value indicating whether this service is enabled
-   * for credential store use.
-   *
-   * @return "true" or "false", any other value is
-   * considered as "false"
-   */
-  public String getCredentialStoreEnabled() {
-    return credentialStoreEnabled;
-  }
-
-  /**
-   * Set a value indicating whether this service is enabled
-   * for credential store use.
-   *
-   * @param credentialStoreEnabled
-   */
-  public void setCredentialStoreEnabled(String credentialStoreEnabled) {
-    this.credentialStoreEnabled = credentialStoreEnabled;
-  }
-
   public String getComponentName() {
     return componentName;
   }

http://git-wip-us.apache.org/repos/asf/ambari/blob/60a6bd45/ambari-server/src/main/java/org/apache/ambari/server/agent/HeartBeatHandler.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/agent/HeartBeatHandler.java b/ambari-server/src/main/java/org/apache/ambari/server/agent/HeartBeatHandler.java
index 48d11c4..75bef30 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/agent/HeartBeatHandler.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/agent/HeartBeatHandler.java
@@ -329,15 +329,7 @@ public class HeartBeatHandler {
           case BACKGROUND_EXECUTION_COMMAND:
           case EXECUTION_COMMAND: {
             ExecutionCommand ec = (ExecutionCommand)ac;
-            /*
-             * Set the value of credentialStore enabled before sending the command to agent.
-             */
-            Cluster cluster = clusterFsm.getCluster(ec.getClusterName());
-            Service service = cluster.getService(ec.getServiceName());
-            if (service != null) {
-              ec.setCredentialStoreEnabled(String.valueOf(service.isCredentialStoreEnabled()));
-            }
-            LOG.info("HeartBeatHandler.sendCommands: sending ExecutionCommand for host {}, role {}, roleCommand {}, and command ID {}, task ID {}",
+            LOG.info("HeartBeatHandler.sendCommands: sending ExecutionCommand for host {}, role {}, roleCommand {}, and command ID {}, taskId {}",
                      ec.getHostname(), ec.getRole(), ec.getRoleCommand(), ec.getCommandId(), ec.getTaskId());
             Map<String, String> hlp = ec.getHostLevelParams();
             if (hlp != null) {

http://git-wip-us.apache.org/repos/asf/ambari/blob/60a6bd45/ambari-server/src/test/java/org/apache/ambari/server/agent/TestHeartbeatHandler.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/agent/TestHeartbeatHandler.java b/ambari-server/src/test/java/org/apache/ambari/server/agent/TestHeartbeatHandler.java
index ac58f64..a50a116 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/agent/TestHeartbeatHandler.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/agent/TestHeartbeatHandler.java
@@ -48,7 +48,6 @@ import java.io.File;
 import java.io.FileWriter;
 import java.io.IOException;
 import java.util.ArrayList;
-import java.util.Collection;
 import java.util.Collections;
 import java.util.Date;
 import java.util.HashMap;
@@ -172,31 +171,22 @@ public class TestHeartbeatHandler {
     ActionManager am = actionManagerTestHelper.getMockActionManager();
     expect(am.getTasks(anyObject(List.class))).andReturn(new ArrayList<HostRoleCommand>());
     replay(am);
-
-    Cluster cluster = heartbeatTestHelper.getDummyCluster();
-    Service hdfs = cluster.addService(HDFS);
-    hdfs.addServiceComponent(DATANODE);
-    hdfs.addServiceComponent(NAMENODE);
-    hdfs.addServiceComponent(SECONDARY_NAMENODE);
-    Collection<Host> hosts = cluster.getHosts();
-    assertEquals(hosts.size(), 1);
-
     Clusters fsm = clusters;
-    Host hostObject = hosts.iterator().next();
+    fsm.addHost(DummyHostname1);
+    Host hostObject = clusters.getHost(DummyHostname1);
     hostObject.setIPv4("ipv4");
     hostObject.setIPv6("ipv6");
     hostObject.setOsType(DummyOsType);
 
-    String hostname = hostObject.getHostName();
     ActionQueue aq = new ActionQueue();
 
     HeartBeatHandler handler = new HeartBeatHandler(fsm, aq, am, injector);
     Register reg = new Register();
     HostInfo hi = new HostInfo();
-    hi.setHostName(hostname);
+    hi.setHostName(DummyHostname1);
     hi.setOS(DummyOs);
     hi.setOSRelease(DummyOSRelease);
-    reg.setHostname(hostname);
+    reg.setHostname(DummyHostname1);
     reg.setHardwareProfile(hi);
     reg.setAgentVersion(metaInfo.getServerVersion());
     handler.handleRegistration(reg);
@@ -205,21 +195,19 @@ public class TestHeartbeatHandler {
 
     ExecutionCommand execCmd = new ExecutionCommand();
     execCmd.setRequestAndStage(2, 34);
-    execCmd.setHostname(hostname);
-    execCmd.setClusterName(cluster.getClusterName());
-    execCmd.setServiceName(HDFS);
-    aq.enqueue(hostname, execCmd);
+    execCmd.setHostname(DummyHostname1);
+    aq.enqueue(DummyHostname1, new ExecutionCommand());
     HeartBeat hb = new HeartBeat();
     hb.setResponseId(0);
     HostStatus hs = new HostStatus(Status.HEALTHY, DummyHostStatus);
     List<Alert> al = new ArrayList<Alert>();
     al.add(new Alert());
     hb.setNodeStatus(hs);
-    hb.setHostname(hostname);
+    hb.setHostname(DummyHostname1);
 
     handler.handleHeartBeat(hb);
     assertEquals(HostState.HEALTHY, hostObject.getState());
-    assertEquals(0, aq.dequeueAll(hostname).size());
+    assertEquals(0, aq.dequeueAll(DummyHostname1).size());
   }
 
 


[35/50] [abbrv] ambari git commit: AMBARI-18956. Ambari attempts to commit transactions marked as rollback-only (magyari_sandor)

Posted by nc...@apache.org.
AMBARI-18956. Ambari attempts to commit transactions marked as rollback-only (magyari_sandor)


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

Branch: refs/heads/branch-dev-patch-upgrade
Commit: 73d372b8db6b4809fac98338aef1c04ae4c95c92
Parents: d24beb1
Author: Sandor Magyari <sm...@hortonworks.com>
Authored: Fri Dec 2 09:43:24 2016 +0100
Committer: Sandor Magyari <sm...@hortonworks.com>
Committed: Fri Dec 2 09:43:24 2016 +0100

----------------------------------------------------------------------
 .../orm/AmbariJpaLocalTxnInterceptor.java       |   9 +-
 .../orm/AmbariJpaLocalTxnInterceptorTest.java   | 155 +++++++++++++++++++
 2 files changed, 162 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/73d372b8/ambari-server/src/main/java/org/apache/ambari/server/orm/AmbariJpaLocalTxnInterceptor.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/orm/AmbariJpaLocalTxnInterceptor.java b/ambari-server/src/main/java/org/apache/ambari/server/orm/AmbariJpaLocalTxnInterceptor.java
index d7ba463..e19192a 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/orm/AmbariJpaLocalTxnInterceptor.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/orm/AmbariJpaLocalTxnInterceptor.java
@@ -218,12 +218,17 @@ public class AmbariJpaLocalTxnInterceptor implements MethodInterceptor {
   /**
    * Returns True if rollback DID NOT HAPPEN (i.e. if commit should continue).
    *
-   * @param transactional The metadata annotaiton of the method
+   * @param transactional The metadata annotation of the method
    * @param e             The exception to test for rollback
    * @param txn           A JPA Transaction to issue rollbacks on
    */
-  private boolean rollbackIfNecessary(Transactional transactional, Exception e,
+  static boolean rollbackIfNecessary(Transactional transactional, Exception e,
                                       EntityTransaction txn) {
+    if (txn.getRollbackOnly()) {
+      txn.rollback();
+      return false;
+    }
+
     boolean commit = true;
 
     //check rollback clauses

http://git-wip-us.apache.org/repos/asf/ambari/blob/73d372b8/ambari-server/src/test/java/org/apache/ambari/server/orm/AmbariJpaLocalTxnInterceptorTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/orm/AmbariJpaLocalTxnInterceptorTest.java b/ambari-server/src/test/java/org/apache/ambari/server/orm/AmbariJpaLocalTxnInterceptorTest.java
new file mode 100644
index 0000000..ea7ea53
--- /dev/null
+++ b/ambari-server/src/test/java/org/apache/ambari/server/orm/AmbariJpaLocalTxnInterceptorTest.java
@@ -0,0 +1,155 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.ambari.server.orm;
+
+import com.google.inject.persist.Transactional;
+import org.easymock.EasyMockSupport;
+import org.junit.Assert;
+import org.junit.Test;
+
+import javax.persistence.EntityTransaction;
+
+import java.io.FileNotFoundException;
+import java.io.IOException;
+
+import static org.apache.ambari.server.orm.AmbariJpaLocalTxnInterceptor.rollbackIfNecessary;
+import static org.easymock.EasyMock.expect;
+
+public class AmbariJpaLocalTxnInterceptorTest extends EasyMockSupport {
+
+  @Test
+  public void canBeCommittedIfExceptionsToBeRolledBackOnIsEmpty() {
+    Transactional transactional = createNiceMock(Transactional.class);
+    EntityTransaction transaction = createStrictMock(EntityTransaction.class);
+
+    expect(transaction.getRollbackOnly()).andReturn(false);
+    expect(transactional.rollbackOn()).andReturn(new Class[0]);
+
+    replayAll();
+
+    boolean canCommit = rollbackIfNecessary(transactional, new RuntimeException(), transaction);
+    Assert.assertTrue("Should be allowed to commit, since rollbackOn clause is empty", canCommit);
+
+    verifyAll();
+  }
+
+  @Test
+  public void canBeCommittedIfUnknownExceptionThrown() {
+    Transactional transactional = createNiceMock(Transactional.class);
+    EntityTransaction transaction = createStrictMock(EntityTransaction.class);
+
+    expect(transaction.getRollbackOnly()).andReturn(false);
+    expect(transactional.rollbackOn()).andReturn(new Class[] { IllegalArgumentException.class });
+
+    replayAll();
+
+    boolean canCommit = rollbackIfNecessary(transactional, new RuntimeException(), transaction);
+    Assert.assertTrue("Should be allowed to commit, exception thrown does not match rollbackOn clause", canCommit);
+
+    verifyAll();
+  }
+
+  @Test
+  public void rolledBackForKnownException() {
+    Transactional transactional = createNiceMock(Transactional.class);
+    EntityTransaction transaction = createStrictMock(EntityTransaction.class);
+
+    expect(transaction.getRollbackOnly()).andReturn(false);
+    expect(transactional.rollbackOn()).andReturn(new Class[] {
+      NullPointerException.class, IllegalArgumentException.class
+    });
+    expect(transactional.ignore()).andReturn(new Class[0]);
+    transaction.rollback();
+
+    replayAll();
+
+    boolean canCommit = rollbackIfNecessary(transactional, new IllegalArgumentException("rolling back"), transaction);
+    Assert.assertFalse("Should be rolled back, since exception matches rollbackOn clause", canCommit);
+
+    verifyAll();
+  }
+
+  @Test
+  public void rolledBackForSubclassOfKnownException() {
+    Transactional transactional = createNiceMock(Transactional.class);
+    EntityTransaction transaction = createStrictMock(EntityTransaction.class);
+
+    expect(transaction.getRollbackOnly()).andReturn(false);
+    expect(transactional.rollbackOn()).andReturn(new Class[] { RuntimeException.class });
+    expect(transactional.ignore()).andReturn(new Class[0]);
+    transaction.rollback();
+
+    replayAll();
+
+    boolean canCommit = rollbackIfNecessary(transactional, new IllegalArgumentException("rolling back"), transaction);
+    Assert.assertFalse("Should be rolled back, since exception is subclass of the one in rollbackOn clause", canCommit);
+
+    verifyAll();
+  }
+
+  @Test
+  public void canBeCommittedIfIgnoredExceptionThrown() {
+    Transactional transactional = createNiceMock(Transactional.class);
+    EntityTransaction transaction = createStrictMock(EntityTransaction.class);
+
+    expect(transaction.getRollbackOnly()).andReturn(false);
+    expect(transactional.rollbackOn()).andReturn(new Class[] { IllegalArgumentException.class });
+    expect(transactional.ignore()).andReturn(new Class[] { NumberFormatException.class });
+
+    replayAll();
+
+    boolean canCommit = rollbackIfNecessary(transactional, new NumberFormatException("rolling back"), transaction);
+    Assert.assertTrue("Should be allowed to commit, since ignored exception was thrown", canCommit);
+
+    verifyAll();
+  }
+
+  @Test
+  public void canBeCommittedIfSubclassOfIgnoredExceptionThrown() {
+    Transactional transactional = createNiceMock(Transactional.class);
+    EntityTransaction transaction = createStrictMock(EntityTransaction.class);
+
+    expect(transaction.getRollbackOnly()).andReturn(false);
+    expect(transactional.rollbackOn()).andReturn(new Class[] { Exception.class });
+    expect(transactional.ignore()).andReturn(new Class[] { IOException.class });
+
+    replayAll();
+
+    boolean canCommit = rollbackIfNecessary(transactional, new FileNotFoundException("rolling back"), transaction);
+    Assert.assertTrue("Should be allowed to commit, since subclass of ignored exception was thrown", canCommit);
+
+    verifyAll();
+  }
+
+  @Test
+  public void rolledBackIfTransactionMarkedRollbackOnly() {
+    Transactional transactional = createNiceMock(Transactional.class);
+    EntityTransaction transaction = createStrictMock(EntityTransaction.class);
+
+    expect(transaction.getRollbackOnly()).andReturn(true);
+    transaction.rollback();
+
+    replayAll();
+
+    boolean canCommit = rollbackIfNecessary(transactional, null, transaction);
+    Assert.assertFalse("Should be rolled back, since transaction was marked rollback-only", canCommit);
+
+    verifyAll();
+  }
+
+}


[27/50] [abbrv] ambari git commit: AMBARI-18780. Fix livy configuration upgrade from HDP 2.5 to HDP 2.6 (Jeff Zhang via smohanty)

Posted by nc...@apache.org.
AMBARI-18780. Fix livy configuration upgrade from HDP 2.5 to HDP 2.6 (Jeff Zhang via smohanty)


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

Branch: refs/heads/branch-dev-patch-upgrade
Commit: 6100be63867209de5dd5eaae6087aad850e25466
Parents: bb8be5b
Author: Sumit Mohanty <sm...@hortonworks.com>
Authored: Thu Dec 1 07:46:20 2016 -0800
Committer: Sumit Mohanty <sm...@hortonworks.com>
Committed: Thu Dec 1 07:46:45 2016 -0800

----------------------------------------------------------------------
 .../stacks/HDP/2.5/upgrades/config-upgrade.xml          | 12 ++++++++++++
 .../stacks/HDP/2.5/upgrades/nonrolling-upgrade-2.6.xml  |  4 ++++
 .../resources/stacks/HDP/2.5/upgrades/upgrade-2.6.xml   |  3 +++
 3 files changed, 19 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/6100be63/ambari-server/src/main/resources/stacks/HDP/2.5/upgrades/config-upgrade.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.5/upgrades/config-upgrade.xml b/ambari-server/src/main/resources/stacks/HDP/2.5/upgrades/config-upgrade.xml
index 87ede63..9ddb667 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.5/upgrades/config-upgrade.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.5/upgrades/config-upgrade.xml
@@ -44,5 +44,17 @@
         </changes>
       </component>
     </service>
+
+    <service name="SPARK">
+      <component name="LIVY_SERVER">
+        <changes>
+          <definition xsi:type="configure" id="hdp_2_5_0_0_rename_spark_livy_configs">
+            <type>livy-conf</type>
+            <transfer operation="move" from-key="livy.server.kerberos.keytab" to-key="livy.server.launch.kerberos.keytab" />
+            <transfer operation="move" from-key="livy.server.kerberos.principal" to-key="livy.server.launch.kerberos.principal" />
+          </definition>
+        </changes>
+      </component>
+    </service>
   </services>
 </upgrade-config-changes>

http://git-wip-us.apache.org/repos/asf/ambari/blob/6100be63/ambari-server/src/main/resources/stacks/HDP/2.5/upgrades/nonrolling-upgrade-2.6.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.5/upgrades/nonrolling-upgrade-2.6.xml b/ambari-server/src/main/resources/stacks/HDP/2.5/upgrades/nonrolling-upgrade-2.6.xml
index fc4c8c5..c13ad99 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.5/upgrades/nonrolling-upgrade-2.6.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.5/upgrades/nonrolling-upgrade-2.6.xml
@@ -59,6 +59,10 @@
           <function>prepare</function>
         </task>
       </execute-stage>
+
+      <execute-stage service="SPARK" component="LIVY_SERVER" title="Apply config changes for Livy Server">
+        <task xsi:type="configure" id="hdp_2_5_0_0_rename_spark_livy_configs"/>
+      </execute-stage>
     </group>
 
     <group xsi:type="stop" name="STOP_HIGH_LEVEL_SERVICE_COMPONENTS" title="Stop Components for High-Level Services">

http://git-wip-us.apache.org/repos/asf/ambari/blob/6100be63/ambari-server/src/main/resources/stacks/HDP/2.5/upgrades/upgrade-2.6.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.5/upgrades/upgrade-2.6.xml b/ambari-server/src/main/resources/stacks/HDP/2.5/upgrades/upgrade-2.6.xml
index eb4309a..1f7c1a8 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.5/upgrades/upgrade-2.6.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.5/upgrades/upgrade-2.6.xml
@@ -761,6 +761,9 @@
         </upgrade>
       </component>
       <component name="LIVY_SERVER">
+        <pre-upgrade>
+          <task xsi:type="configure" id="hdp_2_5_0_0_rename_spark_livy_configs" />
+        </pre-upgrade>
         <upgrade>
           <task xsi:type="restart-task" />
         </upgrade>


[48/50] [abbrv] ambari git commit: AMBARI-19049. Alerts Popup displays full error stacktrace instead of minimal content (alexantonenko)

Posted by nc...@apache.org.
AMBARI-19049. Alerts Popup displays full error stacktrace instead of minimal content (alexantonenko)


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

Branch: refs/heads/branch-dev-patch-upgrade
Commit: def3b0ae85b968c7dd41307f4c671bf07d4fc826
Parents: 9348725
Author: Alex Antonenko <hi...@gmail.com>
Authored: Fri Dec 2 15:18:46 2016 +0200
Committer: Alex Antonenko <hi...@gmail.com>
Committed: Fri Dec 2 20:13:17 2016 +0200

----------------------------------------------------------------------
 .../controllers/main/service/info/summary.js    | 37 +++++++++++---------
 .../main/service/info/service_alert_popup.hbs   | 15 +++++---
 2 files changed, 31 insertions(+), 21 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/def3b0ae/ambari-web/app/controllers/main/service/info/summary.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/service/info/summary.js b/ambari-web/app/controllers/main/service/info/summary.js
index 88a6581..fc423fe 100644
--- a/ambari-web/app/controllers/main/service/info/summary.js
+++ b/ambari-web/app/controllers/main/service/info/summary.js
@@ -386,25 +386,30 @@ App.MainServiceInfoSummaryController = Em.Controller.extend(App.WidgetSectionMix
           var property = context.get('componentName') ? 'componentName' : 'serviceName';
           var serviceDefinitions = this.get('controller.content').filterProperty(property, context.get(property));
           // definitions should be sorted in order: critical, warning, ok, unknown, other
-          var criticalDefinitions = [], warningDefinitions = [], okDefinitions = [], unknownDefinitions = [];
+          var definitionTypes = {
+            "isCritical": [],
+            "isWarning": [],
+            "isOK": [],
+            "isUnknown": []
+          };
+
           serviceDefinitions.forEach(function (definition) {
-            if (definition.get('isCritical')) {
-              criticalDefinitions.push(definition);
-              serviceDefinitions = serviceDefinitions.without(definition);
-            } else if (definition.get('isWarning')) {
-              warningDefinitions.push(definition);
-              serviceDefinitions = serviceDefinitions.without(definition);
-            } else if (definition.get('isOK')) {
-              okDefinitions.push(definition);
-              serviceDefinitions = serviceDefinitions.without(definition);
-            } else if (definition.get('isUnknown')) {
-              unknownDefinitions.push(definition);
-              serviceDefinitions = serviceDefinitions.without(definition);
-            }
+            Object.keys(definitionTypes).forEach(function (type) {
+              if (definition.get(type)) {
+                definition.set('isCollapsed', true);
+                definitionTypes[type].push(definition);
+                serviceDefinitions = serviceDefinitions.without(definition);
+              }
+            });
           });
-          serviceDefinitions = criticalDefinitions.concat(warningDefinitions, okDefinitions, unknownDefinitions, serviceDefinitions);
+          serviceDefinitions = definitionTypes.isCritical.concat(definitionTypes.isWarning, definitionTypes.isOK, definitionTypes.isUnknown, serviceDefinitions);
+
           return serviceDefinitions;
         }.property('controller.content'),
+        onToggleBlock: function (alert) {
+          this.$('#' + alert.context.clientId).toggle('blind', 500);
+          alert.context.set("isCollapsed", !alert.context.get("isCollapsed"));
+        },
         gotoAlertDetails: function (event) {
           if (event && event.context) {
             this.get('parentView').hide();
@@ -856,4 +861,4 @@ App.MainServiceInfoSummaryController = Em.Controller.extend(App.WidgetSectionMix
     App.router.route('main' + event.context.href);
   }
 
-});
\ No newline at end of file
+});

http://git-wip-us.apache.org/repos/asf/ambari/blob/def3b0ae/ambari-web/app/templates/main/service/info/service_alert_popup.hbs
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates/main/service/info/service_alert_popup.hbs b/ambari-web/app/templates/main/service/info/service_alert_popup.hbs
index 3c132a3..8b72a50 100644
--- a/ambari-web/app/templates/main/service/info/service_alert_popup.hbs
+++ b/ambari-web/app/templates/main/service/info/service_alert_popup.hbs
@@ -22,11 +22,16 @@
       <li class="alert-list-wrap">
         <div class="row">
           <div class="col-md-8 name-text">
-            <div>
-              <a href="#" {{action "gotoAlertDetails" alert target="view"}}>{{alert.label}}</a>
-            </div>
-            <div class="definition-latest-text">
-              {{alert.latestText}}
+            <div class="accordion-group block">
+              <div class="accordion-heading" {{action "onToggleBlock" alert target="view"}}>
+                <i {{bindAttr class=":pull-left :accordion-toggle alert.isCollapsed:icon-caret-right:icon-caret-down"}}></i>
+                <a class="accordion-toggle" href="#" {{action "gotoAlertDetails" alert target="view"}}>{{alert.label}}</a>
+              </div>
+              <div id="{{unbound alert.clientId}}" class="accordion-body collapse in" style="display: none">
+                <div class="accordion-inner definition-latest-text">
+                  {{alert.latestText}}
+                </div>
+              </div>
             </div>
           </div>
           <div class="col-md-4 status-col" rel="alert-status-tooltip" >


[32/50] [abbrv] ambari git commit: AMBARI-19054 : Grafana failed to start at deployment (avijayan)

Posted by nc...@apache.org.
AMBARI-19054 : Grafana failed to start at deployment (avijayan)


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

Branch: refs/heads/branch-dev-patch-upgrade
Commit: 7577ebb264ae71f81e6572510500f1b87ac46a18
Parents: 406b245
Author: Aravindan Vijayan <av...@hortonworks.com>
Authored: Thu Dec 1 13:27:16 2016 -0800
Committer: Aravindan Vijayan <av...@hortonworks.com>
Committed: Thu Dec 1 13:27:16 2016 -0800

----------------------------------------------------------------------
 .../ambari-metrics-grafana/conf/unix/ambari-metrics-grafana    | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/7577ebb2/ambari-metrics/ambari-metrics-grafana/conf/unix/ambari-metrics-grafana
----------------------------------------------------------------------
diff --git a/ambari-metrics/ambari-metrics-grafana/conf/unix/ambari-metrics-grafana b/ambari-metrics/ambari-metrics-grafana/conf/unix/ambari-metrics-grafana
index 472942e..8a8ac8f 100644
--- a/ambari-metrics/ambari-metrics-grafana/conf/unix/ambari-metrics-grafana
+++ b/ambari-metrics/ambari-metrics-grafana/conf/unix/ambari-metrics-grafana
@@ -104,7 +104,7 @@ case "$1" in
 
     # Prepare environment
     # mkdir -p "$LOG_DIR" "$DATA_DIR" && chown "$GRAFANA_USER":"$GRAFANA_GROUP" "$LOG_DIR" "$DATA_DIR"
-    # touch "$PID_FILE" && chown "$GRAFANA_USER":"$GRAFANA_GROUP" "$PID_FILE"
+    touch "$PID_FILE" && chown "$GRAFANA_USER":"$GRAFANA_GROUP" "$PID_FILE"
 
     # if [ -n "$MAX_OPEN_FILES" ]; then
     #   ulimit -n $MAX_OPEN_FILES
@@ -116,10 +116,10 @@ case "$1" in
     return=$?
     if [ $return -eq 0 ]
     then
-      sleep 1
+      sleep 5
       # check if pid file has been written two
       if ! [[ -s $PID_FILE ]]; then
-        echo "Start FAILED" >> $LOG_FILE
+        echo "Start FAILED because daemon did not write pid in pid_file" >> $LOG_FILE
         exit 1
       fi
       i=0


[46/50] [abbrv] ambari git commit: AMBARI-19064 Refactor widgets on Dashboard page. (atkach)

Posted by nc...@apache.org.
http://git-wip-us.apache.org/repos/asf/ambari/blob/9348725b/ambari-web/test/views/main/dashboard/widget_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/views/main/dashboard/widget_test.js b/ambari-web/test/views/main/dashboard/widget_test.js
index 0544ff6..63da712 100644
--- a/ambari-web/test/views/main/dashboard/widget_test.js
+++ b/ambari-web/test/views/main/dashboard/widget_test.js
@@ -21,178 +21,84 @@ require('views/main/dashboard/widget');
 
 describe('App.DashboardWidgetView', function () {
 
-  var dashboardWidgetView = App.DashboardWidgetView.create({
+  var dashboardWidgetView;
+
+  dashboardWidgetView = App.DashboardWidgetView.create({
     parentView: Em.Object.create({
       widgetsMapper: Em.K,
-      getUserPref: function () {return {complete: Em.K}},
+      getUserPref: function () {
+        return {complete: Em.K}
+      },
       postUserPref: Em.K,
       translateToReal: Em.K,
       visibleWidgets: [],
       hiddenWidgets: []
+    }),
+    widget: Em.Object.create({
+      id: 5,
+      sourceName: 'HDFS',
+      title: 'Widget'
     })
   });
 
   describe('#viewID', function () {
     it('viewID is computed with id', function () {
-      dashboardWidgetView.set('id', 5);
       expect(dashboardWidgetView.get('viewID')).to.equal('widget-5');
     });
   });
 
   describe('#model', function () {
-    it('model_type is null', function () {
-      dashboardWidgetView.set('model_type', null);
+
+    beforeEach(function() {
+      sinon.stub(dashboardWidgetView, 'findModelBySource').returns(Em.Object.create({serviceName: 'HDFS'}));
+    });
+
+    afterEach(function() {
+      dashboardWidgetView.findModelBySource.restore();
+    });
+
+    it('sourceName is null', function () {
+      dashboardWidgetView.set('widget.sourceName', null);
       dashboardWidgetView.propertyDidChange('model');
-      expect(dashboardWidgetView.get('model')).to.eql({});
+      expect(dashboardWidgetView.get('model')).to.be.an.object;
     });
-    it('model_type is valid', function () {
-      dashboardWidgetView.set('model_type', 's');
+    it('sourceName is valid', function () {
+      dashboardWidgetView.set('widget.sourceName', 'HDFS');
       dashboardWidgetView.propertyDidChange('model');
-      dashboardWidgetView.set('parentView.s_model', {'s': {}});
-      expect(dashboardWidgetView.get('model')).to.eql({'s': {}});
+      expect(dashboardWidgetView.get('model')).to.eql(Em.Object.create({serviceName: 'HDFS'}));
     });
   });
 
   describe("#didInsertElement()", function () {
-    before(function () {
+
+    beforeEach(function () {
       sinon.stub(App, 'tooltip', Em.K);
     });
-    after(function () {
+    afterEach(function () {
       App.tooltip.restore();
     });
+
     it("call App.tooltip", function () {
       dashboardWidgetView.didInsertElement();
       expect(App.tooltip.calledOnce).to.be.true;
     });
   });
 
-  describe("#deleteWidget()", function () {
-    beforeEach(function () {
-      sinon.stub(dashboardWidgetView.get('parentView'), 'widgetsMapper').returns({});
-      sinon.stub(dashboardWidgetView.get('parentView'), 'getUserPref').returns({
-        complete: Em.K
-      });
-    });
-
-    afterEach(function () {
-      dashboardWidgetView.get('parentView').widgetsMapper.restore();
-      dashboardWidgetView.get('parentView').getUserPref.restore();
-    });
-
-    it("testMode is off", function () {
-      dashboardWidgetView.set('parentView.persistKey', 'key');
-      dashboardWidgetView.deleteWidget();
-      expect(dashboardWidgetView.get('parentView').getUserPref.calledWith('key')).to.be.true;
-    });
-  });
+  describe("#editWidget()", function () {
 
-  describe("#deleteWidgetComplete()", function () {
     beforeEach(function () {
-      sinon.spy(dashboardWidgetView.get('parentView'), 'postUserPref');
-      sinon.spy(dashboardWidgetView.get('parentView'), 'translateToReal');
-      dashboardWidgetView.set('parentView.currentPrefObject', {
-        dashboardVersion: 'new',
-        visible: ['1', '2'],
-        hidden: [],
-        threshold: 'threshold'
-      });
-      dashboardWidgetView.set('parentView.persistKey', 'key');
-      dashboardWidgetView.deleteWidgetComplete();
-    });
-    afterEach(function () {
-      dashboardWidgetView.get('parentView').postUserPref.restore();
-      dashboardWidgetView.get('parentView').translateToReal.restore();
-    });
-    it("postUserPref is called with correct data", function () {
-      var arg = JSON.parse(JSON.stringify(dashboardWidgetView.get('parentView').postUserPref.args[0][1]));
-      expect(arg).to.be.eql({
-        dashboardVersion: 'new',
-        visible: ['1', '2'],
-        hidden: [[5, null]],
-        threshold: 'threshold'
-      });
-    });
-    it("translateToReal is called with valid data", function () {
-      var arg = JSON.parse(JSON.stringify(dashboardWidgetView.get('parentView').translateToReal.args[0][0]));
-      expect(arg).to.be.eql({
-        dashboardVersion: 'new',
-        visible: ['1', '2'],
-        hidden: [[5, null]],
-        threshold: 'threshold'
-      });
-    });
-  });
-
-  describe("#editWidget()", function () {
-    before(function () {
       sinon.stub(dashboardWidgetView, 'showEditDialog', Em.K);
     });
-    after(function () {
+    afterEach(function () {
       dashboardWidgetView.showEditDialog.restore();
     });
+
     it("call showEditDialog", function () {
       dashboardWidgetView.editWidget();
       expect(dashboardWidgetView.showEditDialog.calledOnce).to.be.true;
     });
   });
 
-  describe("#showEditDialog()", function () {
-    var obj = Em.Object.create({
-      observeThresh1Value: Em.K,
-      observeThresh2Value: Em.K,
-      thresh1: '1',
-      thresh2: '2'
-    });
-    beforeEach(function () {
-      sinon.spy(obj, 'observeThresh1Value');
-      sinon.spy(obj, 'observeThresh2Value');
-      sinon.stub(dashboardWidgetView.get('parentView'), 'getUserPref').returns({
-        complete: Em.K
-      });
-      var popup = dashboardWidgetView.showEditDialog(obj);
-      popup.onPrimary();
-    });
-    afterEach(function () {
-      obj.observeThresh1Value.restore();
-      obj.observeThresh2Value.restore();
-      dashboardWidgetView.get('parentView').getUserPref.restore();
-    });
-
-    it("observeThresh1Value is called once", function () {
-      expect(obj.observeThresh1Value.calledOnce).to.be.true;
-    });
-
-    it("observeThresh2Value is called once", function () {
-      expect(obj.observeThresh2Value.calledOnce).to.be.true;
-    });
-
-    it("thresh1 = 1", function () {
-      expect(dashboardWidgetView.get('thresh1')).to.equal(1);
-    });
-
-    it("thresh2 = 2", function () {
-      expect(dashboardWidgetView.get('thresh2')).to.equal(2);
-    });
-
-    it("getUserPref is called once", function () {
-      expect(dashboardWidgetView.get('parentView').getUserPref.calledOnce).to.be.true;
-    });
-  });
-
-  describe('#model', function () {
-    it('model_type is null', function () {
-      dashboardWidgetView.set('model_type', null);
-      dashboardWidgetView.propertyDidChange('model');
-      expect(dashboardWidgetView.get('model')).to.eql({});
-    });
-    it('model_type is valid', function () {
-      dashboardWidgetView.set('model_type', 's');
-      dashboardWidgetView.propertyDidChange('model');
-      dashboardWidgetView.set('parentView.s_model', {'s': {}});
-      expect(dashboardWidgetView.get('model')).to.eql({'s': {}});
-    });
-  });
-
   describe('#hoverContentTopClass', function () {
     var tests = [
       {
@@ -258,7 +164,7 @@ describe('App.DashboardWidgetView', function () {
       var testCases = [
         {
           data: {
-            thresh1: '',
+            thresholdMin: '',
             maxValue: 0
           },
           result: {
@@ -268,7 +174,7 @@ describe('App.DashboardWidgetView', function () {
         },
         {
           data: {
-            thresh1: 'NaN',
+            thresholdMin: 'NaN',
             maxValue: 0
           },
           result: {
@@ -278,7 +184,7 @@ describe('App.DashboardWidgetView', function () {
         },
         {
           data: {
-            thresh1: '-1',
+            thresholdMin: '-1',
             maxValue: 0
           },
           result: {
@@ -288,7 +194,7 @@ describe('App.DashboardWidgetView', function () {
         },
         {
           data: {
-            thresh1: '2',
+            thresholdMin: '2',
             maxValue: 1
           },
           result: {
@@ -298,8 +204,8 @@ describe('App.DashboardWidgetView', function () {
         },
         {
           data: {
-            thresh1: '1',
-            thresh2: '1',
+            thresholdMin: '1',
+            thresholdMax: '1',
             maxValue: 2
           },
           result: {
@@ -309,8 +215,8 @@ describe('App.DashboardWidgetView', function () {
         },
         {
           data: {
-            thresh1: '1',
-            thresh2: '0',
+            thresholdMin: '1',
+            thresholdMax: '0',
             maxValue: 2
           },
           result: {
@@ -320,8 +226,8 @@ describe('App.DashboardWidgetView', function () {
         },
         {
           data: {
-            thresh1: '1',
-            thresh2: '2',
+            thresholdMin: '1',
+            thresholdMax: '2',
             maxValue: 2
           },
           result: {
@@ -331,12 +237,12 @@ describe('App.DashboardWidgetView', function () {
         }
       ];
       testCases.forEach(function (test) {
-        describe("thresh1 - " + test.data.thresh1 + ', maxValue - ' + test.data.maxValue, function () {
+        describe("thresholdMin - " + test.data.thresholdMin + ', maxValue - ' + test.data.maxValue, function () {
 
           beforeEach(function () {
             widget.set('isThresh2Error', false);
-            widget.set('thresh2', test.data.thresh2 || "");
-            widget.set('thresh1', test.data.thresh1);
+            widget.set('thresholdMax', test.data.thresholdMax || "");
+            widget.set('thresholdMin', test.data.thresholdMin);
             widget.set('maxValue', test.data.maxValue);
             widget.observeThresh1Value();
           });
@@ -367,7 +273,7 @@ describe('App.DashboardWidgetView', function () {
       var testCases = [
         {
           data: {
-            thresh2: '',
+            thresholdMax: '',
             maxValue: 0
           },
           result: {
@@ -377,7 +283,7 @@ describe('App.DashboardWidgetView', function () {
         },
         {
           data: {
-            thresh2: 'NaN',
+            thresholdMax: 'NaN',
             maxValue: 0
           },
           result: {
@@ -387,7 +293,7 @@ describe('App.DashboardWidgetView', function () {
         },
         {
           data: {
-            thresh2: '-1',
+            thresholdMax: '-1',
             maxValue: 0
           },
           result: {
@@ -397,7 +303,7 @@ describe('App.DashboardWidgetView', function () {
         },
         {
           data: {
-            thresh2: '2',
+            thresholdMax: '2',
             maxValue: 1
           },
           result: {
@@ -407,7 +313,7 @@ describe('App.DashboardWidgetView', function () {
         },
         {
           data: {
-            thresh2: '2',
+            thresholdMax: '2',
             maxValue: 2
           },
           result: {
@@ -417,10 +323,10 @@ describe('App.DashboardWidgetView', function () {
         }
       ];
       testCases.forEach(function (test) {
-        describe("thresh2 - " + test.data.thresh2 + ', maxValue - ' + test.data.maxValue, function () {
+        describe("thresholdMax - " + test.data.thresholdMax + ', maxValue - ' + test.data.maxValue, function () {
 
           beforeEach(function () {
-            widget.set('thresh2', test.data.thresh2 || "");
+            widget.set('thresholdMax', test.data.thresholdMax || "");
             widget.set('maxValue', test.data.maxValue);
             widget.observeThresh2Value();
           });

http://git-wip-us.apache.org/repos/asf/ambari/blob/9348725b/ambari-web/test/views/main/dashboard/widgets/hbase_average_load_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/views/main/dashboard/widgets/hbase_average_load_test.js b/ambari-web/test/views/main/dashboard/widgets/hbase_average_load_test.js
index e3a08c9..8cb3246 100644
--- a/ambari-web/test/views/main/dashboard/widgets/hbase_average_load_test.js
+++ b/ambari-web/test/views/main/dashboard/widgets/hbase_average_load_test.js
@@ -82,8 +82,8 @@ describe('App.HBaseAverageLoadView', function() {
 
   App.TestAliases.testAsComputedAlias(getView(), 'data', 'model.averageLoad', 'number');
 
-  App.TestAliases.testAsComputedGtProperties(getView(), 'isRed', 'data', 'thresh2');
+  App.TestAliases.testAsComputedGtProperties(getView(), 'isRed', 'data', 'thresholdMax');
 
-  App.TestAliases.testAsComputedLteProperties(getView(), 'isGreen', 'data', 'thresh1');
+  App.TestAliases.testAsComputedLteProperties(getView(), 'isGreen', 'data', 'thresholdMin');
 
 });

http://git-wip-us.apache.org/repos/asf/ambari/blob/9348725b/ambari-web/test/views/main/dashboard/widgets/hbase_regions_in_transition_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/views/main/dashboard/widgets/hbase_regions_in_transition_test.js b/ambari-web/test/views/main/dashboard/widgets/hbase_regions_in_transition_test.js
index 8ad1531..4366ab6 100644
--- a/ambari-web/test/views/main/dashboard/widgets/hbase_regions_in_transition_test.js
+++ b/ambari-web/test/views/main/dashboard/widgets/hbase_regions_in_transition_test.js
@@ -23,7 +23,7 @@ require('views/main/dashboard/widgets/text_widget');
 require('views/main/dashboard/widget');
 
 function getView() {
-  return App.HBaseRegionsInTransitionView.create({model_type:null});
+  return App.HBaseRegionsInTransitionView.create({});
 }
 
 describe('App.HBaseRegionsInTransitionView', function() {
@@ -81,9 +81,9 @@ describe('App.HBaseRegionsInTransitionView', function() {
 
   App.TestAliases.testAsComputedAlias(getView(), 'data', 'model.regionsInTransition', 'number');
 
-  App.TestAliases.testAsComputedGtProperties(getView(), 'isRed', 'data', 'thresh2');
+  App.TestAliases.testAsComputedGtProperties(getView(), 'isRed', 'data', 'thresholdMax');
 
-  App.TestAliases.testAsComputedLteProperties(getView(), 'isGreen', 'data', 'thresh1');
+  App.TestAliases.testAsComputedLteProperties(getView(), 'isGreen', 'data', 'thresholdMin');
 
   App.TestAliases.testAsComputedAnd(getView(), 'isOrange', ['!isGreen', '!isRed']);
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/9348725b/ambari-web/test/views/main/dashboard/widgets/namenode_rpc_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/views/main/dashboard/widgets/namenode_rpc_test.js b/ambari-web/test/views/main/dashboard/widgets/namenode_rpc_test.js
index 474d099..15b7503 100644
--- a/ambari-web/test/views/main/dashboard/widgets/namenode_rpc_test.js
+++ b/ambari-web/test/views/main/dashboard/widgets/namenode_rpc_test.js
@@ -35,7 +35,6 @@ describe('App.NameNodeRpcView', function() {
         nameNodeRpc: 1
       },
       e: {
-        isOrange: true,
         isNA: false,
         content: '1.00 ms',
         data: '1.00'
@@ -46,7 +45,6 @@ describe('App.NameNodeRpcView', function() {
         nameNodeRpc: 10
       },
       e: {
-        isOrange: false,
         isNA: false,
         content: '10.00 ms',
         data: '10.00'
@@ -57,7 +55,6 @@ describe('App.NameNodeRpcView', function() {
         nameNodeRpc: 0
       },
       e: {
-        isOrange: false,
         isNA: false,
         content: '0 ms',
         data: 0
@@ -68,7 +65,6 @@ describe('App.NameNodeRpcView', function() {
         nameNodeRpc: null
       },
       e: {
-        isOrange: false,
         isNA: true,
         content: Em.I18n.t('services.service.summary.notAvailable'),
         data: null
@@ -78,24 +74,21 @@ describe('App.NameNodeRpcView', function() {
 
   tests.forEach(function(test) {
     describe('nameNodeRpc - ' + test.model.nameNodeRpc, function() {
-      var jobTrackerRpcView = App.NameNodeRpcView.create({model_type:null, model: test.model});
+      var jobTrackerRpcView = App.NameNodeRpcView.create({model: test.model});
       it('content', function() {
         expect(jobTrackerRpcView.get('content')).to.equal(test.e.content);
       });
       it('data', function() {
         expect(jobTrackerRpcView.get('data')).to.equal(test.e.data);
       });
-      it('isOrange', function() {
-        expect(jobTrackerRpcView.get('isOrange')).to.equal(test.e.isOrange);
-      });
       it('isNA', function() {
         expect(jobTrackerRpcView.get('isNA')).to.equal(test.e.isNA);
       });
     });
   });
 
-  App.TestAliases.testAsComputedGtProperties(getView(), 'isRed', 'data', 'thresh2');
+  App.TestAliases.testAsComputedGtProperties(getView(), 'isRed', 'data', 'thresholdMax');
 
-  App.TestAliases.testAsComputedLteProperties(getView(), 'isGreen', 'data', 'thresh1');
+  App.TestAliases.testAsComputedLteProperties(getView(), 'isGreen', 'data', 'thresholdMin');
 
 });

http://git-wip-us.apache.org/repos/asf/ambari/blob/9348725b/ambari-web/test/views/main/dashboard/widgets/text_widget_single_threshold_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/views/main/dashboard/widgets/text_widget_single_threshold_test.js b/ambari-web/test/views/main/dashboard/widgets/text_widget_single_threshold_test.js
index e564922..3136c35 100644
--- a/ambari-web/test/views/main/dashboard/widgets/text_widget_single_threshold_test.js
+++ b/ambari-web/test/views/main/dashboard/widgets/text_widget_single_threshold_test.js
@@ -22,7 +22,7 @@ require('views/main/dashboard/widget');
 require('views/main/dashboard/widgets/text_widget_single_threshold');
 
 function getView() {
-  return App.TextDashboardSingleThresholdWidgetView.create({thresh1:0});
+  return App.TextDashboardSingleThresholdWidgetView.create({thresholdMin:0});
 }
 
 describe('App.TextDashboardSingleThresholdWidgetView', function() {
@@ -43,8 +43,8 @@ describe('App.TextDashboardSingleThresholdWidgetView', function() {
   ];
 
   tests.forEach(function(test) {
-    describe('data - ' + test.data + ' | thresh1 - 0', function() {
-      var textDashboardWidgetSingleThresholdView = App.TextDashboardSingleThresholdWidgetView.create({thresh1:0});
+    describe('data - ' + test.data + ' | thresholdMin - 0', function() {
+      var textDashboardWidgetSingleThresholdView = App.TextDashboardSingleThresholdWidgetView.create({thresholdMin:0});
       textDashboardWidgetSingleThresholdView.set('data', test.data);
       it('isNA', function() {
         expect(textDashboardWidgetSingleThresholdView.get('isNA')).to.equal(test.e.isNA);
@@ -52,6 +52,6 @@ describe('App.TextDashboardSingleThresholdWidgetView', function() {
     });
   });
 
-  App.TestAliases.testAsComputedGtProperties(getView(), 'isRed', 'data', 'thresh1');
-  App.TestAliases.testAsComputedLteProperties(getView(), 'isGreen', 'data', 'thresh1');
+  App.TestAliases.testAsComputedGtProperties(getView(), 'isRed', 'data', 'thresholdMin');
+  App.TestAliases.testAsComputedLteProperties(getView(), 'isGreen', 'data', 'thresholdMin');
 });

http://git-wip-us.apache.org/repos/asf/ambari/blob/9348725b/ambari-web/test/views/main/dashboard/widgets/text_widget_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/views/main/dashboard/widgets/text_widget_test.js b/ambari-web/test/views/main/dashboard/widgets/text_widget_test.js
index 730e209..096d782 100644
--- a/ambari-web/test/views/main/dashboard/widgets/text_widget_test.js
+++ b/ambari-web/test/views/main/dashboard/widgets/text_widget_test.js
@@ -22,7 +22,7 @@ require('views/main/dashboard/widget');
 require('views/main/dashboard/widgets/text_widget');
 
 function getView() {
-  return App.TextDashboardWidgetView.create({thresh1:40, thresh2:70});
+  return App.TextDashboardWidgetView.create({thresholdMin:40, thresholdMax:70});
 }
 
 describe('App.TextDashboardWidgetView', function() {
@@ -43,8 +43,8 @@ describe('App.TextDashboardWidgetView', function() {
   ];
 
   tests.forEach(function(test) {
-    describe('data - ' + test.data + ' | thresh1 - 40 | thresh2 - 70', function() {
-      var textDashboardWidgetView = App.TextDashboardWidgetView.create({thresh1:40, thresh2:70});
+    describe('data - ' + test.data + ' | thresholdMin - 40 | thresholdMax - 70', function() {
+      var textDashboardWidgetView = App.TextDashboardWidgetView.create({thresholdMin:40, thresholdMax:70});
       textDashboardWidgetView.set('data', test.data);
       it('isNA', function() {
         expect(textDashboardWidgetView.get('isNA')).to.equal(test.e.isNA);
@@ -52,9 +52,9 @@ describe('App.TextDashboardWidgetView', function() {
     });
   });
 
-  App.TestAliases.testAsComputedGtProperties(getView(), 'isGreen', 'data', 'thresh2');
+  App.TestAliases.testAsComputedGtProperties(getView(), 'isGreen', 'data', 'thresholdMax');
 
-  App.TestAliases.testAsComputedLteProperties(getView(), 'isRed', 'data', 'thresh1');
+  App.TestAliases.testAsComputedLteProperties(getView(), 'isRed', 'data', 'thresholdMin');
 
   App.TestAliases.testAsComputedAnd(getView(), 'isOrange', ['!isGreen', '!isRed']);
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/9348725b/ambari-web/test/views/main/dashboard/widgets/uptime_text_widget_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/views/main/dashboard/widgets/uptime_text_widget_test.js b/ambari-web/test/views/main/dashboard/widgets/uptime_text_widget_test.js
index fbe2694..fa20593 100644
--- a/ambari-web/test/views/main/dashboard/widgets/uptime_text_widget_test.js
+++ b/ambari-web/test/views/main/dashboard/widgets/uptime_text_widget_test.js
@@ -25,7 +25,7 @@ var uptimeTextDashboardWidgetView;
 describe('App.UptimeTextDashboardWidgetView', function() {
 
   beforeEach(function () {
-    uptimeTextDashboardWidgetView = App.UptimeTextDashboardWidgetView.create({thresh1:40, thresh2:70});
+    uptimeTextDashboardWidgetView = App.UptimeTextDashboardWidgetView.create({thresholdMin:40, thresholdMax:70});
   });
 
   describe('#timeConverter', function() {

http://git-wip-us.apache.org/repos/asf/ambari/blob/9348725b/ambari-web/test/views/main/dashboard/widgets_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/views/main/dashboard/widgets_test.js b/ambari-web/test/views/main/dashboard/widgets_test.js
index 0781c79..707087a 100644
--- a/ambari-web/test/views/main/dashboard/widgets_test.js
+++ b/ambari-web/test/views/main/dashboard/widgets_test.js
@@ -25,526 +25,325 @@ require('views/main/dashboard/widgets');
 
 describe('App.MainDashboardWidgetsView', function () {
 
-  var view = App.MainDashboardWidgetsView.create();
-
-  describe('#setInitPrefObject', function () {
-    var hostMetricsWidgetsCount = 4;
-    var hdfsWidgetsCount = 7;
-    var hbaseWidgetsCount = 4;
-    var yarnWidgetsCount = 4;
-    var totalWidgetsCount = 20;
-    var tests = Em.A([
-      {
-        models: {
-          host_metrics_model: null,
-          hdfs_model: null,
-          hbase_model: null,
-          yarn_model: null
-        },
-        e: {
-          visibleL: totalWidgetsCount - hostMetricsWidgetsCount - hdfsWidgetsCount - hbaseWidgetsCount - yarnWidgetsCount - 1,
-          hiddenL: 0
-        },
-        m: 'All models are null'
-      },
-      {
-        models: {
-          host_metrics_model: {},
-          hdfs_model: null,
-          hbase_model: null,
-          yarn_model: null
-        },
-        e: {
-          visibleL: totalWidgetsCount - hdfsWidgetsCount - hbaseWidgetsCount - yarnWidgetsCount - 1,
-          hiddenL: 0
-        },
-        m: 'hdfs_model, hbase_model, yarn_model are null'
-      },
-      {
-        models: {
-          host_metrics_model: {},
-          hdfs_model: {},
-          hbase_model: null,
-          yarn_model: null
-        },
-        e: {
-          visibleL: totalWidgetsCount - hbaseWidgetsCount - yarnWidgetsCount - 1,
-          hiddenL: 0
-        },
-        m: 'hbase_model, yarn_model are null'
-      },
-      {
-        models: {
-          host_metrics_model: {},
-          hdfs_model: {},
-          hbase_model: null,
-          yarn_model: null
-        },
-        e: {
-          visibleL: totalWidgetsCount - hbaseWidgetsCount - yarnWidgetsCount - 1,
-          hiddenL: 0
-        },
-        m: 'hbase_model and yarn_model are null'
-      },
-      {
-        models: {
-          host_metrics_model: {},
-          hdfs_model: {},
-          hbase_model: {},
-          yarn_model: null
-        },
-        e: {
-          visibleL: totalWidgetsCount - yarnWidgetsCount - 1,
-          hiddenL: 1
-        },
-        m: 'yarn_model is null'
-      },
-      {
-        models: {
-          host_metrics_model: {},
-          hdfs_model: {},
-          hbase_model: {},
-          yarn_model: {}
-        },
-        e: {
-          visibleL: totalWidgetsCount - 1,
-          hiddenL: 1
-        },
-        m: 'All models are not null'
-      }
-    ]);
+  var view;
+
+  beforeEach(function() {
+    view = App.MainDashboardWidgetsView.create({
+      getUserPref: Em.K,
+      postUserPref: Em.K,
+      setDBProperty: Em.K,
+      persistKey: 'key'
+    });
+  });
+
+  describe('#didInsertElement()', function() {
 
     beforeEach(function() {
-      sinon.stub(view, 'resolveConfigDependencies');
+      sinon.stub(view, 'loadWidgetsSettings').returns({
+        complete: Em.clb
+      });
+      sinon.stub(view, 'checkServicesChange');
+      sinon.stub(view, 'renderWidgets');
+      sinon.stub(Em.run, 'next');
+      view.didInsertElement();
     });
 
     afterEach(function() {
-      view.resolveConfigDependencies.restore();
+      view.loadWidgetsSettings.restore();
+      view.checkServicesChange.restore();
+      view.renderWidgets.restore();
+      Em.run.next.restore();
     });
 
-    tests.forEach(function (test) {
-      describe(test.m, function () {
-
-        beforeEach(function () {
-          view.set('host_metrics_model', test.models.host_metrics_model);
-          view.set('hdfs_model', test.models.hdfs_model);
-          view.set('hbase_model', test.models.hbase_model);
-          view.set('yarn_model', test.models.yarn_model);
-          view.setInitPrefObject();
-        });
-
-        it('visible.length is ' + test.e.visibleL, function () {
-          expect(view.get('initPrefObject.visible.length')).to.equal(test.e.visibleL);
-        });
-
-        it('hidden.length is ' + test.e.hiddenL, function () {
-          expect(view.get('initPrefObject.hidden.length')).to.equal(test.e.hiddenL);
-        });
-
-      });
+    it('checkServicesChange should be called', function() {
+      expect(view.checkServicesChange).to.be.calledOnce;
     });
-  });
 
-  describe('#persistKey', function () {
-    beforeEach(function () {
-      sinon.stub(App, 'get').withArgs('router.loginName').returns('tdk');
+    it('renderWidgets should be called', function() {
+      expect(view.renderWidgets).to.be.calledOnce;
     });
-    afterEach(function () {
-      App.get.restore();
+
+    it('isDataLoaded should be true', function() {
+      expect(view.get('isDataLoaded')).to.be.true;
     });
-    it('Check it', function () {
-      expect(view.get('persistKey')).to.equal('user-pref-tdk-dashboard');
+
+    it('Em.run.next should be called', function() {
+      expect(Em.run.next.calledWith(view, 'makeSortable')).to.be.true;
     });
   });
 
-  describe("#didInsertElement()", function () {
-    beforeEach(function () {
-      sinon.stub(view, 'setWidgetsDataModel', Em.K);
-      sinon.stub(view, 'setInitPrefObject', Em.K);
-      sinon.stub(view, 'setOnLoadVisibleWidgets', Em.K);
-      sinon.stub(Em.run, 'next', Em.K);
-      view.didInsertElement();
-    });
-    afterEach(function () {
-      view.setWidgetsDataModel.restore();
-      view.setInitPrefObject.restore();
-      view.setOnLoadVisibleWidgets.restore();
-      Em.run.next.restore();
-    });
-    it("setWidgetsDataModel is called once", function () {
-      expect(view.setWidgetsDataModel.calledOnce).to.be.true;
-    });
-    it("setInitPrefObject is called once", function () {
-      expect(view.setInitPrefObject.calledOnce).to.be.true;
-    });
-    it("setOnLoadVisibleWidgets is called once", function () {
-      expect(view.setOnLoadVisibleWidgets.calledOnce).to.be.true;
+  describe('#loadWidgetsSettings()', function() {
+
+    beforeEach(function() {
+      sinon.spy(view, 'getUserPref');
     });
-    it("makeSortable is called in the next loop", function () {
-      expect(Em.run.next.calledWith(view, 'makeSortable')).to.be.true;
+
+    afterEach(function() {
+      view.getUserPref.restore();
     });
-    it("isDataLoaded is true", function () {
-      expect(view.get('isDataLoaded')).to.be.true
+
+    it('getUserPref should be called', function() {
+      view.loadWidgetsSettings();
+      expect(view.getUserPref.calledWith('key')).to.be.true;
     });
   });
 
-  describe("#setWidgetsDataModel()", function () {
-    beforeEach(function () {
-      this.model = sinon.stub(App.Service, 'find');
-      this.get = sinon.stub(App, 'get');
-    });
-    afterEach(function () {
-      this.model.restore();
-      this.get.restore();
+  describe('#saveWidgetsSettings()', function() {
+
+    beforeEach(function() {
+      sinon.stub(view, 'setDBProperty');
+      sinon.stub(view, 'postUserPref');
+      view.saveWidgetsSettings({settings:{}});
     });
-    it("No host_metrics_model", function () {
-      this.get.returns([]);
-      this.model.returns([Em.Object.create({
-        serviceName: 'S1',
-        id: 'S1'
-      })]);
-      view.set('host_metrics_model', null);
-      view.setWidgetsDataModel();
-      expect(view.get('host_metrics_model')).to.be.null;
-      expect(view.get('s1_model')).to.eql(Em.Object.create({
-        serviceName: 'S1',
-        id: 'S1'
-      }));
+
+    afterEach(function() {
+      view.setDBProperty.restore();
+      view.postUserPref.restore();
     });
-    it("host_metrics_model is present", function () {
-      this.get.returns([1]);
-      this.model.returns([Em.Object.create({
-        serviceName: 'HDFS',
-        id: 'HDFS'
-      })]);
-      view.set('host_metrics_model', null);
-      view.setWidgetsDataModel();
-      expect(view.get('host_metrics_model')).to.eql([1]);
-      expect(view.get('hdfs_model.id')).to.equal('HDFS');
+
+    it('setDBProperty should be called', function() {
+      expect(view.setDBProperty.calledWith('key', {settings:{}})).to.be.true;
     });
-  });
 
-  describe("#plusButtonFilterView", function () {
-    var plusButtonFilterView = view.get('plusButtonFilterView').create({
-      parentView: view
+    it('postUserPref should be called', function() {
+      expect(view.postUserPref.calledWith('key', {settings:{}})).to.be.true;
     });
-    plusButtonFilterView.reopen({
-      visibleWidgets: [],
-      hiddenWidgets: []
+
+    it('userPreferences should be set', function() {
+      expect(view.get('userPreferences')).to.be.eql({settings:{}});
     });
+  });
 
-    describe("#applyFilter()", function () {
-      var widget = {checked: true};
-      beforeEach(function () {
-        sinon.stub(view, 'getUserPref').returns({
-          complete: Em.K
-        });
-        sinon.stub(view, 'widgetsMapper').returns(widget);
-      });
+  describe('#getUserPrefSuccessCallback()', function() {
 
-      afterEach(function () {
-        view.getUserPref.restore();
-        view.widgetsMapper.restore();
-      });
+    beforeEach(function() {
+      sinon.stub(view, 'getUserPrefErrorCallback');
+    });
 
-      it("testMode is off", function () {
-        plusButtonFilterView.applyFilter();
-        expect(view.getUserPref.calledOnce).to.be.true;
-      });
+    afterEach(function() {
+      view.getUserPrefErrorCallback.restore();
     });
 
-    describe("#applyFilterComplete()", function () {
-      beforeEach(function () {
-        sinon.stub(view, 'postUserPref');
-        sinon.stub(view, 'translateToReal');
-        sinon.stub(App.router, 'get', function (k) {
-          if ('loginName' === k) return 'tdk';
-          return Em.get(App.router, k);
-        });
-        plusButtonFilterView.set('hiddenWidgets', [
-          Em.Object.create({
-            checked: true,
-            id: 1,
-            displayName: 'i1'
-          }),
-          Em.Object.create({
-            checked: false,
-            id: 2,
-            displayName: 'i2'
-          })
-        ]);
-        view.set('currentPrefObject', Em.Object.create({
-          dashboardVersion: 'new',
-          visible: [],
-          hidden: [],
-          threshold: 'threshold'
-        }));
-        view.set('persistKey', 'key');
-        plusButtonFilterView.applyFilterComplete();
-      });
-      afterEach(function () {
-        view.postUserPref.restore();
-        view.translateToReal.restore();
-        App.router.get.restore();
-      });
-      it("postUserPref is called once", function () {
-        expect(view.postUserPref.calledOnce).to.be.true;
-      });
-      it("translateToReal is called with correct data", function () {
-        expect(view.translateToReal.getCall(0).args[0]).to.eql(Em.Object.create({
-          dashboardVersion: 'new',
-          visible: [1],
-          hidden: [
-            [2, 'i2']
-          ],
-          threshold: 'threshold'
-        }));
-      });
-      it("1 hidden widget", function () {
-        expect(plusButtonFilterView.get('hiddenWidgets.length')).to.equal(1);
-      });
+    it('getUserPrefErrorCallback should be called', function() {
+      view.getUserPrefSuccessCallback(null);
+      expect(view.getUserPrefErrorCallback).to.be.calledOnce;
     });
-  });
 
-  describe("#translateToReal()", function () {
-    beforeEach(function () {
-      sinon.stub(view, 'widgetsMapper').returns(Em.Object.create());
-      view.set('visibleWidgets', []);
-      view.set('hiddenWidgets', []);
-    });
-    afterEach(function () {
-      view.widgetsMapper.restore();
-    });
-    it("version is not new", function () {
-      var data = {
-        dashboardVersion: null,
-        visible: [],
-        hidden: [],
-        threshold: []
-      };
-      view.translateToReal(data);
-      expect(view.get('visibleWidgets')).to.be.empty;
-      expect(view.get('hiddenWidgets')).to.be.empty;
-    });
-    it("version is new", function () {
-      var data = {
-        dashboardVersion: 'new',
-        visible: [1],
-        hidden: [
-          ['id', 'title']
-        ],
-        threshold: [
-          [],
-          [
-            ['tresh1'],
-            ['tresh2']
-          ]
-        ]
-      };
-      view.translateToReal(data);
-      expect(view.get('visibleWidgets')).to.not.be.empty;
-      expect(view.get('hiddenWidgets')).to.not.be.empty;
+    it('userPreferences should be set', function() {
+      view.getUserPrefSuccessCallback({settings:{}});
+      expect(view.get('userPreferences')).to.be.eql({settings:{}});
     });
   });
 
-  describe("#setOnLoadVisibleWidgets()", function () {
-    beforeEach(function () {
-      sinon.stub(view, 'translateToReal', Em.K);
-      sinon.stub(view, 'getUserPref').returns({complete: Em.K});
-    });
+  describe('#getUserPrefErrorCallback()', function() {
 
-    afterEach(function () {
-      view.translateToReal.restore();
-      view.getUserPref.restore();
+    beforeEach(function() {
+      sinon.stub(view, 'generateDefaultUserPreferences').returns({settings:{}});
+      sinon.stub(view, 'saveWidgetsSettings');
     });
 
-    it("testMode is false", function () {
-      view.setOnLoadVisibleWidgets();
-      expect(view.getUserPref.calledOnce).to.be.true;
+    afterEach(function() {
+      view.generateDefaultUserPreferences.restore();
+      view.saveWidgetsSettings.restore();
     });
-  });
 
-  describe("#removeWidget()", function () {
-    var widget;
-    var value;
-    beforeEach(function () {
-      widget = {};
-      value = {
-        visible: [widget],
-        hidden: [
-          [widget]
-        ]
-      };
-      value = view.removeWidget(value, widget);
-    });
-    it("value.visible is empty", function () {
-      expect(value.visible).to.be.empty;
-    });
-    it("value.hidden is empty", function () {
-      expect(value.hidden).to.be.empty;
+    it('saveWidgetsSettings should be called', function() {
+      view.getUserPrefErrorCallback();
+      expect(view.saveWidgetsSettings.calledWith({settings:{}})).to.be.true;
     });
   });
 
-  describe("#containsWidget()", function () {
-    it("widget visible", function () {
-      var widget = {};
-      var value = {
-        visible: [widget],
-        hidden: [
-          [widget]
-        ]
-      };
-      expect(view.containsWidget(value, widget)).to.be.true;
-    });
-    it("widget absent", function () {
-      var widget = {};
-      var value = {
-        visible: [],
-        hidden: []
-      };
-      expect(view.containsWidget(value, widget)).to.be.false;
-    });
-    it("widget hidden", function () {
-      var widget = {};
-      var value = {
-        visible: [],
-        hidden: [
-          [widget]
-        ]
-      };
-      expect(view.containsWidget(value, widget)).to.be.true;
+  describe('#resolveConfigDependencies()', function() {
+
+    beforeEach(function() {
+      this.mock = sinon.stub(App.router, 'get');
     });
-  });
 
-  describe("#persistKey", function () {
-    before(function () {
-      sinon.stub(App, 'get').withArgs('router.loginName').returns('user');
+    afterEach(function() {
+      App.router.get.restore();
     });
-    after(function () {
-      App.get.restore();
+
+    it('isHiddenByDefault should be undefined', function() {
+      var widgets = [{id: 20}];
+      this.mock.returns({properties: {'hide_yarn_memory_widget': 'false'}});
+      view.resolveConfigDependencies(widgets);
+      expect(widgets[0].isHiddenByDefault).to.be.undefined;
     });
-    it("depends on router.loginName", function () {
-      view.propertyDidChange('persistKey');
-      expect(view.get('persistKey')).to.equal('user-pref-user-dashboard');
+
+    it('isHiddenByDefault should be true', function() {
+      var widgets = [{id: 20}];
+      this.mock.returns({properties: {'hide_yarn_memory_widget': 'true'}});
+      view.resolveConfigDependencies(widgets);
+      expect(widgets[0].isHiddenByDefault).to.be.true;
     });
   });
 
-  describe("#getUserPrefSuccessCallback()", function () {
+  describe('#generateDefaultUserPreferences', function() {
 
-    it("response is null", function () {
-      view.set('currentPrefObject', null);
-      view.getUserPrefSuccessCallback(null, {}, {});
-      expect(view.get('currentPrefObject')).to.be.null;
+    beforeEach(function() {
+      sinon.stub(view, 'resolveConfigDependencies');
+      sinon.stub(App.Service, 'find').returns(Em.Object.create());
+      view.set('widgetsDefinition', [
+        Em.Object.create({sourceName: 'S1', id: 1}),
+        Em.Object.create({sourceName: 'HOST_METRICS', id: 2, isHiddenByDefault: true, threshold: []}),
+        Em.Object.create({sourceName: 'HOST_METRICS', id: 3, threshold: [1, 2]})
+      ]);
     });
 
-    it("response is correct", function () {
-      view.set('currentPrefObject', null);
-      view.getUserPrefSuccessCallback({}, {}, {});
-      expect(view.get('currentPrefObject')).to.eql({});
+    afterEach(function() {
+      view.resolveConfigDependencies.restore();
+      App.Service.find.restore();
     });
 
-    it('should update missing thresholds', function () {
+    it('should generate default preferences', function() {
+      expect(JSON.stringify(view.generateDefaultUserPreferences())).to.be.eql(JSON.stringify({
+        "visible": [3],
+        "hidden": [2],
+        "threshold": {
+          "2": [],
+          "3": [1,2]
+        }
+      }));
+      expect(view.resolveConfigDependencies).to.be.calledOnce;
+    });
+  });
+
+  describe('#renderWidgets()', function() {
 
-      view.set('currentPrefObject', null);
-      view.getUserPrefSuccessCallback({
+    it('should set visibleWidgets and hiddenWidgets', function() {
+      view.set('userPreferences', {
+        visible: [1],
+        hidden: [2],
         threshold: {
-          17: []
+          1: [],
+          2: [1,2]
         }
-      }, {}, {});
-      expect(view.get('currentPrefObject.threshold')['17']).to.eql([70, 90]);
+      });
+      view.renderWidgets();
+      expect(view.get('visibleWidgets')).to.be.eql([Em.Object.create({
+        id: 1,
+        threshold: [],
+        viewClass: App['NameNodeHeapPieChartView'],
+        sourceName: 'HDFS',
+        title: Em.I18n.t('dashboard.widgets.NameNodeHeap')
+      })]);
+      expect(view.get('hiddenWidgets')).to.be.eql([
+        Em.Object.create({
+          id: 2,
+          title: Em.I18n.t('dashboard.widgets.HDFSDiskUsage'),
+          checked: false
+        })
+      ]);
+    });
+  });
+
+  describe('#checkServicesChange()', function() {
+
+    beforeEach(function() {
+      sinon.stub(view, 'generateDefaultUserPreferences').returns({
+        visible: [1, 2],
+        hidden: [3, 4]
+      });
+      sinon.stub(view, 'saveWidgetsSettings');
+    });
 
+    afterEach(function() {
+      view.generateDefaultUserPreferences.restore();
+      view.saveWidgetsSettings.restore();
     });
 
+    it('userPreferences should be updated', function() {
+      view.set('userPreferences', {
+        visible: [3],
+        hidden: [1],
+        threshold: {}
+      });
+      view.checkServicesChange();
+      expect(view.saveWidgetsSettings.getCall(0).args[0]).to.be.eql({
+        visible: [3, 2],
+        hidden: [1, 4],
+        threshold: {}
+      });
+    });
   });
 
-  describe("#resetAllWidgets()", function () {
+  describe('#resetAllWidgets()', function() {
 
-    beforeEach(function () {
+    beforeEach(function() {
       sinon.stub(App, 'showConfirmationPopup', Em.clb);
-      sinon.stub(view, 'postUserPref', Em.K);
-      sinon.stub(view, 'setDBProperty', Em.K);
-      sinon.stub(view, 'translateToReal', Em.K);
-      view.setProperties({
-        currentTimeRangeIndex: 1,
-        customStartTime: 1000,
-        customEndTime: 2000
-      });
+      sinon.stub(view, 'generateDefaultUserPreferences').returns({settings: {}});
+      sinon.stub(view, 'saveWidgetsSettings');
+      sinon.stub(view, 'renderWidgets');
       view.resetAllWidgets();
     });
 
-    afterEach(function () {
+    afterEach(function() {
       App.showConfirmationPopup.restore();
-      view.postUserPref.restore();
-      view.setDBProperty.restore();
-      view.translateToReal.restore();
+      view.generateDefaultUserPreferences.restore();
+      view.saveWidgetsSettings.restore();
+      view.renderWidgets.restore();
     });
 
-    it('persist reset', function () {
-      expect(view.postUserPref.calledOnce).to.be.true;
-    });
-    it('local storage reset', function () {
-      expect(view.setDBProperty.calledOnce).to.be.true;
+    it('saveWidgetsSettings should be called', function() {
+      expect(view.saveWidgetsSettings.calledWith({settings: {}})).to.be.true;
     });
-    it('time range reset', function () {
-      expect(view.get('currentTimeRangeIndex')).to.equal(0);
+
+    it('renderWidgets should be called', function() {
+      expect(view.renderWidgets).to.be.calledOnce;
     });
-    it('custom start time reset', function () {
+
+    it('properties should be reset', function() {
+      expect(view.get('currentTimeRangeIndex')).to.be.equal(0);
       expect(view.get('customStartTime')).to.be.null;
-    });
-    it('custom end time reset', function () {
       expect(view.get('customEndTime')).to.be.null;
     });
-    it('default settings application', function () {
-      expect(view.translateToReal.calledOnce).to.be.true;
-    });
-
   });
 
-  describe('#checkServicesChange', function () {
+  describe('#plusButtonFilterView', function() {
+    var plusButtonFilterView;
 
-    var emptyCurrentPref = {
-        visible: [],
-        hidden: [],
-        threshold: {}
-      },
-      widgetsMap = {
-        hdfs_model: ['1', '2', '3', '4', '5', '10', '11'],
-        host_metrics_model: ['6', '7', '8', '9'],
-        hbase_model: ['12', '13', '14', '15', '16'],
-        yarn_model: ['17', '18', '19', '20', '23'],
-        storm_model: ['21'],
-        flume_model: ['22']
-      },
-      emptyModelTitle = '{0} absent',
-      notEmptyModelTitle = '{0} present';
-
-    Em.keys(widgetsMap).forEach(function (item, index, array) {
-      it(notEmptyModelTitle.format(item), function () {
-        array.forEach(function (modelName) {
-          view.set(modelName, modelName === item ? {} : null);
-        });
-        expect(view.checkServicesChange(emptyCurrentPref).visible).to.eql(widgetsMap[item]);
+    beforeEach(function() {
+      plusButtonFilterView = view.get('plusButtonFilterView').create({
+        parentView: Em.Object.create({
+          saveWidgetsSettings: Em.K,
+          renderWidgets: Em.K
+        })
       });
     });
 
-    Em.keys(widgetsMap).forEach(function (item, index, array) {
-      it(emptyModelTitle.format(item), function () {
-        var expected = [];
-        array.forEach(function (modelName) {
-          if (modelName === item) {
-            view.set(modelName, null);
-          } else {
-            view.set(modelName, {});
-            expected = expected.concat(widgetsMap[modelName]);
-          }
+    describe('#applyFilter()', function() {
+
+      beforeEach(function() {
+        sinon.spy(plusButtonFilterView.get('parentView'), 'renderWidgets');
+        sinon.spy(plusButtonFilterView.get('parentView'), 'saveWidgetsSettings');
+        plusButtonFilterView.set('parentView.userPreferences', {
+          visible: [2],
+          hidden: [1, 3],
+          threshold: {}
         });
-        expect(view.checkServicesChange({
-          visible: widgetsMap[item],
-          hidden: [],
+        plusButtonFilterView.set('hiddenWidgets', [
+          Em.Object.create({checked: true, id: 1})
+        ]);
+        plusButtonFilterView.applyFilter();
+      });
+
+      afterEach(function() {
+        plusButtonFilterView.get('parentView').renderWidgets.restore();
+        plusButtonFilterView.get('parentView').saveWidgetsSettings.restore();
+      });
+
+      it('saveWidgetsSettings should be called', function() {
+        expect(plusButtonFilterView.get('parentView').saveWidgetsSettings.getCall(0).args[0]).to.be.eql({
+          visible: [2, 1],
+          hidden: [3],
           threshold: {}
-        }).visible).to.eql(expected);
+        });
       });
-    });
 
+      it('renderWidgets should be called', function() {
+        expect(plusButtonFilterView.get('parentView').renderWidgets).to.be.calledOnce;
+      });
+    });
   });
+
 });


[30/50] [abbrv] ambari git commit: AMBARI-19052. Re-arrange "Role Based Access Control" info table (akovalenko)

Posted by nc...@apache.org.
AMBARI-19052. Re-arrange "Role Based Access Control" info table (akovalenko)


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

Branch: refs/heads/branch-dev-patch-upgrade
Commit: 63c0f2e58fc09b709e890923752c4ccb04181180
Parents: 63938e0
Author: Aleksandr Kovalenko <ak...@hortonworks.com>
Authored: Thu Dec 1 19:22:02 2016 +0200
Committer: Aleksandr Kovalenko <ak...@hortonworks.com>
Committed: Thu Dec 1 20:20:33 2016 +0200

----------------------------------------------------------------------
 .../admin-web/app/scripts/services/Cluster.js   | 51 --------------------
 .../app/scripts/services/RoleDetailsModal.js    | 31 +++++++-----
 .../app/views/modals/RoleDetailsModal.html      |  6 +--
 3 files changed, 23 insertions(+), 65 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/63c0f2e5/ambari-admin/src/main/resources/ui/admin-web/app/scripts/services/Cluster.js
----------------------------------------------------------------------
diff --git a/ambari-admin/src/main/resources/ui/admin-web/app/scripts/services/Cluster.js b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/services/Cluster.js
index 02c231a..0f9b582 100644
--- a/ambari-admin/src/main/resources/ui/admin-web/app/scripts/services/Cluster.js
+++ b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/services/Cluster.js
@@ -30,57 +30,6 @@ angular.module('ambariAdminConsole')
       'CLUSTER.USER'
     ],
 
-    orderedAuthorizations : [
-      "SERVICE.VIEW_METRICS",
-      "SERVICE.VIEW_STATUS_INFO",
-      "SERVICE.VIEW_CONFIGS",
-      "SERVICE.COMPARE_CONFIGS",
-      "SERVICE.VIEW_ALERTS",
-      "SERVICE.START_STOP",
-      "SERVICE.DECOMMISSION_RECOMMISSION",
-      "SERVICE.RUN_SERVICE_CHECK",
-      "SERVICE.TOGGLE_MAINTENANCE",
-      "SERVICE.RUN_CUSTOM_COMMAND",
-      "SERVICE.MODIFY_CONFIGS",
-      "SERVICE.MANAGE_CONFIG_GROUPS",
-      "SERVICE.MOVE",
-      "SERVICE.ENABLE_HA",
-      "SERVICE.MANAGE_ALERTS",
-      "SERVICE.TOGGLE_ALERTS",
-      "SERVICE.ADD_DELETE_SERVICES",
-      "SERVICE.VIEW_OPERATIONAL_LOGS",
-      "HOST.VIEW_CONFIGS",
-      "HOST.VIEW_METRICS",
-      "HOST.VIEW_STATUS_INFO",
-      "HOST.ADD_DELETE_COMPONENTS",
-      "HOST.ADD_DELETE_HOSTS",
-      "HOST.TOGGLE_MAINTENANCE",
-      "CLUSTER.VIEW_ALERTS",
-      "CLUSTER.VIEW_CONFIGS",
-      "CLUSTER.VIEW_METRICS",
-      "CLUSTER.VIEW_STACK_DETAILS",
-      "CLUSTER.VIEW_STATUS_INFO",
-      "CLUSTER.MANAGE_ALERTS",
-      "CLUSTER.MANAGE_CONFIG_GROUPS",
-      "CLUSTER.MANAGE_CREDENTIALS",
-      "CLUSTER.MODIFY_CONFIGS",
-      "CLUSTER.TOGGLE_ALERTS",
-      "CLUSTER.TOGGLE_KERBEROS",
-      "CLUSTER.UPGRADE_DOWNGRADE_STACK",
-      "CLUSTER.RUN_CUSTOM_COMMAND",
-      "AMBARI.ADD_DELETE_CLUSTERS",
-      "AMBARI.ASSIGN_ROLES",
-      "AMBARI.EDIT_STACK_REPOS",
-      "AMBARI.MANAGE_GROUPS",
-      "AMBARI.MANAGE_SETTINGS",
-      "AMBARI.MANAGE_STACK_VERSIONS",
-      "AMBARI.MANAGE_USERS",
-      "AMBARI.MANAGE_VIEWS",
-      "AMBARI.RENAME_CLUSTER",
-      "AMBARI.RUN_CUSTOM_COMMAND",
-      "SERVICE.SET_SERVICE_USERS_GROUPS"
-    ],
-
     orderedLevels: ['SERVICE', 'HOST', 'CLUSTER', 'AMBARI'],
 
     ineditableRoles : ['VIEW.USER', 'AMBARI.ADMINISTRATOR'],

http://git-wip-us.apache.org/repos/asf/ambari/blob/63c0f2e5/ambari-admin/src/main/resources/ui/admin-web/app/scripts/services/RoleDetailsModal.js
----------------------------------------------------------------------
diff --git a/ambari-admin/src/main/resources/ui/admin-web/app/scripts/services/RoleDetailsModal.js b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/services/RoleDetailsModal.js
index 5a14b33..06019c2 100644
--- a/ambari-admin/src/main/resources/ui/admin-web/app/scripts/services/RoleDetailsModal.js
+++ b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/services/RoleDetailsModal.js
@@ -33,9 +33,9 @@ angular.module('ambariAdminConsole')
         templateUrl: 'views/modals/RoleDetailsModal.html',
         size: 'lg',
         controller: function($scope, $modalInstance) {
+          var authorizationsOrder;
           $scope.title = '';
           $scope.orderedRoles = ['AMBARI.ADMINISTRATOR'].concat(Cluster.orderedRoles).reverse();
-          $scope.orderedAuthorizations = Cluster.orderedAuthorizations;
           $scope.orderedLevels = Cluster.orderedLevels;
           $scope.authHash = {};
           $scope.getLevelName = function (key) {
@@ -44,25 +44,34 @@ angular.module('ambariAdminConsole')
           angular.forEach(roles, function (r) {
             angular.forEach(r.authorizations, function (auth) {
               var match = auth.authorization_id.match(/(\w+)\./),
-                levelKey = match && match[1],
-                isLevelDisplayed = $scope.orderedAuthorizations.some(function (item) {
-                  return !item.indexOf(levelKey);
-                });
+                  levelKey = match && match[1],
+                  isLevelDisplayed = $scope.orderedLevels.indexOf(levelKey) !== -1;
               if (isLevelDisplayed) {
                 if (!$scope.authHash[levelKey]) {
                   $scope.authHash[levelKey] = {};
                 }
                 if (!$scope.authHash[levelKey][auth.authorization_id]) {
-                  $scope.authHash[levelKey][auth.authorization_id] = auth.authorization_name;
+                  $scope.authHash[levelKey][auth.authorization_id] = {
+                    name: auth.authorization_name,
+                    roles: {}
+                  };
                 }
-                if (!r.authHash) {
-                  r.authHash = {};
-                }
-                r.authHash[auth.authorization_id] = true;
+                $scope.authHash[levelKey][auth.authorization_id].roles[r.permission_name] = true;
               }
             });
           });
-          $scope.roles = roles.sort(function(a, b) {
+
+          // sort authorizations for each level by number of roles permissions
+          for (var level in $scope.authHash) {
+            if ($scope.authHash.hasOwnProperty(level)) {
+              authorizationsOrder = Object.keys($scope.authHash[level]).sort(function (a, b) {
+                return Object.keys($scope.authHash[level][b].roles).length - Object.keys($scope.authHash[level][a].roles).length;
+              });
+              $scope.authHash[level].order = authorizationsOrder;
+            }
+          }
+
+          $scope.roles = roles.sort(function (a, b) {
             return $scope.orderedRoles.indexOf(a.permission_name) - $scope.orderedRoles.indexOf(b.permission_name);
           });
           $scope.ok = function() {

http://git-wip-us.apache.org/repos/asf/ambari/blob/63c0f2e5/ambari-admin/src/main/resources/ui/admin-web/app/views/modals/RoleDetailsModal.html
----------------------------------------------------------------------
diff --git a/ambari-admin/src/main/resources/ui/admin-web/app/views/modals/RoleDetailsModal.html b/ambari-admin/src/main/resources/ui/admin-web/app/views/modals/RoleDetailsModal.html
index 926bea9..942a733 100644
--- a/ambari-admin/src/main/resources/ui/admin-web/app/views/modals/RoleDetailsModal.html
+++ b/ambari-admin/src/main/resources/ui/admin-web/app/views/modals/RoleDetailsModal.html
@@ -40,10 +40,10 @@
         </div>
       </div>
       <div class="table-row-wrapper">
-        <div class="table-row" ng-repeat="auth in orderedAuthorizations" ng-if="authHash[level][auth]">
-          <div class="table-cell">{{authHash[level][auth]}}</div>
+        <div class="table-row" ng-repeat="auth_id in authHash[level].order">
+          <div class="table-cell">{{authHash[level][auth_id].name}}</div>
           <div class="table-cell text-center" ng-repeat="role in roles">
-            <i class="glyphicon glyphicon-ok green-icon" ng-show="role.authHash[auth]"></i>
+            <i class="glyphicon glyphicon-ok green-icon" ng-show="authHash[level][auth_id].roles[role.permission_name]"></i>
           </div>
         </div>
       </div>


[06/50] [abbrv] ambari git commit: AMBARI-18962:Make check_package_condition in script.py overridable by services in stacks (dili)

Posted by nc...@apache.org.
AMBARI-18962:Make check_package_condition in script.py overridable by services in stacks (dili)


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

Branch: refs/heads/branch-dev-patch-upgrade
Commit: 10878592c2e2f5ac0412be8085c634d471f7358f
Parents: 9559a16
Author: Di Li <di...@apache.org>
Authored: Wed Nov 30 11:13:19 2016 -0500
Committer: Di Li <di...@apache.org>
Committed: Wed Nov 30 11:13:19 2016 -0500

----------------------------------------------------------------------
 .../resource_management/libraries/script/script.py   | 15 +++++++++------
 .../custom_actions/scripts/install_packages.py       |  2 +-
 2 files changed, 10 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/10878592/ambari-common/src/main/python/resource_management/libraries/script/script.py
----------------------------------------------------------------------
diff --git a/ambari-common/src/main/python/resource_management/libraries/script/script.py b/ambari-common/src/main/python/resource_management/libraries/script/script.py
index f8df842..584775e 100644
--- a/ambari-common/src/main/python/resource_management/libraries/script/script.py
+++ b/ambari-common/src/main/python/resource_management/libraries/script/script.py
@@ -580,7 +580,7 @@ class Script(object):
       if isinstance(package_list_str, basestring) and len(package_list_str) > 0:
         package_list = json.loads(package_list_str)
         for package in package_list:
-          if Script.check_package_condition(package):
+          if self.check_package_condition(package):
             name = self.format_package_name(package['name'])
             # HACK: On Windows, only install ambari-metrics packages using Choco Package Installer
             # TODO: Update this once choco packages for hadoop are created. This is because, service metainfo.xml support
@@ -604,22 +604,25 @@ class Script(object):
                           str(config['hostLevelParams']['stack_version']))
       reload_windows_env()
       
-  @staticmethod
-  def check_package_condition(package):
-    from resource_management.libraries.functions import package_conditions
+  def check_package_condition(self, package):
     condition = package['condition']
-    name = package['name']
     
     if not condition:
       return True
     
+    return self.should_install_package(package)
+
+  def should_install_package(self, package):
+    from resource_management.libraries.functions import package_conditions
+    condition = package['condition']
     try:
       chooser_method = getattr(package_conditions, condition)
     except AttributeError:
+      name = package['name']
       raise Fail("Condition with name '{0}', when installing package {1}. Please check package_conditions.py.".format(condition, name))
 
     return chooser_method()
-      
+
   @staticmethod
   def matches_any_regexp(string, regexp_list):
     for regex in regexp_list:

http://git-wip-us.apache.org/repos/asf/ambari/blob/10878592/ambari-server/src/main/resources/custom_actions/scripts/install_packages.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/custom_actions/scripts/install_packages.py b/ambari-server/src/main/resources/custom_actions/scripts/install_packages.py
index 0e31310..112abe3 100644
--- a/ambari-server/src/main/resources/custom_actions/scripts/install_packages.py
+++ b/ambari-server/src/main/resources/custom_actions/scripts/install_packages.py
@@ -460,7 +460,7 @@ class InstallPackages(Script):
     """
     filtered_package_list = []
     for package in package_list:
-      if Script.check_package_condition(package):
+      if self.check_package_condition(package):
         filtered_package_list.append(package)
     return filtered_package_list