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

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

Repository: ambari
Updated Branches:
  refs/heads/ambari-rest-api-explorer 3cb45e849 -> 3acd2e6da


AMBARI-20558. HiveView does not work on WASB ACLs cluster (Gaurav Nagar via nitirajrathore)


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

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

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


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


[40/50] [abbrv] ambari git commit: AMBARI-20673.For sort/partition operator, if there is only 1 reducer, display just 'sort' rather than 'sort/partition'(Venkata Sairam via padmapriyanitt)

Posted by ja...@apache.org.
AMBARI-20673.For sort/partition operator, if there is only 1 reducer, display just 'sort' rather than 'sort/partition'(Venkata Sairam via padmapriyanitt)


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

Branch: refs/heads/ambari-rest-api-explorer
Commit: eff2b435a08858be6229d4d712c4f9bf3a212be1
Parents: e64bff0
Author: padmapriyanitt <pa...@gmail.com>
Authored: Tue Apr 11 12:04:35 2017 +0530
Committer: padmapriyanitt <pa...@gmail.com>
Committed: Tue Apr 11 12:04:35 2017 +0530

----------------------------------------------------------------------
 .../ui/app/utils/hive-explainer/renderer.js     | 40 ++++++++++++--------
 1 file changed, 25 insertions(+), 15 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/eff2b435/contrib/views/hive20/src/main/resources/ui/app/utils/hive-explainer/renderer.js
----------------------------------------------------------------------
diff --git a/contrib/views/hive20/src/main/resources/ui/app/utils/hive-explainer/renderer.js b/contrib/views/hive20/src/main/resources/ui/app/utils/hive-explainer/renderer.js
index 1cfcb15..78aa39d 100644
--- a/contrib/views/hive20/src/main/resources/ui/app/utils/hive-explainer/renderer.js
+++ b/contrib/views/hive20/src/main/resources/ui/app/utils/hive-explainer/renderer.js
@@ -24,7 +24,7 @@ export default function doRender(data, selector, onRequestDetail, draggable) {
   const width = '1570', height = '800';
 
   d3.select(selector).select('*').remove();
-
+  var isSingleReducer = isSingleReducerAvailable(data);
   const svg =
     d3.select(selector)
       .append('svg')
@@ -64,10 +64,10 @@ export default function doRender(data, selector, onRequestDetail, draggable) {
       .attr('data-vertex', d => d._vertex);
 
   root
-    .call(recurseC, onRequestDetail);
+    .call(recurseC, onRequestDetail, isSingleReducer);
 
   root
-    .call(recurseV, onRequestDetail);
+    .call(recurseV, onRequestDetail, isSingleReducer);
 
   container.selectAll('path.edge')
     .data(data.connections)
@@ -79,8 +79,16 @@ export default function doRender(data, selector, onRequestDetail, draggable) {
   reset(zoom, svg, container);
 
 }
-
-function recurseV(vertices, onRequestDetail) {
+function isSingleReducerAvailable(data){
+  let reducerCount = data.vertices.filter(function(item){
+    return item['_vertex'].indexOf("Reducer") === 0;
+  });
+  if(reducerCount && reducerCount.length === 1) {
+    return true;
+  }
+  return false;
+}
+function recurseV(vertices, onRequestDetail, isSingleReducer) {
   vertices.each(function(cVertx) {
     const vertex = d3.select(this);
 
@@ -95,14 +103,14 @@ function recurseV(vertices, onRequestDetail) {
         .style('transform', d => `translate(${d._widthOfSelf * 200}px, ${d._offsetY * 100}px)`);
 
       vertices
-        .call(recurseC, onRequestDetail);
+        .call(recurseC, onRequestDetail, isSingleReducer);
 
       vertices
-        .call(recurseV, onRequestDetail);
+        .call(recurseV, onRequestDetail, isSingleReducer);
   });
 }
 
-function recurseC(children, onRequestDetail) {
+function recurseC(children, onRequestDetail, isSingleReducer) {
   children.each(function(d) {
     const child = d3.select(this);
 
@@ -131,18 +139,18 @@ function recurseC(children, onRequestDetail) {
         .attr('width', 140)
           .append('xhtml:body')
         .style('margin', 0)
-          .html(d => getRenderer(d._operator)(d))
+          .html(d => getRenderer(d._operator, isSingleReducer)(d))
         .on('click', d => {
           const vertex = d3.select(Ember.$(d3.select(this).node()).closest('.vertex').get(0)).data()[0];
           onRequestDetail(doClean(d), vertex);
         });
 
       children
-        .call(recurseC, onRequestDetail);
+        .call(recurseC, onRequestDetail, isSingleReducer);
     });
 }
 
-function getRenderer(type) {
+function getRenderer(type, isSingleReducer) {
   if(type === 'Fetch Operator') {
     return (d => {
       return (`
@@ -151,7 +159,7 @@ function getRenderer(type) {
             <i class='fa ${getOperatorIcon(d._operator)}' aria-hidden='true'></i>
           </div>
           <div class='operator-body' style='margin-left: 10px;'>
-            <div>${getOperatorLabel(d)}</div>
+            <div>${getOperatorLabel(d, isSingleReducer)}</div>
             ${(d['limit:'] && d['limit:'] > -1) ? '<div><span style="font-weight: lighter;">Limit:</span> ' + d['limit:'] + ' </div>' : ''}
           </div>
         </div>
@@ -167,7 +175,7 @@ function getRenderer(type) {
           <i class='fa ${getOperatorIcon(d._operator)}' aria-hidden='true'></i>
         </div>
         <div class='operator-body' style='margin-left: 10px;'>
-          <div>${getOperatorLabel(d)}</div>
+          <div>${getOperatorLabel(d, isSingleReducer)}</div>
           ${stats}
         </div>
       </div>
@@ -180,9 +188,11 @@ function getNumberOfRows(statistics) {
   const match = statistics.match(/([^\?]*)\Num rows: (\d*)/);
   return (match.length === 3 && Number.isNaN(Number(match[2])) === false) ? match[2] : 0;
 }
-function getOperatorLabel(d) {
+function getOperatorLabel(d, isSingleReducer) {
   const operator = d._operator;
-
+  if(operator === 'Partition/Sort Pseudo-Edge' && isSingleReducer) {
+    return "Sort";
+  }
   if(operator === 'TableScan') {
     return d['alias:'];
   }


[47/50] [abbrv] ambari git commit: AMBARI-20443. No need to show 'hive_ambari_database' (Masahiro Tanaka via alejandro)

Posted by ja...@apache.org.
AMBARI-20443. No need to show 'hive_ambari_database' (Masahiro Tanaka via alejandro)


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

Branch: refs/heads/ambari-rest-api-explorer
Commit: 69c55935a57252e3490bfed6905b1bb2fb8ce86d
Parents: 91aa3c8
Author: Alejandro Fernandez <af...@hortonworks.com>
Authored: Tue Apr 11 10:47:24 2017 -0700
Committer: Alejandro Fernandez <af...@hortonworks.com>
Committed: Tue Apr 11 10:47:24 2017 -0700

----------------------------------------------------------------------
 .../common-services/HIVE/0.12.0.2.0/configuration/hive-env.xml    | 3 ++-
 .../common-services/HIVE/2.1.0.3.0/configuration/hive-env.xml     | 1 +
 2 files changed, 3 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/69c55935/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/configuration/hive-env.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/configuration/hive-env.xml b/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/configuration/hive-env.xml
index 5f56617..ad668a2 100644
--- a/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/configuration/hive-env.xml
+++ b/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/configuration/hive-env.xml
@@ -117,7 +117,8 @@
     <name>hive_ambari_database</name>
     <value>MySQL</value>
     <description>Database type.</description>
-    <on-ambari-upgrade add="true"/>
+    <deleted>true</true>
+    <on-ambari-upgrade add="false"/>
   </property>
   <property>
     <name>hive_database_name</name>

http://git-wip-us.apache.org/repos/asf/ambari/blob/69c55935/ambari-server/src/main/resources/common-services/HIVE/2.1.0.3.0/configuration/hive-env.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/HIVE/2.1.0.3.0/configuration/hive-env.xml b/ambari-server/src/main/resources/common-services/HIVE/2.1.0.3.0/configuration/hive-env.xml
index 4ed26f7..872120c 100644
--- a/ambari-server/src/main/resources/common-services/HIVE/2.1.0.3.0/configuration/hive-env.xml
+++ b/ambari-server/src/main/resources/common-services/HIVE/2.1.0.3.0/configuration/hive-env.xml
@@ -86,6 +86,7 @@
     <name>hive_ambari_database</name>
     <value>MySQL</value>
     <description>Database type.</description>
+    <deleted>true</true>
     <on-ambari-upgrade add="false"/>
   </property>
   <property>


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

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


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

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

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


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


[35/50] [abbrv] ambari git commit: AMBARI-20716. Support amazonlinux 2017 in Ambari (aonishuk)

Posted by ja...@apache.org.
AMBARI-20716. Support amazonlinux 2017 in Ambari (aonishuk)


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

Branch: refs/heads/ambari-rest-api-explorer
Commit: 5377e66448aea708d42751704e69bb15418c5a3e
Parents: 9405e24
Author: Andrew Onishuk <ao...@hortonworks.com>
Authored: Mon Apr 10 12:43:28 2017 +0300
Committer: Andrew Onishuk <ao...@hortonworks.com>
Committed: Mon Apr 10 12:43:28 2017 +0300

----------------------------------------------------------------------
 .../src/main/python/ambari_commons/resources/os_family.json         | 1 +
 1 file changed, 1 insertion(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/5377e664/ambari-common/src/main/python/ambari_commons/resources/os_family.json
----------------------------------------------------------------------
diff --git a/ambari-common/src/main/python/ambari_commons/resources/os_family.json b/ambari-common/src/main/python/ambari_commons/resources/os_family.json
index e9bd1a4..859ce56 100644
--- a/ambari-common/src/main/python/ambari_commons/resources/os_family.json
+++ b/ambari-common/src/main/python/ambari_commons/resources/os_family.json
@@ -68,6 +68,7 @@
     "aliases": {
       "amazon2015": "amazon6",
       "amazon2016": "amazon6",
+      "amazon2017": "amazon6",
       "suse11sp3": "suse11"
     }
 }


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

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


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

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

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


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

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

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

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

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

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

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

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

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

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


[38/50] [abbrv] ambari git commit: AMBARI-20724 Merge calls to server which fetch ambari properties. (atkach)

Posted by ja...@apache.org.
AMBARI-20724 Merge calls to server which fetch ambari properties. (atkach)


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

Branch: refs/heads/ambari-rest-api-explorer
Commit: 735cbda86216204e6a8db2da7b7bae46c847931d
Parents: bab55aa
Author: Andrii Tkach <at...@apache.org>
Authored: Mon Apr 10 17:52:43 2017 +0300
Committer: Andrii Tkach <at...@apache.org>
Committed: Mon Apr 10 17:52:43 2017 +0300

----------------------------------------------------------------------
 .../controllers/global/cluster_controller.js    | 31 ++-------
 ambari-web/app/controllers/main.js              | 28 +-------
 ambari-web/app/routes/main.js                   | 32 ++++-----
 .../global/cluster_controller_test.js           | 73 ++++++--------------
 ambari-web/test/controllers/main_test.js        | 66 ------------------
 5 files changed, 45 insertions(+), 185 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/735cbda8/ambari-web/app/controllers/global/cluster_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/global/cluster_controller.js b/ambari-web/app/controllers/global/cluster_controller.js
index b24219e..29c979e 100644
--- a/ambari-web/app/controllers/global/cluster_controller.js
+++ b/ambari-web/app/controllers/global/cluster_controller.js
@@ -142,30 +142,7 @@ App.ClusterController = Em.Controller.extend(App.ReloadPopupMixin, {
     }
   },
 
-  /**
-   * load current server clock in milli-seconds
-   */
-  loadClientServerClockDistance: function () {
-    var dfd = $.Deferred();
-    this.getServerClock().done(function () {
-      dfd.resolve();
-    });
-    return dfd.promise();
-  },
-
-  getServerClock: function () {
-    return App.ajax.send({
-      name: 'ambari.service',
-      sender: this,
-      data: {
-        fields: '?fields=RootServiceComponents/server_clock'
-      },
-      success: 'getServerClockSuccessCallback',
-      error: 'getServerClockErrorCallback'
-    });
-  },
-
-  getServerClockSuccessCallback: function (data) {
+  setServerClock: function (data) {
     var clientClock = new Date().getTime();
     var serverClock = (data.RootServiceComponents.server_clock).toString();
     serverClock = serverClock.length < 13 ? serverClock + '000' : serverClock;
@@ -185,7 +162,6 @@ App.ClusterController = Em.Controller.extend(App.ReloadPopupMixin, {
   loadClusterData: function () {
     this.loadAuthorizations();
     this.getAllHostNames();
-    this.loadAmbariProperties();
 
     if (!App.get('clusterName')) {
       return;
@@ -441,10 +417,13 @@ App.ClusterController = Em.Controller.extend(App.ReloadPopupMixin, {
   },
 
   loadAmbariPropertiesSuccess: function (data) {
+    var mainController = App.router.get('mainController');
     this.set('ambariProperties', data.RootServiceComponents.properties);
     // Absence of 'jdk.name' and 'jce.name' properties says that ambari configured with custom jdk.
     this.set('isCustomJDK', App.isEmptyObject(App.permit(data.RootServiceComponents.properties, ['jdk.name', 'jce.name'])));
-    App.router.get('mainController').monitorInactivity();
+    this.setServerClock(data);
+    mainController.setAmbariServerVersion.call(mainController, data);
+    mainController.monitorInactivity();
   },
 
   loadAmbariPropertiesError: Em.K,

http://git-wip-us.apache.org/repos/asf/ambari/blob/735cbda8/ambari-web/app/controllers/main.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main.js b/ambari-web/app/controllers/main.js
index 798115f..499df74 100644
--- a/ambari-web/app/controllers/main.js
+++ b/ambari-web/app/controllers/main.js
@@ -123,42 +123,18 @@ App.MainController = Em.Controller.extend({
     );
   }.observes("App.router.location.lastSetURL", "App.clusterStatus.isInstalled"),
 
-  /**
-   * check server version and web client version
-   */
-  checkServerClientVersion: function () {
-    var dfd = $.Deferred();
-    var self = this;
-    self.getServerVersion().done(function () {
-      dfd.resolve();
-    });
-    return dfd.promise();
-  },
-  getServerVersion: function(){
-    return App.ajax.send({
-      name: 'ambari.service',
-      sender: this,
-      data: {
-        fields: '?fields=RootServiceComponents/component_version,RootServiceComponents/properties/server.os_family&minimal_response=true'
-      },
-      success: 'getServerVersionSuccessCallback',
-      error: 'getServerVersionErrorCallback'
-    });
-  },
-  getServerVersionSuccessCallback: function (data) {
+  setAmbariServerVersion: function (data) {
     var clientVersion = App.get('version');
     var serverVersion = (data.RootServiceComponents.component_version).toString();
     this.set('ambariServerVersion', serverVersion);
     if (clientVersion) {
       this.set('versionConflictAlertBody', Em.I18n.t('app.versionMismatchAlert.body').format(serverVersion, clientVersion));
-      this.set('isServerClientVersionMismatch', clientVersion != serverVersion);
+      this.set('isServerClientVersionMismatch', clientVersion !== serverVersion);
     } else {
       this.set('isServerClientVersionMismatch', false);
     }
     App.set('isManagedMySQLForHiveEnabled', App.config.isManagedMySQLForHiveAllowed(data.RootServiceComponents.properties['server.os_family']));
   },
-  getServerVersionErrorCallback: function () {
-  },
 
   monitorInactivity: function() {
     var timeout = Number(App.router.get('clusterController.ambariProperties')['user.inactivity.timeout.default']);

http://git-wip-us.apache.org/repos/asf/ambari/blob/735cbda8/ambari-web/app/routes/main.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/routes/main.js b/ambari-web/app/routes/main.js
index 88776b3..0a2375e 100644
--- a/ambari-web/app/routes/main.js
+++ b/ambari-web/app/routes/main.js
@@ -30,31 +30,31 @@ module.exports = Em.Route.extend(App.RouterRedirections, {
     App.db.updateStorage();
     var self = this;
     var location = router.location.location.hash;
+    var clusterController = App.router.get('clusterController');
+
     router.getAuthenticated().done(function (loggedIn) {
       if (loggedIn) {
         var applicationController = App.router.get('applicationController');
         App.router.get('experimentalController').loadSupports().complete(function () {
           applicationController.startKeepAlivePoller();
-          App.router.get('mainController').checkServerClientVersion().done(function () {
+          clusterController.loadAmbariProperties().complete(function () {
             App.router.get('mainViewsController').loadAmbariViews();
-            App.router.get('clusterController').loadClusterName(false).done(function () {
+            clusterController.loadClusterName(false).done(function () {
               if (App.get('testMode')) {
                 router.get('mainController').initialize();
               } else {
                 if (router.get('clusterInstallCompleted')) {
-                  App.router.get('clusterController').loadClientServerClockDistance().done(function () {
-                    if (!App.get('isOnlyViewUser')) {
-                      App.router.get('clusterController').checkDetailedRepoVersion().done(function () {
-                        router.get('mainController').initialize();
-                      });
-                    } else {
-                      // Don't transit to Views when user already on View page
-                      if (App.router.currentState.name !== 'viewDetails') {
-                        App.router.transitionTo('main.views.index');
-                      }
-                      App.router.get('clusterController').set('isLoaded', true); // hide loading bar
+                  if (!App.get('isOnlyViewUser')) {
+                    clusterController.checkDetailedRepoVersion().done(function () {
+                      router.get('mainController').initialize();
+                    });
+                  } else {
+                    // Don't transit to Views when user already on View page
+                    if (App.router.currentState.name !== 'viewDetails') {
+                      App.router.transitionTo('main.views.index');
                     }
-                  });
+                    clusterController.set('isLoaded', true); // hide loading bar
+                  }
                 }
                 else {
                   Em.run.next(function () {
@@ -65,13 +65,13 @@ module.exports = Em.Route.extend(App.RouterRedirections, {
                         if (App.isAuthorized('AMBARI.ADD_DELETE_CLUSTERS')) {
                           self.redirectToInstaller(router, currentClusterStatus, false);
                         } else {
-                          App.router.get('clusterController').set('isLoaded', true);
+                          clusterController.set('isLoaded', true);
                           Em.run.next(function () {
                             App.router.transitionTo('main.views.index');
                           });
                         }
                       } else {
-                        App.router.get('clusterController').set('isLoaded', true);
+                        clusterController.set('isLoaded', true);
                       }
                     });
                   });

http://git-wip-us.apache.org/repos/asf/ambari/blob/735cbda8/ambari-web/test/controllers/global/cluster_controller_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/global/cluster_controller_test.js b/ambari-web/test/controllers/global/cluster_controller_test.js
index e7b71f9..170ed78 100644
--- a/ambari-web/test/controllers/global/cluster_controller_test.js
+++ b/ambari-web/test/controllers/global/cluster_controller_test.js
@@ -134,7 +134,7 @@ describe('App.clusterController', function () {
     });
   });
 
-  describe('#getServerClockSuccessCallback()', function () {
+  describe('#setServerClock()', function () {
     var testCases = [
       {
         title: 'if server clock is 1 then currentServerTime should be 1000',
@@ -178,7 +178,7 @@ describe('App.clusterController', function () {
 
     testCases.forEach(function (test) {
       it(test.title, function () {
-        controller.getServerClockSuccessCallback(test.data);
+        controller.setServerClock(test.data);
         expect(App.get('currentServerTime')).to.equal(test.result);
         App.set('clockDistance', clockDistance);
         App.set('currentServerTime', currentServerTime);
@@ -572,41 +572,6 @@ describe('App.clusterController', function () {
     });
   });
 
-  describe('#loadClientServerClockDistance()', function() {
-
-    beforeEach(function() {
-      sinon.stub(controller, 'getServerClock').returns({
-        done: Em.clb
-      });
-    });
-
-    afterEach(function() {
-      controller.getServerClock.restore();
-    });
-
-    it('getServerClock should be called', function() {
-      expect(controller.loadClientServerClockDistance()).to.be.an.object;
-      expect(controller.getServerClock).to.be.calledOnce;
-    });
-  });
-
-  describe('#getServerClock()', function() {
-
-    it('App.ajax.send should be called', function() {
-      controller.getServerClock();
-      var args = testHelpers.findAjaxRequest('name', 'ambari.service');
-      expect(args[0]).to.eql({
-        name: 'ambari.service',
-        sender: controller,
-        data: {
-          fields: '?fields=RootServiceComponents/server_clock'
-        },
-        success: 'getServerClockSuccessCallback',
-        error: 'getServerClockErrorCallback'
-      });
-    });
-  });
-
   describe('#isRunningState()', function() {
     var testCases = [
       {
@@ -738,20 +703,25 @@ describe('App.clusterController', function () {
   });
 
   describe('#loadAmbariPropertiesSuccess()', function() {
+    var data = {
+      RootServiceComponents: {
+        properties: {
+          p1: '1'
+        }
+      }
+    };
 
     beforeEach(function() {
       sinon.stub(App.router.get('mainController'), 'monitorInactivity');
-      controller.loadAmbariPropertiesSuccess({
-        RootServiceComponents: {
-          properties: {
-            p1: '1'
-          }
-        }
-      });
+      sinon.stub(App.router.get('mainController'), 'setAmbariServerVersion');
+      sinon.stub(controller, 'setServerClock');
+      controller.loadAmbariPropertiesSuccess(data);
     });
 
     afterEach(function() {
       App.router.get('mainController').monitorInactivity.restore();
+      App.router.get('mainController').setAmbariServerVersion.restore();
+      controller.setServerClock.restore();
     });
 
     it('should set ambariProperties', function() {
@@ -765,6 +735,14 @@ describe('App.clusterController', function () {
     it('monitorInactivity should be called', function() {
       expect(App.router.get('mainController').monitorInactivity).to.be.calledOnce;
     });
+
+    it('setAmbariServerVersion should be called', function() {
+      expect(App.router.get('mainController').setAmbariServerVersion.calledWith(data)).to.be.true;
+    });
+
+    it('setServerClock should be called', function() {
+      expect(controller.setServerClock.calledWith(data)).to.be.true;
+    });
   });
 
   describe('#updateClusterData()', function() {
@@ -849,7 +827,6 @@ describe('App.clusterController', function () {
     beforeEach(function() {
       sinon.stub(controller, 'loadAuthorizations');
       sinon.stub(controller, 'getAllHostNames');
-      sinon.stub(controller, 'loadAmbariProperties');
       sinon.stub(controller, 'loadClusterInfo');
       sinon.stub(controller, 'restoreUpgradeState');
       sinon.stub(controller, 'loadClusterDataToModel');
@@ -871,7 +848,6 @@ describe('App.clusterController', function () {
       App.router.get('mainController').startPolling.restore();
       controller.loadAuthorizations.restore();
       controller.getAllHostNames.restore();
-      controller.loadAmbariProperties.restore();
       controller.loadClusterInfo.restore();
       controller.restoreUpgradeState.restore();
       controller.loadClusterDataToModel.restore();
@@ -887,11 +863,6 @@ describe('App.clusterController', function () {
       expect(controller.getAllHostNames.calledOnce).to.be.true;
     });
 
-    it('loadAmbariProperties should be called', function() {
-      controller.loadClusterData();
-      expect(controller.loadAmbariProperties.calledOnce).to.be.true;
-    });
-
     it('getAllUserSettings should be called', function() {
       controller.loadClusterData();
       expect(App.router.get('userSettingsController').getAllUserSettings.calledOnce).to.be.true;

http://git-wip-us.apache.org/repos/asf/ambari/blob/735cbda8/ambari-web/test/controllers/main_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/main_test.js b/ambari-web/test/controllers/main_test.js
index c026604..9673092 100644
--- a/ambari-web/test/controllers/main_test.js
+++ b/ambari-web/test/controllers/main_test.js
@@ -22,40 +22,6 @@ var testHelpers = require('test/helpers');
 describe('App.MainController', function () {
   var mainController = App.MainController.create();
 
-  describe('#getServerVersionSuccessCallback', function () {
-
-    var controller = App.MainController.create(),
-      cases = [
-        {
-          osFamily: 'redhat5',
-          expected: false
-        },
-        {
-          osFamily: 'redhat6',
-          expected: true
-        },
-        {
-          osFamily: 'suse11',
-          expected: false
-        }
-      ],
-      title = 'App.isManagedMySQLForHiveEnabled should be {0} for {1}';
-
-    cases.forEach(function (item) {
-      it(title.format(item.expected, item.osFamily), function () {
-        controller.getServerVersionSuccessCallback({
-          'RootServiceComponents': {
-            'component_version': '',
-            'properties': {
-              'server.os_family': item.osFamily
-            }
-          }
-        });
-        expect(App.get('isManagedMySQLForHiveEnabled')).to.equal(item.expected);
-      });
-    });
-  });
-
   App.TestAliases.testAsComputedAlias(mainController, 'isClusterDataLoaded', 'App.router.clusterController.isLoaded', 'boolean');
 
   App.TestAliases.testAsComputedAlias(mainController, 'clusterDataLoadedPercent', 'App.router.clusterController.clusterDataLoadedPercent', 'string');
@@ -110,38 +76,6 @@ describe('App.MainController', function () {
     });
   });
 
-  describe('#checkServerClientVersion', function() {
-    beforeEach(function () {
-      sinon.stub(mainController, 'getServerVersion').returns({
-        done: function(func) {
-          if (func) {
-            func();
-          }
-        }
-      });
-    });
-    afterEach(function () {
-      mainController.getServerVersion.restore();
-    });
-    it ('Should resolve promise', function() {
-      var deffer = mainController.checkServerClientVersion();
-      deffer.then(function(val){
-        expect(val).to.be.undefined;
-      });
-    });
-  });
-
-  describe('#getServerVersion', function() {
-
-    it ('Should send data', function() {
-      mainController.getServerVersion();
-      var args = testHelpers.findAjaxRequest('name', 'ambari.service');
-      expect(args[0]).to.exists;
-      expect(args[0].sender).to.be.eql(mainController);
-      expect(args[0].data.fields).to.be.equal('?fields=RootServiceComponents/component_version,RootServiceComponents/properties/server.os_family&minimal_response=true');
-    });
-  });
-
   describe('#updateTitle', function() {
     beforeEach(function () {
       sinon.stub(App.router, 'get').withArgs('clusterController.clusterName').returns('c1')


[37/50] [abbrv] ambari git commit: AMBARI-20723 Remove singleNodeInstall flag from ambari-web code. (ababiichuk)

Posted by ja...@apache.org.
AMBARI-20723 Remove singleNodeInstall flag from ambari-web code. (ababiichuk)


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

Branch: refs/heads/ambari-rest-api-explorer
Commit: bab55aac66e06be0bc99a6ac2e75b86b0c2c5b48
Parents: 753b38c
Author: ababiichuk <ab...@hortonworks.com>
Authored: Mon Apr 10 16:55:12 2017 +0300
Committer: ababiichuk <ab...@hortonworks.com>
Committed: Mon Apr 10 17:29:15 2017 +0300

----------------------------------------------------------------------
 ambari-web/app/assets/test/tests.js             |  1 -
 ambari-web/app/config.js                        |  2 -
 .../templates/main/service/services/oozie.hbs   | 40 --------------
 ambari-web/app/views.js                         |  1 -
 .../app/views/common/quick_view_link_view.js    |  8 ---
 .../app/views/main/service/info/summary.js      |  7 ---
 .../app/views/main/service/services/hbase.js    |  6 ---
 .../app/views/main/service/services/hdfs.js     |  4 --
 .../app/views/main/service/services/oozie.js    | 29 -----------
 .../test/views/common/quick_link_view_test.js   | 10 ----
 .../views/main/service/info/summary_test.js     | 26 ---------
 .../views/main/service/services/hbase_test.js   | 23 --------
 .../views/main/service/services/hdfs_test.js    | 20 -------
 .../views/main/service/services/oozie_test.js   | 55 --------------------
 14 files changed, 232 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/bab55aac/ambari-web/app/assets/test/tests.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/assets/test/tests.js b/ambari-web/app/assets/test/tests.js
index ef8d0bc..432479d 100644
--- a/ambari-web/app/assets/test/tests.js
+++ b/ambari-web/app/assets/test/tests.js
@@ -349,7 +349,6 @@ var files = [
   'test/views/main/service/services/storm_test',
   'test/views/main/service/services/yarn_test',
   'test/views/main/service/services/hive_test',
-  'test/views/main/service/services/oozie_test',
   'test/views/main/service/services/mapreduce2_test',
   'test/views/main/service/services/zookeeper_test',
   'test/views/main/service/services/flume_test',

http://git-wip-us.apache.org/repos/asf/ambari/blob/bab55aac/ambari-web/app/config.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/config.js b/ambari-web/app/config.js
index 47eb788..de4b52a 100644
--- a/ambari-web/app/config.js
+++ b/ambari-web/app/config.js
@@ -45,8 +45,6 @@ App.alertGroupsUpdateInterval = 10000;
 App.clusterEnvUpdateInterval = 10000;
 App.pageReloadTime = 3600000;
 App.nnCheckpointAgeAlertThreshold = 12; // in hours
-App.singleNodeInstall = false;
-App.singleNodeAlias = document.location.hostname;
 App.minDiskSpace = 2.0; // minimum disk space required for '/' for each host before install, unit GB
 App.minDiskSpaceUsrLib = 1.0; // minimum disk space for '/usr/lib' for each host before install, unit GB
 App.healthIconClassGreen = 'glyphicon glyphicon-ok-sign'; // bootstrap icon class for healthy/started service/host/host-component

http://git-wip-us.apache.org/repos/asf/ambari/blob/bab55aac/ambari-web/app/templates/main/service/services/oozie.hbs
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates/main/service/services/oozie.hbs b/ambari-web/app/templates/main/service/services/oozie.hbs
deleted file mode 100644
index 3706eb4..0000000
--- a/ambari-web/app/templates/main/service/services/oozie.hbs
+++ /dev/null
@@ -1,40 +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.
-}}
-
-<div class="clearfix">
-  <div class="name col-md-2">
-    <i class="pull-left glyphicon glyphicon-empty"></i>
-    {{view App.MainDashboardServiceHealthView serviceBinding="view.service"}}
-    <a {{action selectService view.service href=true}}>{{view.service.displayName}}</a>
-    {{#if view.alertsCount}}
-      <a href="#" class="label label-important" {{action "showAlertsPopup" view.service target="view.parentView"}}>
-        {{view.alertsCount}}
-      </a>
-    {{/if}}
-  </div>
-  <div class="summary span">
-    {{#each component in view.masters}}
-      <a href="#" {{action showDetails component.host}}>{{component.displayName}}</a>,
-    {{/each}}
-
-    <a href="#" {{action filterHosts view.clients.component}}>{{view.clients.title}}</a>,
-
-    <a href="{{unbound view.webUi}}" target="_blank">{{t services.oozie.webUi}}</a>
-
-  </div>
-</div>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/bab55aac/ambari-web/app/views.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views.js b/ambari-web/app/views.js
index 3ed1a37..8031434 100644
--- a/ambari-web/app/views.js
+++ b/ambari-web/app/views.js
@@ -295,7 +295,6 @@ require('views/main/service/services/mapreduce2');
 require('views/main/service/services/hbase');
 require('views/main/service/services/hive');
 require('views/main/service/services/zookeeper');
-require('views/main/service/services/oozie');
 require('views/main/service/services/flume');
 require('views/main/service/services/storm');
 require('views/main/service/services/ranger');

http://git-wip-us.apache.org/repos/asf/ambari/blob/bab55aac/ambari-web/app/views/common/quick_view_link_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/common/quick_view_link_view.js b/ambari-web/app/views/common/quick_view_link_view.js
index 3f3a3a3..dfaf953 100644
--- a/ambari-web/app/views/common/quick_view_link_view.js
+++ b/ambari-web/app/views/common/quick_view_link_view.js
@@ -98,7 +98,6 @@ App.QuickLinksView = Em.View.extend({
    *
    * The flags responsible for correct, up-to-date state of quick links:
    * - App.currentStackVersionNumber
-   * - App.singleNodeInstall
    * - App.router.clusterController.isHostComponentMetricsLoaded
    */
   setQuickLinks: function () {
@@ -107,7 +106,6 @@ App.QuickLinksView = Em.View.extend({
     }
   }.observes(
     'App.currentStackVersionNumber',
-    'App.singleNodeInstall',
     'App.router.clusterController.isServiceMetricsLoaded',
     'App.router.clusterController.isHostComponentMetricsLoaded',
     'App.router.clusterController.quickLinksUpdateCounter'
@@ -612,12 +610,6 @@ App.QuickLinksView = Em.View.extend({
   getHosts: function (response, serviceName) {
     //The default error message when we cannot obtain the host information for the given service
     this.set('quickLinksErrorMessage', Em.I18n.t('quick.links.error.nohosts.label').format(serviceName));
-    if (App.get('singleNodeInstall')) {
-      return [{
-        hostName: App.get('singleNodeAlias'),
-        publicHostName: App.get('singleNodeAlias')
-      }];
-    }
     var hosts = [];
     var quickLinkConfigs = App.QuickLinksConfig.find().findProperty("id", serviceName);
     if (quickLinkConfigs) {

http://git-wip-us.apache.org/repos/asf/ambari/blob/bab55aac/ambari-web/app/views/main/service/info/summary.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/service/info/summary.js b/ambari-web/app/views/main/service/info/summary.js
index 551a3fd..75d4ed5 100644
--- a/ambari-web/app/views/main/service/info/summary.js
+++ b/ambari-web/app/views/main/service/info/summary.js
@@ -135,13 +135,6 @@ App.MainServiceInfoSummaryView = Em.View.extend(App.Persist, App.TimeRangeMixin,
     return result;
   }.property('controller.content'),
 
-  historyServerUI: function () {
-    var master = this.get('controller.content.hostComponents').findProperty('isMaster');
-    return App.singleNodeInstall
-      ? "http://" + App.singleNodeAlias + ":19888"
-      : "http://" + master.get("host.publicHostName") + ":19888";
-  }.property('controller.content'),
-
   /**
    * Property related to ZOOKEEPER service, is unused for other services
    * @return {Object}

http://git-wip-us.apache.org/repos/asf/ambari/blob/bab55aac/ambari-web/app/views/main/service/services/hbase.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/service/services/hbase.js b/ambari-web/app/views/main/service/services/hbase.js
index d2716aa..ddcb18d 100644
--- a/ambari-web/app/views/main/service/services/hbase.js
+++ b/ambari-web/app/views/main/service/services/hbase.js
@@ -67,12 +67,6 @@ App.MainDashboardServiceHbaseView = App.MainDashboardServiceView.extend({
     return this.t("dashboard.services.hbase.summary").format(this.get('service.regionServersTotal'), avgLoad);
   }.property('service.regionServersTotal', 'service.averageLoad'),
 
-  hbaseMasterWebUrl: function () {
-    if (this.get('activeMaster.host.publicHostName')) {
-      return "http://" + (App.singleNodeInstall ? App.singleNodeAlias : this.get('activeMaster.host.publicHostName')) + ":60010";
-    }
-  }.property('activeMaster'),
-
   averageLoad: function () {
     var avgLoad = this.get('service.averageLoad');
     if (isNaN(avgLoad)) {

http://git-wip-us.apache.org/repos/asf/ambari/blob/bab55aac/ambari-web/app/views/main/service/services/hdfs.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/service/services/hdfs.js b/ambari-web/app/views/main/service/services/hdfs.js
index 79208b9..becb75c 100644
--- a/ambari-web/app/views/main/service/services/hdfs.js
+++ b/ambari-web/app/views/main/service/services/hdfs.js
@@ -113,10 +113,6 @@ App.MainDashboardServiceHdfsView = App.MainDashboardServiceView.extend({
     return this.t('services.service.summary.notRunning');
   }.property("service.nameNodeStartTime"),
 
-  nodeWebUrl: function () {
-    return "http://" + (App.singleNodeInstall ? App.singleNodeAlias :  this.get('service.nameNode.publicHostName')) + ":50070";
-  }.property('service.nameNode'),
-
   nodeHeap: App.MainDashboardServiceView.formattedHeap('dashboard.services.hdfs.nodes.heapUsed', 'service.jvmMemoryHeapUsed', 'service.jvmMemoryHeapMax'),
 
   dfsUsedDisk: diskPart('dashboard.services.hdfs.capacityUsed', 'service.capacityTotal', 'service.capacityUsed'),

http://git-wip-us.apache.org/repos/asf/ambari/blob/bab55aac/ambari-web/app/views/main/service/services/oozie.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/service/services/oozie.js b/ambari-web/app/views/main/service/services/oozie.js
deleted file mode 100644
index f7a645d..0000000
--- a/ambari-web/app/views/main/service/services/oozie.js
+++ /dev/null
@@ -1,29 +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');
-
-App.MainDashboardServiceOozieView = App.MainDashboardServiceView.extend({
-  serviceName: 'oozie',
-  templateName: require('templates/main/service/services/oozie'),
-
-  webUi: function () {
-    var hostName = App.singleNodeInstall ? App.singleNodeAlias : this.get('service.hostComponents').findProperty('componentName', 'OOZIE_SERVER').get('host.publicHostName');
-    return "http://{0}:11000/oozie".format(hostName);
-  }.property('service')
-});
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/bab55aac/ambari-web/test/views/common/quick_link_view_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/views/common/quick_link_view_test.js b/ambari-web/test/views/common/quick_link_view_test.js
index c0d58c8..fbdb711 100644
--- a/ambari-web/test/views/common/quick_link_view_test.js
+++ b/ambari-web/test/views/common/quick_link_view_test.js
@@ -886,7 +886,6 @@ describe('App.QuickViewLinks', function () {
       sinon.stub(quickViewLinks, 'processHbaseHosts').returns(['hbaseHost']);
       sinon.stub(quickViewLinks, 'processYarnHosts').returns(['yarnHost']);
       sinon.stub(quickViewLinks, 'findHosts').returns(['host1']);
-      App.set('singleNodeInstall', false);
       sinon.stub(App.QuickLinksConfig, 'find').returns([
         Em.Object.create({
           id: 'OOZIE',
@@ -990,15 +989,6 @@ describe('App.QuickViewLinks', function () {
       App.QuickLinksConfig.find.restore();
     });
 
-    it("singleNodeInstall is true", function() {
-      App.set('singleNodeInstall', true);
-      App.set('singleNodeAlias', 'host1');
-      expect(quickViewLinks.getHosts({}, 'S1')).to.eql([{
-        hostName: 'host1',
-        publicHostName: 'host1'
-      }])
-    });
-
     var tests = [
       {
         serviceName: 'OOZIE',

http://git-wip-us.apache.org/repos/asf/ambari/blob/bab55aac/ambari-web/test/views/main/service/info/summary_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/views/main/service/info/summary_test.js b/ambari-web/test/views/main/service/info/summary_test.js
index 51fd2f2..41f2992 100644
--- a/ambari-web/test/views/main/service/info/summary_test.js
+++ b/ambari-web/test/views/main/service/info/summary_test.js
@@ -350,32 +350,6 @@ describe('App.MainServiceInfoSummaryView', function() {
     });
   });
 
-  describe("#historyServerUI", function() {
-
-    it("singleNodeInstall is true", function() {
-      App.set('singleNodeInstall', true);
-      App.set('singleNodeAlias', 'alias');
-      view.propertyDidChange('historyServerUI');
-      expect(view.get('historyServerUI')).to.equal("http://alias:19888");
-    });
-
-    it("singleNodeInstall is false", function () {
-      App.set('singleNodeInstall', false);
-      view.set('controller.content', Em.Object.create({
-        hostComponents: [
-          Em.Object.create({
-            isMaster: true,
-            host: Em.Object.create({
-              publicHostName: 'host1'
-            })
-          })
-        ]
-      }));
-      view.propertyDidChange('historyServerUI');
-      expect(view.get('historyServerUI')).to.equal("http://host1:19888");
-    });
-  });
-
   describe("#serversHost", function() {
 
     it("should return empty object", function() {

http://git-wip-us.apache.org/repos/asf/ambari/blob/bab55aac/ambari-web/test/views/main/service/services/hbase_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/views/main/service/services/hbase_test.js b/ambari-web/test/views/main/service/services/hbase_test.js
index 6c0f1f1..f8f1941 100644
--- a/ambari-web/test/views/main/service/services/hbase_test.js
+++ b/ambari-web/test/views/main/service/services/hbase_test.js
@@ -86,27 +86,4 @@ describe('App.MainDashboardServiceHbaseView', function () {
     });
   });
 
-  describe("#hbaseMasterWebUrl", function() {
-
-    it("activeMaster is present", function() {
-      view.reopen({
-        activeMaster: Em.Object.create({
-          host: Em.Object.create({
-            publicHostName: 'host1'
-          })
-        })
-      });
-      App.set('singleNodeInstall', false);
-      view.propertyDidChange('hbaseMasterWebUrl');
-      expect(view.get('hbaseMasterWebUrl')).to.be.equal('http://host1:60010');
-    });
-    it("activeMaster is null", function() {
-      view.reopen({
-        activeMaster: null
-      });
-      view.propertyDidChange('hbaseMasterWebUrl');
-      expect(view.get('hbaseMasterWebUrl')).to.be.undefined;
-    });
-  });
-
 });
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/bab55aac/ambari-web/test/views/main/service/services/hdfs_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/views/main/service/services/hdfs_test.js b/ambari-web/test/views/main/service/services/hdfs_test.js
index 4de5f0b..f39b376 100644
--- a/ambari-web/test/views/main/service/services/hdfs_test.js
+++ b/ambari-web/test/views/main/service/services/hdfs_test.js
@@ -183,26 +183,6 @@ describe('App.MainDashboardServiceHdfsView', function () {
     });
   });
 
-  describe("#nodeWebUrl", function () {
-
-    it("singleNodeInstall is true", function () {
-      App.set('singleNodeInstall', true);
-      App.set('singleNodeAlias', 'host1');
-
-      view.propertyDidChange('nodeWebUrl');
-      expect(view.get('nodeWebUrl')).to.be.equal("http://host1:50070");
-    });
-
-    it("singleNodeInstall is false", function () {
-      App.set('singleNodeInstall', false);
-      view.set('service.nameNode', Em.Object.create({
-        publicHostName: 'host2'
-      }));
-      view.propertyDidChange('nodeWebUrl');
-      expect(view.get('nodeWebUrl')).to.be.equal("http://host2:50070");
-    });
-  });
-
   describe("#nonDfsUsed", function() {
     var testCases = [
       {

http://git-wip-us.apache.org/repos/asf/ambari/blob/bab55aac/ambari-web/test/views/main/service/services/oozie_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/views/main/service/services/oozie_test.js b/ambari-web/test/views/main/service/services/oozie_test.js
deleted file mode 100644
index c95e65f..0000000
--- a/ambari-web/test/views/main/service/services/oozie_test.js
+++ /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
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-var App = require('app');
-require('/views/main/service/services/oozie');
-
-describe('App.MainDashboardServiceOozieView', function () {
-  var view;
-
-  beforeEach(function() {
-    view = App.MainDashboardServiceOozieView.create();
-  });
-
-  describe("#webUi", function () {
-
-    it("singleNodeInstall is true", function () {
-      App.set('singleNodeInstall', true);
-      App.set('singleNodeAlias', 'host1');
-
-      view.propertyDidChange('webUi');
-      expect(view.get('webUi')).to.be.equal("http://host1:11000/oozie");
-    });
-
-    it("singleNodeInstall is false", function () {
-      App.set('singleNodeInstall', false);
-      view.set('service', Em.Object.create({
-        hostComponents: [
-          Em.Object.create({
-            componentName: 'OOZIE_SERVER',
-            host: Em.Object.create({
-              publicHostName: 'host2'
-            })
-          })
-        ]
-      }));
-      view.propertyDidChange('webUi');
-      expect(view.get('webUi')).to.be.equal("http://host2:11000/oozie");
-    });
-  });
-});
\ No newline at end of file


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

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


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

Branch: refs/heads/ambari-rest-api-explorer
Commit: b4fc47f5ea849a5e8fafea0842397fbb1d73272c
Parents: b491509
Author: pallavkul <pa...@gmail.com>
Authored: Wed Apr 5 11:17:27 2017 +0530
Committer: pallavkul <pa...@gmail.com>
Committed: Wed Apr 5 11:17:27 2017 +0530

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


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

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

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


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

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


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

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

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


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

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

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

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


[49/50] [abbrv] ambari git commit: Merge trunk to ambari-rest-api-explorer branch. (jaimin)

Posted by ja...@apache.org.
http://git-wip-us.apache.org/repos/asf/ambari/blob/3acd2e6d/ambari-server/src/main/java/org/apache/ambari/server/api/services/groups/MemberService.java
----------------------------------------------------------------------
diff --cc ambari-server/src/main/java/org/apache/ambari/server/api/services/groups/MemberService.java
index 0ccc472,0000000..f03b47f
mode 100644,000000..100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/api/services/groups/MemberService.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/api/services/groups/MemberService.java
@@@ -1,200 -1,0 +1,200 @@@
 +/**
 + * 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.api.services.groups;
 +
 +import java.util.HashMap;
 +import java.util.Map;
 +
 +import javax.ws.rs.DELETE;
 +import javax.ws.rs.GET;
 +import javax.ws.rs.POST;
 +import javax.ws.rs.PUT;
 +import javax.ws.rs.Path;
 +import javax.ws.rs.PathParam;
 +import javax.ws.rs.Produces;
 +import javax.ws.rs.core.Context;
 +import javax.ws.rs.core.HttpHeaders;
 +import javax.ws.rs.core.Response;
 +import javax.ws.rs.core.UriInfo;
 +
 +import org.apache.ambari.server.api.resources.ResourceInstance;
 +import org.apache.ambari.server.api.services.BaseService;
 +import org.apache.ambari.server.api.services.Request;
 +import org.apache.ambari.server.controller.MemberResponse;
 +import org.apache.ambari.server.controller.spi.Resource;
 +
 +import io.swagger.annotations.Api;
 +import io.swagger.annotations.ApiImplicitParam;
 +import io.swagger.annotations.ApiImplicitParams;
 +import io.swagger.annotations.ApiOperation;
 +import io.swagger.annotations.ApiParam;
 +import io.swagger.annotations.ApiResponse;
 +import io.swagger.annotations.ApiResponses;
 +
 +/**
 + * Service responsible for user membership requests.
 + */
 +@Path("/groups/{groupName}/members")
 +@Api(value = "Groups", description = "Endpoint for group specific operations")
 +public class MemberService extends BaseService {
 +  /**
 +   * Creates new members.
 +   * Handles: POST /groups/{groupname}/members requests.
 +   *
 +   * @param headers      http headers
 +   * @param ui           uri info
 +   * @param groupName    group name
 +   * @return information regarding the created member
 +   */
 +   @POST
 +   @Produces("text/plain")
 +   public Response createMember(String body, @Context HttpHeaders headers, @Context UriInfo ui, @PathParam("groupName") String groupName) {
 +    return handleRequest(headers, body, ui, Request.Type.POST, createMemberResource(groupName, null));
 +  }
 +
 +  /**
 +   * Creates a new member.
 +   * Handles: POST /groups/{groupname}/members/{username} requests.
 +   *
 +   * @param headers      http headers
 +   * @param ui           uri info
 +   * @param groupName    group name
 +   * @param userName     the user name
 +   * @return information regarding the created member
 +   */
 +   @POST
 +   @Path("{userName}")
 +   @Produces("text/plain")
 +   public Response createMember(String body, @Context HttpHeaders headers, @Context UriInfo ui, @PathParam("groupName") String groupName,
 +                                 @PathParam("userName") String userName) {
 +    return handleRequest(headers, body, ui, Request.Type.POST, createMemberResource(groupName, userName));
 +  }
 +
 +   /**
 +    * Deletes a member.
 +    * Handles:  DELETE /groups/{groupname}/members/{username} requests.
 +    *
 +    * @param headers      http headers
 +    * @param ui           uri info
 +    * @param groupName    group name
 +    * @param userName     the user name
 +    * @return information regarding the deleted group
 +    */
 +   @DELETE
 +   @Path("{userName}")
 +   @Produces("text/plain")
 +   @ApiOperation(value = "Delete group member", nickname = "MemberService#deleteMember", notes = "Delete member resource.")
 +   @ApiResponses(value = {
 +     @ApiResponse(code = 200, message = "Successful operation"),
 +     @ApiResponse(code = 500, message = "Server Error")}
 +   )
 +   public Response deleteMember(@Context HttpHeaders headers, @Context UriInfo ui, @ApiParam(value = "group name", required = true) @PathParam("groupName") String groupName,
 +                                @ApiParam(value = "user name", required = true) @PathParam("userName") String userName) {
 +     return handleRequest(headers, null, ui, Request.Type.DELETE, createMemberResource(groupName, userName));
 +   }
 +
 +  /**
 +   * Gets all members.
 +   * Handles: GET /groups/{groupname}/members requests.
 +   *
 +   * @param headers    http headers
 +   * @param ui         uri info
 +   * @param groupName  group name
 +   * @return information regarding all members
 +   */
 +  @GET
 +  @Produces("text/plain")
 +  @ApiOperation(value = "Get all group members", nickname = "MemberService#getMembers", notes = "Returns details of all members.", response = MemberResponse.class, responseContainer = "List")
 +  @ApiImplicitParams({
 +    @ApiImplicitParam(name = "fields", value = "Filter member details", defaultValue = "MemberInfo/*", dataType = "string", paramType = "query"),
 +    @ApiImplicitParam(name = "sortBy", value = "Sort members (asc | desc)", defaultValue = "MemberInfo/user_name.asc", dataType = "string", paramType = "query"),
 +    @ApiImplicitParam(name = "page_size", value = "The number of resources to be returned for the paged response.", defaultValue = "10", dataType = "integer", paramType = "query"),
 +    @ApiImplicitParam(name = "from", value = "The starting page resource (inclusive). Valid values are :offset | \"start\"", defaultValue = "0", dataType = "string", paramType = "query"),
 +    @ApiImplicitParam(name = "to", value = "The ending page resource (inclusive). Valid values are :offset | \"end\"", dataType = "string", paramType = "query")
 +  })
 +  @ApiResponses(value = {
 +    @ApiResponse(code = 200, message = "Successful operation", response = MemberResponse.class, responseContainer = "List")}
 +  )
 +  public Response getMembers(@Context HttpHeaders headers, @Context UriInfo ui, @ApiParam(value = "group name", required = true) @PathParam("groupName") String groupName) {
 +    return handleRequest(headers, null, ui, Request.Type.GET, createMemberResource(groupName, null));
 +  }
 +
 +  /**
 +   * Gets member.
 +   * Handles: GET /groups/{groupname}/members/{username} requests.
 +   *
 +   * @param headers    http headers
 +   * @param ui         uri info
 +   * @param groupName    group name
 +   * @param userName   the user name
 +   * @return information regarding the specific member
 +   */
 +  @GET
 +  @Path("{userName}")
 +  @Produces("text/plain")
 +  @ApiOperation(value = "Get group member", nickname = "MemberService#getMember", notes = "Returns member details.", response = MemberResponse.class)
 +  @ApiImplicitParams({
 +    @ApiImplicitParam(name = "fields", value = "Filter member details", defaultValue = "MemberInfo", dataType = "string", paramType = "query")
 +  })
 +  @ApiResponses(value = {
 +    @ApiResponse(code = 200, message = "Successful operation", response = MemberResponse.class)}
 +  )
 +  public Response getMember(@Context HttpHeaders headers, @Context UriInfo ui, @ApiParam(value = "group name", required = true)  @PathParam("groupName") String groupName,
 +                            @ApiParam(value = "user name", required = true) @PathParam("userName") String userName) {
 +    return handleRequest(headers, null, ui, Request.Type.GET, createMemberResource(groupName, userName));
 +  }
 +
 +  /**
 +   * Updates all members.
 +   * Handles: PUT /groups/{groupname}/members requests.
 +   *
 +   * @param headers    http headers
 +   * @param ui         uri info
 +   * @param groupName    group name
 +   * @return status of the request
 +   */
 +  @PUT
 +  @Produces("text/plain")
 +  @ApiOperation(value = "Update group members", nickname = "MemberService#updateMembers", notes = "Updates group member resources.", responseContainer = "List")
 +  @ApiImplicitParams({
 +    @ApiImplicitParam(name = "body", value = "input parameters in json form", required = true, dataType = "org.apache.ambari.server.controller.MemberRequest", paramType = "body")
 +  })
 +  @ApiResponses(value = {
 +    @ApiResponse(code = 200, message = "Successful operation"),
 +    @ApiResponse(code = 500, message = "Server Error")}
 +  )
 +  public Response updateMembers(String body, @Context HttpHeaders headers, @Context UriInfo ui, @ApiParam(value = "group name", required = true)
 +                                 @PathParam("groupName") String groupName) {
 +    return handleRequest(headers, body, ui, Request.Type.PUT, createMemberResource(groupName, null));
 +  }
 +
 +  /**
 +   * Create a member resource instance.
 +   *
 +   * @param groupName  group name
 +   * @param userName   user name
 +   *
 +   * @return a member resource instance
 +   */
 +  private ResourceInstance createMemberResource(String groupName, String userName) {
-     final Map<Resource.Type, String> mapIds = new HashMap<Resource.Type, String>();
++    final Map<Resource.Type, String> mapIds = new HashMap<>();
 +    mapIds.put(Resource.Type.Group, groupName);
 +    mapIds.put(Resource.Type.Member, userName);
 +    return createResource(Resource.Type.Member, mapIds);
 +  }
 +}

http://git-wip-us.apache.org/repos/asf/ambari/blob/3acd2e6d/ambari-server/src/main/java/org/apache/ambari/server/api/services/users/ActiveWidgetLayoutService.java
----------------------------------------------------------------------
diff --cc ambari-server/src/main/java/org/apache/ambari/server/api/services/users/ActiveWidgetLayoutService.java
index 3dea1ca,0000000..561e7d3
mode 100644,000000..100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/api/services/users/ActiveWidgetLayoutService.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/api/services/users/ActiveWidgetLayoutService.java
@@@ -1,111 -1,0 +1,111 @@@
 +/**
 + * 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.api.services.users;
 +
 +import java.util.HashMap;
 +import java.util.Map;
 +
 +import javax.ws.rs.GET;
 +import javax.ws.rs.PUT;
 +import javax.ws.rs.Path;
 +import javax.ws.rs.PathParam;
 +import javax.ws.rs.Produces;
 +import javax.ws.rs.core.Context;
 +import javax.ws.rs.core.HttpHeaders;
 +import javax.ws.rs.core.Response;
 +import javax.ws.rs.core.UriInfo;
 +
 +import org.apache.ambari.server.api.resources.ResourceInstance;
 +import org.apache.ambari.server.api.services.BaseService;
 +import org.apache.ambari.server.api.services.Request;
 +import org.apache.ambari.server.controller.ActiveWidgetLayoutResponse;
 +import org.apache.ambari.server.controller.spi.Resource;
 +import org.apache.commons.lang.StringUtils;
 +
 +import io.swagger.annotations.Api;
 +import io.swagger.annotations.ApiImplicitParam;
 +import io.swagger.annotations.ApiImplicitParams;
 +import io.swagger.annotations.ApiOperation;
 +import io.swagger.annotations.ApiParam;
 +import io.swagger.annotations.ApiResponse;
 +import io.swagger.annotations.ApiResponses;
 +
 +/**
 + * WidgetLayout Service
 + */
 +@Path("/users/{userName}/activeWidgetLayouts")
 +@Api(value = "Users", description = "Endpoint for User specific operations")
 +public class ActiveWidgetLayoutService extends BaseService {
 +
 +  /**
 +   * Handles URL: /users/{userName}/activeWidgetLayouts
 +   * Get all instances for a view.
 +   *
 +   * @param headers  http headers
 +   * @param ui       uri info
 +   * @param userName user name
 +   *
 +   * @return instance collection resource representation
 +   */
 +  @GET
 +  @Produces("text/plain")
 +  @ApiOperation(value = "Get user widget layouts", nickname = "ActiveWidgetLayoutService#getServices", notes = "Returns all active widget layouts for user.", response = ActiveWidgetLayoutResponse.class, responseContainer = "List")
 +  @ApiImplicitParams({
 +    @ApiImplicitParam(name = "fields", value = "Filter user layout details", defaultValue = "WidgetLayoutInfo/*", dataType = "string", paramType = "query"),
 +    @ApiImplicitParam(name = "sortBy", value = "Sort layouts (asc | desc)", defaultValue = "WidgetLayoutInfo/user_name.asc", dataType = "string", paramType = "query"),
 +    @ApiImplicitParam(name = "page_size", value = "The number of resources to be returned for the paged response.", defaultValue = "10", dataType = "integer", paramType = "query"),
 +    @ApiImplicitParam(name = "from", value = "The starting page resource (inclusive). Valid values are :offset | \"start\"", defaultValue = "0", dataType = "string", paramType = "query"),
 +    @ApiImplicitParam(name = "to", value = "The ending page resource (inclusive). Valid values are :offset | \"end\"", dataType = "string", paramType = "query")
 +  })
 +  public Response getServices(String body, @Context HttpHeaders headers, @Context UriInfo ui, @ApiParam(value = "user name", required = true)
 +                              @PathParam("userName") String userName) {
 +
 +    return handleRequest(headers, body, ui, Request.Type.GET, createResource(userName));
 +  }
 +
 +  /**
 +   *
 +   * @param body      body
 +   * @param headers   http headers
 +   * @param ui        uri info
 +   * @param userName  user name
 +   * @return
 +   */
 +  @PUT
 +  @Produces("text/plain")
 +  @ApiOperation(value = "Update user widget layouts", nickname = "ActiveWidgetLayoutService#updateServices", notes = "Updates user widget layout.")
 +  @ApiImplicitParams({
 +    @ApiImplicitParam(name = "body", value = "input parameters in json form", required = true, dataType = "org.apache.ambari.server.controller.ActiveWidgetLayoutRequest", paramType = "body")
 +  })
 +  @ApiResponses(value = {
 +    @ApiResponse(code = 200, message = "Successful operation"),
 +    @ApiResponse(code = 500, message = "Server Error")}
 +  )
 +  public Response updateServices(String body, @Context HttpHeaders headers, @Context UriInfo ui, @ApiParam(value = "user name", required = true)
 +                                 @PathParam("userName") String userName) {
 +
 +    return handleRequest(headers, body, ui, Request.Type.PUT, createResource(userName));
 +  }
 +
 +  private ResourceInstance createResource(String userName) {
-     Map<Resource.Type,String> mapIds = new HashMap<Resource.Type, String>();
++    Map<Resource.Type,String> mapIds = new HashMap<>();
 +    mapIds.put(Resource.Type.User, StringUtils.lowerCase(userName));
 +    return createResource(Resource.Type.ActiveWidgetLayout, mapIds);
 +  }
 +
 +}

http://git-wip-us.apache.org/repos/asf/ambari/blob/3acd2e6d/ambari-server/src/main/java/org/apache/ambari/server/api/services/users/UserAuthorizationService.java
----------------------------------------------------------------------
diff --cc ambari-server/src/main/java/org/apache/ambari/server/api/services/users/UserAuthorizationService.java
index 195f2e7,0000000..505108e
mode 100644,000000..100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/api/services/users/UserAuthorizationService.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/api/services/users/UserAuthorizationService.java
@@@ -1,120 -1,0 +1,120 @@@
 +/*
 + * 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.api.services.users;
 +
 +import java.util.HashMap;
 +import java.util.Map;
 +
 +import javax.ws.rs.GET;
 +import javax.ws.rs.Path;
 +import javax.ws.rs.PathParam;
 +import javax.ws.rs.Produces;
 +import javax.ws.rs.core.Context;
 +import javax.ws.rs.core.HttpHeaders;
 +import javax.ws.rs.core.Response;
 +import javax.ws.rs.core.UriInfo;
 +
 +import org.apache.ambari.server.api.resources.ResourceInstance;
 +import org.apache.ambari.server.api.services.BaseService;
 +import org.apache.ambari.server.api.services.Request;
 +import org.apache.ambari.server.controller.UserAuthorizationResponse;
 +import org.apache.ambari.server.controller.spi.Resource;
 +import org.apache.commons.lang.StringUtils;
 +
 +import io.swagger.annotations.Api;
 +import io.swagger.annotations.ApiImplicitParam;
 +import io.swagger.annotations.ApiImplicitParams;
 +import io.swagger.annotations.ApiOperation;
 +import io.swagger.annotations.ApiParam;
 +import io.swagger.annotations.ApiResponse;
 +import io.swagger.annotations.ApiResponses;
 +
 +/**
 + * UserAuthorizationService is a read-only service responsible for user authorization resource requests.
 + * <p/>
 + * The result sets returned by this service represent the set of authorizations assigned to a given user.
 + * Authorizations are tied to a resource, so a user may have the multiple authorization entries for the
 + * same authorization id (for example VIEW.USE), however each will represnet a different view instance.
 + */
 +@Path("/users/{userName}/authorizations")
 +@Api(value = "Users", description = "Endpoint for user specific operations")
 +public class UserAuthorizationService extends BaseService {
 +
 +  /**
 +   * Handles: GET  /users/{user_name}/authorizations
 +   * Get all authorizations for the relative user.
 +   *
 +   * @param headers        http headers
 +   * @param ui             uri info
 +   * @param userName       user name
 +   * @return authorizations collection resource representation
 +   */
 +  @GET
 +  @Produces("text/plain")
 +  @ApiOperation(value = "Get all authorizations", nickname = "UserAuthorizationService#getAuthorizations", notes = "Returns all authorization for user.", response = UserAuthorizationResponse.class, responseContainer = "List")
 +  @ApiImplicitParams({
 +    @ApiImplicitParam(name = "fields", value = "Filter user authorization details", defaultValue = "AuthorizationInfo/*", dataType = "string", paramType = "query"),
 +    @ApiImplicitParam(name = "sortBy", value = "Sort user authorizations (asc | desc)", defaultValue = "AuthorizationInfo/user_name.asc", dataType = "string", paramType = "query"),
 +    @ApiImplicitParam(name = "page_size", value = "The number of resources to be returned for the paged response.", defaultValue = "10", dataType = "integer", paramType = "query"),
 +    @ApiImplicitParam(name = "from", value = "The starting page resource (inclusive). Valid values are :offset | \"start\"", defaultValue = "0", dataType = "string", paramType = "query"),
 +    @ApiImplicitParam(name = "to", value = "The ending page resource (inclusive). Valid values are :offset | \"end\"", dataType = "string", paramType = "query")
 +  })
 +  public Response getAuthorizations(@Context HttpHeaders headers, @Context UriInfo ui, @ApiParam(value = "user name", required = true)
 +                                    @PathParam ("userName") String userName) {
 +    return handleRequest(headers, null, ui, Request.Type.GET, createAuthorizationResource(userName,null));
 +  }
 +
 +  /**
 +   * Handles: GET  /users/{userName}/authorizations/{authorization_id}
 +   * Get a specific authorization.
 +   *
 +   * @param headers         http headers
 +   * @param ui              uri info
 +   * @param userName        user name
 +   * @param authorizationId authorization ID
 +   * @return authorization instance representation
 +   */
 +  @GET
 +  @Path("{authorization_id}")
 +  @Produces("text/plain")
 +  @ApiOperation(value = "Get user authorization", nickname = "UserAuthorizationService#getAuthorization", notes = "Returns user authorization details.", response = UserAuthorizationResponse.class)
 +  @ApiImplicitParams({
 +    @ApiImplicitParam(name = "fields", value = "Filter user authorization details", defaultValue = "AuthorizationInfo/*", dataType = "string", paramType = "query")
 +  })
 +  @ApiResponses(value = {
 +    @ApiResponse(code = 200, message = "Successful operation", response = UserAuthorizationResponse.class)}
 +  )
 +  public Response getAuthorization(@Context HttpHeaders headers, @Context UriInfo ui, @ApiParam(value = "user name", required = true)
 +  @PathParam ("userName") String userName, @ApiParam(value = "Authorization Id", required = true) @PathParam("authorization_id") String authorizationId) {
 +    return handleRequest(headers, null, ui, Request.Type.GET, createAuthorizationResource(userName, authorizationId));
 +  }
 +
 +  /**
 +   * Create an authorization resource.
 +   * @param userName         user name
 +   * @param authorizationId authorization id
 +   * @return an authorization resource instance
 +   */
 +  protected ResourceInstance createAuthorizationResource(String userName, String authorizationId) {
-     Map<Resource.Type, String> mapIds = new HashMap<Resource.Type, String>();
++    Map<Resource.Type, String> mapIds = new HashMap<>();
 +    mapIds.put(Resource.Type.User, StringUtils.lowerCase(userName));
 +    mapIds.put(Resource.Type.UserAuthorization, authorizationId);
 +    return createResource(Resource.Type.UserAuthorization, mapIds);
 +  }
 +}

http://git-wip-us.apache.org/repos/asf/ambari/blob/3acd2e6d/ambari-server/src/main/java/org/apache/ambari/server/api/services/users/UserPrivilegeService.java
----------------------------------------------------------------------
diff --cc ambari-server/src/main/java/org/apache/ambari/server/api/services/users/UserPrivilegeService.java
index 293b45f,0000000..c0079d4
mode 100644,000000..100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/api/services/users/UserPrivilegeService.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/api/services/users/UserPrivilegeService.java
@@@ -1,113 -1,0 +1,113 @@@
 +/**
 + * 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 privileges and
 + * limitations under the License.
 + */
 +
 +package org.apache.ambari.server.api.services.users;
 +
 +import java.util.HashMap;
 +import java.util.Map;
 +
 +import javax.ws.rs.GET;
 +import javax.ws.rs.Path;
 +import javax.ws.rs.PathParam;
 +import javax.ws.rs.Produces;
 +import javax.ws.rs.core.Context;
 +import javax.ws.rs.core.HttpHeaders;
 +import javax.ws.rs.core.Response;
 +import javax.ws.rs.core.UriInfo;
 +
 +import org.apache.ambari.server.api.resources.ResourceInstance;
 +import org.apache.ambari.server.api.services.BaseService;
 +import org.apache.ambari.server.api.services.Request;
 +import org.apache.ambari.server.controller.UserPrivilegeResponse;
 +import org.apache.ambari.server.controller.spi.Resource;
 +import org.apache.commons.lang.StringUtils;
 +
 +import io.swagger.annotations.Api;
 +import io.swagger.annotations.ApiImplicitParam;
 +import io.swagger.annotations.ApiImplicitParams;
 +import io.swagger.annotations.ApiOperation;
 +import io.swagger.annotations.ApiParam;
 +import io.swagger.annotations.ApiResponse;
 +import io.swagger.annotations.ApiResponses;
 +
 +/**
 + *  Service responsible for user privilege resource requests.
 + */
 +@Path("/users/{userName}/privileges")
 +@Api(value = "Users", description = "Endpoint for user specific operations")
 +public class UserPrivilegeService extends BaseService {
 +
 +
 +  /**
 +   * Handles: GET  /users/{userName}/privileges
 +   * Get all privileges.
 +   * @param headers
 +   * @param ui
 +   * @param userName
 +   * @return
 +   */
 +  @GET
 +  @Produces("text/plain")
 +  @ApiOperation(value = "Get all privileges", nickname = "UserPrivilegeService#getPrivileges", notes = "Returns all privileges for user.", response = UserPrivilegeResponse.class, responseContainer = "List")
 +  @ApiImplicitParams({
 +    @ApiImplicitParam(name = "fields", value = "Filter user privileges", defaultValue = "PrivilegeInfo/*", dataType = "string", paramType = "query"),
 +    @ApiImplicitParam(name = "sortBy", value = "Sort user privileges (asc | desc)", defaultValue = "PrivilegeInfo/user_name.asc", dataType = "string", paramType = "query"),
 +    @ApiImplicitParam(name = "page_size", value = "The number of resources to be returned for the paged response.", defaultValue = "10", dataType = "integer", paramType = "query"),
 +    @ApiImplicitParam(name = "from", value = "The starting page resource (inclusive). Valid values are :offset | \"start\"", defaultValue = "0", dataType = "string", paramType = "query"),
 +    @ApiImplicitParam(name = "to", value = "The ending page resource (inclusive). Valid values are :offset | \"end\"", dataType = "string", paramType = "query")
 +  })
 +
 +  public Response getPrivileges(@Context HttpHeaders headers, @Context UriInfo ui,
 +                                @ApiParam(value = "user name", required = true, defaultValue = "admin") @PathParam("userName") String userName) {
 +    return handleRequest(headers, null, ui, Request.Type.GET, createPrivilegeResource(userName, null));
 +  }
 +
 +  /**
 +   * Handles: GET /users/{userName}/privileges/{privilegeID}
 +   * Get a specific privilege.
 +   *
 +   * @param headers        http headers
 +   * @param ui             uri info
 +   * @param userName       user name
 +   * @param privilegeId   privilege id
 +   *
 +   * @return privilege instance representation
 +   */
 +  @GET
 +  @Path("{privilegeId}")
 +  @Produces("text/plain")
 +  @ApiOperation(value = "Get user privilege", nickname = "UserPrivilegeService#getPrivilege", notes = "Returns user privilege details.", response = UserPrivilegeResponse.class)
 +  @ApiImplicitParams({
 +    @ApiImplicitParam(name = "fields", value = "Filter user privilege details", defaultValue = "PrivilegeInfo/*", dataType = "string", paramType = "query")
 +  })
 +  @ApiResponses(value = {
 +    @ApiResponse(code = 200, message = "Successful operation", response = UserPrivilegeResponse.class)}
 +  )
 +  public Response getPrivilege(@Context HttpHeaders headers, @Context UriInfo ui, @ApiParam(value = "user name", required = true) @PathParam ("userName") String userName,
 +                               @ApiParam(value = "privilege id", required = true) @PathParam("privilegeId") String privilegeId) {
 +    return handleRequest(headers, null, ui, Request.Type.GET, createPrivilegeResource(userName, privilegeId));
 +  }
 +
 +
 +  protected ResourceInstance createPrivilegeResource(String userName, String privilegeId) {
-     final Map<Resource.Type, String> mapIds = new HashMap<Resource.Type, String>();
++    final Map<Resource.Type, String> mapIds = new HashMap<>();
 +    mapIds.put(Resource.Type.User, StringUtils.lowerCase(userName));
 +    mapIds.put(Resource.Type.UserPrivilege, privilegeId);
 +    return createResource(Resource.Type.UserPrivilege, mapIds);
 +  }
 +}

http://git-wip-us.apache.org/repos/asf/ambari/blob/3acd2e6d/ambari-server/src/main/java/org/apache/ambari/server/api/services/views/ViewExternalSubResourceService.java
----------------------------------------------------------------------
diff --cc ambari-server/src/main/java/org/apache/ambari/server/api/services/views/ViewExternalSubResourceService.java
index bca0f05,0000000..27b4463
mode 100644,000000..100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/api/services/views/ViewExternalSubResourceService.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/api/services/views/ViewExternalSubResourceService.java
@@@ -1,148 -1,0 +1,148 @@@
 +/**
 + * 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.api.services.views;
 +
 +import java.io.IOException;
 +import java.util.HashMap;
 +import java.util.Map;
 +
 +import javax.ws.rs.GET;
 +import javax.ws.rs.Path;
 +import javax.ws.rs.PathParam;
 +import javax.ws.rs.Produces;
 +import javax.ws.rs.core.Context;
 +import javax.ws.rs.core.HttpHeaders;
 +import javax.ws.rs.core.Response;
 +import javax.ws.rs.core.UriInfo;
 +
 +import org.apache.ambari.server.api.resources.ResourceInstance;
 +import org.apache.ambari.server.api.services.BaseService;
 +import org.apache.ambari.server.api.services.Request;
 +import org.apache.ambari.server.controller.spi.Resource;
 +import org.apache.ambari.server.orm.entities.ViewEntity;
 +import org.apache.ambari.server.orm.entities.ViewInstanceEntity;
 +
 +/**
 + * Service responsible for view sub-resource requests.
 + */
 +public class ViewExternalSubResourceService  extends BaseService {
 +
 +  /**
 +   * The resource type.
 +   */
 +  private final Resource.Type type;
 +
 +  /**
 +   * The view name.
 +   */
 +  private final String viewName;
 +
 +  /**
 +   * The view version.
 +   */
 +  private final String version;
 +
 +  /**
 +   * The instance name.
 +   */
 +  private final String instanceName;
 +
 +  /**
 +   * Mapping of resource names to services.
 +   */
-   private final Map<String, Object> resourceServiceMap = new HashMap<String, Object>();
++  private final Map<String, Object> resourceServiceMap = new HashMap<>();
 +
 +
 +  // ----- Constructors ------------------------------------------------------
 +
 +  public ViewExternalSubResourceService(Resource.Type type, ViewInstanceEntity viewInstanceDefinition) {
 +    ViewEntity viewEntity = viewInstanceDefinition.getViewEntity();
 +
 +    this.type         = type;
 +    this.viewName     = viewEntity.getCommonName();
 +    this.version      = viewEntity.getVersion();
 +    this.instanceName = viewInstanceDefinition.getName();
 +  }
 +
 +  /**
 +   * Handles URL: /resources
 +   * Get all external resources for a view.
 +   *
 +   * @param headers  http headers
 +   * @param ui       uri info
 +   *
 +   * @return instance collection resource representation
 +   */
 +  @GET
 +  @Produces("text/plain")
 +  public Response getResources(String body, @Context HttpHeaders headers, @Context UriInfo ui) {
 +    return handleRequest(headers, body, ui, Request.Type.GET,
 +        createResource(viewName, instanceName));
 +  }
 +
 +  /**
 +   * Handles: GET /resources/{resourceName} Get a specific external resource.
 +   *
 +   * @param resourceName  resource name
 +   *
 +   * @return resource service instance representation
 +   *
 +   * @throws IllegalArgumentException if the given resource name is unknown
 +   */
 +  @Path("{resourceName}")
 +  public Object getResource(@PathParam("resourceName") String resourceName) throws IOException {
 +
 +    Object service = resourceServiceMap.get(resourceName);
 +    if (service == null) {
 +      throw new IllegalArgumentException("A resource type " + resourceName + " for view instance " +
 +          viewName + "/" + instanceName + " can not be found.");
 +    }
 +
 +    return service;
 +  }
 +
 +
 +  // ----- helper methods ----------------------------------------------------
 +
 +  /**
 +   * Register a sub-resource service.
 +   *
 +   * @param resourceName  the resource name
 +   * @param service       the service
 +   */
 +  public void addResourceService(String resourceName, Object service) {
 +    resourceServiceMap.put(resourceName, service);
 +  }
 +
 +  /**
 +   * Create an view instance resource.
 +   *
 +   * @param viewName      view name
 +   * @param instanceName  instance name
 +   *
 +   * @return a view instance resource
 +   */
 +  private ResourceInstance createResource(String viewName, String instanceName) {
-     Map<Resource.Type,String> mapIds = new HashMap<Resource.Type, String>();
++    Map<Resource.Type,String> mapIds = new HashMap<>();
 +    mapIds.put(Resource.Type.View, viewName);
 +    mapIds.put(Resource.Type.ViewVersion, version);
 +    mapIds.put(Resource.Type.ViewInstance, instanceName);
 +    return createResource(type, mapIds);
 +  }
 +}

http://git-wip-us.apache.org/repos/asf/ambari/blob/3acd2e6d/ambari-server/src/main/java/org/apache/ambari/server/api/services/views/ViewInstanceService.java
----------------------------------------------------------------------
diff --cc ambari-server/src/main/java/org/apache/ambari/server/api/services/views/ViewInstanceService.java
index 639933a,0000000..8e87e6f
mode 100644,000000..100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/api/services/views/ViewInstanceService.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/api/services/views/ViewInstanceService.java
@@@ -1,313 -1,0 +1,313 @@@
 +/*
 + * 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.api.services.views;
 +
 +import java.util.HashMap;
 +import java.util.Map;
 +
 +import javax.ws.rs.DELETE;
 +import javax.ws.rs.GET;
 +import javax.ws.rs.POST;
 +import javax.ws.rs.PUT;
 +import javax.ws.rs.Path;
 +import javax.ws.rs.PathParam;
 +import javax.ws.rs.Produces;
 +import javax.ws.rs.WebApplicationException;
 +import javax.ws.rs.core.Context;
 +import javax.ws.rs.core.HttpHeaders;
 +import javax.ws.rs.core.Response;
 +import javax.ws.rs.core.UriInfo;
 +
 +import org.apache.ambari.server.api.resources.ResourceInstance;
 +import org.apache.ambari.server.api.services.BaseService;
 +import org.apache.ambari.server.api.services.Request;
 +import org.apache.ambari.server.controller.ViewInstanceResponse;
 +import org.apache.ambari.server.controller.spi.Resource;
 +import org.apache.ambari.server.orm.entities.ViewInstanceEntity;
 +import org.apache.ambari.server.security.authorization.AuthorizationException;
 +import org.apache.ambari.server.view.ViewRegistry;
 +
 +import io.swagger.annotations.Api;
 +import io.swagger.annotations.ApiImplicitParam;
 +import io.swagger.annotations.ApiImplicitParams;
 +import io.swagger.annotations.ApiOperation;
 +import io.swagger.annotations.ApiParam;
 +import io.swagger.annotations.ApiResponse;
 +import io.swagger.annotations.ApiResponses;
 +
 +/**
 + * Service responsible for instances resource requests.
 + */
 +@Path("/views/{viewName}/versions/{version}/instances")
 +@Api(tags = "Views", description = "Endpoint for view specific operations")
 +public class ViewInstanceService extends BaseService {
 +  /**
 +   * The view registry;
 +   */
 +  private final ViewRegistry viewRegistry = ViewRegistry.getInstance();
 +
 +  /**
 +   * Handles URL: /views/{viewName}/versions/{version}/instances
 +   * Get all instances for a view.
 +   *
 +   * @param headers    http headers
 +   * @param ui         uri info
 +   * @param viewName   view id
 +   * @param version    version id
 +   *
 +   * @return instance collection resource representation
 +   */
 +  @GET
 +  @Produces("text/plain")
 +  @ApiOperation(value = "Get all view instances", nickname = "ViewInstanceService#getServices", notes = "Returns all instances for a view version.", response = ViewInstanceResponse.class, responseContainer = "List")
 +  @ApiImplicitParams({
 +    @ApiImplicitParam(name = "fields", value = "Filter view instance details", defaultValue = "ViewInstanceInfo/*", dataType = "string", paramType = "query"),
 +    @ApiImplicitParam(name = "sortBy", value = "Sort users (asc | desc)", defaultValue = "ViewInstanceInfo/instance_name.desc", dataType = "string", paramType = "query"),
 +    @ApiImplicitParam(name = "page_size", value = "The number of resources to be returned for the paged response.", defaultValue = "10", dataType = "integer", paramType = "query"),
 +    @ApiImplicitParam(name = "from", value = "The starting page resource (inclusive). Valid values are :offset | \"start\"", defaultValue = "0", dataType = "string", paramType = "query"),
 +    @ApiImplicitParam(name = "to", value = "The ending page resource (inclusive). Valid values are :offset | \"end\"", dataType = "string", paramType = "query")
 +  })
 +  @ApiResponses(value = {
 +    @ApiResponse(code = 200, message = "Successful operation", response = ViewInstanceResponse.class, responseContainer = "List")}
 +  )
 +  public Response getServices(String body, @Context HttpHeaders headers, @Context UriInfo ui,
 +                              @PathParam("viewName") String viewName, @PathParam("version") String version) throws AuthorizationException {
 +    return handleRequest(headers, body, ui, Request.Type.GET, createResource(viewName, version, null));
 +  }
 +
 +
 +  /**
 +   * Handles URL: /views/{viewName}/versions/{version}/instances/{instanceID}
 +   * Get a specific instance.
 +   *
 +   * @param headers       http headers
 +   * @param ui            uri info
 +   * @param viewName      view id
 +   * @param version       version id
 +   * @param instanceName  instance id
 +   *
 +   * @return instance resource representation
 +   */
 +  @GET
 +  @Path("{instanceName}")
 +  @Produces("text/plain")
 +  @ApiOperation(value = "Get single view instance", nickname = "ViewInstanceService#getService", notes = "Returns view instance details.", response = ViewInstanceResponse.class)
 +  @ApiImplicitParams({
 +    @ApiImplicitParam(name = "fields", value = "Filter view instance details", defaultValue = "ViewInstanceInfo", dataType = "string", paramType = "query")
 +  })
 +  @ApiResponses(value = {
 +    @ApiResponse(code = 200, message = "Successful operation", response = ViewInstanceResponse.class)}
 +  )
 +  public Response getService(String body, @Context HttpHeaders headers, @Context UriInfo ui,
 +                             @ApiParam(value = "view name") @PathParam("viewName") String viewName, @PathParam("version") String version,
 +                             @ApiParam(value = "instance name") @PathParam("instanceName") String instanceName) throws AuthorizationException {
 +    return handleRequest(headers, body, ui, Request.Type.GET, createResource(viewName, version, instanceName));
 +  }
 +
 +
 +  /**
 +   * Handles: POST /views/{viewName}/versions/{version}/instances/{instanceId}
 +   * Create a specific instance.
 +   *
 +   * @param body          http body
 +   * @param headers       http headers
 +   * @param ui            uri info
 +   * @param viewName      view id
 +   * @param version       version id
 +   * @param instanceName  instance id
 +   *
 +   * @return information regarding the created instance
 +   */
 +  @POST
 +  @Path("{instanceName}")
 +  @Produces("text/plain")
 +  @ApiOperation(value = "Create view instance", nickname = "ViewInstanceService#createService", notes = "Creates view instance resource.")
 +  @ApiImplicitParams({
 +    @ApiImplicitParam(name = "body", value = "input parameters in json form", required = true, dataType = "org.apache.ambari.server.controller.ViewInstanceRequest", paramType = "body")
 +  })
 +  @ApiResponses(value = {
 +    @ApiResponse(code = 200, message = "Successful operation"),
 +    @ApiResponse(code = 500, message = "Server Error")}
 +  )
 +  public Response createService(String body, @Context HttpHeaders headers, @Context UriInfo ui,
 +                                @ApiParam(value = "view name") @PathParam("viewName") String viewName, @PathParam("version") String version,
 +                                @ApiParam(value = "instance name") @PathParam("instanceName") String instanceName) throws AuthorizationException {
 +    return handleRequest(headers, body, ui, Request.Type.POST, createResource(viewName, version, instanceName));
 +  }
 +
 +  /**
 +   * Handles: POST /views/{viewName}/versions/{version}/instances
 +   * Create multiple instances.
 +   *
 +   * @param body       http body
 +   * @param headers    http headers
 +   * @param ui         uri info
 +   * @param viewName   view id
 +   * @param version    version id
 +   *
 +   * @return information regarding the created instances
 +   */
 +  @POST
 +  @Produces("text/plain")
 +  public Response createServices(String body, @Context HttpHeaders headers, @Context UriInfo ui,
 +                                 @PathParam("viewName") String viewName, @PathParam("version") String version) throws AuthorizationException {
 +    return handleRequest(headers, body, ui, Request.Type.POST, createResource(viewName, version, null));
 +  }
 +
 +  /**
 +   * Handles: PUT /views/{viewName}/versions/{version}/instances/{instanceId}
 +   * Update a specific instance.
 +   *
 +   * @param body          http body
 +   * @param headers       http headers
 +   * @param ui            uri info
 +   * @param viewName   view id
 +   * @param version    version id
 +   * @param instanceName  instance id
 +   *
 +   * @return information regarding the updated instance
 +   */
 +  @PUT
 +  @Path("{instanceName}")
 +  @Produces("text/plain")
 +  @ApiOperation(value = "Update view instance detail", nickname = "ViewInstanceService#updateService", notes = "Updates view instance resource.")
 +  @ApiImplicitParams({
 +    @ApiImplicitParam(name = "body", value = "input parameters in json form", required = true, dataType = "org.apache.ambari.server.controller.ViewInstanceRequest", paramType = "body")
 +  })
 +  @ApiResponses(value = {
 +    @ApiResponse(code = 200, message = "Successful operation"),
 +    @ApiResponse(code = 500, message = "Server Error")}
 +  )
 +  public Response updateService(String body, @Context HttpHeaders headers, @Context UriInfo ui,
 +                                @ApiParam(value = "view name") @PathParam("viewName") String viewName, @PathParam("version") String version,
 +                                @ApiParam(value = "instance name") @PathParam("instanceName") String instanceName) throws AuthorizationException {
 +    return handleRequest(headers, body, ui, Request.Type.PUT, createResource(viewName, version, instanceName));
 +  }
 +
 +  /**
 +   * Handles: PUT /views/{viewName}/versions/{version}/instances
 +   * Update multiple instances.
 +   *
 +   * @param body     http body
 +   * @param headers  http headers
 +   * @param ui       uri info
 +   * @param viewName   view id
 +   * @param version    version id
 +   *
 +   * @return information regarding the updated instance
 +   */
 +  @PUT
 +  @Produces("text/plain")
 +  public Response updateServices(String body, @Context HttpHeaders headers, @Context UriInfo ui,
 +                                 @PathParam("viewName") String viewName, @PathParam("version") String version) throws AuthorizationException {
 +    return handleRequest(headers, body, ui, Request.Type.PUT, createResource(viewName, version, null));
 +  }
 +
 +  /**
 +   * Handles: DELETE /views/{viewName}/versions/{version}/instances/{instanceId}
 +   * Delete a specific instance.
 +   *
 +   * @param headers       http headers
 +   * @param ui            uri info
 +   * @param viewName   view id
 +   * @param version    version id
 +   * @param instanceName  instance id
 +   *
 +   * @return information regarding the deleted instance
 +   */
 +  @DELETE
 +  @Path("{instanceName}")
 +  @Produces("text/plain")
 +  @ApiOperation(value = "Delete view instance", nickname = "ViewInstanceService#deleteService", notes = "Delete view resource.")
 +  @ApiResponses(value = {
 +    @ApiResponse(code = 200, message = "Successful operation"),
 +    @ApiResponse(code = 500, message = "Server Error")}
 +  )
 +  public Response deleteService(@Context HttpHeaders headers, @Context UriInfo ui,
 +                                @ApiParam(value = "view name") @PathParam("viewName") String viewName, @PathParam("version") String version,
 +                                @ApiParam(value = "instance name") @PathParam("instanceName") String instanceName) throws AuthorizationException {
 +    return handleRequest(headers, null, ui, Request.Type.DELETE, createResource(viewName, version, instanceName));
 +  }
 +
 +  /**
 +   * Get the sub-resource
 +   *
 +   * @param instanceName  the instance id
 +   *
 +   * @return the service
 +   */
 +  @Path("{instanceName}/{resources}")
 +  public Object getResourceHandler(@Context javax.ws.rs.core.Request request,
 +                                   @PathParam("viewName") String viewName, @PathParam("version") String version,
 +                                   @PathParam("instanceName") String instanceName,
 +                                   @PathParam("resources") String resources) {
 +
 +    hasPermission(viewName, version, Request.Type.valueOf(request.getMethod()), instanceName);
 +
 +    ViewInstanceEntity instanceDefinition =
 +        ViewRegistry.getInstance().getInstanceDefinition(viewName, version, instanceName);
 +
 +    if (instanceDefinition == null) {
 +      throw new IllegalArgumentException("A view instance " +
 +          viewName + "/" + instanceName + " can not be found.");
 +    }
 +
 +    Object service = instanceDefinition.getService(resources);
 +
 +    if (service == null) {
 +      throw new IllegalArgumentException("A resource type " + resources + " for view instance " +
 +          viewName + "/" + instanceName + " can not be found.");
 +    }
 +    return service;
 +  }
 +
 +  // ----- helper methods ----------------------------------------------------
 +
 +  /**
 +   * Create an view instance resource.
 +   *
 +   * @param viewName      view name
 +   * @param instanceName  instance name
 +   *
 +   * @return a view instance resource
 +   */
 +  private ResourceInstance createResource(String viewName, String viewVersion, String instanceName) {
-     Map<Resource.Type, String> mapIds = new HashMap<Resource.Type, String>();
++    Map<Resource.Type, String> mapIds = new HashMap<>();
 +    mapIds.put(Resource.Type.View, viewName);
 +    mapIds.put(Resource.Type.ViewVersion, viewVersion);
 +    mapIds.put(Resource.Type.ViewInstance, instanceName);
 +    return createResource(Resource.Type.ViewInstance, mapIds);
 +  }
 +
 +  /**
 +   * Determine whether or not the access specified by the given request type
 +   * is permitted for the current user on the view instance resource identified
 +   * by the given instance name.
 +   *
 +   * @param requestType   the request method type
 +   * @param instanceName  the name of the view instance resource
 +   *
 +   * @throws WebApplicationException if access is forbidden
 +   */
 +  private void hasPermission(String viewName, String version, Request.Type requestType, String instanceName) {
 +    if (!viewRegistry.checkPermission(viewName, version, instanceName, requestType == Request.Type.GET)) {
 +      throw new WebApplicationException(Response.Status.FORBIDDEN);
 +    }
 +  }
 +}

http://git-wip-us.apache.org/repos/asf/ambari/blob/3acd2e6d/ambari-server/src/main/java/org/apache/ambari/server/api/services/views/ViewPermissionService.java
----------------------------------------------------------------------
diff --cc ambari-server/src/main/java/org/apache/ambari/server/api/services/views/ViewPermissionService.java
index f8e2a56,0000000..c8499e3
mode 100644,000000..100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/api/services/views/ViewPermissionService.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/api/services/views/ViewPermissionService.java
@@@ -1,208 -1,0 +1,208 @@@
 +/**
 + * 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.api.services.views;
 +
 +import java.util.HashMap;
 +import java.util.Map;
 +
 +import javax.ws.rs.DELETE;
 +import javax.ws.rs.GET;
 +import javax.ws.rs.POST;
 +import javax.ws.rs.PUT;
 +import javax.ws.rs.Path;
 +import javax.ws.rs.PathParam;
 +import javax.ws.rs.Produces;
 +import javax.ws.rs.core.Context;
 +import javax.ws.rs.core.HttpHeaders;
 +import javax.ws.rs.core.Response;
 +import javax.ws.rs.core.UriInfo;
 +
 +import org.apache.ambari.server.api.resources.ResourceInstance;
 +import org.apache.ambari.server.api.services.BaseService;
 +import org.apache.ambari.server.api.services.Request;
 +import org.apache.ambari.server.controller.ViewPermissionResponse;
 +import org.apache.ambari.server.controller.spi.Resource;
 +
 +import io.swagger.annotations.Api;
 +import io.swagger.annotations.ApiImplicitParam;
 +import io.swagger.annotations.ApiImplicitParams;
 +import io.swagger.annotations.ApiOperation;
 +import io.swagger.annotations.ApiParam;
 +import io.swagger.annotations.ApiResponse;
 +import io.swagger.annotations.ApiResponses;
 +
 +
 +/**
 + * Service responsible for custom view permission resource requests.
 + */
 +@Path("/views/{viewName}/versions/{version}/permissions")
 +@Api(value = "Views", description = "Endpoint for view specific operations")
 +public class ViewPermissionService extends BaseService {
 +
 +  /**
 +   * Handles: GET  /permissions
 +   * Get all permissions.
 +   *
 +   * @param headers    http headers
 +   * @param ui         uri info
 +   * @param viewName   view id
 +   * @param version    version id
 +   *
 +   * @return permission collection resource representation
 +   */
 +  @GET
 +  @Produces("text/plain")
 +  @ApiOperation(value = "Get all permissions for a view", nickname = "ViewPermissionService#getPermissions", notes = "Returns all permission details for the version of a view.", response = ViewPermissionResponse.class, responseContainer = "List")
 +  @ApiImplicitParams({
 +    @ApiImplicitParam(name = "fields", value = "Filter privileges", defaultValue = "PermissionInfo/*", dataType = "string", paramType = "query"),
 +    @ApiImplicitParam(name = "page_size", value = "The number of resources to be returned for the paged response.", defaultValue = "10", dataType = "integer", paramType = "query"),
 +    @ApiImplicitParam(name = "from", value = "The starting page resource (inclusive). Valid values are :offset | \"start\"", defaultValue = "0", dataType = "string", paramType = "query"),
 +    @ApiImplicitParam(name = "to", value = "The ending page resource (inclusive). Valid values are :offset | \"end\"", dataType = "string", paramType = "query")
 +  })
 +  @ApiResponses(value = {
 +    @ApiResponse(code = 200, message = "Successful operation", response = ViewPermissionResponse.class, responseContainer = "List")}
 +  )
 +  public Response getPermissions(@Context HttpHeaders headers, @Context UriInfo ui,
 +                                 @ApiParam(value = "view name") @PathParam("viewName") String viewName,
 +                                 @ApiParam(value = "view version") @PathParam("version") String version) {
 +    return handleRequest(headers, null, ui, Request.Type.GET, createPermissionResource(
 +      viewName, version, null));
 +  }
 +
 +  /**
 +   * Handles: GET /views/{viewName}/versions/{version}/permissions/{permissionID}
 +   * Get a specific permission.
 +   *
 +   * @param headers        http headers
 +   * @param ui             uri info
 +   * @param viewName       view id
 +   * @param version        version id
 +   * @param permissionId   permission id
 +   *
 +   * @return permission instance representation
 +   */
 +  @GET
 +  @Path("{permissionId}")
 +  @Produces("text/plain")
 +  @ApiOperation(value = "Get single view permission", nickname = "ViewPermissionService#getPermission", notes = "Returns permission details for a single version of a view.", response = ViewPermissionResponse.class)
 +  @ApiImplicitParams({
 +    @ApiImplicitParam(name = "fields", value = "Filter view permission details", defaultValue = "PermissionInfo", dataType = "string", paramType = "query")
 +  })
 +  @ApiResponses(value = {
 +    @ApiResponse(code = 200, message = "Successful operation", response = ViewPermissionResponse.class)}
 +  )
 +  public Response getPermission(@Context HttpHeaders headers, @Context UriInfo ui,
 +                                @ApiParam(value = "view name") @PathParam("viewName") String viewName,
 +                                @ApiParam(value = "view version") @PathParam("version") String version,
 +                                @ApiParam(value = "permission id") @PathParam("permissionId") String permissionId) {
 +
 +    return handleRequest(headers, null, ui, Request.Type.GET, createPermissionResource(
 +        viewName, version, permissionId));
 +  }
 +
 +  /**
 +   * Handles: POST /views/{viewName}/versions/{version}/permissions/{permissionID}
 +   * Create a specific permission.
 +   *
 +   * @param headers        http headers
 +   * @param ui             uri info
 +   * @param viewName       view id
 +   * @param version        version id
 +   * @param permissionId   permission id
 +   *
 +   * @return information regarding the created permission
 +   */
 +  @POST
 +  @Path("{permissionId}")
 +  @Produces("text/plain")
 +  public Response createPermission(String body, @Context HttpHeaders headers, @Context UriInfo ui,
 +                                   @ApiParam(value = "view name") @PathParam("viewName") String viewName,
 +                                   @ApiParam(value = "view version") @PathParam("version") String version,
 +                                   @ApiParam(value = "permission id") @PathParam("permissionId") String permissionId) {
 +
 +    return handleRequest(headers, body, ui, Request.Type.POST, createPermissionResource(
 +        viewName, version, permissionId));
 +  }
 +
 +  /**
 +   * Handles: PUT /views/{viewName}/versions/{version}/permissions/{permissionID}
 +   * Update a specific permission.
 +   *
 +   * @param headers       http headers
 +   * @param ui            uri info
 +   * @param viewName      view id
 +   * @param version       version id
 +   * @param permissionId  permission id
 +   * @return information regarding the updated permission
 +   */
 +  @PUT
 +  @Path("{permissionId}")
 +  @Produces("text/plain")
 +  public Response updatePermission(String body, @Context HttpHeaders headers, @Context UriInfo ui,
 +                                   @ApiParam(value = "view name") @PathParam("viewName") String viewName,
 +                                   @ApiParam(value = "view version") @PathParam("version") String version,
 +                                   @ApiParam(value = "permission id") @PathParam("permissionId") String permissionId) {
 +
 +    return handleRequest(headers, body, ui, Request.Type.PUT, createPermissionResource(
 +        viewName, version, permissionId));
 +  }
 +
 +  /**
 +   * Handles: DELETE /views/{viewName}/versions/{version}/permissions/{permissionID}
 +   * Delete a specific permission.
 +   *
 +   * @param headers       http headers
 +   * @param ui            uri info
 +   * @param viewName      view id
 +   * @param version       version id
 +   * @param permissionId  permission id
 +   *
 +   * @return information regarding the deleted permission
 +   */
 +  @DELETE
 +  @Path("{permissionId}")
 +  @Produces("text/plain")
 +  public Response deletePermission(@Context HttpHeaders headers, @Context UriInfo ui,
 +                                   @ApiParam(value = "view name") @PathParam("viewName") String viewName,
 +                                   @ApiParam(value = "view version") @PathParam("version") String version,
 +                                   @ApiParam(value = "permission id") @PathParam("permissionId") String permissionId) {
 +
 +    return handleRequest(headers, null, ui, Request.Type.DELETE, createPermissionResource(
 +        viewName, version, permissionId));
 +  }
 +
 +
 +  // ----- helper methods ----------------------------------------------------
 +
 +  /**
 +   * Create a permission resource.
 +   *
 +   * @param permissionId permission name
 +   *
 +   * @return a permission resource instance
 +   */
 +  protected ResourceInstance createPermissionResource(String viewName, String viewVersion, String permissionId) {
-     Map<Resource.Type,String> mapIds = new HashMap<Resource.Type, String>();
++    Map<Resource.Type,String> mapIds = new HashMap<>();
 +    mapIds.put(Resource.Type.View, viewName);
 +    mapIds.put(Resource.Type.ViewVersion, viewVersion);
 +    mapIds.put(Resource.Type.ViewPermission, permissionId);
 +
 +    return createResource(Resource.Type.ViewPermission, mapIds);
 +  }
 +}

http://git-wip-us.apache.org/repos/asf/ambari/blob/3acd2e6d/ambari-server/src/main/java/org/apache/ambari/server/api/services/views/ViewPrivilegeService.java
----------------------------------------------------------------------
diff --cc ambari-server/src/main/java/org/apache/ambari/server/api/services/views/ViewPrivilegeService.java
index 047d463,0000000..08e250b
mode 100644,000000..100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/api/services/views/ViewPrivilegeService.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/api/services/views/ViewPrivilegeService.java
@@@ -1,268 -1,0 +1,268 @@@
 +/**
 + * 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 privileges and
 + * limitations under the License.
 + */
 +
 +package org.apache.ambari.server.api.services.views;
 +
 +import java.util.HashMap;
 +import java.util.Map;
 +
 +import javax.ws.rs.DELETE;
 +import javax.ws.rs.GET;
 +import javax.ws.rs.POST;
 +import javax.ws.rs.PUT;
 +import javax.ws.rs.Path;
 +import javax.ws.rs.PathParam;
 +import javax.ws.rs.Produces;
 +import javax.ws.rs.core.Context;
 +import javax.ws.rs.core.HttpHeaders;
 +import javax.ws.rs.core.Response;
 +import javax.ws.rs.core.UriInfo;
 +
 +import org.apache.ambari.server.api.resources.ResourceInstance;
 +import org.apache.ambari.server.api.services.BaseService;
 +import org.apache.ambari.server.api.services.Request;
 +import org.apache.ambari.server.controller.ViewPrivilegeResponse;
 +import org.apache.ambari.server.controller.spi.Resource;
 +
 +import io.swagger.annotations.Api;
 +import io.swagger.annotations.ApiImplicitParam;
 +import io.swagger.annotations.ApiImplicitParams;
 +import io.swagger.annotations.ApiOperation;
 +import io.swagger.annotations.ApiParam;
 +import io.swagger.annotations.ApiResponse;
 +import io.swagger.annotations.ApiResponses;
 +
 +/**
 + *  Service responsible for view privilege resource requests.
 + */
 +@Api(tags = "Views", description = "Endpoint for view specific operations")
 +@Path("/views/{viewName}/versions/{version}/instances/{instanceName}/privileges")
 +public class ViewPrivilegeService extends BaseService {
 +  /**
 +   * Handles: GET  /views/{viewName}/versions/{version}/instances/{instanceName}/privileges
 +   * Get all privileges.
 +   *
 +   * @param headers       http headers
 +   * @param ui            uri info
 +   * @param viewName      view id
 +   * @param version       version id
 +   * @param instanceName  instance id
 +   *
 +   * @return privilege collection representation
 +   */
 +  @GET
 +  @Produces("text/plain")
 +  @ApiOperation(value = "Get all view instance privileges", nickname = "ViewPrivilegeService#getPrivileges", notes = "Returns all privileges for the resource.", response = ViewPrivilegeResponse.class, responseContainer = "List")
 +  @ApiImplicitParams({
 +    @ApiImplicitParam(name = "fields", value = "Filter privileges", defaultValue = "PrivilegeInfo/*", dataType = "string", paramType = "query"),
 +    @ApiImplicitParam(name = "sortBy", value = "Sort privileges (asc | desc)", defaultValue = "PrivilegeInfo/user_name.asc", dataType = "string", paramType = "query"),
 +    @ApiImplicitParam(name = "page_size", value = "The number of resources to be returned for the paged response.", defaultValue = "10", dataType = "integer", paramType = "query"),
 +    @ApiImplicitParam(name = "from", value = "The starting page resource (inclusive). Valid values are :offset | \"start\"", defaultValue = "0", dataType = "string", paramType = "query"),
 +    @ApiImplicitParam(name = "to", value = "The ending page resource (inclusive). Valid values are :offset | \"end\"", dataType = "string", paramType = "query")
 +  })
 +  public Response getPrivileges(@Context HttpHeaders headers, @Context UriInfo ui,
 +                                @ApiParam(value = "view name") @PathParam("viewName") String viewName,
 +                                @ApiParam(value = "view version") @PathParam("version") String version,
 +                                @ApiParam(value = "instance name") @PathParam("instanceName") String instanceName) {
 +    return handleRequest(headers, null, ui, Request.Type.GET, createPrivilegeResource(viewName, version, instanceName,null));
 +  }
 +
 +  /**
 +   * Handles: GET /views/{viewName}/versions/{version}/instances/{instanceName}/privileges/{privilegeID}
 +   * Get a specific privilege.
 +   *
 +   * @param headers        http headers
 +   * @param ui             uri info
 +   * @param viewName       view id
 +   * @param version        version id
 +   * @param instanceName   instance id
 +   * @param privilegeId    privilege id
 +   *
 +   * @return privilege instance representation
 +   */
 +  @GET
 +  @Path("/{privilegeId}")
 +  @Produces("text/plain")
 +  @ApiOperation(value = "Get single view instance privilege", nickname = "ViewPrivilegeService#getPrivilege", notes = "Returns privilege details.", response = ViewPrivilegeResponse.class)
 +  @ApiImplicitParams({
 +    @ApiImplicitParam(name = "fields", value = "Filter privilege details", defaultValue = "PrivilegeInfo", dataType = "string", paramType = "query")
 +  })
 +  @ApiResponses(value = {
 +    @ApiResponse(code = 200, message = "Successful operation", response = ViewPrivilegeResponse.class)}
 +  )
 +  public Response getPrivilege(@Context HttpHeaders headers, @Context UriInfo ui,
 +                               @ApiParam(value = "view name") @PathParam("viewName") String viewName,
 +                               @ApiParam(value = "view version") @PathParam("version") String version,
 +                               @ApiParam(value = "instance name") @PathParam("instanceName") String instanceName,
 +                               @ApiParam(value = "privilege id", required = true) @PathParam("privilegeId") String privilegeId) {
 +
 +    return handleRequest(headers, null, ui, Request.Type.GET, createPrivilegeResource(viewName, version, instanceName,privilegeId));
 +  }
 +
 +  /**
 +   * Handles: POST /views/{viewName}/versions/{version}/instances/{instanceName}/privileges
 +   * Create a privilege.
 +   *
 +   * @param body          request body
 +   * @param headers       http headers
 +   * @param ui            uri info
 +   * @param viewName      view id
 +   * @param version       version id
 +   * @param instanceName  instance id
 +   *
 +   * @return information regarding the created privilege
 +   */
 +  @POST
 +  @Produces("text/plain")
 +  @ApiOperation(value = "Create view instance privilege", nickname = "ViewPrivilegeService#createPrivilege", notes = "Create privilege resource for view instance.")
 +  @ApiImplicitParams({
 +    @ApiImplicitParam(name = "body", value = "input parameters in json form", required = true, dataType = "org.apache.ambari.server.controller.ViewPrivilegeRequest", paramType = "body")
 +  })
 +  @ApiResponses(value = {
 +    @ApiResponse(code = 200, message = "Successful operation"),
 +    @ApiResponse(code = 500, message = "Server Error")}
 +  )
 +  public Response createPrivilege(String body, @Context HttpHeaders headers, @Context UriInfo ui,
 +                                  @ApiParam(value = "view name") @PathParam("viewName") String viewName,
 +                                  @ApiParam(value = "view version") @PathParam("version") String version,
 +                                  @ApiParam(value = "instance name") @PathParam("instanceName") String instanceName) {
 +
 +    return handleRequest(headers, body, ui, Request.Type.POST, createPrivilegeResource(viewName, version, instanceName,null));
 +  }
 +
 +  /**
 +   * Handles: PUT /views/{viewName}/versions/{version}/instances/{instanceName}/privileges/{privilegeID}
 +   * Update a specific privilege.
 +   *
 +   * @param headers       http headers
 +   * @param ui            uri info
 +   * @param viewName      view id
 +   * @param version       version id
 +   * @param instanceName  instance id
 +   * @param privilegeId   privilege id
 +   *
 +   * @return information regarding the updated privilege
 +   */
 +  @PUT
 +  // Remove comments when the below API call is fixed
 +  /*@Path("{privilegeId}")
 +  @Produces("text/plain")
 +  @ApiOperation(value = "Update view instance privilege", notes = "Update privilege resource for view instance.")
 +  @ApiImplicitParams({
 +    @ApiImplicitParam(name = "body", value = "input parameters in json form", required = true, dataType = "org.apache.ambari.server.controller.ViewPrivilegeRequest", paramType = "body")
 +  })
 +  @ApiResponses(value = {
 +    @ApiResponse(code = 200, message = "Successful operation"),
 +    @ApiResponse(code = 500, message = "Server Error")}
 +  ) */
 +  public Response updatePrivilege(String body, @Context HttpHeaders headers, @Context UriInfo ui,
 +                                  @ApiParam(value = "view name") @PathParam("viewName") String viewName,
 +                                  @ApiParam(value = "view version") @PathParam("version") String version,
 +                                  @ApiParam(value = "instance name") @PathParam("instanceName") String instanceName,
 +                                  @ApiParam(value = "privilege id") @PathParam("privilegeId") String privilegeId) {
 +
 +    return handleRequest(headers, body, ui, Request.Type.PUT, createPrivilegeResource(viewName, version, instanceName, privilegeId));
 +  }
 +
 +  /**
 +   * Handles: PUT /views/{viewName}/versions/{version}/instances/{instanceName}/privileges
 +   * Update a set of privileges for the resource.
 +   *
 +   * @param body          request body
 +   * @param headers       http headers
 +   * @param ui            uri info
 +   * @param viewName      view id
 +   * @param version       version id
 +   * @param instanceName  instance id
 +   *
 +   * @return information regarding the updated privileges
 +   */
 +  @PUT
 +  @Produces("text/plain")
 +  public Response updatePrivileges(String body, @Context HttpHeaders headers, @Context UriInfo ui,
 +                                   @ApiParam(value = "view name") @PathParam("viewName") String viewName,
 +                                   @ApiParam(value = "view version") @PathParam("version") String version,
 +                                   @ApiParam(value = "instance name") @PathParam("instanceName") String instanceName) {
 +    return handleRequest(headers, body, ui, Request.Type.PUT, createPrivilegeResource(viewName, version, instanceName,null));
 +  }
 +
 +  /**
 +   * Handles: DELETE /views/{viewName}/versions/{version}/instances/{instanceName}/privileges
 +   * Delete privileges.
 +   *
 +   * @param body          request body
 +   * @param headers       http headers
 +   * @param ui            uri info
 +   * @param viewName      view id
 +   * @param version       version id
 +   * @param instanceName  instance id
 +   *
 +   * @return information regarding the deleted privileges
 +   */
 +  @DELETE
 +  @Produces("text/plain")
 +  public Response deletePrivileges(String body, @Context HttpHeaders headers, @Context UriInfo ui,
 +                                   @ApiParam(value = "view name") @PathParam("viewName") String viewName,
 +                                   @ApiParam(value = "view version") @PathParam("viewVersion") String version,
 +                                   @ApiParam(value = "instance name") @PathParam("instanceName") String instanceName) {
 +
 +    return handleRequest(headers, body, ui, Request.Type.DELETE, createPrivilegeResource(viewName, version, instanceName,null));
 +  }
 +
 +  /**
 +   * Handles: DELETE /views/{viewName}/versions/{version}/instances/{instanceName}/privileges/{privilegeID}
 +   * Delete a specific privilege.
 +   *
 +   * @param headers       http headers
 +   * @param ui            uri info
 +   * @param viewName      view id
 +   * @param version       version id
 +   * @param instanceName  instance id
 +   * @param privilegeId   privilege id
 +   *
 +   * @return information regarding the deleted privilege
 +   */
 +  @DELETE
 +  @Path("{privilegeId}")
 +  @Produces("text/plain")
 +  @ApiOperation(value = "Delete view instance privilege", nickname = "ViewPrivilegeService#deletePrivilege", notes = "Delete view instance privilege resource.")
 +  @ApiResponses(value = {
 +    @ApiResponse(code = 200, message = "Successful operation"),
 +    @ApiResponse(code = 500, message = "Server Error")}
 +  )
 +  public Response deletePrivilege(@Context HttpHeaders headers, @Context UriInfo ui,
 +                                  @ApiParam(value = "view name") @PathParam("viewName") String viewName,
 +                                  @ApiParam(value = "view version") @PathParam("version") String version,
 +                                  @ApiParam(value = "instance name") @PathParam("instanceName") String instanceName,
 +                                  @ApiParam(value = "privilege id") @PathParam("privilegeId") String privilegeId) {
 +
 +    return handleRequest(headers, null, ui, Request.Type.DELETE, createPrivilegeResource(viewName, version, instanceName, privilegeId));
 +  }
 +
 +
 +  protected ResourceInstance createPrivilegeResource(String viewName, String viewVersion, String instanceName, String privilegeId) {
-     Map<Resource.Type,String> mapIds = new HashMap<Resource.Type, String>();
++    Map<Resource.Type,String> mapIds = new HashMap<>();
 +    mapIds.put(Resource.Type.View, viewName);
 +    mapIds.put(Resource.Type.ViewVersion, viewVersion);
 +    mapIds.put(Resource.Type.ViewInstance, instanceName);
 +    mapIds.put(Resource.Type.ViewPrivilege, privilegeId);
 +
 +    return createResource(Resource.Type.ViewPrivilege, mapIds);
 +  }
 +}
 +

http://git-wip-us.apache.org/repos/asf/ambari/blob/3acd2e6d/ambari-server/src/main/java/org/apache/ambari/server/api/services/views/ViewSubResourceService.java
----------------------------------------------------------------------
diff --cc ambari-server/src/main/java/org/apache/ambari/server/api/services/views/ViewSubResourceService.java
index 081d699,0000000..d680f04
mode 100644,000000..100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/api/services/views/ViewSubResourceService.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/api/services/views/ViewSubResourceService.java
@@@ -1,136 -1,0 +1,136 @@@
 +/**
 + * 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.api.services.views;
 +
 +import java.util.HashMap;
 +import java.util.Map;
 +
 +import javax.ws.rs.core.HttpHeaders;
 +import javax.ws.rs.core.Response;
 +import javax.ws.rs.core.UriInfo;
 +
 +import org.apache.ambari.server.api.resources.ResourceInstance;
 +import org.apache.ambari.server.api.services.BaseService;
 +import org.apache.ambari.server.api.services.Request;
 +import org.apache.ambari.server.controller.spi.Resource;
 +import org.apache.ambari.server.orm.entities.ViewEntity;
 +import org.apache.ambari.server.orm.entities.ViewInstanceEntity;
 +import org.apache.ambari.view.ViewResourceHandler;
 +
 +/**
 + * View sub-resource service.
 + */
 +public class ViewSubResourceService extends BaseService implements ViewResourceHandler {
 +  /**
 +   * The type of the sub-resource.
 +   */
 +  private final Resource.Type type;
 +
 +  /**
 +   * The associated view name.
 +   */
 +  private final String viewName;
 +
 +  /**
 +   * The view version.
 +   */
 +  private final String version;
 +
 +  /**
 +   * The associated view instance name.
 +   */
 +  private final String instanceName;
 +
 +
 +  // ----- Constructors ------------------------------------------------------
 +
 +  /**
 +   * Construct a view sub-resource service.
 +   */
 +  public ViewSubResourceService(Resource.Type type, ViewInstanceEntity viewInstanceDefinition) {
 +    ViewEntity viewEntity = viewInstanceDefinition.getViewEntity();
 +
 +    this.type         = type;
 +    this.viewName     = viewEntity.getCommonName();
 +    this.version      = viewEntity.getVersion();
 +    this.instanceName = viewInstanceDefinition.getName();
 +  }
 +
 +
 +  // ----- ViewResourceHandler -----------------------------------------------
 +
 +  @Override
 +  public Response handleRequest(HttpHeaders headers, UriInfo ui,
 +                                RequestType requestType, MediaType mediaType,
 +                                String resourceId) {
 +    return handleRequest(headers, null, ui, getRequestType(requestType),
 +        getMediaType(mediaType), createResource(resourceId));
 +  }
 +
 +  @Override
 +  public Response handleRequest(HttpHeaders headers, UriInfo ui, String resourceId) {
 +    return handleRequest(headers, null, ui, Request.Type.GET,
 +        createResource(resourceId));
 +  }
 +
 +
 +  // ----- helper methods ----------------------------------------------------
 +
 +  // create a resource with the given id
 +  protected ResourceInstance createResource(String resourceId) {
-     Map<Resource.Type,String> mapIds = new HashMap<Resource.Type,String>();
++    Map<Resource.Type,String> mapIds = new HashMap<>();
 +
 +    mapIds.put(Resource.Type.View, viewName);
 +    mapIds.put(Resource.Type.ViewVersion, version);
 +    mapIds.put(Resource.Type.ViewInstance, instanceName);
 +
 +    if (resourceId != null) {
 +      mapIds.put(type, resourceId);
 +    }
 +    return super.createResource(type, mapIds);
 +  }
 +
 +  // get the internal request type from the view API request type
 +  private Request.Type getRequestType(RequestType type) {
 +    switch (type) {
 +      case GET:
 +        return Request.Type.GET;
 +      case POST:
 +        return Request.Type.POST;
 +      case PUT:
 +        return Request.Type.PUT;
 +      case DELETE:
 +        return Request.Type.DELETE;
 +      case QUERY_POST:
 +        return Request.Type.QUERY_POST;
 +    }
 +    throw new IllegalArgumentException("Unknown resource type " + type);
 +  }
 +
 +  // get the JAX-RS media type from the view media type
 +  private javax.ws.rs.core.MediaType getMediaType(MediaType type) {
 +    switch (type) {
 +      case TEXT_PLAIN:
 +        return javax.ws.rs.core.MediaType.TEXT_PLAIN_TYPE;
 +      case APPLICATION_JSON:
 +        return javax.ws.rs.core.MediaType.APPLICATION_JSON_TYPE;
 +    }
 +    throw new IllegalArgumentException("Unknown media type " + type);
 +  }
 +}

http://git-wip-us.apache.org/repos/asf/ambari/blob/3acd2e6d/ambari-server/src/main/java/org/apache/ambari/server/api/services/views/ViewVersionService.java
----------------------------------------------------------------------
diff --cc ambari-server/src/main/java/org/apache/ambari/server/api/services/views/ViewVersionService.java
index 95ebb39,0000000..ab329f8
mode 100644,000000..100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/api/services/views/ViewVersionService.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/api/services/views/ViewVersionService.java
@@@ -1,208 -1,0 +1,208 @@@
 +/**
 + * 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.api.services.views;
 +
 +import java.util.HashMap;
 +import java.util.Map;
 +
 +import javax.ws.rs.DELETE;
 +import javax.ws.rs.GET;
 +import javax.ws.rs.POST;
 +import javax.ws.rs.PUT;
 +import javax.ws.rs.Path;
 +import javax.ws.rs.PathParam;
 +import javax.ws.rs.Produces;
 +import javax.ws.rs.core.Context;
 +import javax.ws.rs.core.HttpHeaders;
 +import javax.ws.rs.core.Response;
 +import javax.ws.rs.core.UriInfo;
 +
 +import org.apache.ambari.server.api.resources.ResourceInstance;
 +import org.apache.ambari.server.api.services.BaseService;
 +import org.apache.ambari.server.api.services.Request;
 +import org.apache.ambari.server.controller.ViewVersionResponse;
 +import org.apache.ambari.server.controller.spi.Resource;
 +
 +import io.swagger.annotations.Api;
 +import io.swagger.annotations.ApiImplicitParam;
 +import io.swagger.annotations.ApiImplicitParams;
 +import io.swagger.annotations.ApiOperation;
 +import io.swagger.annotations.ApiParam;
 +import io.swagger.annotations.ApiResponse;
 +import io.swagger.annotations.ApiResponses;
 +
 +
 +/**
 + * Service responsible for view version resource requests.
 + */
 +@Path("/views/{viewName}/versions")
 +@Api(value = "Views", description = "Endpoint for view specific operations")
 +public class ViewVersionService extends BaseService {
 +
 +  /**
 +   * Handles: GET  /views/{viewName}/versions
 +   * Get all views versions.
 +   *
 +   * @param headers  http headers
 +   * @param ui       uri info
 +   * @param viewName   view id
 +   *
 +   * @return view collection resource representation
 +   */
 +  @GET
 +  @Produces("text/plain")
 +  @ApiOperation(value = "Get all versions for a view", nickname = "ViewVersionService#getVersions", notes = "Returns details of all versions for a view.", response = ViewVersionResponse.class, responseContainer = "List")
 +  @ApiImplicitParams({
 +    @ApiImplicitParam(name = "fields", value = "Filter view version details", defaultValue = "ViewVersionInfo/*", dataType = "string", paramType = "query"),
 +    @ApiImplicitParam(name = "sortBy", value = "Sort users (asc | desc)", defaultValue = "ViewVersionInfo/version.desc", dataType = "string", paramType = "query"),
 +    @ApiImplicitParam(name = "page_size", value = "The number of resources to be returned for the paged response.", defaultValue = "10", dataType = "integer", paramType = "query"),
 +    @ApiImplicitParam(name = "from", value = "The starting page resource (inclusive). Valid values are :offset | \"start\"", defaultValue = "0", dataType = "string", paramType = "query"),
 +    @ApiImplicitParam(name = "to", value = "The ending page resource (inclusive). Valid values are :offset | \"end\"", dataType = "string", paramType = "query")
 +  })
 +  @ApiResponses(value = {
 +    @ApiResponse(code = 200, message = "Successful operation", response = ViewVersionResponse.class, responseContainer = "List")}
 +  )
 +  public Response getVersions(String body, @Context HttpHeaders headers, @Context UriInfo ui,
 +                              @ApiParam(value = "view name") @PathParam("viewName") String viewName) {
 +
 +    return handleRequest(headers, body, ui, Request.Type.GET, createResource(viewName, null));
 +  }
 +
 +
 +  /**
 +   * Handles: GET /views/{viewName}/versions/{version}
 +   * Get a specific view version.
 +   *
 +   * @param headers  http headers
 +   * @param ui       uri info
 +   * @param viewName   view id
 +   * @param version  version id
 +   *
 +   * @return view instance representation
 +   */
 +  @GET
 +  @Path("{version}")
 +  @Produces("text/plain")
 +  @ApiOperation(value = "Get single view version", nickname = "ViewVersionService#getVersion", notes = "Returns view details.", response = ViewVersionResponse.class)
 +  @ApiImplicitParams({
 +    @ApiImplicitParam(name = "fields", value = "Filter view details", defaultValue = "ViewVersionInfo", dataType = "string", paramType = "query")
 +  })
 +  @ApiResponses(value = {
 +    @ApiResponse(code = 200, message = "Successful operation", response = ViewVersionResponse.class)}
 +  )
 +  public Response getVersion(String body, @Context HttpHeaders headers, @Context UriInfo ui,
 +                              @ApiParam(value = "view name") @PathParam("viewName") String viewName,
 +                              @PathParam("version") String version) {
 +
 +    return handleRequest(headers, body, ui, Request.Type.GET, createResource(viewName, version));
 +  }
 +
 +  /**
 +   * Handles: POST /views/{viewName}/versions/{version}
 +   * Create a specific view version.
 +   *
 +   * @param headers    http headers
 +   * @param ui         uri info
 +   * @param viewName   view id
 +   * @param version    the version
 +   *
 +   * @return information regarding the created view
 +   */
 +  @POST
 +  @Path("{version}")
 +  @Produces("text/plain")
 +  public Response createVersions(String body, @Context HttpHeaders headers, @Context UriInfo ui,
 +                                 @ApiParam(value = "view name") @PathParam("viewName") String viewName,
 +                                 @PathParam("version") String version) {
 +
 +    return handleRequest(headers, body, ui, Request.Type.POST, createResource(viewName, version));
 +  }
 +
 +  /**
 +   * Handles: PUT /views/{viewName}/versions/{version}
 +   * Update a specific view version.
 +   *
 +   * @param headers   http headers
 +   * @param ui        uri info
 +   * @param viewName  view id
 +   * @param version   the version
 +   *
 +   * @return information regarding the updated view
 +   */
 +  @PUT
 +  @Path("{version}")
 +  @Produces("text/plain")
 +  public Response updateVersions(String body, @Context HttpHeaders headers, @Context UriInfo ui,
 +                                 @ApiParam(value = "view name") @PathParam("viewName") String viewName,
 +                                 @PathParam("version") String version) {
 +
 +    return handleRequest(headers, body, ui, Request.Type.PUT, createResource(viewName, version));
 +  }
 +
 +  /**
 +   * Handles: DELETE /views/{viewName}/versions/{version}
 +   * Delete a specific view version.
 +   *
 +   * @param headers   http headers
 +   * @param ui        uri info
 +   * @param viewName   view id
 +   * @param version   version id
 +   *
 +   * @return information regarding the deleted view version
 +   */
 +  @DELETE
 +  @Path("{version}")
 +  @Produces("text/plain")
 +  public Response deleteVersions(@Context HttpHeaders headers, @Context UriInfo ui,
 +                                 @PathParam("viewName") String viewName, @PathParam("version") String version) {
 +
 +    return handleRequest(headers, null, ui, Request.Type.DELETE, createResource(viewName, version));
 +  }
 +
 +
 +  /**
 +   * Get the permissions sub-resource
 +   *
 +   * @param version  the version
 +   *
 +   * @return the permission service
 +
 +  @Path("{version}/permissions")
 +  public ViewPermissionService getPermissionHandler(@PathParam("version") String version) {
 +
 +    return new ViewPermissionService(viewName, version);
 +  }
 +
 +
 +  // ----- helper methods ----------------------------------------------------
 +
 +  /**
 +   * Create a view resource.
 +   *
 +   * @param viewName view name
 +   *
 +   * @return a view resource instance
 +   */
 +  private ResourceInstance createResource(String viewName, String version) {
-     Map<Resource.Type,String> mapIds = new HashMap<Resource.Type, String>();
++    Map<Resource.Type,String> mapIds = new HashMap<>();
 +    mapIds.put(Resource.Type.View, viewName);
 +    mapIds.put(Resource.Type.ViewVersion, version);
 +    return createResource(Resource.Type.ViewVersion, mapIds);
 +  }
 +}

http://git-wip-us.apache.org/repos/asf/ambari/blob/3acd2e6d/ambari-server/src/main/java/org/apache/ambari/server/controller/UserRequest.java
----------------------------------------------------------------------


[50/50] [abbrv] ambari git commit: Merge trunk to ambari-rest-api-explorer branch. (jaimin)

Posted by ja...@apache.org.
Merge trunk to ambari-rest-api-explorer branch. (jaimin)


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

Branch: refs/heads/ambari-rest-api-explorer
Commit: 3acd2e6da46494c175250e4f3a9ec074456b12b9
Parents: 3cb45e8 69c5593
Author: Jaimin Jetly <ja...@hortonworks.com>
Authored: Tue Apr 11 11:20:34 2017 -0700
Committer: Jaimin Jetly <ja...@hortonworks.com>
Committed: Tue Apr 11 11:20:34 2017 -0700

----------------------------------------------------------------------
 .../main/resources/ui/admin-web/app/index.html  |    4 +-
 ambari-agent/pom.xml                            |   10 +-
 .../ambari_agent/StatusCommandsExecutor.py      |  209 +--
 .../src/main/python/ambari_agent/main.py        |    5 +-
 .../python/resource_management/TestUtils.py     |   39 +
 .../src/main/python/ambari_commons/network.py   |    2 +
 .../ambari_commons/resources/os_family.json     |    1 +
 .../python/resource_management/core/sudo.py     |   58 +-
 .../python/resource_management/core/utils.py    |   56 +-
 .../libraries/functions/copy_tarball.py         |   24 +-
 .../functions/setup_ranger_plugin_xml.py        |   16 +-
 .../libraries/functions/solr_cloud_util.py      |    7 +-
 .../libraries/functions/stack_select.py         |   16 +-
 .../libraries/script/script.py                  |    8 +-
 ambari-infra/ambari-infra-solr-client/pom.xml   |    5 +
 .../ambari/infra/solr/AmbariSolrCloudCLI.java   |   17 +-
 .../infra/solr/AmbariSolrCloudClient.java       |    9 +
 .../solr/commands/UnsecureZNodeZkCommand.java   |   44 +
 .../FieldAuditLogRequestQueryConverter.java     |    1 -
 .../TopFieldAuditLogRequestQueryConverter.java  |   54 +
 .../logsearch/manager/AuditLogsManager.java     |    3 +-
 .../request/impl/FieldAuditLogRequest.java      |   17 +-
 .../request/impl/TopFieldAuditLogRequest.java   |   40 +
 .../logsearch/rest/AuditLogsResource.java       |    4 +-
 .../logsearch/rest/UserConfigResource.java      |    2 +-
 .../FieldAuditLogRequestQueryConverterTest.java |    3 +-
 ...pFieldAuditLogRequestQueryConverterTest.java |   61 +
 .../ambari-logsearch-web/package.json           |   17 +-
 .../main/webapp/scripts/views/common/Header.js  |    6 +-
 .../conf/unix/ambari-metrics-collector          |    3 +-
 .../server/KdcServerConnectionVerification.java |   31 +-
 .../java/org/apache/ambari/server/Role.java     |    2 +-
 .../server/actionmanager/ActionDBAccessor.java  |   16 +-
 .../actionmanager/ActionDBAccessorImpl.java     |   27 +-
 .../server/actionmanager/ActionManager.java     |    2 +-
 .../server/actionmanager/ActionScheduler.java   |  178 +-
 .../server/actionmanager/HostRoleCommand.java   |   26 +
 .../ambari/server/actionmanager/Request.java    |   10 +-
 .../ambari/server/actionmanager/Stage.java      |   44 +-
 .../apache/ambari/server/agent/ActionQueue.java |   12 +-
 .../ambari/server/agent/AgentRequests.java      |    2 +-
 .../ambari/server/agent/ExecutionCommand.java   |   10 +-
 .../apache/ambari/server/agent/HeartBeat.java   |    6 +-
 .../ambari/server/agent/HeartBeatHandler.java   |   14 +-
 .../ambari/server/agent/HeartBeatResponse.java  |   10 +-
 .../ambari/server/agent/HeartbeatMonitor.java   |    6 +-
 .../ambari/server/agent/HeartbeatProcessor.java |    2 +-
 .../apache/ambari/server/agent/HostInfo.java    |    2 +-
 .../ambari/server/agent/RecoveryReport.java     |    2 +-
 .../server/agent/RegistrationResponse.java      |    2 +-
 .../ambari/server/agent/StatusCommand.java      |    4 +-
 .../alerts/AmbariPerformanceRunnable.java       |    2 +-
 .../server/alerts/StaleAlertRunnable.java       |    2 +-
 .../server/api/AmbariCsrfProtectionFilter.java  |    2 +-
 .../ambari/server/api/AmbariErrorHandler.java   |    2 +-
 .../server/api/handlers/QueryCreateHandler.java |    6 +-
 .../ambari/server/api/predicate/QueryLexer.java |   24 +-
 .../server/api/predicate/QueryParser.java       |    8 +-
 .../expressions/AbstractExpression.java         |    2 +-
 .../expressions/NotLogicalExpression.java       |    2 +-
 .../api/predicate/operators/EqualsOperator.java |    2 +-
 .../operators/GreaterEqualsOperator.java        |    2 +-
 .../predicate/operators/GreaterOperator.java    |    2 +-
 .../api/predicate/operators/InOperator.java     |    2 +-
 .../predicate/operators/LessEqualsOperator.java |    2 +-
 .../api/predicate/operators/LessOperator.java   |    2 +-
 .../predicate/operators/NotEqualsOperator.java  |    2 +-
 .../query/ExtendedResourcePredicateVisitor.java |    2 +-
 .../server/api/query/JpaPredicateVisitor.java   |    4 +-
 .../ambari/server/api/query/JpaSortBuilder.java |    2 +-
 .../api/query/ProcessingPredicateVisitor.java   |    6 +-
 .../ambari/server/api/query/QueryImpl.java      |   60 +-
 .../ambari/server/api/query/QueryInfo.java      |    2 +-
 .../api/query/SubResourcePredicateVisitor.java  |    2 +-
 .../render/AlertSummaryGroupedRenderer.java     |    6 +-
 .../api/query/render/AlertSummaryRenderer.java  |    4 +-
 .../server/api/query/render/BaseRenderer.java   |    2 +-
 .../query/render/ClusterBlueprintRenderer.java  |   36 +-
 .../api/query/render/DefaultRenderer.java       |    4 +-
 .../api/query/render/MinimalRenderer.java       |   10 +-
 .../api/resources/BaseResourceDefinition.java   |    8 +-
 .../resources/ClusterResourceDefinition.java    |    2 +-
 ...ComponentStackVersionResourceDefinition.java |    2 +-
 .../ExtensionLinkResourceDefinition.java        |    2 +-
 .../resources/ExtensionResourceDefinition.java  |    2 +-
 .../ExtensionVersionResourceDefinition.java     |    2 +-
 .../api/resources/FeedResourceDefinition.java   |    2 +-
 .../api/resources/GroupResourceDefinition.java  |    2 +-
 .../HostComponentResourceDefinition.java        |    4 +-
 .../api/resources/JobResourceDefinition.java    |    2 +-
 .../resources/PermissionResourceDefinition.java |    2 +-
 .../resources/ResourceInstanceFactoryImpl.java  |    2 +-
 ...tServiceHostComponentResourceDefinition.java |    2 +-
 .../RootServiceResourceDefinition.java          |    2 +-
 .../resources/ServiceResourceDefinition.java    |    2 +-
 .../StackConfigurationResourceDefinition.java   |    2 +-
 ...ackLevelConfigurationResourceDefinition.java |    2 +-
 .../api/resources/StackResourceDefinition.java  |    2 +-
 .../StackServiceResourceDefinition.java         |    2 +-
 .../StackVersionResourceDefinition.java         |    2 +-
 .../api/resources/UserResourceDefinition.java   |    2 +-
 .../ViewInstanceResourceDefinition.java         |    2 +-
 .../ViewVersionResourceDefinition.java          |    2 +-
 .../resources/WorkflowResourceDefinition.java   |    2 +-
 .../server/api/rest/BootStrapResource.java      |    4 +-
 .../api/services/AlertDefinitionService.java    |    2 +-
 .../server/api/services/AlertGroupService.java  |    2 +-
 .../api/services/AlertHistoryService.java       |    2 +-
 .../server/api/services/AlertNoticeService.java |    2 +-
 .../server/api/services/AlertService.java       |    2 +-
 .../server/api/services/AlertTargetService.java |    2 +-
 .../server/api/services/AmbariMetaInfo.java     |   46 +-
 .../ambari/server/api/services/BaseRequest.java |    6 +-
 .../ClusterKerberosDescriptorService.java       |    2 +-
 .../api/services/ClusterPrivilegeService.java   |    2 +-
 .../server/api/services/ClusterService.java     |    2 +-
 .../services/ClusterStackVersionService.java    |    4 +-
 .../CompatibleRepositoryVersionService.java     |    4 +-
 .../server/api/services/ComponentService.java   |    4 +-
 .../server/api/services/ConfigGroupService.java |    2 +-
 .../api/services/ConfigurationService.java      |    2 +-
 .../server/api/services/CredentialService.java  |    2 +-
 .../api/services/ExtensionLinksService.java     |    2 +-
 .../server/api/services/ExtensionsService.java  |    4 +-
 .../api/services/HostComponentService.java      |    6 +-
 .../services/HostKerberosIdentityService.java   |    2 +-
 .../ambari/server/api/services/HostService.java |    2 +-
 .../api/services/HostStackVersionService.java   |    4 +-
 .../server/api/services/InstanceService.java    |    2 +-
 .../ambari/server/api/services/JobService.java  |    2 +-
 .../server/api/services/LoggingService.java     |    2 +-
 .../api/services/OperatingSystemService.java    |    4 +-
 .../api/services/PersistKeyValueImpl.java       |    4 +-
 .../api/services/PersistKeyValueService.java    |    2 +-
 .../api/services/RecommendationService.java     |    2 +-
 .../server/api/services/RepositoryService.java  |    2 +-
 .../api/services/RepositoryVersionService.java  |    4 +-
 .../ambari/server/api/services/RequestBody.java |    6 +-
 .../server/api/services/RequestFactory.java     |    2 +-
 .../api/services/RequestScheduleService.java    |    2 +-
 .../server/api/services/RequestService.java     |    2 +-
 .../ambari/server/api/services/ResultImpl.java  |    2 +-
 .../api/services/ResultPostProcessorImpl.java   |    4 +-
 .../api/services/RoleAuthorizationService.java  |    2 +-
 .../server/api/services/RootServiceService.java |    6 +-
 .../services/ServiceConfigVersionService.java   |    2 +-
 .../server/api/services/ServiceService.java     |    4 +-
 .../server/api/services/StacksService.java      |   30 +-
 .../server/api/services/StageService.java       |    2 +-
 .../server/api/services/TaskAttemptService.java |    2 +-
 .../ambari/server/api/services/TaskService.java |    2 +-
 .../api/services/UpgradeGroupService.java       |    2 +-
 .../server/api/services/UpgradeItemService.java |    2 +-
 .../server/api/services/UpgradeService.java     |    2 +-
 .../api/services/UpgradeSummaryService.java     |    2 +-
 .../server/api/services/ValidationService.java  |    2 +-
 .../api/services/VersionDefinitionService.java  |    2 +-
 .../api/services/WidgetLayoutService.java       |    2 +-
 .../server/api/services/WidgetService.java      |    2 +-
 .../server/api/services/WorkflowService.java    |    2 +-
 .../services/groups/GroupPrivilegeService.java  |    2 +-
 .../api/services/groups/MemberService.java      |    2 +-
 .../services/parsers/JsonRequestBodyParser.java |   10 +-
 .../api/services/serializers/CsvSerializer.java |    6 +-
 .../StackAdvisorBlueprintProcessor.java         |   16 +-
 .../stackadvisor/StackAdvisorRequest.java       |   16 +-
 .../stackadvisor/StackAdvisorRunner.java        |    2 +-
 ...rationDependenciesRecommendationCommand.java |   12 +-
 .../ConfigurationRecommendationCommand.java     |   12 +-
 .../commands/StackAdvisorCommand.java           |    6 +-
 .../recommendations/RecommendationResponse.java |    6 +-
 .../users/ActiveWidgetLayoutService.java        |    2 +-
 .../users/UserAuthorizationService.java         |    2 +-
 .../services/users/UserPrivilegeService.java    |    2 +-
 .../views/ViewExternalSubResourceService.java   |    4 +-
 .../api/services/views/ViewInstanceService.java |    2 +-
 .../services/views/ViewPermissionService.java   |    2 +-
 .../services/views/ViewPrivilegeService.java    |    2 +-
 .../services/views/ViewSubResourceService.java  |    2 +-
 .../api/services/views/ViewVersionService.java  |    2 +-
 .../ambari/server/api/util/TreeNodeImpl.java    |    6 +-
 ...ClusterPrivilegeChangeRequestAuditEvent.java |    4 +-
 .../ViewPrivilegeChangeRequestAuditEvent.java   |    4 +-
 .../eventcreator/PrivilegeEventCreator.java     |    2 +-
 .../RepositoryVersionEventCreator.java          |    4 +-
 .../RequestAuditEventCreatorHelper.java         |    2 +-
 .../eventcreator/ViewPrivilegeEventCreator.java |    2 +-
 .../server/bootstrap/BSHostStatusCollector.java |    2 +-
 .../ambari/server/bootstrap/BSRunner.java       |    2 +-
 .../ambari/server/bootstrap/BootStrapImpl.java  |    4 +-
 .../ambari/server/bootstrap/SshHostInfo.java    |    2 +-
 .../server/checks/AbstractCheckDescriptor.java  |    2 +-
 .../server/checks/AtlasPresenceCheck.java       |    4 +-
 .../ambari/server/checks/CheckDescription.java  |    5 +-
 .../server/checks/ClientRetryPropertyCheck.java |    2 +-
 .../checks/ComponentsInstallationCheck.java     |    6 +-
 .../server/checks/ConfigurationMergeCheck.java  |    2 +-
 .../ambari/server/checks/HealthCheck.java       |    2 +-
 .../HiveDynamicServiceDiscoveryCheck.java       |    2 +-
 .../checks/HostsMasterMaintenanceCheck.java     |    4 +-
 .../server/checks/InstallPackagesCheck.java     |    6 +-
 ...apReduce2JobHistoryStatePreservingCheck.java |    2 +-
 .../server/checks/PreviousUpgradeCompleted.java |    2 +-
 .../checks/SecondaryNamenodeDeletedCheck.java   |    2 +-
 .../checks/ServiceCheckValidityCheck.java       |   13 +-
 .../server/checks/ServicePresenceCheck.java     |   56 +-
 .../ServicesMapReduceDistributedCacheCheck.java |    2 +-
 .../ServicesTezDistributedCacheCheck.java       |    2 +-
 .../ambari/server/checks/ServicesUpCheck.java   |    6 +-
 .../server/checks/UpgradeCheckRegistry.java     |   12 +-
 .../server/checks/VersionMismatchCheck.java     |    2 +-
 .../collections/functors/ContainsPredicate.java |    2 +-
 .../DelegatedMultiplePredicateContainer.java    |    2 +-
 .../collections/functors/EqualsPredicate.java   |    2 +-
 .../functors/PredicateClassFactory.java         |    2 +-
 .../server/configuration/Configuration.java     |    2 +-
 .../ambari/server/controller/ActionRequest.java |   19 +-
 .../AmbariCustomCommandExecutionHelper.java     |    3 +-
 .../server/controller/AmbariHandlerList.java    |    4 +-
 .../server/controller/AuthToLocalBuilder.java   |    8 +-
 .../server/controller/ClusterResponse.java      |   17 +-
 .../server/controller/ConfigurationRequest.java |    4 +-
 .../server/controller/ExecuteActionRequest.java |   20 +-
 .../controller/ExtensionLinkResponse.java       |    2 +-
 .../controller/ExtensionVersionResponse.java    |    2 +-
 .../server/controller/KerberosHelperImpl.java   |  118 +-
 .../server/controller/LdapSyncRequest.java      |    2 +-
 .../controller/MaintenanceStateHelper.java      |    6 +-
 .../server/controller/PrereqCheckRequest.java   |    2 +-
 .../controller/RequestsByStatusesRequest.java   |    2 +-
 .../controller/RootServiceResponseFactory.java  |    8 +-
 .../server/controller/ServiceRequest.java       |   10 +-
 .../server/controller/ShortTaskStatus.java      |   19 +-
 .../StackServiceComponentResponse.java          |    2 +-
 .../server/controller/StackServiceResponse.java |   10 +-
 .../server/controller/StackVersionResponse.java |    2 +-
 .../ambari/server/controller/UserRequest.java   |    2 +-
 .../gsinstaller/ClusterDefinition.java          |   26 +-
 .../gsinstaller/GSInstallerNoOpProvider.java    |    2 +-
 .../gsinstaller/GSInstallerProviderModule.java  |    2 +-
 .../GSInstallerResourceProvider.java            |   12 +-
 .../AbstractAuthorizedResourceProvider.java     |    2 +-
 .../internal/AbstractPropertyProvider.java      |   10 +-
 .../internal/AbstractProviderModule.java        |   70 +-
 .../internal/AbstractResourceProvider.java      |   16 +-
 .../internal/ActionResourceProvider.java        |   10 +-
 .../ActiveWidgetLayoutResourceProvider.java     |   14 +-
 .../AlertDefinitionResourceProvider.java        |   16 +-
 .../internal/AlertGroupResourceProvider.java    |   34 +-
 .../internal/AlertHistoryResourceProvider.java  |   10 +-
 .../internal/AlertNoticeResourceProvider.java   |   10 +-
 .../internal/AlertResourceProvider.java         |   10 +-
 .../internal/AlertSummaryPropertyProvider.java  |   14 +-
 .../internal/AlertTargetResourceProvider.java   |   34 +-
 .../AmbariPrivilegeResourceProvider.java        |    6 +-
 .../controller/internal/AppCookieManager.java   |    2 +-
 .../internal/ArtifactResourceProvider.java      |   26 +-
 .../controller/internal/BaseClusterRequest.java |    4 +-
 .../controller/internal/BaseProvider.java       |   22 +-
 .../BlueprintConfigurationProcessor.java        |  186 +-
 .../internal/BlueprintResourceProvider.java     |   28 +-
 .../controller/internal/CalculatedStatus.java   |   18 +-
 .../internal/ClientConfigResourceProvider.java  |   80 +-
 .../internal/ClusterControllerImpl.java         |   22 +-
 ...usterKerberosDescriptorResourceProvider.java |    8 +-
 .../ClusterPrivilegeResourceProvider.java       |    6 +-
 .../internal/ClusterResourceProvider.java       |   16 +-
 .../ClusterStackVersionResourceProvider.java    |   26 +-
 ...atibleRepositoryVersionResourceProvider.java |    2 +-
 .../internal/ConfigGroupResourceProvider.java   |   34 +-
 .../internal/ConfigurationResourceProvider.java |   22 +-
 .../internal/CredentialResourceProvider.java    |   10 +-
 .../internal/ExportBlueprintRequest.java        |   30 +-
 .../server/controller/internal/Extension.java   |   20 +-
 .../internal/ExtensionLinkResourceProvider.java |   14 +-
 .../internal/ExtensionResourceProvider.java     |    8 +-
 .../ExtensionVersionResourceProvider.java       |    8 +-
 .../internal/FeedResourceProvider.java          |   10 +-
 .../GroupPrivilegeResourceProvider.java         |    6 +-
 .../internal/GroupResourceProvider.java         |   14 +-
 .../HostComponentProcessResourceProvider.java   |    8 +-
 .../internal/HostComponentResourceProvider.java |   50 +-
 .../HostKerberosIdentityResourceProvider.java   |    4 +-
 .../internal/HostResourceProvider.java          |   32 +-
 .../internal/InstanceResourceProvider.java      |   10 +-
 .../internal/JobResourceProvider.java           |   14 +-
 .../KerberosDescriptorResourceProvider.java     |    2 +-
 .../internal/LdapSyncEventResourceProvider.java |   28 +-
 .../internal/LoggingResourceProvider.java       |    6 +-
 .../internal/MemberResourceProvider.java        |   18 +-
 .../OperatingSystemResourceProvider.java        |    4 +-
 .../internal/PermissionResourceProvider.java    |    8 +-
 .../PreUpgradeCheckResourceProvider.java        |    2 +-
 .../internal/PrivilegeResourceProvider.java     |   22 +-
 .../internal/PropertyPredicateVisitor.java      |    2 +-
 .../QuickLinkArtifactResourceProvider.java      |   16 +-
 .../RecommendationResourceProvider.java         |   14 +-
 .../internal/RemoteClusterResourceProvider.java |   10 +-
 .../internal/RepositoryResourceProvider.java    |    8 +-
 .../RepositoryVersionResourceProvider.java      |   12 +-
 .../internal/RequestResourceFilter.java         |    2 +-
 .../internal/RequestResourceProvider.java       |   28 +-
 .../RequestScheduleResourceProvider.java        |   22 +-
 .../internal/RequestStageContainer.java         |    2 +-
 .../RoleAuthorizationResourceProvider.java      |    8 +-
 .../RootServiceComponentPropertyProvider.java   |    4 +-
 .../RootServiceComponentResourceProvider.java   |    8 +-
 ...ootServiceHostComponentResourceProvider.java |   10 +-
 .../internal/RootServiceResourceProvider.java   |    8 +-
 .../ServiceConfigVersionResourceProvider.java   |   24 +-
 .../internal/ServiceResourceProvider.java       |   42 +-
 .../internal/SimplifyingPredicateVisitor.java   |    6 +-
 .../controller/internal/SortRequestImpl.java    |    2 +-
 .../server/controller/internal/Stack.java       |   76 +-
 .../internal/StackAdvisorResourceProvider.java  |   22 +-
 .../internal/StackArtifactResourceProvider.java |   18 +-
 ...ConfigurationDependencyResourceProvider.java |   12 +-
 .../StackConfigurationResourceProvider.java     |   10 +-
 .../internal/StackDefinedPropertyProvider.java  |   10 +-
 .../StackDependencyResourceProvider.java        |   10 +-
 ...StackLevelConfigurationResourceProvider.java |   10 +-
 .../internal/StackResourceProvider.java         |    8 +-
 .../StackServiceComponentResourceProvider.java  |   12 +-
 .../internal/StackServiceResourceProvider.java  |   16 +-
 .../internal/StackVersionResourceProvider.java  |    8 +-
 .../internal/StageResourceProvider.java         |   14 +-
 .../internal/TargetClusterResourceProvider.java |   12 +-
 .../internal/TaskAttemptResourceProvider.java   |   16 +-
 .../internal/TaskResourceProvider.java          |    8 +-
 .../internal/ThemeArtifactResourceProvider.java |   16 +-
 .../controller/internal/URLStreamProvider.java  |    2 +-
 .../internal/UpgradeGroupResourceProvider.java  |   12 +-
 .../internal/UpgradeItemResourceProvider.java   |   75 +-
 .../internal/UpgradeResourceProvider.java       |   86 +-
 .../UpgradeSummaryResourceProvider.java         |   14 +-
 .../UserAuthorizationResourceProvider.java      |   10 +-
 .../internal/UserPrivilegeResourceProvider.java |    6 +-
 .../internal/UserResourceProvider.java          |   14 +-
 .../internal/ValidationResourceProvider.java    |   10 +-
 .../VersionDefinitionResourceProvider.java      |    2 +-
 .../internal/ViewInstanceResourceProvider.java  |   14 +-
 .../ViewPermissionResourceProvider.java         |    8 +-
 .../internal/ViewPrivilegeResourceProvider.java |    8 +-
 .../internal/ViewResourceProvider.java          |    8 +-
 .../internal/ViewURLResourceProvider.java       |    6 +-
 .../internal/ViewVersionResourceProvider.java   |    8 +-
 .../internal/WidgetLayoutResourceProvider.java  |   18 +-
 .../internal/WidgetResourceProvider.java        |   12 +-
 .../internal/WorkflowResourceProvider.java      |   14 +-
 .../controller/jdbc/JDBCResourceProvider.java   |   10 +-
 .../controller/jmx/JMXPropertyProvider.java     |    8 +-
 .../controller/logging/LogLineResult.java       |    2 +-
 .../logging/LoggingRequestHelperImpl.java       |    4 +-
 .../logging/LoggingSearchPropertyProvider.java  |    2 +-
 .../MetricsDataTransferMethodFactory.java       |    4 +-
 .../MetricsDownsamplingMethodFactory.java       |    2 +-
 .../metrics/RestMetricsPropertyProvider.java    |   10 +-
 .../ThreadPoolEnabledPropertyProvider.java      |    4 +-
 .../GangliaComponentPropertyProvider.java       |    6 +-
 .../GangliaHostComponentPropertyProvider.java   |    6 +-
 .../ganglia/GangliaHostPropertyProvider.java    |    2 +-
 .../metrics/ganglia/GangliaMetric.java          |    2 +-
 .../ganglia/GangliaPropertyProvider.java        |   24 +-
 .../ganglia/GangliaReportPropertyProvider.java  |    6 +-
 .../metrics/timeline/AMSPropertyProvider.java   |   26 +-
 .../timeline/AMSReportPropertyProvider.java     |    8 +-
 .../cache/TimelineMetricCacheEntryFactory.java  |    4 +-
 .../controller/predicate/AndPredicate.java      |    2 +-
 .../controller/predicate/ArrayPredicate.java    |    8 +-
 .../controller/predicate/EqualsPredicate.java   |    2 +-
 .../predicate/GreaterEqualsPredicate.java       |    2 +-
 .../controller/predicate/GreaterPredicate.java  |    2 +-
 .../predicate/LessEqualsPredicate.java          |    2 +-
 .../controller/predicate/LessPredicate.java     |    2 +-
 .../controller/predicate/OrPredicate.java       |    2 +-
 .../ambari/server/controller/spi/Resource.java  |    2 +-
 ...eredThreadPoolExecutorCompletionService.java |    2 +-
 .../controller/utilities/PredicateBuilder.java  |   12 +-
 .../controller/utilities/PropertyHelper.java    |   26 +-
 .../customactions/ActionDefinitionManager.java  |   12 +-
 .../customactions/ActionDefinitionXml.java      |    2 +-
 .../ambari/server/events/HostsRemovedEvent.java |    2 +-
 .../alerts/AlertAggregateListener.java          |    2 +-
 .../listeners/alerts/AlertHostListener.java     |    2 +-
 .../alerts/AlertStateChangedListener.java       |    4 +-
 .../listeners/tasks/TaskStatusListener.java     |    2 +-
 .../upgrade/HostVersionOutOfSyncListener.java   |    4 +-
 .../listeners/upgrade/StackVersionListener.java |    2 +-
 .../ambari/server/metadata/ActionMetadata.java  |   10 +-
 .../metadata/AmbariServiceAlertDefinitions.java |    2 +-
 .../server/metadata/RoleCommandOrder.java       |    8 +-
 .../system/impl/AmbariMetricSinkImpl.java       |    2 +-
 .../system/impl/AmbariPerformanceMonitor.java   |    2 +-
 .../server/notifications/DispatchFactory.java   |    2 +-
 .../dispatchers/SNMPDispatcher.java             |    2 +-
 .../orm/AmbariJpaLocalTxnInterceptor.java       |    2 +-
 .../orm/AmbariLocalSessionInterceptor.java      |    2 +-
 .../apache/ambari/server/orm/dao/AlertsDAO.java |    6 +-
 .../orm/dao/ConfigGroupHostMappingDAO.java      |   14 +-
 .../ambari/server/orm/dao/ExtensionLinkDAO.java |    4 +-
 .../apache/ambari/server/orm/dao/GroupDAO.java  |    2 +-
 .../server/orm/dao/HostConfigMappingDAO.java    |   22 +-
 .../apache/ambari/server/orm/dao/HostDAO.java   |    2 +-
 .../server/orm/dao/HostRoleCommandDAO.java      |   65 +-
 .../dao/HostRoleCommandStatusSummaryDTO.java    |    4 +-
 .../apache/ambari/server/orm/dao/MemberDAO.java |    2 +-
 .../ambari/server/orm/dao/ServiceConfigDAO.java |    2 +-
 .../apache/ambari/server/orm/dao/StageDAO.java  |   76 +-
 .../ambari/server/orm/dao/UpgradeDAO.java       |    5 -
 .../apache/ambari/server/orm/dao/UserDAO.java   |    4 +-
 .../orm/entities/AlertCurrentEntity_.java       |    2 +-
 .../orm/entities/AlertDefinitionEntity.java     |    2 +-
 .../orm/entities/AlertHistoryEntity_.java       |    2 +-
 .../server/orm/entities/AlertNoticeEntity_.java |    2 +-
 .../server/orm/entities/AlertTargetEntity.java  |    4 +-
 .../server/orm/entities/ClusterEntity.java      |   13 +-
 .../orm/entities/HostRoleCommandEntity.java     |   33 +-
 .../orm/entities/HostRoleCommandEntity_.java    |    2 +-
 .../orm/entities/OperatingSystemEntity.java     |    2 +-
 .../server/orm/entities/PrincipalEntity.java    |    2 +-
 .../server/orm/entities/ResourceEntity.java     |    2 +-
 .../ambari/server/orm/entities/StageEntity.java |   28 +-
 .../server/orm/entities/StageEntityPK.java      |   35 +-
 .../server/orm/entities/StageEntity_.java       |    2 +-
 .../server/orm/entities/UpgradeEntity.java      |   27 +-
 .../ambari/server/orm/entities/UserEntity.java  |    2 +-
 .../ambari/server/orm/entities/ViewEntity.java  |   14 +-
 .../server/orm/entities/ViewInstanceEntity.java |   18 +-
 .../server/orm/helpers/dbms/PostgresHelper.java |    2 +-
 .../server/orm/models/HostComponentSummary.java |    2 +-
 .../ambari/server/proxy/ProxyService.java       |    2 +-
 .../server/security/SecurePasswordHelper.java   |    2 +-
 .../AmbariKerberosAuthenticationProperties.java |    2 +-
 .../AmbariLdapAuthenticationProvider.java       |    4 +-
 .../AmbariPamAuthenticationProvider.java        |    4 +-
 .../authorization/LdapServerProperties.java     |    2 +-
 .../server/security/authorization/User.java     |    2 +-
 .../server/security/authorization/Users.java    |   46 +-
 .../jwt/JwtAuthenticationProperties.java        |    2 +-
 .../encryption/AbstractCredentialStore.java     |    2 +-
 .../security/encryption/CredentialProvider.java |    2 +-
 .../encryption/CredentialStoreServiceImpl.java  |    2 +-
 .../encryption/InMemoryCredentialStore.java     |    2 +-
 .../encryption/MasterKeyServiceImpl.java        |    2 +-
 .../security/ldap/AmbariLdapDataPopulator.java  |   18 +-
 .../server/security/ldap/LdapBatchDto.java      |   18 +-
 .../server/security/ldap/LdapGroupDto.java      |    2 +-
 .../server/security/ldap/LdapSyncDto.java       |    4 +-
 .../security/unsecured/rest/ConnectionInfo.java |    2 +-
 .../serveraction/ServerActionExecutor.java      |  118 +-
 .../kerberos/ADKerberosOperationHandler.java    |    2 +-
 .../AbstractPrepareKerberosServerAction.java    |    6 +-
 .../kerberos/CreateKeytabFilesServerAction.java |    4 +-
 .../kerberos/CreatePrincipalsServerAction.java  |    2 +-
 .../kerberos/DestroyPrincipalsServerAction.java |    2 +-
 .../kerberos/IPAKerberosOperationHandler.java   |    4 +-
 .../kerberos/KerberosOperationHandler.java      |   24 +-
 .../kerberos/MITKerberosOperationHandler.java   |    8 +-
 .../PrepareDisableKerberosServerAction.java     |   10 +-
 .../PrepareEnableKerberosServerAction.java      |    4 +-
 .../PrepareKerberosIdentitiesServerAction.java  |    6 +-
 .../UpdateKerberosConfigsServerAction.java      |   10 +-
 .../upgrades/FinalizeUpgradeAction.java         |   12 +-
 .../FixCapacitySchedulerOrderingPolicy.java     |  118 ++
 .../upgrades/FixYarnWebServiceUrl.java          |  103 ++
 .../upgrades/UpgradeUserKerberosDescriptor.java |    6 +-
 .../apache/ambari/server/stack/BaseModule.java  |    4 +-
 .../ambari/server/stack/ComponentModule.java    |    8 +-
 .../server/stack/ConfigurationDirectory.java    |    6 +-
 .../ambari/server/stack/ConfigurationInfo.java  |    6 +-
 .../server/stack/ConfigurationModule.java       |    6 +-
 .../ambari/server/stack/ExtensionDirectory.java |    2 +-
 .../ambari/server/stack/ExtensionModule.java    |    8 +-
 .../apache/ambari/server/stack/HostsType.java   |    4 +-
 .../ambari/server/stack/MasterHostResolver.java |    8 +-
 .../stack/QuickLinksConfigurationModule.java    |    4 +-
 .../ambari/server/stack/ServiceDirectory.java   |    4 +-
 .../ambari/server/stack/ServiceModule.java      |   36 +-
 .../ambari/server/stack/StackContext.java       |    4 +-
 .../ambari/server/stack/StackDirectory.java     |    4 +-
 .../ambari/server/stack/StackManager.java       |   18 +-
 .../apache/ambari/server/stack/StackModule.java |   27 +-
 .../apache/ambari/server/stack/ThemeModule.java |    4 +-
 .../ambari/server/stageplanner/RoleGraph.java   |    8 +-
 .../server/stageplanner/RoleGraphNode.java      |    6 +-
 .../apache/ambari/server/state/CheckHelper.java |    2 +-
 .../org/apache/ambari/server/state/Cluster.java |   30 +-
 .../ambari/server/state/ComponentInfo.java      |    6 +-
 .../ambari/server/state/ConfigHelper.java       |    2 +-
 .../apache/ambari/server/state/ConfigImpl.java  |    2 +-
 .../ambari/server/state/ConfigMergeHelper.java  |    2 +-
 .../ambari/server/state/DependencyInfo.java     |    2 +-
 .../ambari/server/state/DesiredConfig.java      |    2 +-
 .../ambari/server/state/ExtensionInfo.java      |    6 +-
 .../apache/ambari/server/state/HostConfig.java  |    6 +-
 .../ambari/server/state/PropertyInfo.java       |   10 +-
 .../server/state/ServiceComponentImpl.java      |   19 +-
 .../apache/ambari/server/state/ServiceImpl.java |   10 +-
 .../apache/ambari/server/state/ServiceInfo.java |   50 +-
 .../ambari/server/state/ServiceOsSpecific.java  |    2 +-
 .../apache/ambari/server/state/StackInfo.java   |   33 +-
 .../ambari/server/state/UpgradeHelper.java      |   58 +-
 .../state/alert/AggregateDefinitionMapping.java |    6 +-
 .../state/alert/AlertDefinitionFactory.java     |    2 +-
 .../server/state/alert/AlertDefinitionHash.java |   16 +-
 .../ambari/server/state/alert/MetricSource.java |    4 +-
 .../server/state/cluster/ClusterImpl.java       |   48 +-
 .../server/state/cluster/ClustersImpl.java      |   22 +-
 .../state/configgroup/ConfigGroupImpl.java      |   12 +-
 .../server/state/fsm/StateMachineFactory.java   |    5 +-
 .../state/host/HostHealthyHeartbeatEvent.java   |    2 +-
 .../kerberos/AbstractKerberosDescriptor.java    |    2 +-
 .../AbstractKerberosDescriptorContainer.java    |   49 +-
 .../KerberosConfigurationDescriptor.java        |    6 +-
 .../state/kerberos/KerberosDescriptor.java      |   12 +-
 .../KerberosDescriptorUpdateHelper.java         |   14 +-
 .../kerberos/KerberosIdentityDescriptor.java    |   18 +
 .../kerberos/KerberosKeytabDescriptor.java      |    6 +-
 .../kerberos/KerberosPrincipalDescriptor.java   |    2 +-
 .../kerberos/KerberosServiceDescriptor.java     |    4 +-
 .../KerberosServiceDescriptorFactory.java       |    2 +-
 .../kerberos/VariableReplacementHelper.java     |    4 +-
 .../quicklinks/QuickLinksConfiguration.java     |    4 +-
 .../ambari/server/state/scheduler/Batch.java    |    2 +-
 .../server/state/scheduler/BatchRequestJob.java |    4 +-
 .../services/AlertNoticeDispatchService.java    |   34 +-
 .../services/AmbariServerAlertService.java      |    2 +-
 .../state/services/MetricsRetrievalService.java |   29 +-
 .../services/RetryUpgradeActionService.java     |    2 +-
 .../server/state/stack/ConfigurationXml.java    |    6 +-
 .../state/stack/ExtensionMetainfoXml.java       |    6 +-
 .../server/state/stack/MetricDefinition.java    |    2 +-
 .../ambari/server/state/stack/OsFamily.java     |    8 +-
 .../server/state/stack/PrerequisiteCheck.java   |    4 +-
 .../server/state/stack/RepositoryXml.java       |    4 +-
 .../server/state/stack/ServiceMetainfoXml.java  |    2 +-
 .../server/state/stack/StackMetainfoXml.java    |    2 +-
 .../state/stack/StackRoleCommandOrder.java      |    8 +-
 .../ambari/server/state/stack/UpgradePack.java  |   26 +-
 .../state/stack/upgrade/ClusterGrouping.java    |    8 +-
 .../state/stack/upgrade/ColocatedGrouping.java  |  108 +-
 .../state/stack/upgrade/ConfigureTask.java      |    2 +-
 .../server/state/stack/upgrade/Grouping.java    |   16 +-
 .../stack/upgrade/RepositoryVersionHelper.java  |    2 +-
 .../stack/upgrade/ServiceCheckGrouping.java     |    8 +-
 .../state/stack/upgrade/StageWrapper.java       |    4 +-
 .../state/stack/upgrade/TaskWrapperBuilder.java |   14 +-
 .../svccomphost/ServiceComponentHostImpl.java   |    2 +-
 .../ambari/server/state/theme/Layout.java       |    4 +-
 .../ambari/server/state/theme/Placement.java    |    4 +-
 .../ambari/server/state/theme/Section.java      |    4 +-
 .../ambari/server/state/theme/TabLayout.java    |    4 +-
 .../server/state/theme/ThemeConfiguration.java  |    8 +-
 .../ambari/server/topology/AmbariContext.java   |   20 +-
 .../server/topology/BlueprintFactory.java       |    6 +-
 .../ambari/server/topology/BlueprintImpl.java   |   24 +-
 .../server/topology/BlueprintValidatorImpl.java |   32 +-
 .../topology/ClusterConfigurationRequest.java   |   22 +-
 .../server/topology/ClusterTopologyImpl.java    |   14 +-
 .../ambari/server/topology/Configuration.java   |   22 +-
 .../server/topology/ConfigurationFactory.java   |    4 +-
 .../ambari/server/topology/HostGroupImpl.java   |   16 +-
 .../ambari/server/topology/HostGroupInfo.java   |    4 +-
 .../ambari/server/topology/HostRequest.java     |   12 +-
 .../ambari/server/topology/LogicalRequest.java  |   26 +-
 .../server/topology/PersistedStateImpl.java     |   16 +-
 .../ambari/server/topology/TopologyManager.java |   24 +-
 .../tasks/PersistHostResourcesTask.java         |    4 +-
 .../validators/ClusterConfigTypeValidator.java  |    2 +-
 .../validators/RequiredPasswordValidator.java   |    8 +-
 .../server/upgrade/AbstractUpgradeCatalog.java  |   20 +-
 .../ambari/server/upgrade/StackUpgradeUtil.java |    2 +-
 .../server/upgrade/UpgradeCatalog200.java       |   22 +-
 .../server/upgrade/UpgradeCatalog210.java       |   42 +-
 .../server/upgrade/UpgradeCatalog212.java       |   16 +-
 .../server/upgrade/UpgradeCatalog2121.java      |    6 +-
 .../server/upgrade/UpgradeCatalog220.java       |    6 +-
 .../server/upgrade/UpgradeCatalog221.java       |    2 +-
 .../server/upgrade/UpgradeCatalog222.java       |    6 +-
 .../server/upgrade/UpgradeCatalog230.java       |    6 +-
 .../server/upgrade/UpgradeCatalog240.java       |   12 +-
 .../server/upgrade/UpgradeCatalog242.java       |    2 +-
 .../server/upgrade/UpgradeCatalog250.java       |    2 +-
 .../apache/ambari/server/utils/HTTPUtils.java   |    2 +-
 .../server/utils/JaxbMapKeyListAdapter.java     |    2 +-
 .../server/utils/JaxbMapKeyMapAdapter.java      |    2 +-
 .../server/utils/JaxbMapKeyValAdapter.java      |    2 +-
 .../apache/ambari/server/utils/Parallel.java    |   12 +-
 .../apache/ambari/server/utils/SetUtils.java    |    4 +-
 .../ambari/server/utils/ShellCommandUtil.java   |    4 +-
 .../apache/ambari/server/utils/StageUtils.java  |   60 +-
 .../ambari/server/utils/VersionUtils.java       |    4 +-
 .../apache/ambari/server/view/ClusterImpl.java  |    2 +-
 .../ambari/server/view/RemoteAmbariCluster.java |    4 +-
 .../view/RemoteAmbariClusterRegistry.java       |    4 +-
 .../server/view/RemoteAmbariStreamProvider.java |    4 +-
 .../server/view/ViewAmbariStreamProvider.java   |    4 +-
 .../ambari/server/view/ViewContextImpl.java     |    4 +-
 .../view/ViewExternalSubResourceProvider.java   |   12 +-
 .../ambari/server/view/ViewExtractor.java       |    2 +-
 .../apache/ambari/server/view/ViewRegistry.java |   83 +-
 .../server/view/ViewSubResourceDefinition.java  |    2 +-
 .../server/view/ViewSubResourceProvider.java    |   12 +-
 .../server/view/ViewURLStreamProvider.java      |    4 +-
 .../server/view/persistence/DataStoreImpl.java  |   20 +-
 ambari-server/src/main/python/ambari-server.py  |    4 +-
 .../python/ambari_server/serverConfiguration.py |    3 +
 .../main/resources/Ambari-DDL-Derby-CREATE.sql  |    1 +
 .../main/resources/Ambari-DDL-MySQL-CREATE.sql  |    1 +
 .../main/resources/Ambari-DDL-Oracle-CREATE.sql |    1 +
 .../resources/Ambari-DDL-Postgres-CREATE.sql    |    1 +
 .../resources/Ambari-DDL-SQLAnywhere-CREATE.sql |    3 +-
 .../resources/Ambari-DDL-SQLServer-CREATE.sql   |    1 +
 ambari-server/src/main/resources/alerts.json    |   12 +
 .../1.6.1.2.2.0/role_command_order.json         |   14 +
 .../0.1.0/configuration/ams-env.xml             |   11 +
 .../0.1.0/configuration/ams-grafana-ini.xml     |   11 +
 .../HDP/grafana-llapdaemon-daemons.json         |  313 +++-
 .../0.1.0/package/scripts/hbase.py              |   11 +-
 .../package/scripts/metrics_grafana_util.py     |    8 +-
 .../0.1.0/package/scripts/params.py             |    5 +
 .../0.1.0/role_command_order.json               |    9 +
 .../ATLAS/0.1.0.2.3/package/scripts/params.py   |    5 +
 .../DRUID/0.9.2/package/scripts/superset.py     |    2 +-
 .../FALCON/0.5.0.2.1/role_command_order.json    |    7 +
 .../0.96.0.2.0/package/scripts/params_linux.py  |    9 +-
 .../HBASE/0.96.0.2.0/role_command_order.json    |   10 +
 .../HDFS/2.1.0.2.0/configuration/hadoop-env.xml |    2 +-
 .../2.1.0.2.0/package/scripts/params_linux.py   |   11 +-
 .../HDFS/2.1.0.2.0/role_command_order.json      |   22 +
 .../configuration/ranger-hdfs-audit.xml         |    9 +
 .../3.0.0.3.0/package/scripts/params_linux.py   |    9 +-
 .../HDFS/3.0.0.3.0/service_advisor.py           |   27 +-
 .../HIVE/0.12.0.2.0/configuration/hive-env.xml  |    3 +-
 .../0.12.0.2.0/package/scripts/params_linux.py  |    6 +-
 .../HIVE/0.12.0.2.0/role_command_order.json     |   14 +
 .../HIVE/2.1.0.3.0/configuration/hive-env.xml   |    1 +
 .../configuration/ranger-hive-audit.xml         |    9 +
 .../2.1.0.3.0/package/scripts/params_linux.py   |    6 +-
 .../HIVE/2.1.0.3.0/service_advisor.py           |   25 +-
 .../KAFKA/0.8.1/package/scripts/params.py       |    9 +-
 .../KAFKA/0.8.1/role_command_order.json         |    7 +
 .../KAFKA/0.9.0/role_command_order.json         |    6 +
 .../1.10.3-10/configuration/kerberos-env.xml    |   15 +
 .../1.10.3-10/configuration/krb5-conf.xml       |   43 +-
 .../package/scripts/kerberos_common.py          |    5 +-
 .../1.10.3-10/package/scripts/params.py         |    2 +
 .../1.10.3-10/package/templates/krb5_conf.j2    |   54 -
 .../KERBEROS/1.10.3-10/properties/krb5_conf.j2  |   60 +
 .../0.5.0.2.2/package/scripts/params_linux.py   |   11 +-
 .../KNOX/0.5.0.2.2/role_command_order.json      |    7 +
 .../MAHOUT/1.0.0.2.3/role_command_order.json    |    6 +
 .../OOZIE/4.0.0.2.0/role_command_order.json     |    9 +
 .../PIG/0.12.0.2.0/role_command_order.json      |    6 +
 .../PIG/0.16.1.3.0/configuration/pig-env.xml    |   41 +
 .../PIG/0.16.1.3.0/configuration/pig-log4j.xml  |   65 +
 .../0.16.1.3.0/configuration/pig-properties.xml |   93 +
 .../PIG/0.16.1.3.0/kerberos.json                |   17 +
 .../common-services/PIG/0.16.1.3.0/metainfo.xml |  101 ++
 .../PIG/0.16.1.3.0/package/files/pigSmoke.sh    |   18 +
 .../PIG/0.16.1.3.0/package/scripts/params.py    |   31 +
 .../0.16.1.3.0/package/scripts/params_linux.py  |  104 ++
 .../package/scripts/params_windows.py           |   45 +
 .../PIG/0.16.1.3.0/package/scripts/pig.py       |   80 +
 .../0.16.1.3.0/package/scripts/pig_client.py    |   71 +
 .../0.16.1.3.0/package/scripts/service_check.py |  142 ++
 .../PIG/0.16.1.3.0/service_advisor.py           |  171 ++
 .../RANGER/0.4.0/role_command_order.json        |    8 +
 .../RANGER/0.5.0/role_command_order.json        |    6 +
 .../RANGER/0.6.0/role_command_order.json        |    6 +
 .../0.5.0.2.3/package/scripts/params.py         |   10 +-
 .../0.5.0.2.3/role_command_order.json           |    7 +
 .../SLIDER/0.91.0.3.0/service_advisor.py        |    7 +-
 .../SPARK/1.2.1/role_command_order.json         |    6 +
 .../SPARK/1.5.2/role_command_order.json         |    6 +
 .../SPARK/1.6.0/role_command_order.json         |    8 +
 .../SPARK/2.2.0/service_advisor.py              |    7 +-
 .../SPARK2/2.0.0/role_command_order.json        |    6 +
 .../SQOOP/1.4.4.2.0/role_command_order.json     |    6 +
 .../STORM/0.10.0/role_command_order.json        |    8 +
 .../STORM/0.9.1/package/scripts/params_linux.py |    6 +-
 .../STORM/0.9.1/role_command_order.json         |   13 +
 .../STORM/0.9.3/role_command_order.json         |    7 +
 .../TEZ/0.4.0.2.1/configuration/tez-site.xml    |    2 +-
 .../0.4.0.2.1/package/scripts/params_linux.py   |    2 +
 .../TEZ/0.4.0.2.1/role_command_order.json       |    6 +
 .../TEZ/0.9.0.3.0/service_advisor.py            |    9 +-
 .../configuration-mapred/mapred-site.xml        |    2 +-
 .../2.1.0.2.0/package/scripts/params_linux.py   |   10 +-
 .../YARN/2.1.0.2.0/package/scripts/yarn.py      |   16 +-
 .../YARN/2.1.0.2.0/role_command_order.json      |   21 +
 .../configuration/ranger-yarn-audit.xml         |    9 +
 .../3.0.0.3.0/package/scripts/params_linux.py   |    9 +-
 .../YARN/3.0.0.3.0/package/scripts/yarn.py      |   14 +-
 .../YARN/3.0.0.3.0/service_advisor.py           |  259 +--
 .../0.6.0.2.5/package/scripts/master.py         |   10 +-
 .../ZOOKEEPER/3.4.5/role_command_order.json     |    9 +
 .../ZOOKEEPER/3.4.9/service_advisor.py          |   13 +-
 .../host_scripts/alert_version_select.py        |  104 ++
 .../src/main/resources/properties.json          |    1 +
 .../stacks/BIGTOP/0.8/services/stack_advisor.py |    3 +-
 .../2.0.6/hooks/before-ANY/scripts/params.py    |    1 +
 .../stacks/HDP/2.0.6/services/stack_advisor.py  |    7 +-
 .../stacks/HDP/2.1/services/stack_advisor.py    |    3 +-
 .../services/HDFS/configuration/hadoop-env.xml  |    2 +-
 .../stacks/HDP/2.2/services/stack_advisor.py    |    3 +-
 .../services/HDFS/configuration/hadoop-env.xml  |    2 +-
 .../stacks/HDP/2.3/services/stack_advisor.py    |    3 +-
 .../stacks/HDP/2.3/upgrades/config-upgrade.xml  |    6 +
 .../HDP/2.3/upgrades/nonrolling-upgrade-2.3.xml |   10 +
 .../HDP/2.3/upgrades/nonrolling-upgrade-2.4.xml |   10 +
 .../HDP/2.3/upgrades/nonrolling-upgrade-2.5.xml |   16 +
 .../HDP/2.3/upgrades/nonrolling-upgrade-2.6.xml |   29 +
 .../stacks/HDP/2.3/upgrades/upgrade-2.3.xml     |   10 +
 .../stacks/HDP/2.3/upgrades/upgrade-2.4.xml     |   10 +
 .../stacks/HDP/2.3/upgrades/upgrade-2.5.xml     |   11 +
 .../stacks/HDP/2.3/upgrades/upgrade-2.6.xml     |   21 +
 .../services/HDFS/configuration/hadoop-env.xml  |    2 +-
 .../stacks/HDP/2.4/upgrades/config-upgrade.xml  |    5 +
 .../HDP/2.4/upgrades/nonrolling-upgrade-2.4.xml |   10 +
 .../HDP/2.4/upgrades/nonrolling-upgrade-2.5.xml |   16 +
 .../HDP/2.4/upgrades/nonrolling-upgrade-2.6.xml |   31 +-
 .../stacks/HDP/2.4/upgrades/upgrade-2.4.xml     |   10 +
 .../stacks/HDP/2.4/upgrades/upgrade-2.5.xml     |   11 +
 .../stacks/HDP/2.4/upgrades/upgrade-2.6.xml     |   21 +
 .../stacks/HDP/2.5/services/stack_advisor.py    |  277 ++-
 .../stacks/HDP/2.5/upgrades/config-upgrade.xml  |    6 +
 .../HDP/2.5/upgrades/nonrolling-upgrade-2.5.xml |   16 +
 .../HDP/2.5/upgrades/nonrolling-upgrade-2.6.xml |   29 +
 .../stacks/HDP/2.5/upgrades/upgrade-2.5.xml     |   16 +
 .../stacks/HDP/2.5/upgrades/upgrade-2.6.xml     |   23 +
 .../resources/stacks/HDP/2.6/repos/repoinfo.xml |   16 +-
 .../HDP/2.6/services/ACCUMULO/metainfo.xml      |    2 +-
 .../ATLAS/configuration/ranger-atlas-audit.xml  |   33 +
 .../stacks/HDP/2.6/services/ATLAS/metainfo.xml  |    2 +-
 .../stacks/HDP/2.6/services/DRUID/metainfo.xml  |    2 +-
 .../stacks/HDP/2.6/services/FALCON/metainfo.xml |    2 +-
 .../stacks/HDP/2.6/services/FLUME/metainfo.xml  |    2 +-
 .../HBASE/configuration/ranger-hbase-audit.xml  |   33 +
 .../stacks/HDP/2.6/services/HBASE/metainfo.xml  |    2 +-
 .../services/HDFS/configuration/hadoop-env.xml  |    2 +-
 .../HDFS/configuration/ranger-hdfs-audit.xml    |   33 +
 .../stacks/HDP/2.6/services/HDFS/metainfo.xml   |    2 +-
 .../HIVE/configuration/ranger-hive-audit.xml    |   33 +
 .../stacks/HDP/2.6/services/HIVE/metainfo.xml   |    2 +-
 .../KAFKA/configuration/ranger-kafka-audit.xml  |   33 +
 .../stacks/HDP/2.6/services/KAFKA/metainfo.xml  |    2 +-
 .../KNOX/configuration/ranger-knox-audit.xml    |   33 +
 .../stacks/HDP/2.6/services/KNOX/metainfo.xml   |    2 +-
 .../stacks/HDP/2.6/services/MAHOUT/metainfo.xml |    2 +-
 .../stacks/HDP/2.6/services/OOZIE/metainfo.xml  |    2 +-
 .../stacks/HDP/2.6/services/PIG/metainfo.xml    |    2 +-
 .../stacks/HDP/2.6/services/RANGER/metainfo.xml |    2 +-
 .../configuration/ranger-kms-audit.xml          |   33 +
 .../HDP/2.6/services/RANGER_KMS/metainfo.xml    |    2 +-
 .../stacks/HDP/2.6/services/SLIDER/metainfo.xml |    2 +-
 .../STORM/configuration/ranger-storm-audit.xml  |   33 +
 .../stacks/HDP/2.6/services/STORM/metainfo.xml  |    2 +-
 .../YARN/configuration/ranger-yarn-audit.xml    |   33 +
 .../stacks/HDP/2.6/services/YARN/metainfo.xml   |    2 +-
 .../stacks/HDP/2.6/services/stack_advisor.py    |   27 +-
 .../stacks/HDP/2.6/upgrades/config-upgrade.xml  |  108 ++
 .../HDP/2.6/upgrades/nonrolling-upgrade-2.6.xml |   63 +-
 .../stacks/HDP/2.6/upgrades/upgrade-2.6.xml     |   43 +
 .../stacks/HDP/3.0/services/PIG/metainfo.xml    |   27 +
 .../stacks/HDPWIN/2.1/services/stack_advisor.py |    9 +-
 .../stacks/HDPWIN/2.2/services/stack_advisor.py |    3 +-
 .../KERBEROS/configuration/kerberos-env.xml     |   15 +
 .../KERBEROS/configuration/krb5-conf.xml        |   43 +-
 .../KERBEROS/package/scripts/kerberos_common.py |    5 +-
 .../services/KERBEROS/package/scripts/params.py |    2 +
 .../KERBEROS/package/templates/krb5_conf.j2     |   54 -
 .../services/KERBEROS/properties/krb5_conf.j2   |   60 +
 .../stacks/PERF/1.0/services/stack_advisor.py   |    3 +-
 .../1.0/upgrades/nonrolling-upgrade-2.0.xml     |   10 +
 .../stacks/PERF/1.0/upgrades/upgrade-2.0.xml    |   10 +
 .../src/main/resources/stacks/stack_advisor.py  |   88 +-
 .../ExecutionCommandWrapperTest.java            |   28 +-
 .../actionmanager/TestActionDBAccessorImpl.java |   69 +-
 .../server/actionmanager/TestActionManager.java |   12 +-
 .../actionmanager/TestActionScheduler.java      |  250 +--
 .../TestActionSchedulerThreading.java           |    4 +-
 .../ambari/server/actionmanager/TestStage.java  |    2 +-
 .../server/agent/HeartbeatProcessorTest.java    |   36 +-
 .../server/agent/HeartbeatTestHelper.java       |    6 +-
 .../ambari/server/agent/TestActionQueue.java    |   12 +-
 .../server/agent/TestHeartbeatHandler.java      |   52 +-
 .../server/agent/TestHeartbeatMonitor.java      |    2 +-
 .../alerts/AgentHeartbeatAlertRunnableTest.java |    4 +-
 .../alerts/AmbariPerformanceRunnableTest.java   |    4 +-
 .../server/alerts/StaleAlertRunnableTest.java   |    4 +-
 .../server/api/handlers/CreateHandlerTest.java  |    6 +-
 .../server/api/handlers/DeleteHandlerTest.java  |    2 +-
 .../api/handlers/QueryCreateHandlerTest.java    |   98 +-
 .../server/api/handlers/ReadHandlerTest.java    |    4 +-
 .../server/api/handlers/UpdateHandlerTest.java  |    4 +-
 .../server/api/predicate/QueryLexerTest.java    |   40 +-
 .../server/api/predicate/QueryParserTest.java   |   56 +-
 .../predicate/operators/AndOperatorTest.java    |    4 +-
 .../predicate/operators/EqualsOperatorTest.java |    2 +-
 .../operators/GreaterEqualsOperatorTest.java    |    2 +-
 .../operators/GreaterOperatorTest.java          |    2 +-
 .../api/predicate/operators/InOperatorTest.java |    6 +-
 .../operators/LessEqualsOperatorTest.java       |    2 +-
 .../predicate/operators/LessOperatorTest.java   |    2 +-
 .../operators/NotEqualsOperatorTest.java        |    2 +-
 .../predicate/operators/NotOperatorTest.java    |    2 +-
 .../api/predicate/operators/OrOperatorTest.java |    4 +-
 .../ExtendedResourcePredicateVisitorTest.java   |   18 +-
 .../server/api/query/JpaSortBuilderTest.java    |    2 +-
 .../query/ProcessingPredicateVisitorTest.java   |   12 +-
 .../ambari/server/api/query/QueryImplTest.java  |   62 +-
 .../ambari/server/api/query/QueryInfoTest.java  |    2 +-
 .../render/ClusterBlueprintRendererTest.java    |   44 +-
 .../api/query/render/DefaultRendererTest.java   |   32 +-
 .../render/MetricsPaddingRendererTest.java      |    4 +-
 .../api/query/render/MinimalRendererTest.java   |   40 +-
 .../resources/BaseResourceDefinitionTest.java   |   10 +-
 .../PermissionResourceDefinitionTest.java       |    2 +-
 .../resources/SimpleResourceDefinitionTest.java |    2 +-
 .../ViewInstanceResourceDefinitionTest.java     |    2 +-
 .../server/api/services/ActionServiceTest.java  |    2 +-
 .../server/api/services/AmbariMetaInfoTest.java |   31 +-
 .../server/api/services/BaseServiceTest.java    |    2 +-
 .../api/services/BlueprintServiceTest.java      |    2 +-
 .../ClusterKerberosDescriptorServiceTest.java   |    2 +-
 .../services/ClusterPrivilegeServiceTest.java   |    2 +-
 .../server/api/services/ClusterServiceTest.java |    2 +-
 .../ClusterStackVersionServiceTest.java         |    2 +-
 .../api/services/ComponentServiceTest.java      |    2 +-
 .../api/services/ConfigGroupServiceTest.java    |    2 +-
 .../api/services/ConfigurationServiceTest.java  |    2 +-
 .../api/services/CredentialServiceTest.java     |    2 +-
 .../api/services/ExtensionsServiceTest.java     |    2 +-
 .../server/api/services/FeedServiceTest.java    |    2 +-
 .../server/api/services/GroupServiceTest.java   |    2 +-
 .../api/services/HostComponentServiceTest.java  |    2 +-
 .../HostKerberosIdentityServiceTest.java        |    2 +-
 .../server/api/services/HostServiceTest.java    |    2 +-
 .../services/HostStackVersionServiceTest.java   |    2 +-
 .../api/services/InstanceServiceTest.java       |    2 +-
 .../server/api/services/JobServiceTest.java     |    2 +-
 .../api/services/LdapSyncEventServiceTest.java  |    2 +-
 .../api/services/NamedPropertySetTest.java      |    6 +-
 .../api/services/PermissionServiceTest.java     |    2 +-
 .../services/PersistenceManagerImplTest.java    |   32 +-
 .../services/PreUpgradeCheckServiceTest.java    |    2 +-
 .../api/services/PrivilegeServiceTest.java      |    2 +-
 .../api/services/RecommendationServiceTest.java |    2 +-
 .../api/services/RepositoryServiceTest.java     |    2 +-
 .../server/api/services/RequestFactoryTest.java |   18 +-
 .../services/RoleAuthorizationServiceTest.java  |    2 +-
 .../api/services/RootServiceServiceTest.java    |    2 +-
 .../server/api/services/ServiceServiceTest.java |    2 +-
 .../server/api/services/StacksServiceTest.java  |    2 +-
 .../api/services/TargetClusterServiceTest.java  |    2 +-
 .../api/services/TaskAttemptServiceTest.java    |    2 +-
 .../api/services/UpgradeItemServiceTest.java    |    2 +-
 .../api/services/ValidationServiceTest.java     |    2 +-
 .../services/ViewSubResourceServiceTest.java    |   12 +-
 .../api/services/WorkflowServiceTest.java       |    2 +-
 .../parsers/JsonRequestBodyParserTest.java      |   20 +-
 .../serializers/JsonSerializerTest.java         |   16 +-
 .../StackAdvisorBlueprintProcessorTest.java     |   30 +-
 .../ConfigurationRecommendationCommandTest.java |   12 +-
 .../audit/request/AllPostAndPutCreator.java     |    2 +-
 .../creator/RequestEventCreatorTest.java        |    2 +-
 .../ambari/server/bootstrap/BootStrapTest.java  |    6 +-
 .../checks/AbstractCheckDescriptorTest.java     |    2 +-
 .../checks/ClientRetryPropertyCheckTest.java    |    8 +-
 .../checks/ComponentsInstallationCheckTest.java |   12 +-
 .../checks/ConfigurationMergeCheckTest.java     |    2 +-
 .../HiveDynamicServiceDiscoveryCheckTest.java   |    6 +-
 .../checks/HiveMultipleMetastoreCheckTest.java  |    8 +-
 .../checks/HostsMasterMaintenanceCheckTest.java |    2 +-
 .../checks/HostsRepositoryVersionCheckTest.java |    6 +-
 .../server/checks/InstallPackagesCheckTest.java |    6 +-
 ...duce2JobHistoryStatePreservingCheckTest.java |    6 +-
 .../server/checks/RangerAuditDbCheckTest.java   |    4 +-
 .../server/checks/RangerPasswordCheckTest.java  |    2 +-
 .../server/checks/RangerSSLConfigCheckTest.java |    4 +-
 .../checks/ServiceCheckValidityCheckTest.java   |   20 +-
 .../server/checks/ServicePresenceCheckTest.java |   59 +-
 ...vicesMapReduceDistributedCacheCheckTest.java |   10 +-
 ...rvicesNamenodeHighAvailabilityCheckTest.java |    2 +-
 .../ServicesNamenodeTruncateCheckTest.java      |    2 +-
 .../ServicesTezDistributedCacheCheckTest.java   |   10 +-
 .../server/checks/ServicesUpCheckTest.java      |   10 +-
 .../ServicesYarnWorkPreservingCheckTest.java    |    2 +-
 ...nTimelineServerStatePreservingCheckTest.java |   12 +-
 .../collections/functors/AndPredicateTest.java  |    8 +-
 .../functors/ContainsPredicateTest.java         |    8 +-
 .../functors/ContextTransformerTest.java        |    8 +-
 .../functors/EqualsPredicateTest.java           |    4 +-
 .../collections/functors/NotPredicateTest.java  |    2 +-
 .../collections/functors/OrPredicateTest.java   |    8 +-
 .../AmbariCustomCommandExecutionHelperTest.java |   12 +-
 .../controller/AmbariHandlerListTest.java       |    6 +-
 .../AmbariManagementControllerImplTest.java     |   64 +-
 .../AmbariManagementControllerTest.java         |  386 ++--
 .../BackgroundCustomCommandExecutionTest.java   |    8 +-
 .../server/controller/ClusterRequestTest.java   |    2 +-
 .../server/controller/ClusterResponseTest.java  |    2 +-
 .../server/controller/KerberosHelperTest.java   |    2 +-
 .../server/controller/LdapSyncRequestTest.java  |    8 +-
 .../controller/MaintenanceStateHelperTest.java  |    4 +-
 ...hYarnCapacitySchedulerReleaseConfigTest.java |    8 +-
 .../AbstractControllerResourceProviderTest.java |    4 +-
 .../AbstractDRResourceProviderTest.java         |    4 +-
 .../AbstractJDBCResourceProviderTest.java       |    4 +-
 .../internal/AbstractResourceProviderTest.java  |   36 +-
 .../internal/ActionResourceProviderTest.java    |    8 +-
 .../AlertDefinitionResourceProviderTest.java    |   10 +-
 .../AlertGroupResourceProviderTest.java         |   38 +-
 .../internal/AlertResourceProviderTest.java     |    4 +-
 .../AlertTargetResourceProviderTest.java        |   22 +-
 .../AmbariPrivilegeResourceProviderTest.java    |   44 +-
 .../internal/ArtifactResourceProviderTest.java  |   68 +-
 .../internal/BaseBlueprintProcessorTest.java    |   12 +-
 .../controller/internal/BaseProviderTest.java   |   32 +-
 .../BlueprintConfigurationProcessorTest.java    | 1695 +++++++++---------
 .../internal/BlueprintResourceProviderTest.java |   68 +-
 .../internal/CalculatedStatusTest.java          |   12 +-
 .../ClientConfigResourceProviderTest.java       |  116 +-
 .../internal/ClusterControllerImplTest.java     |  104 +-
 ...rKerberosDescriptorResourceProviderTest.java |   52 +-
 .../ClusterPrivilegeResourceProviderTest.java   |   28 +-
 .../internal/ClusterResourceProviderTest.java   |   70 +-
 ...ClusterStackVersionResourceProviderTest.java |   60 +-
 ...leRepositoryVersionResourceProviderTest.java |    4 +-
 .../internal/ComponentResourceProviderTest.java |   32 +-
 .../ConfigGroupResourceProviderTest.java        |   76 +-
 .../ConfigurationResourceProviderTest.java      |   16 +-
 .../CredentialResourceProviderTest.java         |    8 +-
 .../internal/ExportBlueprintRequestTest.java    |    2 +-
 .../internal/ExtensionResourceProviderTest.java |    6 +-
 .../internal/FeedResourceProviderTest.java      |   24 +-
 .../GroupPrivilegeResourceProviderTest.java     |    4 +-
 .../internal/GroupResourceProviderTest.java     |   10 +-
 .../HostComponentResourceProviderTest.java      |   38 +-
 ...ostKerberosIdentityResourceProviderTest.java |   10 +-
 .../internal/HostResourceProviderTest.java      |   56 +-
 .../internal/InstanceResourceProviderTest.java  |   16 +-
 .../internal/JMXHostProviderTest.java           |   36 +-
 .../internal/JobResourceProviderTest.java       |   12 +-
 .../LdapSyncEventResourceProviderTest.java      |   18 +-
 .../internal/MemberResourceProviderTest.java    |    6 +-
 .../internal/PageResponseImplTest.java          |    8 +-
 .../PermissionResourceProviderTest.java         |    2 +-
 .../PreUpgradeCheckResourceProviderTest.java    |    8 +-
 .../internal/ProvisionClusterRequestTest.java   |   56 +-
 .../internal/QueryResponseImplTest.java         |    8 +-
 .../RemoteClusterResourceProviderTest.java      |    8 +-
 .../RepositoryResourceProviderTest.java         |    8 +-
 .../RepositoryVersionResourceProviderTest.java  |   28 +-
 .../internal/RequestOperationLevelTest.java     |    2 +-
 .../internal/RequestResourceProviderTest.java   |   82 +-
 .../RequestScheduleResourceProviderTest.java    |   45 +-
 .../internal/RequestStageContainerTest.java     |   12 +-
 .../RoleAuthorizationResourceProviderTest.java  |    6 +-
 ...ootServiceComponentPropertyProviderTest.java |    2 +-
 ...ootServiceComponentResourceProviderTest.java |    6 +-
 ...erviceHostComponentResourceProviderTest.java |    8 +-
 .../RootServiceResourceProviderTest.java        |    6 +-
 .../internal/ScaleClusterRequestTest.java       |   16 +-
 .../controller/internal/SchemaImplTest.java     |   12 +-
 .../internal/ServiceResourceProviderTest.java   |   36 +-
 .../SimplifyingPredicateVisitorTest.java        |    2 +-
 .../StackAdvisorResourceProviderTest.java       |   18 +-
 .../StackArtifactResourceProviderTest.java      |    6 +-
 ...igurationDependencyResourceProviderTest.java |    4 +-
 .../StackConfigurationResourceProviderTest.java |   12 +-
 .../StackDefinedPropertyProviderTest.java       |   20 +-
 .../StackDependencyResourceProviderTest.java    |   44 +-
 ...kLevelConfigurationResourceProviderTest.java |   12 +-
 .../internal/StackResourceProviderTest.java     |    6 +-
 .../server/controller/internal/StackTest.java   |    8 +-
 .../internal/StageResourceProviderTest.java     |    6 +-
 .../TargetClusterResourceProviderTest.java      |   22 +-
 .../TaskAttemptResourceProviderTest.java        |    6 +-
 .../internal/TaskResourceProviderTest.java      |   10 +-
 .../controller/internal/TestIvoryService.java   |   18 +-
 .../internal/URLStreamProviderTest.java         |    4 +-
 .../internal/UpgradeResourceProviderTest.java   |    4 +-
 .../UpgradeSummaryResourceProviderTest.java     |   18 +-
 .../UserPrivilegeResourceProviderTest.java      |   10 +-
 .../internal/UserResourceProviderDBTest.java    |   16 +-
 .../VersionDefinitionResourceProviderTest.java  |   12 +-
 .../ViewInstanceResourceProviderTest.java       |   20 +-
 .../ViewPermissionResourceProviderTest.java     |    4 +-
 .../ViewPrivilegeResourceProviderTest.java      |    6 +-
 .../internal/ViewURLResourceProviderTest.java   |    2 +-
 .../WidgetLayoutResourceProviderTest.java       |   14 +-
 .../internal/WorkflowResourceProviderTest.java  |    6 +-
 .../server/controller/ivory/FeedTest.java       |   30 +-
 .../controller/jmx/TestStreamProvider.java      |    2 +-
 .../LoggingRequestHelperFactoryImplTest.java    |    4 +-
 .../logging/LoggingRequestHelperImplTest.java   |   12 +-
 .../LoggingSearchPropertyProviderTest.java      |    4 +-
 .../metrics/JMXPropertyProviderTest.java        |   24 +-
 .../RestMetricsPropertyProviderTest.java        |   24 +-
 .../metrics/ganglia/GangliaMetricTest.java      |    4 +-
 .../ganglia/GangliaPropertyProviderTest.java    |   58 +-
 .../GangliaReportPropertyProviderTest.java      |    2 +-
 .../metrics/ganglia/TestStreamProvider.java     |    2 +-
 .../timeline/AMSPropertyProviderTest.java       |   28 +-
 .../timeline/AMSReportPropertyProviderTest.java |    4 +-
 .../timeline/MetricsPaddingMethodTest.java      |   14 +-
 .../timeline/MetricsRequestHelperTest.java      |    2 +-
 .../timeline/cache/TimelineMetricCacheTest.java |   16 +-
 .../controller/predicate/AndPredicateTest.java  |   12 +-
 .../predicate/CategoryIsEmptyPredicateTest.java |    2 +-
 .../predicate/EqualsPredicateTest.java          |    8 +-
 .../predicate/GreaterEqualsPredicateTest.java   |    4 +-
 .../predicate/GreaterPredicateTest.java         |    6 +-
 .../predicate/LessEqualsPredicateTest.java      |    4 +-
 .../controller/predicate/LessPredicateTest.java |    4 +-
 .../controller/predicate/NotPredicateTest.java  |    4 +-
 .../controller/predicate/OrPredicateTest.java   |   12 +-
 .../predicate/PredicateVisitorTest.java         |    2 +-
 ...ThreadPoolExecutorCompletionServiceTest.java |    6 +-
 .../utilities/PropertyHelperTest.java           |   12 +-
 .../utilities/webserver/StartServer.java        |    2 +-
 .../credentialapi/CredentialUtilTest.java       |   12 +-
 .../apache/ambari/server/events/EventsTest.java |    2 +-
 .../ambari/server/events/MockEventListener.java |    8 +-
 .../listeners/tasks/TaskStatusListenerTest.java |    4 +-
 .../AlertMaintenanceModeListenerTest.java       |    2 +-
 .../HostVersionOutOfSyncListenerTest.java       |   28 +-
 .../upgrade/StackVersionListenerTest.java       |    2 +-
 .../server/hooks/users/UserHookServiceTest.java |    2 +-
 .../metadata/AgentAlertDefinitionsTest.java     |    2 +-
 .../server/metadata/RoleCommandOrderTest.java   |    4 +-
 .../dispatchers/AlertScriptDispatcherTest.java  |    2 +-
 .../dispatchers/AmbariSNMPDispatcherTest.java   |   58 +-
 .../dispatchers/EmailDispatcherTest.java        |   12 +-
 .../dispatchers/SNMPDispatcherTest.java         |   60 +-
 .../ambari/server/orm/DBAccessorImplTest.java   |   10 +-
 .../apache/ambari/server/orm/OrmTestHelper.java |    8 +-
 .../apache/ambari/server/orm/TestOrmImpl.java   |    2 +-
 .../server/orm/dao/AlertDefinitionDAOTest.java  |    2 +-
 .../ambari/server/orm/dao/AlertsDAOTest.java    |    4 +-
 .../server/orm/dao/ConfigGroupDAOTest.java      |    8 +-
 .../server/orm/dao/HostVersionDAOTest.java      |    4 +-
 .../ambari/server/orm/dao/RequestDAOTest.java   |   23 +-
 .../ambari/server/orm/dao/StageDAOTest.java     |    4 +-
 .../ambari/server/orm/dao/UpgradeDAOTest.java   |   23 +-
 .../ambari/server/orm/dao/WidgetDAOTest.java    |    2 +-
 .../server/orm/dao/WidgetLayoutDAOTest.java     |    2 +-
 .../apache/ambari/server/orm/db/DDLTests.java   |    6 +-
 .../orm/entities/LdapSyncSpecEntityTest.java    |    4 +-
 .../orm/entities/PrincipalEntityTest.java       |    4 +-
 .../orm/entities/ViewInstanceEntityTest.java    |    2 +-
 .../ambari/server/proxy/ProxyServiceTest.java   |   28 +-
 .../scheduler/ExecutionScheduleManagerTest.java |   10 +-
 .../AmbariServerSecurityHeaderFilterTest.java   |    4 +-
 .../AmbariViewsSecurityHeaderFilterTest.java    |    4 +-
 .../server/security/CertificateManagerTest.java |    2 +-
 .../security/SecurePasswordHelperTest.java      |    2 +-
 ...ariKerberosAuthenticationPropertiesTest.java |    6 +-
 .../AmbariPamAuthenticationProviderTest.java    |    2 +-
 .../authorization/AuthorizationHelperTest.java  |    4 +-
 .../security/authorization/UsersTest.java       |    4 +-
 .../encryption/MasterKeyServiceTest.java        |    4 +-
 .../ldap/AmbariLdapDataPopulatorTest.java       |   20 +-
 .../security/ldap/LdapPerformanceTest.java      |    4 +-
 .../serveraction/ServerActionExecutorTest.java  |    2 +-
 .../ADKerberosOperationHandlerTest.java         |    4 +-
 .../FinalizeKerberosServerActionTest.java       |    4 +-
 .../kerberos/KerberosOperationHandlerTest.java  |    2 +-
 .../kerberos/KerberosServerActionTest.java      |   12 +-
 .../UpdateKerberosConfigsServerActionTest.java  |    8 +-
 .../AutoSkipFailedSummaryActionTest.java        |    8 +-
 .../ComponentVersionCheckActionTest.java        |   12 +-
 .../FixCapacitySchedulerOrderingPolicyTest.java |  127 ++
 .../upgrades/FixOozieAdminUsersTest.java        |    2 +-
 .../upgrades/FixYarnWebServiceUrlTest.java      |  305 ++++
 .../HBaseEnvMaxDirectMemorySizeActionTest.java  |    2 +-
 .../upgrades/HiveEnvClasspathActionTest.java    |    2 +-
 .../upgrades/KerberosKeytabsActionTest.java     |    6 +-
 .../upgrades/RangerConfigCalculationTest.java   |    4 +-
 .../RangerKerberosConfigCalculationTest.java    |    2 +-
 .../upgrades/RangerKmsProxyConfigTest.java      |    2 +-
 .../RangerWebAlertConfigActionTest.java         |    6 +-
 .../upgrades/UpgradeActionTest.java             |   32 +-
 .../UpgradeUserKerberosDescriptorTest.java      |    4 +-
 .../server/stack/ComponentModuleTest.java       |   22 +-
 .../ambari/server/stack/ServiceModuleTest.java  |   76 +-
 .../stack/StackManagerCommonServicesTest.java   |    2 +-
 .../server/stack/StackManagerExtensionTest.java |    2 +-
 .../ambari/server/stack/StackManagerTest.java   |   30 +-
 .../ambari/server/stack/StackModuleTest.java    |   13 +-
 .../ambari/server/state/CheckHelperTest.java    |   10 +-
 .../ambari/server/state/ConfigGroupTest.java    |   16 +-
 .../ambari/server/state/PropertyInfoTest.java   |    2 +-
 .../server/state/RequestExecutionTest.java      |    4 +-
 .../server/state/ServiceComponentTest.java      |   21 +-
 .../ambari/server/state/ServiceInfoTest.java    |   49 +-
 .../apache/ambari/server/state/ServiceTest.java |    4 +-
 .../ambari/server/state/UpgradeHelperTest.java  |  188 +-
 .../state/alerts/AlertDefinitionHashTest.java   |   16 +-
 .../alerts/AlertStateChangedEventTest.java      |   30 +-
 .../state/cluster/ClusterDeadlockTest.java      |   16 +-
 .../server/state/cluster/ClusterImplTest.java   |   14 +-
 .../state/cluster/ClustersDeadlockTest.java     |    6 +-
 .../server/state/cluster/ClustersImplTest.java  |    4 +-
 .../ConcurrentServiceConfigVersionTest.java     |    4 +-
 ...omponentHostConcurrentWriteDeadlockTest.java |    8 +-
 .../KerberosComponentDescriptorTest.java        |   14 +-
 .../KerberosConfigurationDescriptorTest.java    |   14 +-
 .../state/kerberos/KerberosDescriptorTest.java  |   45 +-
 .../KerberosIdentityDescriptorTest.java         |   18 +-
 .../kerberos/KerberosKeytabDescriptorTest.java  |    6 +-
 .../KerberosPrincipalDescriptorTest.java        |    4 +-
 .../kerberos/KerberosServiceDescriptorTest.java |   16 +-
 .../kerberos/VariableReplacementHelperTest.java |   16 +-
 .../state/scheduler/BatchRequestJobTest.java    |    4 +-
 .../AlertNoticeDispatchServiceTest.java         |   10 +-
 .../services/MetricsRetrievalServiceTest.java   |   63 +
 .../services/RetryUpgradeActionServiceTest.java |   14 +-
 .../ambari/server/state/stack/OSFamilyTest.java |   16 +-
 .../upgrade/RepositoryVersionHelperTest.java    |    2 +-
 .../svccomphost/ServiceComponentHostTest.java   |   24 +-
 .../server/testing/DeadlockWarningThread.java   |    4 +-
 .../server/testing/DeadlockedThreadsTest.java   |    2 +-
 .../server/topology/AmbariContextTest.java      |   32 +-
 .../server/topology/BlueprintFactoryTest.java   |    6 +-
 .../server/topology/BlueprintImplTest.java      |   18 +-
 .../topology/BlueprintValidatorImplTest.java    |   20 +-
 .../ClusterConfigurationRequestTest.java        |   10 +-
 .../ClusterDeployWithStartOnlyTest.java         |   12 +-
 ...InstallWithoutStartOnComponentLevelTest.java |   12 +-
 .../ClusterInstallWithoutStartTest.java         |   12 +-
 .../topology/ClusterTopologyImplTest.java       |   22 +-
 .../topology/ConfigurationFactoryTest.java      |   14 +-
 .../server/topology/ConfigurationTest.java      |  106 +-
 .../topology/RequiredPasswordValidatorTest.java |   24 +-
 .../ambari/server/topology/SettingTest.java     |    6 +-
 .../server/topology/TopologyManagerTest.java    |   12 +-
 .../ClusterConfigTypeValidatorTest.java         |   14 +-
 .../upgrade/AbstractUpgradeCatalogTest.java     |    6 +-
 .../server/upgrade/UpgradeCatalog200Test.java   |   12 +-
 .../server/upgrade/UpgradeCatalog210Test.java   |   32 +-
 .../server/upgrade/UpgradeCatalog212Test.java   |    8 +-
 .../server/upgrade/UpgradeCatalog220Test.java   |    8 +-
 .../server/upgrade/UpgradeCatalog221Test.java   |   10 +-
 .../server/upgrade/UpgradeCatalog230Test.java   |    2 +-
 .../server/upgrade/UpgradeCatalog240Test.java   |   34 +-
 .../server/upgrade/UpgradeCatalog242Test.java   |    4 +-
 .../server/upgrade/UpgradeCatalog250Test.java   |   54 +-
 .../ambari/server/upgrade/UpgradeTest.java      |    2 +-
 .../ambari/server/utils/SetUtilsTest.java       |   10 +-
 .../ambari/server/utils/StageUtilsTest.java     |   40 +-
 .../ambari/server/utils/TestParallel.java       |    8 +-
 .../ambari/server/view/ClusterImplTest.java     |    4 +-
 .../view/ViewAmbariStreamProviderTest.java      |   16 +-
 .../ambari/server/view/ViewExtractorTest.java   |    6 +-
 .../ambari/server/view/ViewRegistryTest.java    |   40 +-
 .../view/ViewSubResourceProviderTest.java       |    6 +-
 .../server/view/ViewURLStreamProviderTest.java  |   44 +-
 .../server/view/events/EventImplTest.java       |    2 +-
 .../view/persistence/DataStoreImplTest.java     |    4 +-
 .../InstanceValidationResultImplTest.java       |    2 +-
 .../stacks/2.0.6/HDFS/test_hdfs_client.py       |   11 +-
 .../stacks/2.0.6/YARN/test_nodemanager.py       |    6 +-
 .../python/stacks/2.0.6/configs/default.json    |   24 +
 .../stacks/2.2/KERBEROS/test_kerberos_client.py |    4 +-
 .../python/stacks/2.2/KERBEROS/use_cases.py     |    5 +-
 .../stacks/2.3/ATLAS/test_metadata_server.py    |    6 +-
 .../stacks/2.5/RANGER/test_ranger_admin.py      |    8 +-
 .../stacks/2.6/RANGER/test_ranger_admin.py      |    8 +-
 .../test_filtering_identity_descriptor.json     |   74 +
 .../HDP/2.0.7/services/SYSTEMML/metainfo.xml    |   39 +
 .../stacks/HDP/2.0.8/services/HIVE/metainfo.xml |  174 ++
 .../HDP/2.0.8/services/SYSTEMML/metainfo.xml    |   39 +
 .../upgrades/upgrade_multi_server_tasks.xml     |   88 +
 ambari-web/app/app.js                           |    4 +
 ambari-web/app/assets/index.html                |    4 +-
 ambari-web/app/assets/test/tests.js             |    6 +-
 ambari-web/app/config.js                        |    2 -
 ambari-web/app/controllers/application.js       |   10 +-
 ambari-web/app/controllers/experimental.js      |    2 +-
 .../controllers/global/cluster_controller.js    |   31 +-
 .../global/errors_handler_controller.js         |    2 +-
 .../global/user_settings_controller.js          |    2 +-
 .../global/wizard_watcher_controller.js         |    2 +-
 ambari-web/app/controllers/installer.js         |   23 +-
 ambari-web/app/controllers/main.js              |   28 +-
 .../main/admin/kerberos/wizard_controller.js    |   18 +-
 ambari-web/app/controllers/main/host/details.js |   14 +-
 .../controllers/main/service/add_controller.js  |   43 +-
 ambari-web/app/controllers/wizard.js            |   62 +-
 .../app/controllers/wizard/step1_controller.js  |    6 +-
 .../app/controllers/wizard/step3_controller.js  |   15 +-
 .../app/controllers/wizard/step4_controller.js  |    2 +
 .../app/controllers/wizard/step6_controller.js  |    8 +-
 .../app/controllers/wizard/step9_controller.js  |    3 +-
 .../wizards/kerberos_descriptor_properties.js   |    5 +
 ambari-web/app/mappers/stack_service_mapper.js  |    1 +
 ambari-web/app/messages.js                      |    8 +-
 ambari-web/app/mixins.js                        |    3 +-
 ambari-web/app/mixins/common/persist.js         |  166 ++
 ambari-web/app/mixins/common/persist_mixin.js   |   45 -
 ambari-web/app/mixins/common/userPref.js        |  126 --
 .../main/host/details/actions/check_host.js     |  110 +-
 .../app/mixins/wizard/addSecurityConfigs.js     |    4 +-
 .../mixins/wizard/assign_master_components.js   |    1 +
 ambari-web/app/models/cluster_states.js         |    3 +-
 ambari-web/app/models/host_component.js         |    3 +-
 ambari-web/app/models/repository.js             |   15 +-
 ambari-web/app/models/stack_service.js          |    1 +
 ambari-web/app/routes/add_kerberos_routes.js    |   22 +-
 ambari-web/app/routes/add_service_routes.js     |   16 +-
 ambari-web/app/routes/installer.js              |   25 +-
 ambari-web/app/routes/main.js                   |   34 +-
 ambari-web/app/routes/stack_upgrade_routes.js   |    2 +-
 .../app/styles/theme/bootstrap-ambari.css       |   42 +-
 ambari-web/app/styles/widgets.less              |    1 +
 ambari-web/app/templates/application.hbs        |   10 +-
 .../common/assign_master_components.hbs         |   14 +-
 .../common/configs/overriddenProperty.hbs       |    4 +-
 .../common/configs/service_config_category.hbs  |   16 +-
 .../common/configs/services_config.hbs          |    6 +-
 .../app/templates/common/form/dropdown.hbs      |    2 +-
 ambari-web/app/templates/common/modal_popup.hbs |   16 +-
 ambari-web/app/templates/common/pagination.hbs  |    2 +-
 ambari-web/app/templates/installer.hbs          |   24 +-
 ambari-web/app/templates/login.hbs              |   12 +-
 ambari-web/app/templates/main.hbs               |    2 +-
 .../stack_upgrade/stack_upgrade_wizard.hbs      |   47 +-
 .../templates/main/service/services/oozie.hbs   |   40 -
 ambari-web/app/templates/wizard/step0.hbs       |    9 +-
 ambari-web/app/templates/wizard/step1.hbs       |   72 +-
 ambari-web/app/templates/wizard/step10.hbs      |    2 +-
 ambari-web/app/templates/wizard/step2.hbs       |  246 +--
 ambari-web/app/templates/wizard/step3.hbs       |   63 +-
 .../step3/step3_host_warning_popup_footer.hbs   |    5 +-
 .../wizard/step3/step3_host_warnings_popup.hbs  |   35 +-
 .../step3/step3_registered_hosts_popup.hbs      |    2 +-
 ambari-web/app/templates/wizard/step4.hbs       |   20 +-
 .../step4/step4_ranger_requirements_popup.hbs   |    2 +-
 ambari-web/app/templates/wizard/step6.hbs       |   18 +-
 ambari-web/app/templates/wizard/step7.hbs       |    4 +-
 ambari-web/app/templates/wizard/step8.hbs       |    8 +-
 ambari-web/app/templates/wizard/step9.hbs       |   46 +-
 .../wizard/step9/step9HostTasksLogPopup.hbs     |    2 +-
 ambari-web/app/utils/ajax/ajax.js               |   24 +-
 ambari-web/app/utils/helper.js                  |   55 +-
 ambari-web/app/utils/persist.js                 |  101 --
 ambari-web/app/views.js                         |    1 -
 .../common/assign_master_components_view.js     |    4 +
 ambari-web/app/views/common/checkbox_view.js    |    3 +-
 .../configs/service_configs_by_category_view.js |    8 +-
 ambari-web/app/views/common/controls_view.js    |    5 +-
 ambari-web/app/views/common/modal_popup.js      |    1 +
 .../views/common/modal_popups/alert_popup.js    |    1 +
 .../common/modal_popups/confirmation_popup.js   |    1 +
 .../app/views/common/quick_view_link_view.js    |    8 -
 ambari-web/app/views/common/table_view.js       |    2 +-
 ambari-web/app/views/login.js                   |    6 +-
 ambari-web/app/views/main/dashboard/widgets.js  |    2 +-
 .../app/views/main/service/info/summary.js      |    9 +-
 .../main/service/manage_config_groups_view.js   |    2 +-
 ambari-web/app/views/main/service/menu.js       |   40 +-
 .../app/views/main/service/reconfigure.js       |    8 +-
 ambari-web/app/views/main/service/service.js    |   23 +-
 .../app/views/main/service/services/hbase.js    |    6 -
 .../app/views/main/service/services/hdfs.js     |    4 -
 .../app/views/main/service/services/oozie.js    |   29 -
 ambari-web/app/views/wizard/step1_view.js       |   13 +-
 ambari-web/app/views/wizard/step2_view.js       |    4 +-
 .../wizard/step3/hostWarningPopupBody_view.js   |    3 +-
 .../wizard/step3/hostWarningPopupFooter_view.js |    4 +-
 ambari-web/app/views/wizard/step6_view.js       |   12 +-
 ambari-web/app/views/wizard/step9_view.js       |    1 +
 .../global/cluster_controller_test.js           |   73 +-
 ambari-web/test/controllers/installer_test.js   |   23 +-
 .../test/controllers/main/service/item_test.js  |    2 +-
 ambari-web/test/controllers/main_test.js        |   67 -
 .../test/controllers/wizard/step3_test.js       |   34 -
 ambari-web/test/controllers/wizard_test.js      |   47 +-
 ambari-web/test/init_test.js                    |   27 +
 .../test/mappers/stack_service_mapper_test.js   |    7 +-
 ambari-web/test/mixins/common/persist_test.js   |  125 ++
 .../test/views/common/quick_link_view_test.js   |   10 -
 ambari-web/test/views/common/table_view_test.js |   14 +-
 .../test/views/main/dashboard/widgets_test.js   |    2 +-
 .../views/main/service/info/summary_test.js     |   26 -
 ambari-web/test/views/main/service/item_test.js |  166 +-
 .../service/manage_config_groups_view_test.js   |  125 ++
 ambari-web/test/views/main/service/menu_test.js |  210 ++-
 .../views/main/service/reassign_view_test.js    |  128 ++
 .../test/views/main/service/reconfigure_test.js |  126 ++
 .../test/views/main/service/service_test.js     |  264 +++
 .../views/main/service/services/hbase_test.js   |   23 -
 .../views/main/service/services/hdfs_test.js    |   20 -
 .../views/main/service/services/oozie_test.js   |   55 -
 ambari-web/test/views/wizard/step1_view_test.js |   16 +-
 .../step3/hostWarningPopupFooter_view_test.js   |   14 +-
 .../vendor/scripts/theme/bootstrap-ambari.js    |   29 +-
 ambari-web/vendor/scripts/visualsearch.js       |    2 +-
 .../stacks/ODPi/2.0/services/stack_advisor.py   |   21 +-
 .../uploads/parsers/xml/XMLParser.java          |    2 +
 .../uploads/parsers/xml/XMLParser.java          |    2 +
 .../main/resources/ui/app/routes/queries/new.js |    5 +-
 .../src/main/resources/ui/app/styles/app.scss   |   41 +-
 .../ui/app/styles/bootstrap-overrides.scss      |   25 +-
 .../resources/ui/app/templates/application.hbs  |    2 +-
 .../app/templates/components/alert-message.hbs  |    6 +-
 .../components/top-application-bar.hbs          |    2 +-
 .../ui/app/utils/hive-explainer/renderer.js     |   40 +-
 .../src/main/resources/ui/pig-web/app/app.js    |   19 +-
 .../apache/ambari/view/utils/hdfs/HdfsApi.java  |    1 +
 .../ui/app/components/bundle-config.js          |    1 +
 .../resources/ui/app/components/coord-config.js |    1 +
 .../ui/app/components/designer-workspace.js     |    1 +
 .../ui/app/components/flow-designer.js          |   17 +-
 .../ui/app/components/global-config.js          |    5 +
 .../resources/ui/app/components/job-config.js   |   32 +-
 .../ui/app/components/workflow-credentials.js   |    2 +-
 .../ui/app/domain/cytoscape-flow-renderer.js    |   20 +-
 .../resources/ui/app/domain/cytoscape-style.js  |   10 +-
 .../src/main/resources/ui/app/index.html        |   14 +
 .../src/main/resources/ui/app/routes/index.js   |    5 +-
 .../ui/app/services/workflow-manager-configs.js |   27 +
 .../src/main/resources/ui/app/styles/app.less   |    3 -
 .../app/templates/components/bundle-config.hbs  |    2 +-
 .../app/templates/components/coord-config.hbs   |    2 +-
 .../templates/components/credentials-config.hbs |    2 +-
 .../app/templates/components/flow-designer.hbs  |    2 +-
 .../app/templates/components/global-config.hbs  |    2 +-
 .../templates/components/transition-config.hbs  |   34 +-
 .../components/workflow-credentials.hbs         |   13 +-
 .../main/resources/ui/public/assets/custom.png  |  Bin 0 -> 350 bytes
 .../main/resources/ui/public/assets/distcp.png  |  Bin 0 -> 229 bytes
 .../main/resources/ui/public/assets/email.png   |  Bin 0 -> 340 bytes
 .../src/main/resources/ui/public/assets/fs.png  |  Bin 0 -> 254 bytes
 .../main/resources/ui/public/assets/hive.png    |  Bin 0 -> 270 bytes
 .../main/resources/ui/public/assets/hive2.png   |  Bin 0 -> 270 bytes
 .../main/resources/ui/public/assets/java.png    |  Bin 0 -> 385 bytes
 .../resources/ui/public/assets/map-reduce.png   |  Bin 0 -> 552 bytes
 .../src/main/resources/ui/public/assets/pig.png |  Bin 0 -> 342 bytes
 .../main/resources/ui/public/assets/shell.png   |  Bin 0 -> 222 bytes
 .../main/resources/ui/public/assets/spark.png   |  Bin 0 -> 381 bytes
 .../main/resources/ui/public/assets/sqoop.png   |  Bin 0 -> 482 bytes
 .../src/main/resources/ui/public/assets/ssh.png |  Bin 0 -> 222 bytes
 .../resources/ui/public/assets/sub-workflow.png |  Bin 0 -> 433 bytes
 .../services/workflow-manager-configs-test.js   |   28 +
 dev-support/test-patch.sh                       |   88 +-
 docs/pom.xml                                    |   15 +-
 docs/src/site/apt/index.apt                     |    2 +-
 docs/src/site/apt/whats-new.apt                 |   24 +-
 docs/src/site/site.xml                          |    2 +
 1353 files changed, 14682 insertions(+), 9155 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/3acd2e6d/ambari-server/src/main/java/org/apache/ambari/server/api/services/groups/GroupPrivilegeService.java
----------------------------------------------------------------------
diff --cc ambari-server/src/main/java/org/apache/ambari/server/api/services/groups/GroupPrivilegeService.java
index 72f4d82,0000000..6b6a674
mode 100644,000000..100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/api/services/groups/GroupPrivilegeService.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/api/services/groups/GroupPrivilegeService.java
@@@ -1,113 -1,0 +1,113 @@@
 +/*
 + * 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.api.services.groups;
 +
 +import java.util.HashMap;
 +import java.util.Map;
 +
 +import javax.ws.rs.GET;
 +import javax.ws.rs.Path;
 +import javax.ws.rs.PathParam;
 +import javax.ws.rs.Produces;
 +import javax.ws.rs.core.Context;
 +import javax.ws.rs.core.HttpHeaders;
 +import javax.ws.rs.core.Response;
 +import javax.ws.rs.core.UriInfo;
 +
 +import org.apache.ambari.server.api.resources.ResourceInstance;
 +import org.apache.ambari.server.api.services.BaseService;
 +import org.apache.ambari.server.api.services.Request;
 +import org.apache.ambari.server.controller.GroupPrivilegeResponse;
 +import org.apache.ambari.server.controller.PrivilegeResponse;
 +import org.apache.ambari.server.controller.spi.Resource;
 +
 +import io.swagger.annotations.Api;
 +import io.swagger.annotations.ApiImplicitParam;
 +import io.swagger.annotations.ApiImplicitParams;
 +import io.swagger.annotations.ApiOperation;
 +import io.swagger.annotations.ApiParam;
 +import io.swagger.annotations.ApiResponse;
 +import io.swagger.annotations.ApiResponses;
 +
 +/**
 + *  Service responsible for group privilege resource requests.
 + */
 +@Path("/groups/{groupName}/privileges")
 +@Api(value = "Groups", description = "Endpoint for group specific operations")
 +public class GroupPrivilegeService extends BaseService {
 +
 +  /**
 +   * Handles: GET  /groups/{groupName}/privileges
 +   * Get all group privileges.
 +   * @param headers
 +   * @param ui
 +   * @param groupName
 +   * @return
 +   */
 +  @GET
 +  @Produces("text/plain")
 +  @ApiOperation(value = "Get all privileges", nickname = "GroupPrivilegeService#getPrivileges", notes = "Returns all privileges for group.", response = GroupPrivilegeResponse.class, responseContainer = "List")
 +  @ApiImplicitParams({
 +    @ApiImplicitParam(name = "fields", value = "Filter user privileges", defaultValue = "PrivilegeInfo/*", dataType = "string", paramType = "query"),
 +    @ApiImplicitParam(name = "sortBy", value = "Sort user privileges (asc | desc)", defaultValue = "PrivilegeInfo/user_name.asc", dataType = "string", paramType = "query"),
 +    @ApiImplicitParam(name = "page_size", value = "The number of resources to be returned for the paged response.", defaultValue = "10", dataType = "integer", paramType = "query"),
 +    @ApiImplicitParam(name = "from", value = "The starting page resource (inclusive). Valid values are :offset | \"start\"", defaultValue = "0", dataType = "string", paramType = "query"),
 +    @ApiImplicitParam(name = "to", value = "The ending page resource (inclusive). Valid values are :offset | \"end\"", dataType = "string", paramType = "query")
 +  })
 +
 +  public Response getPrivileges(@Context HttpHeaders headers, @Context UriInfo ui,
 +                                @ApiParam(value = "group name", required = true) @PathParam("groupName") String groupName) {
 +    return handleRequest(headers, null, ui, Request.Type.GET, createPrivilegeResource(groupName, null));
 +  }
 +
 +
 +  /**
 +   * Handles: GET /groups/{groupName}/privileges{privilegeID}
 +   * Get a specific privilege for a group.
 +   *
 +   * @param headers       http headers
 +   * @param ui            uri info
 +   * @param groupName     group name
 +   * @param privilegeId   privilege id
 +   * @return privilege instance representation
 +   */
 +  @GET
 +  @Path("{privilegeId}")
 +  @Produces("text/plain")
 +  @ApiOperation(value = "Get group privilege", nickname = "GroupPrivilegeService#getPrivilege", notes = "Returns group privilege details.", response = GroupPrivilegeResponse.class)
 +  @ApiImplicitParams({
 +    @ApiImplicitParam(name = "fields", value = "Filter group privilege details", defaultValue = "PrivilegeInfo/*", dataType = "string", paramType = "query")
 +  })
 +  @ApiResponses(value = {
 +    @ApiResponse(code = 200, message = "Successful operation", response = PrivilegeResponse.class)}
 +  )
 +  public Response getPrivilege(@Context HttpHeaders headers, @Context UriInfo ui, @ApiParam(value = "group name", required = true) @PathParam ("groupName") String groupName,
 +                               @ApiParam(value = "privilege id", required = true) @PathParam("privilegeId") String privilegeId) {
 +    return handleRequest(headers, null, ui, Request.Type.GET, createPrivilegeResource(groupName, privilegeId));
 +  }
 +
 +
 +
 +  protected ResourceInstance createPrivilegeResource(String groupName, String privilegeId) {
-     final Map<Resource.Type, String> mapIds = new HashMap<Resource.Type, String>();
++    final Map<Resource.Type, String> mapIds = new HashMap<>();
 +    mapIds.put(Resource.Type.Group, groupName);
 +    mapIds.put(Resource.Type.GroupPrivilege, privilegeId);
 +    return createResource(Resource.Type.GroupPrivilege, mapIds);
 +  }
 +}


[43/50] [abbrv] ambari git commit: AMBARI-20725. Use Infra-Solr user to create Solr user-roles (oleewere)

Posted by ja...@apache.org.
AMBARI-20725. Use Infra-Solr user to create Solr user-roles (oleewere)


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

Branch: refs/heads/ambari-rest-api-explorer
Commit: a214d800f6c75c34c22b7685c93c19be1c06d5c2
Parents: c0cef76
Author: oleewere <ol...@gmail.com>
Authored: Tue Apr 11 13:13:09 2017 +0200
Committer: oleewere <ol...@gmail.com>
Committed: Tue Apr 11 13:18:03 2017 +0200

----------------------------------------------------------------------
 .../libraries/functions/solr_cloud_util.py                   | 7 ++++---
 .../src/test/python/stacks/2.3/ATLAS/test_metadata_server.py | 6 +++---
 .../src/test/python/stacks/2.5/RANGER/test_ranger_admin.py   | 8 ++++----
 .../src/test/python/stacks/2.6/RANGER/test_ranger_admin.py   | 8 ++++----
 4 files changed, 15 insertions(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/a214d800/ambari-common/src/main/python/resource_management/libraries/functions/solr_cloud_util.py
----------------------------------------------------------------------
diff --git a/ambari-common/src/main/python/resource_management/libraries/functions/solr_cloud_util.py b/ambari-common/src/main/python/resource_management/libraries/functions/solr_cloud_util.py
index 1eeb86b..1c5432b 100644
--- a/ambari-common/src/main/python/resource_management/libraries/functions/solr_cloud_util.py
+++ b/ambari-common/src/main/python/resource_management/libraries/functions/solr_cloud_util.py
@@ -294,7 +294,6 @@ def add_solr_roles(config, roles = [], new_service_principals = [], tries = 30,
   if it is then update the user-roles mapping for Solr (this will upgrade the solr_znode/security.json file).
   In case of custom security.json is used for infra-solr, this step will be skipped.
   """
-  sudo = AMBARI_SUDO_BINARY
   solr_hosts = default_config(config, "/clusterHostInfo/infra_solr_hosts", [])
   security_enabled = config['configurations']['cluster-env']['security_enabled']
   solr_ssl_enabled = default_config(config, 'configurations/infra-solr-env/infra_solr_ssl_enabled', False)
@@ -316,10 +315,11 @@ def add_solr_roles(config, roles = [], new_service_principals = [], tries = 30,
     hostname = config['hostname'].lower()
     solr_host = __get_random_solr_host(hostname, solr_hosts)
     solr_url = format("{solr_protocol}://{solr_host}:{solr_port}/solr/admin/authorization")
+    solr_user = config['configurations']['infra-solr-env']['infra_solr_user']
     solr_user_keytab = config['configurations']['infra-solr-env']['infra_solr_kerberos_keytab']
     solr_user_principal = config['configurations']['infra-solr-env']['infra_solr_kerberos_principal'].replace('_HOST', hostname)
     solr_user_kinit_cmd = format("{kinit_path_local} -kt {solr_user_keytab} {solr_user_principal};")
-    solr_authorization_enabled_cmd=format("{sudo} {solr_user_kinit_cmd} {sudo} curl -k -s --negotiate -u : {solr_protocol}://{solr_host}:{solr_port}/solr/admin/authorization | grep authorization.enabled")
+    solr_authorization_enabled_cmd=format("{solr_user_kinit_cmd} curl -k -s --negotiate -u : {solr_protocol}://{solr_host}:{solr_port}/solr/admin/authorization | grep authorization.enabled")
 
     if len(new_service_principals) > 0:
       new_service_users = []
@@ -338,10 +338,11 @@ def add_solr_roles(config, roles = [], new_service_principals = [], tries = 30,
       set_user_role_map['set-user-role'] = user_role_map
       set_user_role_json = json.dumps(set_user_role_map)
 
-      add_solr_role_cmd = format("{sudo} {solr_user_kinit_cmd} {sudo} curl -H 'Content-type:application/json' -d '{set_user_role_json}' -s -o /dev/null -w'%{{http_code}}' --negotiate -u: -k {solr_url} | grep 200")
+      add_solr_role_cmd = format("{solr_user_kinit_cmd} curl -H 'Content-type:application/json' -d '{set_user_role_json}' -s -o /dev/null -w'%{{http_code}}' --negotiate -u: -k {solr_url} | grep 200")
 
       Logger.info(format("Check authorization enabled command: {solr_authorization_enabled_cmd} \nSet user-role settings command: {add_solr_role_cmd}"))
       Execute(solr_authorization_enabled_cmd + " && "+ add_solr_role_cmd,
               tries=tries,
               try_sleep=try_sleep,
+              user=solr_user,
               logoutput=True)

http://git-wip-us.apache.org/repos/asf/ambari/blob/a214d800/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 388aa57..d1d8b7f 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
@@ -304,9 +304,9 @@ class TestMetadataServer(RMFTestCase):
                                     action=['delete'],
                                     create_parents=True)
     kinit_path_local = get_kinit_path()
-    self.assertResourceCalled('Execute', "ambari-sudo.sh " + kinit_path_local + " -kt /etc/security/keytabs/ambari-infra-solr.keytab infra-solr/c6401.ambari.apache.org@EXAMPLE.COM; ambari-sudo.sh curl -k -s --negotiate -u : http://c6401.ambari.apache.org:8886/solr/admin/authorization | grep authorization.enabled && ambari-sudo.sh "
-                              + kinit_path_local +" -kt /etc/security/keytabs/ambari-infra-solr.keytab infra-solr/c6401.ambari.apache.org@EXAMPLE.COM; ambari-sudo.sh curl -H 'Content-type:application/json' -d '{\"set-user-role\": {\"atlas@EXAMPLE.COM\": [\"atlas_user\", \"ranger_audit_user\", \"dev\"]}}' -s -o /dev/null -w'%{http_code}' --negotiate -u: -k http://c6401.ambari.apache.org:8886/solr/admin/authorization | grep 200",
-                              logoutput = True, tries = 30, try_sleep = 10)
+    self.assertResourceCalled('Execute', kinit_path_local + " -kt /etc/security/keytabs/ambari-infra-solr.keytab infra-solr/c6401.ambari.apache.org@EXAMPLE.COM; curl -k -s --negotiate -u : http://c6401.ambari.apache.org:8886/solr/admin/authorization | grep authorization.enabled && "
+                              + kinit_path_local +" -kt /etc/security/keytabs/ambari-infra-solr.keytab infra-solr/c6401.ambari.apache.org@EXAMPLE.COM; curl -H 'Content-type:application/json' -d '{\"set-user-role\": {\"atlas@EXAMPLE.COM\": [\"atlas_user\", \"ranger_audit_user\", \"dev\"]}}' -s -o /dev/null -w'%{http_code}' --negotiate -u: -k http://c6401.ambari.apache.org:8886/solr/admin/authorization | grep 200",
+                              logoutput = True, tries = 30, try_sleep = 10, user='solr')
 
     self.assertResourceCalledRegexp('^Execute$', '^ambari-sudo.sh JAVA_HOME=/usr/jdk64/jdk1.7.0_45 /usr/lib/ambari-infra-solr-client/solrCloudCli.sh --zookeeper-connect-string c6401.ambari.apache.org:2181/infra-solr --create-collection --collection vertex_index --config-set atlas_configs --shards 1 --replication 1 --max-shards 1 --retry 5 --interval 10')
     self.assertResourceCalledRegexp('^Execute$', '^ambari-sudo.sh JAVA_HOME=/usr/jdk64/jdk1.7.0_45 /usr/lib/ambari-infra-solr-client/solrCloudCli.sh --zookeeper-connect-string c6401.ambari.apache.org:2181/infra-solr --create-collection --collection edge_index --config-set atlas_configs --shards 1 --replication 1 --max-shards 1 --retry 5 --interval 10')

http://git-wip-us.apache.org/repos/asf/ambari/blob/a214d800/ambari-server/src/test/python/stacks/2.5/RANGER/test_ranger_admin.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/stacks/2.5/RANGER/test_ranger_admin.py b/ambari-server/src/test/python/stacks/2.5/RANGER/test_ranger_admin.py
index 0d38876..8f2bd2e 100644
--- a/ambari-server/src/test/python/stacks/2.5/RANGER/test_ranger_admin.py
+++ b/ambari-server/src/test/python/stacks/2.5/RANGER/test_ranger_admin.py
@@ -167,11 +167,11 @@ class TestRangerAdmin(RMFTestCase):
                                     action=['delete'],
                                     create_parents=True)
 
-    self.assertResourceCalled('Execute', "ambari-sudo.sh /usr/bin/kinit -kt /etc/security/keytabs/infra-solr.service.keytab infra-solr/c6401.ambari.apache.org@EXAMPLE.COM; ambari-sudo.sh curl -k -s --negotiate -u : http://c6401.ambari.apache.org:8886/solr/admin/authorization | grep authorization.enabled && ambari-sudo.sh /usr/bin/kinit -kt /etc/security/keytabs/infra-solr.service.keytab infra-solr/c6401.ambari.apache.org@EXAMPLE.COM; ambari-sudo.sh curl -H 'Content-type:application/json' -d '{\"set-user-role\": {\"rangeradmin@EXAMPLE.COM\": [\"ranger_user\", \"ranger_audit_user\", \"dev\"]}}' -s -o /dev/null -w'%{http_code}' --negotiate -u: -k http://c6401.ambari.apache.org:8886/solr/admin/authorization | grep 200",
-                              logoutput = True, tries = 30, try_sleep = 10)
-    self.assertResourceCalled('Execute', "ambari-sudo.sh /usr/bin/kinit -kt /etc/security/keytabs/infra-solr.service.keytab infra-solr/c6401.ambari.apache.org@EXAMPLE.COM; ambari-sudo.sh curl -k -s --negotiate -u : http://c6401.ambari.apache.org:8886/solr/admin/authorization | grep authorization.enabled && ambari-sudo.sh /usr/bin/kinit -kt /etc/security/keytabs/infra-solr.service.keytab infra-solr/c6401.ambari.apache.org@EXAMPLE.COM; ambari-sudo.sh curl -H \'Content-type:application/json\' -d "
+    self.assertResourceCalled('Execute', "/usr/bin/kinit -kt /etc/security/keytabs/infra-solr.service.keytab infra-solr/c6401.ambari.apache.org@EXAMPLE.COM; curl -k -s --negotiate -u : http://c6401.ambari.apache.org:8886/solr/admin/authorization | grep authorization.enabled && /usr/bin/kinit -kt /etc/security/keytabs/infra-solr.service.keytab infra-solr/c6401.ambari.apache.org@EXAMPLE.COM; curl -H 'Content-type:application/json' -d '{\"set-user-role\": {\"rangeradmin@EXAMPLE.COM\": [\"ranger_user\", \"ranger_audit_user\", \"dev\"]}}' -s -o /dev/null -w'%{http_code}' --negotiate -u: -k http://c6401.ambari.apache.org:8886/solr/admin/authorization | grep 200",
+                              logoutput = True, tries = 30, try_sleep = 10, user='infra-solr')
+    self.assertResourceCalled('Execute', "/usr/bin/kinit -kt /etc/security/keytabs/infra-solr.service.keytab infra-solr/c6401.ambari.apache.org@EXAMPLE.COM; curl -k -s --negotiate -u : http://c6401.ambari.apache.org:8886/solr/admin/authorization | grep authorization.enabled && /usr/bin/kinit -kt /etc/security/keytabs/infra-solr.service.keytab infra-solr/c6401.ambari.apache.org@EXAMPLE.COM; curl -H \'Content-type:application/json\' -d "
                                          "\'{\"set-user-role\": {\"hbase@EXAMPLE.COM\": [\"ranger_audit_user\", \"dev\"], \"nn@EXAMPLE.COM\": [\"ranger_audit_user\", \"dev\"], \"knox@EXAMPLE.COM\": [\"ranger_audit_user\", \"dev\"], \"rangerkms@EXAMPLE.COM\": [\"ranger_audit_user\", \"dev\"], \"kafka@EXAMPLE.COM\": [\"ranger_audit_user\", \"dev\"], \"hive@EXAMPLE.COM\": [\"ranger_audit_user\", \"dev\"], \"nifi@EXAMPLE.COM\": [\"ranger_audit_user\", \"dev\"], \"storm@EXAMPLE.COM\": [\"ranger_audit_user\", \"dev\"], \"yarn@EXAMPLE.COM\": [\"ranger_audit_user\", \"dev\"]}}\' -s -o /dev/null -w\'%{http_code}\' --negotiate -u: -k http://c6401.ambari.apache.org:8886/solr/admin/authorization | grep 200",
-                              logoutput = True, tries = 30, try_sleep = 10)
+                              logoutput = True, tries = 30, try_sleep = 10, user='infra-solr')
 
     self.assertResourceCalledRegexp('^Execute$', '^ambari-sudo.sh JAVA_HOME=/usr/jdk64/jdk1.7.0_45 /usr/lib/ambari-infra-solr-client/solrCloudCli.sh --zookeeper-connect-string c6401.ambari.apache.org:2181/ambari-solr --create-collection --collection ranger_audits --config-set ranger_audits --shards 1 --replication 1 --max-shards 1 --retry 5 --interval 10')
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/a214d800/ambari-server/src/test/python/stacks/2.6/RANGER/test_ranger_admin.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/stacks/2.6/RANGER/test_ranger_admin.py b/ambari-server/src/test/python/stacks/2.6/RANGER/test_ranger_admin.py
index ea3829e..9167017 100644
--- a/ambari-server/src/test/python/stacks/2.6/RANGER/test_ranger_admin.py
+++ b/ambari-server/src/test/python/stacks/2.6/RANGER/test_ranger_admin.py
@@ -156,11 +156,11 @@ class TestRangerAdmin(RMFTestCase):
     self.assertResourceCalledRegexp('^Directory$', '^/tmp/solr_config_ranger_audits_0.[0-9]*',
                                     action=['delete'],
                                     create_parents=True)
-    self.assertResourceCalled('Execute', "ambari-sudo.sh /usr/bin/kinit -kt /etc/security/keytabs/infra-solr.service.keytab infra-solr/c6401.ambari.apache.org@EXAMPLE.COM; ambari-sudo.sh curl -k -s --negotiate -u : http://c6401.ambari.apache.org:8886/solr/admin/authorization | grep authorization.enabled && ambari-sudo.sh /usr/bin/kinit -kt /etc/security/keytabs/infra-solr.service.keytab infra-solr/c6401.ambari.apache.org@EXAMPLE.COM; ambari-sudo.sh curl -H 'Content-type:application/json' -d '{\"set-user-role\": {\"rangeradmin@EXAMPLE.COM\": [\"ranger_user\", \"ranger_audit_user\", \"dev\"]}}' -s -o /dev/null -w'%{http_code}' --negotiate -u: -k http://c6401.ambari.apache.org:8886/solr/admin/authorization | grep 200",
-                              logoutput = True, tries = 30, try_sleep = 10)
-    self.assertResourceCalled('Execute', "ambari-sudo.sh /usr/bin/kinit -kt /etc/security/keytabs/infra-solr.service.keytab infra-solr/c6401.ambari.apache.org@EXAMPLE.COM; ambari-sudo.sh curl -k -s --negotiate -u : http://c6401.ambari.apache.org:8886/solr/admin/authorization | grep authorization.enabled && ambari-sudo.sh /usr/bin/kinit -kt /etc/security/keytabs/infra-solr.service.keytab infra-solr/c6401.ambari.apache.org@EXAMPLE.COM; ambari-sudo.sh curl -H \'Content-type:application/json\' -d "
+    self.assertResourceCalled('Execute', "/usr/bin/kinit -kt /etc/security/keytabs/infra-solr.service.keytab infra-solr/c6401.ambari.apache.org@EXAMPLE.COM; curl -k -s --negotiate -u : http://c6401.ambari.apache.org:8886/solr/admin/authorization | grep authorization.enabled && /usr/bin/kinit -kt /etc/security/keytabs/infra-solr.service.keytab infra-solr/c6401.ambari.apache.org@EXAMPLE.COM; curl -H 'Content-type:application/json' -d '{\"set-user-role\": {\"rangeradmin@EXAMPLE.COM\": [\"ranger_user\", \"ranger_audit_user\", \"dev\"]}}' -s -o /dev/null -w'%{http_code}' --negotiate -u: -k http://c6401.ambari.apache.org:8886/solr/admin/authorization | grep 200",
+                              logoutput = True, tries = 30, try_sleep = 10, user='infra-solr')
+    self.assertResourceCalled('Execute', "/usr/bin/kinit -kt /etc/security/keytabs/infra-solr.service.keytab infra-solr/c6401.ambari.apache.org@EXAMPLE.COM; curl -k -s --negotiate -u : http://c6401.ambari.apache.org:8886/solr/admin/authorization | grep authorization.enabled && /usr/bin/kinit -kt /etc/security/keytabs/infra-solr.service.keytab infra-solr/c6401.ambari.apache.org@EXAMPLE.COM; curl -H \'Content-type:application/json\' -d "
                                          "\'{\"set-user-role\": {\"hbase@EXAMPLE.COM\": [\"ranger_audit_user\", \"dev\"], \"nn@EXAMPLE.COM\": [\"ranger_audit_user\", \"dev\"], \"knox@EXAMPLE.COM\": [\"ranger_audit_user\", \"dev\"], \"rangerkms@EXAMPLE.COM\": [\"ranger_audit_user\", \"dev\"], \"kafka@EXAMPLE.COM\": [\"ranger_audit_user\", \"dev\"], \"hive@EXAMPLE.COM\": [\"ranger_audit_user\", \"dev\"], \"nifi@EXAMPLE.COM\": [\"ranger_audit_user\", \"dev\"], \"storm@EXAMPLE.COM\": [\"ranger_audit_user\", \"dev\"], \"yarn@EXAMPLE.COM\": [\"ranger_audit_user\", \"dev\"]}}\' -s -o /dev/null -w\'%{http_code}\' --negotiate -u: -k http://c6401.ambari.apache.org:8886/solr/admin/authorization | grep 200",
-                              logoutput = True, tries = 30, try_sleep = 10)
+                              logoutput = True, tries = 30, try_sleep = 10, user='infra-solr')
 
     self.assertResourceCalledRegexp('^Execute$', '^ambari-sudo.sh JAVA_HOME=/usr/jdk64/jdk1.7.0_45 /usr/lib/ambari-infra-solr-client/solrCloudCli.sh --zookeeper-connect-string c6401.ambari.apache.org:2181/infra-solr --create-collection --collection ranger_audits --config-set ranger_audits --shards 1 --replication 1 --max-shards 1 --retry 5 --interval 10')
 


[48/50] [abbrv] ambari git commit: Merge trunk to ambari-rest-api-explorer branch. (jaimin)

Posted by ja...@apache.org.
http://git-wip-us.apache.org/repos/asf/ambari/blob/3acd2e6d/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ActiveWidgetLayoutResourceProvider.java
----------------------------------------------------------------------
diff --cc ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ActiveWidgetLayoutResourceProvider.java
index 0d026b6,70a5723..b231ff8
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ActiveWidgetLayoutResourceProvider.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ActiveWidgetLayoutResourceProvider.java
@@@ -184,31 -198,6 +184,31 @@@ public class ActiveWidgetLayoutResource
      return resources;
    }
  
 +  /**
 +   * Returns the response for the active widget layout that should be returned for the active widget layout REST endpoint
 +   * @param layoutEntity {@link WidgetLayoutEntity}
 +   * @return  {@link ActiveWidgetLayoutResponse}
 +   * @throws SystemException
 +   */
 +  private ActiveWidgetLayoutResponse getResponse(WidgetLayoutEntity layoutEntity) throws SystemException {
 +    String clusterName = null;
 +    try {
 +      clusterName = getManagementController().getClusters().getClusterById(layoutEntity.getClusterId()).getClusterName();
 +    } catch (AmbariException e) {
 +      throw new SystemException(e.getMessage());
 +    }
-     List<HashMap<String,WidgetResponse>> widgets = new ArrayList<HashMap<String,WidgetResponse>>();
++    List<HashMap<String,WidgetResponse>> widgets = new ArrayList<>();
 +    List<WidgetLayoutUserWidgetEntity> widgetLayoutUserWidgetEntityList = layoutEntity.getListWidgetLayoutUserWidgetEntity();
 +    for (WidgetLayoutUserWidgetEntity widgetLayoutUserWidgetEntity : widgetLayoutUserWidgetEntityList) {
 +      WidgetEntity widgetEntity = widgetLayoutUserWidgetEntity.getWidget();
-       HashMap<String, WidgetResponse> widgetInfoMap = new HashMap<String, WidgetResponse>();
++      HashMap<String, WidgetResponse> widgetInfoMap = new HashMap<>();
 +      widgetInfoMap.put("WidgetInfo",WidgetResponse.coerce(widgetEntity));
 +      widgets.add(widgetInfoMap);
 +    }
 +   return  new ActiveWidgetLayoutResponse(layoutEntity.getId(), clusterName, layoutEntity.getDisplayName(), layoutEntity.getLayoutName(),
 +      layoutEntity.getSectionName(), layoutEntity.getScope(), layoutEntity.getUserName(),  widgets);
 +  }
 +
    @Override
    public RequestStatus updateResources(Request request, Predicate predicate)
      throws SystemException, UnsupportedPropertyException, NoSuchResourceException, NoSuchParentResourceException {

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

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

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

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

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

http://git-wip-us.apache.org/repos/asf/ambari/blob/3acd2e6d/ambari-server/src/main/java/org/apache/ambari/server/security/authorization/User.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/ambari/blob/3acd2e6d/ambari-server/src/main/java/org/apache/ambari/server/view/ViewRegistry.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/ambari/blob/3acd2e6d/ambari-server/src/test/java/org/apache/ambari/server/api/services/GroupServiceTest.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/ambari/blob/3acd2e6d/ambari-server/src/test/java/org/apache/ambari/server/api/services/ViewSubResourceServiceTest.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/ambari/blob/3acd2e6d/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/GroupPrivilegeResourceProviderTest.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/ambari/blob/3acd2e6d/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/UserPrivilegeResourceProviderTest.java
----------------------------------------------------------------------


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

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


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

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

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


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

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

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

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


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

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


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

Branch: refs/heads/ambari-rest-api-explorer
Commit: 2ee12f4c4af62d5ce004e869f5a248e982a4245f
Parents: e61d111
Author: padmapriyanitt <pa...@gmail.com>
Authored: Thu Apr 6 12:12:24 2017 +0530
Committer: padmapriyanitt <pa...@gmail.com>
Committed: Thu Apr 6 12:12:24 2017 +0530

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


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

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

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

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


[33/50] [abbrv] ambari git commit: AMBARI-20712 - Parallel Requests With Intersecting Hosts Don't Block Correctly (jonathanhurley)

Posted by ja...@apache.org.
AMBARI-20712 - Parallel Requests With Intersecting Hosts Don't Block Correctly (jonathanhurley)


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

Branch: refs/heads/ambari-rest-api-explorer
Commit: 28eff65eea321cc8f7fe6c783460f0d710708bf8
Parents: 91028d1
Author: Jonathan Hurley <jh...@hortonworks.com>
Authored: Sat Apr 8 15:17:14 2017 -0400
Committer: Jonathan Hurley <jh...@hortonworks.com>
Committed: Sat Apr 8 21:32:08 2017 -0400

----------------------------------------------------------------------
 .../server/actionmanager/ActionScheduler.java   | 154 ++++++++-----------
 .../server/actionmanager/HostRoleCommand.java   |  26 ++++
 .../AmbariCustomCommandExecutionHelper.java     |   3 +-
 .../server/orm/dao/HostRoleCommandDAO.java      |  49 ++++++
 .../orm/entities/HostRoleCommandEntity.java     |  33 +++-
 .../main/resources/Ambari-DDL-Derby-CREATE.sql  |   1 +
 .../main/resources/Ambari-DDL-MySQL-CREATE.sql  |   1 +
 .../main/resources/Ambari-DDL-Oracle-CREATE.sql |   1 +
 .../resources/Ambari-DDL-Postgres-CREATE.sql    |   1 +
 .../resources/Ambari-DDL-SQLAnywhere-CREATE.sql |   3 +-
 .../resources/Ambari-DDL-SQLServer-CREATE.sql   |   1 +
 .../actionmanager/TestActionScheduler.java      |  41 ++---
 12 files changed, 204 insertions(+), 110 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/28eff65e/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/ActionScheduler.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/ActionScheduler.java b/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/ActionScheduler.java
index 758db35..316f2bd 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/ActionScheduler.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/ActionScheduler.java
@@ -42,7 +42,6 @@ import org.apache.ambari.server.ServiceComponentHostNotFoundException;
 import org.apache.ambari.server.ServiceComponentNotFoundException;
 import org.apache.ambari.server.agent.ActionQueue;
 import org.apache.ambari.server.agent.AgentCommand;
-import org.apache.ambari.server.agent.AgentCommand.AgentCommandType;
 import org.apache.ambari.server.agent.CancelCommand;
 import org.apache.ambari.server.agent.CommandReport;
 import org.apache.ambari.server.agent.ExecutionCommand;
@@ -355,15 +354,15 @@ class ActionScheduler implements Runnable {
       }
 
       Set<Long> runningRequestIds = new HashSet<>();
-      List<Stage> stages = db.getFirstStageInProgressPerRequest();
+      List<Stage> firstStageInProgressPerRequest = db.getFirstStageInProgressPerRequest();
       if (LOG.isDebugEnabled()) {
         LOG.debug("Scheduler wakes up");
-        LOG.debug("Processing {} in progress stages ", stages.size());
+        LOG.debug("Processing {} in progress stages", firstStageInProgressPerRequest.size());
       }
 
-      publishInProgressTasks(stages);
+      publishInProgressTasks(firstStageInProgressPerRequest);
 
-      if (stages.isEmpty()) {
+      if (firstStageInProgressPerRequest.isEmpty()) {
         // Nothing to do
         if (LOG.isDebugEnabled()) {
           LOG.debug("There are no stages currently in progress.");
@@ -375,11 +374,19 @@ class ActionScheduler implements Runnable {
 
       int i_stage = 0;
 
-      HashSet<String> hostsWithTasks = getListOfHostsWithPendingTask(stages);
-      actionQueue.updateListOfHostsWithPendingTask(hostsWithTasks);
+      // get the range of requests in progress
+      long iLowestRequestIdInProgress = firstStageInProgressPerRequest.get(0).getRequestId();
+      long iHighestRequestIdInProgress = firstStageInProgressPerRequest.get(
+          firstStageInProgressPerRequest.size() - 1).getRequestId();
 
-      stages = filterParallelPerHostStages(stages);
-      // At this point the stages is a filtered list
+      List<String> hostsWithPendingTasks = hostRoleCommandDAO.getHostsWithPendingTasks(
+          iLowestRequestIdInProgress, iHighestRequestIdInProgress);
+
+      actionQueue.updateListOfHostsWithPendingTask(new HashSet<>(hostsWithPendingTasks));
+
+      // filter the stages in progress down to those which can be scheduled in
+      // parallel
+      List<Stage> stages = filterParallelPerHostStages(firstStageInProgressPerRequest);
 
       boolean exclusiveRequestIsGoing = false;
       // This loop greatly depends on the fact that order of stages in
@@ -565,123 +572,92 @@ class ActionScheduler implements Runnable {
   }
 
   /**
-   * Returns the list of hosts that have a task assigned
-   *
-   * @param stages
-   * @return
-   */
-  private HashSet<String> getListOfHostsWithPendingTask(List<Stage> stages) {
-    HashSet<String> hostsWithTasks = new HashSet<>();
-    for (Stage s : stages) {
-      hostsWithTasks.addAll(s.getHosts());
-    }
-    return hostsWithTasks;
-  }
-
-  /**
-   * Returns filtered list of stages such that the returned list is an ordered list of stages that may
-   * be executed in parallel or in the order in which they are presented
+   * Returns filtered list of stages such that the returned list is an ordered
+   * list of stages that may be executed in parallel or in the order in which
+   * they are presented.
    * <p/>
-   * Assumption: the list of stages supplied as input are ordered by request id and then stage id.
+   * The specified stages must be ordered by request ID and may only contain the
+   * next stage in progress per request (as returned by
+   * {@link ActionDBAccessor#getFirstStageInProgressPerRequest()}. This is
+   * because there is a requirement that within a request, no two stages may
+   * ever run in parallel.
    * <p/>
-   * Rules:
+   * The following rules will be applied to the list:
    * <ul>
-   * <li>
-   * Stages are filtered such that the first stage in the list (assumed to be the first pending
-   * stage from the earliest active request) has priority
-   * </li>
-   * <li>
-   * No stage in any request may be executed before an earlier stage in the same request
-   * </li>
-   * <li>
-   * A stages in different requests may be performed in parallel if the relevant hosts for the
-   * stage in the later requests do not intersect with the union of hosts from (pending) stages
-   * in earlier requests
+   * <li>Stages are filtered such that the first stage in the list (assumed to
+   * be the first pending stage from the earliest active request) has priority.
    * </li>
+   * <li>No stage in any request may be executed before an earlier stage in the
+   * same request. This requirement is automatically covered by virtue of the
+   * supplied stages only being for the next stage in progress per request.</li>
+   * <li>A stage in different request may be performed in parallel
+   * if-and-only-if the relevant hosts for the stage in the later requests do
+   * not intersect with the union of hosts from (pending) stages in earlier
+   * requests. In order to accomplish this</li>
    * </ul>
    *
-   * @param stages the stages to process
+   * @param firstStageInProgressPerRequest
+   *          the stages to process, one stage per request
    * @return a list of stages that may be executed in parallel
    */
-  private List<Stage> filterParallelPerHostStages(List<Stage> stages) {
+  private List<Stage> filterParallelPerHostStages(List<Stage> firstStageInProgressPerRequest) {
+    // if there's only 1 stage in progress in 1 request, simply return that stage
+    if (firstStageInProgressPerRequest.size() == 1) {
+      return firstStageInProgressPerRequest;
+    }
+
     List<Stage> retVal = new ArrayList<>();
-    Set<String> affectedHosts = new HashSet<>();
-    Set<Long> affectedRequests = new HashSet<>();
 
-    for (Stage s : stages) {
-      long requestId = s.getRequestId();
+    // set the lower range (inclusive) of requests to limit the query a bit
+    // since there can be a LOT of commands
+    long lowerRequestIdInclusive = firstStageInProgressPerRequest.get(0).getRequestId();
+
+    // determine if this stage can be scheduled in parallel with the other
+    // stages from other requests
+    for (Stage stage : firstStageInProgressPerRequest) {
+      long requestId = stage.getRequestId();
 
       if (LOG.isTraceEnabled()) {
-        LOG.trace("==> Processing stage: {}/{} ({}) for {}", requestId, s.getStageId(), s.getRequestContext());
+        LOG.trace("==> Processing stage: {}/{} ({}) for {}", requestId, stage.getStageId(), stage.getRequestContext());
       }
 
       boolean addStage = true;
 
+      // there are at least 2 request in progress concurrently; determine which
+      // hosts are affected
+      HashSet<String> hostsInProgressForEarlierRequests = new HashSet<>(
+          hostRoleCommandDAO.getBlockingHostsForRequest(lowerRequestIdInclusive, requestId));
+
       // Iterate over the relevant hosts for this stage to see if any intersect with the set of
       // hosts needed for previous stages.  If any intersection occurs, this stage may not be
       // executed in parallel.
-      for (String host : s.getHosts()) {
+      for (String host : stage.getHosts()) {
         LOG.trace("===> Processing Host {}", host);
 
-        if (affectedHosts.contains(host)) {
+        if (hostsInProgressForEarlierRequests.contains(host)) {
           if (LOG.isTraceEnabled()) {
-            LOG.trace("===>  Skipping stage since it utilizes at least one host that a previous stage requires: {}/{} ({})", s.getRequestId(), s.getStageId(), s.getRequestContext());
+            LOG.trace("===>  Skipping stage since it utilizes at least one host that a previous stage requires: {}/{} ({})", stage.getRequestId(), stage.getStageId(), stage.getRequestContext());
           }
 
-          addStage &= false;
-        } else {
-          if (!Stage.INTERNAL_HOSTNAME.equalsIgnoreCase(host) && !isStageHasBackgroundCommandsOnly(s, host)) {
-            LOG.trace("====>  Adding host to affected hosts: {}", host);
-            affectedHosts.add(host);
-          }
-
-          addStage &= true;
-        }
-      }
-
-      // If this stage is for a request that we have already processed, the it cannot execute in
-      // parallel since only one stage per request my execute at a time. The first time we encounter
-      // a request id, will be for the first pending stage for that request, so it is a candidate
-      // for execution at this time - if the previous test for host intersection succeeds.
-      if (affectedRequests.contains(requestId)) {
-        if (LOG.isTraceEnabled()) {
-          LOG.trace("===>  Skipping stage since the request it is in has been processed already: {}/{} ({})", s.getRequestId(), s.getStageId(), s.getRequestContext());
-        }
-
-        addStage = false;
-      } else {
-        if (LOG.isTraceEnabled()) {
-          LOG.trace("====>  Adding request to affected requests: {}", requestId);
+          addStage = false;
+          break;
         }
-
-        affectedRequests.add(requestId);
-        addStage &= true;
       }
 
-      // If both tests pass - the stage is the first pending stage in its request and the hosts
-      // required in the stage do not intersect with hosts from stages that should occur before this,
-      // than add it to the list of stages that may be executed in parallel.
+      // add the stage is no other prior stages for prior requests intersect the
+      // hosts in this stage
       if (addStage) {
         if (LOG.isTraceEnabled()) {
-          LOG.trace("===>  Adding stage to return value: {}/{} ({})", s.getRequestId(), s.getStageId(), s.getRequestContext());
+          LOG.trace("===>  Adding stage to return value: {}/{} ({})", stage.getRequestId(), stage.getStageId(), stage.getRequestContext());
         }
 
-        retVal.add(s);
+        retVal.add(stage);
       }
     }
 
     return retVal;
   }
 
-  private boolean isStageHasBackgroundCommandsOnly(Stage s, String host) {
-    for (ExecutionCommandWrapper c : s.getExecutionCommands(host)) {
-      if (c.getCommandType() != AgentCommandType.BACKGROUND_EXECUTION_COMMAND) {
-        return false;
-      }
-    }
-    return true;
-  }
-
   private boolean hasPreviousStageFailed(Stage stage) {
     boolean failed = false;
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/28eff65e/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/HostRoleCommand.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/HostRoleCommand.java b/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/HostRoleCommand.java
index 651eb24..87a6edf 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/HostRoleCommand.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/HostRoleCommand.java
@@ -68,6 +68,7 @@ public class HostRoleCommand {
   private String commandDetail;
   private String customCommandName;
   private ExecutionCommandWrapper executionCommandWrapper;
+  private boolean isBackgroundCommand = false;
 
   @Inject
   private ExecutionCommandDAO executionCommandDAO;
@@ -179,6 +180,7 @@ public class HostRoleCommand {
     event = new ServiceComponentHostEventWrapper(hostRoleCommandEntity.getEvent());
     commandDetail = hostRoleCommandEntity.getCommandDetail();
     customCommandName = hostRoleCommandEntity.getCustomCommandName();
+    isBackgroundCommand = hostRoleCommandEntity.isBackgroundCommand();
   }
 
   //todo: why is this not symmetrical with the constructor which takes an entity
@@ -201,6 +203,7 @@ public class HostRoleCommand {
     hostRoleCommandEntity.setRoleCommand(roleCommand);
     hostRoleCommandEntity.setCommandDetail(commandDetail);
     hostRoleCommandEntity.setCustomCommandName(customCommandName);
+    hostRoleCommandEntity.setBackgroundCommand(isBackgroundCommand);
 
     HostEntity hostEntity = hostDAO.findById(hostId);
     if (null != hostEntity) {
@@ -433,6 +436,29 @@ public class HostRoleCommand {
   }
 
   /**
+   * Gets whether this command runs in the background and does not block other
+   * commands.
+   *
+   * @return {@code true} if this command runs in the background, {@code false}
+   *         otherise.
+   */
+  public boolean isBackgroundCommand() {
+    return isBackgroundCommand;
+  }
+
+  /**
+   * Sets whether this command runs in the background and does not block other
+   * commands.
+   *
+   * @param isBackgroundCommand
+   *          {@code true} if this command runs in the background, {@code false}
+   *          otherise.
+   */
+  public void setBackgroundCommand(boolean isBackgroundCommand) {
+    this.isBackgroundCommand = isBackgroundCommand;
+  }
+
+  /**
    * Gets whether commands which fail and are retryable are automatically
    * skipped and marked with {@link HostRoleStatus#SKIPPED_FAILED}.
    *

http://git-wip-us.apache.org/repos/asf/ambari/blob/28eff65e/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariCustomCommandExecutionHelper.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariCustomCommandExecutionHelper.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariCustomCommandExecutionHelper.java
index 77d5bf8..d5018f5 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariCustomCommandExecutionHelper.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariCustomCommandExecutionHelper.java
@@ -144,7 +144,7 @@ public class AmbariCustomCommandExecutionHelper {
   private final static String ALIGN_MAINTENANCE_STATE = "align_maintenance_state";
 
   public final static int MIN_STRICT_SERVICE_CHECK_TIMEOUT = 120;
-  
+
   @Inject
   private ActionMetadata actionMetadata;
 
@@ -378,6 +378,7 @@ public class AmbariCustomCommandExecutionHelper {
 
       //set type background
       if(customCommandDefinition != null && customCommandDefinition.isBackground()){
+        cmd.setBackgroundCommand(true);
         execCmd.setCommandType(AgentCommandType.BACKGROUND_EXECUTION_COMMAND);
       }
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/28eff65e/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/HostRoleCommandDAO.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/HostRoleCommandDAO.java b/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/HostRoleCommandDAO.java
index 79b8bc9..7318162 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/HostRoleCommandDAO.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/HostRoleCommandDAO.java
@@ -43,6 +43,7 @@ import org.apache.ambari.server.RoleCommand;
 import org.apache.ambari.server.actionmanager.HostRoleCommand;
 import org.apache.ambari.server.actionmanager.HostRoleCommandFactory;
 import org.apache.ambari.server.actionmanager.HostRoleStatus;
+import org.apache.ambari.server.agent.AgentCommand.AgentCommandType;
 import org.apache.ambari.server.api.query.JpaPredicateVisitor;
 import org.apache.ambari.server.api.query.JpaSortBuilder;
 import org.apache.ambari.server.configuration.Configuration;
@@ -914,6 +915,54 @@ public class HostRoleCommandDAO {
   }
 
   /**
+   * Gets a lists of hosts with commands in progress given a range of requests.
+   * The range of requests should include all requests with at least 1 stage in
+   * progress.
+   *
+   * @return the list of hosts with commands in progress.
+   * @see HostRoleStatus#IN_PROGRESS_STATUSES
+   */
+  @RequiresSession
+  public List<String> getHostsWithPendingTasks(long iLowestRequestIdInProgress,
+      long iHighestRequestIdInProgress) {
+    TypedQuery<String> query = entityManagerProvider.get().createNamedQuery(
+        "HostRoleCommandEntity.findHostsByCommandStatus", String.class);
+
+    query.setParameter("iLowestRequestIdInProgress", iLowestRequestIdInProgress);
+    query.setParameter("iHighestRequestIdInProgress", iHighestRequestIdInProgress);
+    query.setParameter("statuses", HostRoleStatus.IN_PROGRESS_STATUSES);
+    return daoUtils.selectList(query);
+  }
+
+  /**
+   * Gets a lists of hosts with commands in progress which occurr before the
+   * specified request ID. This will only return commands which are not
+   * {@link AgentCommandType#BACKGROUND_EXECUTION_COMMAND} as thsee commands do
+   * not block future requests.
+   *
+   * @param lowerRequestIdInclusive
+   *          the lowest request ID to consider (inclusive) when getting any
+   *          blocking hosts.
+   * @param requestId
+   *          the request ID to calculate any blocking hosts for (essentially,
+   *          the upper limit exclusive)
+   * @return the list of hosts from older running requests which will block
+   *         those same hosts in the specified request ID.
+   * @see HostRoleStatus#IN_PROGRESS_STATUSES
+   */
+  @RequiresSession
+  public List<String> getBlockingHostsForRequest(long lowerRequestIdInclusive,
+      long requestId) {
+    TypedQuery<String> query = entityManagerProvider.get().createNamedQuery(
+        "HostRoleCommandEntity.getBlockingHostsForRequest", String.class);
+
+    query.setParameter("lowerRequestIdInclusive", lowerRequestIdInclusive);
+    query.setParameter("upperRequestIdExclusive", requestId);
+    query.setParameter("statuses", HostRoleStatus.IN_PROGRESS_STATUSES);
+    return daoUtils.selectList(query);
+  }
+
+  /**
    * The {@link HostRoleCommandPredicateVisitor} is used to convert an Ambari
    * {@link Predicate} into a JPA {@link javax.persistence.criteria.Predicate}.
    */

http://git-wip-us.apache.org/repos/asf/ambari/blob/28eff65e/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/HostRoleCommandEntity.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/HostRoleCommandEntity.java b/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/HostRoleCommandEntity.java
index a809295..fdec5f0 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/HostRoleCommandEntity.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/HostRoleCommandEntity.java
@@ -70,7 +70,14 @@ import org.apache.commons.lang.ArrayUtils;
     @NamedQuery(name = "HostRoleCommandEntity.findByHostRoleNullHost", query = "SELECT command FROM HostRoleCommandEntity command WHERE command.hostEntity IS NULL AND command.requestId=:requestId AND command.stageId=:stageId AND command.role=:role"),
     @NamedQuery(name = "HostRoleCommandEntity.findByStatusBetweenStages", query = "SELECT command FROM HostRoleCommandEntity command WHERE command.requestId = :requestId AND command.stageId >= :minStageId AND command.stageId <= :maxStageId AND command.status = :status"),
     @NamedQuery(name = "HostRoleCommandEntity.updateAutoSkipExcludeRoleCommand", query = "UPDATE HostRoleCommandEntity command SET command.autoSkipOnFailure = :autoSkipOnFailure WHERE command.requestId = :requestId AND command.roleCommand <> :roleCommand"),
-    @NamedQuery(name = "HostRoleCommandEntity.updateAutoSkipForRoleCommand", query = "UPDATE HostRoleCommandEntity command SET command.autoSkipOnFailure = :autoSkipOnFailure WHERE command.requestId = :requestId AND command.roleCommand = :roleCommand")
+    @NamedQuery(name = "HostRoleCommandEntity.updateAutoSkipForRoleCommand", query = "UPDATE HostRoleCommandEntity command SET command.autoSkipOnFailure = :autoSkipOnFailure WHERE command.requestId = :requestId AND command.roleCommand = :roleCommand"),
+    @NamedQuery(
+        name = "HostRoleCommandEntity.findHostsByCommandStatus",
+        query = "SELECT DISTINCT(host.hostName) FROM HostRoleCommandEntity command, HostEntity host WHERE (command.requestId >= :iLowestRequestIdInProgress AND command.requestId <= :iHighestRequestIdInProgress) AND command.status IN :statuses AND command.hostId = host.hostId AND host.hostName IS NOT NULL"),
+    @NamedQuery(
+        name = "HostRoleCommandEntity.getBlockingHostsForRequest",
+        query = "SELECT DISTINCT(host.hostName) FROM HostRoleCommandEntity command, HostEntity host WHERE command.requestId >= :lowerRequestIdInclusive AND command.requestId < :upperRequestIdExclusive AND command.status IN :statuses AND command.isBackgroundCommand=0 AND command.hostId = host.hostId AND host.hostName IS NOT NULL")
+
 })
 public class HostRoleCommandEntity {
 
@@ -195,6 +202,10 @@ public class HostRoleCommandEntity {
   @OneToOne(mappedBy = "hostRoleCommandEntity", cascade = CascadeType.REMOVE)
   private TopologyLogicalTaskEntity topologyLogicalTaskEntity;
 
+  @Basic
+  @Column(name = "is_background_command", nullable = false)
+  private short isBackgroundCommand = 0;
+
   public Long getTaskId() {
     return taskId;
   }
@@ -407,6 +418,26 @@ public class HostRoleCommandEntity {
     autoSkipOnFailure = skipFailures ? 1 : 0;
   }
 
+  /**
+   * Sets whether this is a command is a background command and will not block
+   * other commands.
+   *
+   * @param runInBackground
+   *          {@code true} if this is a background command, {@code false}
+   *          otherwise.
+   */
+  public void setBackgroundCommand(boolean runInBackground) {
+    isBackgroundCommand = (short) (runInBackground ? 1 : 0);
+  }
+
+  /**
+   * Gets whether this command runs in the background and will not block other
+   * commands.
+   */
+  public boolean isBackgroundCommand() {
+    return isBackgroundCommand == 0 ? false : true;
+  }
+
   @Override
   public boolean equals(Object o) {
     if (this == o) {

http://git-wip-us.apache.org/repos/asf/ambari/blob/28eff65e/ambari-server/src/main/resources/Ambari-DDL-Derby-CREATE.sql
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/Ambari-DDL-Derby-CREATE.sql b/ambari-server/src/main/resources/Ambari-DDL-Derby-CREATE.sql
index 6744a74..5785a9d 100644
--- a/ambari-server/src/main/resources/Ambari-DDL-Derby-CREATE.sql
+++ b/ambari-server/src/main/resources/Ambari-DDL-Derby-CREATE.sql
@@ -383,6 +383,7 @@ CREATE TABLE host_role_command (
   role_command VARCHAR(255),
   command_detail VARCHAR(255),
   custom_command_name VARCHAR(255),
+  is_background_command SMALLINT DEFAULT 0 NOT NULL,
   CONSTRAINT PK_host_role_command PRIMARY KEY (task_id),
   CONSTRAINT FK_host_role_command_host_id FOREIGN KEY (host_id) REFERENCES hosts (host_id),
   CONSTRAINT FK_host_role_command_stage_id FOREIGN KEY (stage_id, request_id) REFERENCES stage (stage_id, request_id));

http://git-wip-us.apache.org/repos/asf/ambari/blob/28eff65e/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 6279f83..96ef0ac 100644
--- a/ambari-server/src/main/resources/Ambari-DDL-MySQL-CREATE.sql
+++ b/ambari-server/src/main/resources/Ambari-DDL-MySQL-CREATE.sql
@@ -404,6 +404,7 @@ CREATE TABLE host_role_command (
   structured_out LONGBLOB,
   command_detail VARCHAR(255),
   custom_command_name VARCHAR(255),
+  is_background_command SMALLINT DEFAULT 0 NOT NULL,
   CONSTRAINT PK_host_role_command PRIMARY KEY (task_id),
   CONSTRAINT FK_host_role_command_host_id FOREIGN KEY (host_id) REFERENCES hosts (host_id),
   CONSTRAINT FK_host_role_command_stage_id FOREIGN KEY (stage_id, request_id) REFERENCES stage (stage_id, request_id));

http://git-wip-us.apache.org/repos/asf/ambari/blob/28eff65e/ambari-server/src/main/resources/Ambari-DDL-Oracle-CREATE.sql
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/Ambari-DDL-Oracle-CREATE.sql b/ambari-server/src/main/resources/Ambari-DDL-Oracle-CREATE.sql
index 470eb60..3396ce9 100644
--- a/ambari-server/src/main/resources/Ambari-DDL-Oracle-CREATE.sql
+++ b/ambari-server/src/main/resources/Ambari-DDL-Oracle-CREATE.sql
@@ -384,6 +384,7 @@ CREATE TABLE host_role_command (
   structured_out BLOB NULL,
   command_detail VARCHAR2(255) NULL,
   custom_command_name VARCHAR2(255) NULL,
+  is_background_command SMALLINT DEFAULT 0 NOT NULL,
   CONSTRAINT PK_host_role_command PRIMARY KEY (task_id),
   CONSTRAINT FK_host_role_command_host_id FOREIGN KEY (host_id) REFERENCES hosts (host_id),
   CONSTRAINT FK_host_role_command_stage_id FOREIGN KEY (stage_id, request_id) REFERENCES stage (stage_id, request_id));

http://git-wip-us.apache.org/repos/asf/ambari/blob/28eff65e/ambari-server/src/main/resources/Ambari-DDL-Postgres-CREATE.sql
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/Ambari-DDL-Postgres-CREATE.sql b/ambari-server/src/main/resources/Ambari-DDL-Postgres-CREATE.sql
index 87ffb7f..c6bfa94 100644
--- a/ambari-server/src/main/resources/Ambari-DDL-Postgres-CREATE.sql
+++ b/ambari-server/src/main/resources/Ambari-DDL-Postgres-CREATE.sql
@@ -383,6 +383,7 @@ CREATE TABLE host_role_command (
   role_command VARCHAR(255),
   command_detail VARCHAR(255),
   custom_command_name VARCHAR(255),
+  is_background_command SMALLINT DEFAULT 0 NOT NULL,
   CONSTRAINT PK_host_role_command PRIMARY KEY (task_id),
   CONSTRAINT FK_host_role_command_host_id FOREIGN KEY (host_id) REFERENCES hosts (host_id),
   CONSTRAINT FK_host_role_command_stage_id FOREIGN KEY (stage_id, request_id) REFERENCES stage (stage_id, request_id));

http://git-wip-us.apache.org/repos/asf/ambari/blob/28eff65e/ambari-server/src/main/resources/Ambari-DDL-SQLAnywhere-CREATE.sql
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/Ambari-DDL-SQLAnywhere-CREATE.sql b/ambari-server/src/main/resources/Ambari-DDL-SQLAnywhere-CREATE.sql
index a460194..bbf5d3c 100644
--- a/ambari-server/src/main/resources/Ambari-DDL-SQLAnywhere-CREATE.sql
+++ b/ambari-server/src/main/resources/Ambari-DDL-SQLAnywhere-CREATE.sql
@@ -75,7 +75,7 @@ CREATE TABLE clusterconfig (
   config_data TEXT NOT NULL,
   config_attributes TEXT,
   create_timestamp NUMERIC(19) NOT NULL,
-  selected_timestamp NUMERIC(19) NOT NULL DEFAULT 0,  
+  selected_timestamp NUMERIC(19) NOT NULL DEFAULT 0,
   CONSTRAINT PK_clusterconfig PRIMARY KEY (config_id),
   CONSTRAINT FK_clusterconfig_cluster_id FOREIGN KEY (cluster_id) REFERENCES clusters (cluster_id),
   CONSTRAINT FK_clusterconfig_stack_id FOREIGN KEY (stack_id) REFERENCES stack(stack_id),
@@ -382,6 +382,7 @@ CREATE TABLE host_role_command (
   structured_out IMAGE,
   command_detail VARCHAR(255),
   custom_command_name VARCHAR(255),
+  is_background_command SMALLINT DEFAULT 0 NOT NULL,
   CONSTRAINT PK_host_role_command PRIMARY KEY (task_id),
   CONSTRAINT FK_host_role_command_host_id FOREIGN KEY (host_id) REFERENCES hosts (host_id),
   CONSTRAINT FK_host_role_command_stage_id FOREIGN KEY (stage_id, request_id) REFERENCES stage (stage_id, request_id));

http://git-wip-us.apache.org/repos/asf/ambari/blob/28eff65e/ambari-server/src/main/resources/Ambari-DDL-SQLServer-CREATE.sql
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/Ambari-DDL-SQLServer-CREATE.sql b/ambari-server/src/main/resources/Ambari-DDL-SQLServer-CREATE.sql
index 237c892..13ab01d 100644
--- a/ambari-server/src/main/resources/Ambari-DDL-SQLServer-CREATE.sql
+++ b/ambari-server/src/main/resources/Ambari-DDL-SQLServer-CREATE.sql
@@ -388,6 +388,7 @@ CREATE TABLE host_role_command (
   role_command VARCHAR(255),
   command_detail VARCHAR(255),
   custom_command_name VARCHAR(255),
+  is_background_command SMALLINT DEFAULT 0 NOT NULL,
   CONSTRAINT PK_host_role_command PRIMARY KEY CLUSTERED (task_id),
   CONSTRAINT FK_host_role_command_host_id FOREIGN KEY (host_id) REFERENCES hosts (host_id),
   CONSTRAINT FK_host_role_command_stage_id FOREIGN KEY (stage_id, request_id) REFERENCES stage (stage_id, request_id));

http://git-wip-us.apache.org/repos/asf/ambari/blob/28eff65e/ambari-server/src/test/java/org/apache/ambari/server/actionmanager/TestActionScheduler.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/actionmanager/TestActionScheduler.java b/ambari-server/src/test/java/org/apache/ambari/server/actionmanager/TestActionScheduler.java
index d7d3d40..b1a7524 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/actionmanager/TestActionScheduler.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/actionmanager/TestActionScheduler.java
@@ -1106,41 +1106,45 @@ public class TestActionScheduler {
     hosts.put(hostname4, sch);
     when(scomp.getServiceComponentHosts()).thenReturn(hosts);
 
-    List<Stage> stages = new ArrayList<>();
-    stages.add(
+    List<Stage> firstStageInProgressPerRequest = new ArrayList<>();
+
+    firstStageInProgressPerRequest.add(
             getStageWithSingleTask(
                     hostname1, "cluster1", Role.DATANODE,
                     RoleCommand.START, Service.Type.HDFS, 1, 1, 1));
-    stages.add( // Stage with the same hostname, should not be scheduled
+
+    // Stage with the same hostname, should not be scheduled
+    firstStageInProgressPerRequest.add(
             getStageWithSingleTask(
                     hostname1, "cluster1", Role.GANGLIA_MONITOR,
                     RoleCommand.START, Service.Type.GANGLIA, 2, 2, 2));
 
-    stages.add(
+    firstStageInProgressPerRequest.add(
             getStageWithSingleTask(
                     hostname2, "cluster1", Role.DATANODE,
                     RoleCommand.START, Service.Type.HDFS, 3, 3, 3));
 
-    stages.add(
+    firstStageInProgressPerRequest.add(
         getStageWithSingleTask(
             hostname3, "cluster1", Role.DATANODE,
             RoleCommand.START, Service.Type.HDFS, 4, 4, 4));
 
-    stages.add( // Stage with the same request id, should not be scheduled
-        getStageWithSingleTask(
-            hostname4, "cluster1", Role.GANGLIA_MONITOR,
-            RoleCommand.START, Service.Type.GANGLIA, 5, 5, 4));
-
     ActionDBAccessor db = mock(ActionDBAccessor.class);
     HostRoleCommandDAO hostRoleCommandDAOMock = mock(HostRoleCommandDAO.class);
     Mockito.doNothing().when(hostRoleCommandDAOMock).publishTaskCreateEvent(anyListOf(HostRoleCommand.class));
 
+    List<String> blockingHostsRequest1 = new ArrayList<>();
+    when(hostRoleCommandDAOMock.getBlockingHostsForRequest(1, 1)).thenReturn(blockingHostsRequest1);
+
+    List<String> blockingHostsRequest2 = Lists.newArrayList(hostname1);
+    when(hostRoleCommandDAOMock.getBlockingHostsForRequest(1, 2)).thenReturn(blockingHostsRequest2);
+
     RequestEntity request = mock(RequestEntity.class);
     when(request.isExclusive()).thenReturn(false);
     when(db.getRequestEntity(anyLong())).thenReturn(request);
 
-    when(db.getCommandsInProgressCount()).thenReturn(stages.size());
-    when(db.getFirstStageInProgressPerRequest()).thenReturn(stages);
+    when(db.getCommandsInProgressCount()).thenReturn(firstStageInProgressPerRequest.size());
+    when(db.getFirstStageInProgressPerRequest()).thenReturn(firstStageInProgressPerRequest);
 
     Properties properties = new Properties();
     Configuration conf = new Configuration(properties);
@@ -1152,11 +1156,10 @@ public class TestActionScheduler {
 
     scheduler.doWork();
 
-    Assert.assertEquals(HostRoleStatus.QUEUED, stages.get(0).getHostRoleStatus(hostname1, "DATANODE"));
-    Assert.assertEquals(HostRoleStatus.PENDING, stages.get(1).getHostRoleStatus(hostname1, "GANGLIA_MONITOR"));
-    Assert.assertEquals(HostRoleStatus.QUEUED, stages.get(2).getHostRoleStatus(hostname2, "DATANODE"));
-    Assert.assertEquals(HostRoleStatus.QUEUED, stages.get(3).getHostRoleStatus(hostname3, "DATANODE"));
-    Assert.assertEquals(HostRoleStatus.PENDING, stages.get(4).getHostRoleStatus(hostname4, "GANGLIA_MONITOR"));
+    Assert.assertEquals(HostRoleStatus.QUEUED, firstStageInProgressPerRequest.get(0).getHostRoleStatus(hostname1, "DATANODE"));
+    Assert.assertEquals(HostRoleStatus.PENDING, firstStageInProgressPerRequest.get(1).getHostRoleStatus(hostname1, "GANGLIA_MONITOR"));
+    Assert.assertEquals(HostRoleStatus.QUEUED, firstStageInProgressPerRequest.get(2).getHostRoleStatus(hostname2, "DATANODE"));
+    Assert.assertEquals(HostRoleStatus.QUEUED, firstStageInProgressPerRequest.get(3).getHostRoleStatus(hostname3, "DATANODE"));
   }
 
 
@@ -2065,6 +2068,8 @@ public class TestActionScheduler {
     hosts.put(hostname1, sch1);
     when(scomp.getServiceComponentHosts()).thenReturn(hosts);
 
+    HostRoleCommandDAO hostRoleCommandDAO = mock(HostRoleCommandDAO.class);
+
     HostEntity hostEntity = new HostEntity();
     hostEntity.setHostName(hostname1);
     hostDAO.create(hostEntity);
@@ -2100,7 +2105,7 @@ public class TestActionScheduler {
 
     ActionScheduler scheduler = new ActionScheduler(100, 50000, db, aq, fsm, 3,
         new HostsMap((String) null), unitOfWork, null, conf, entityManagerProviderMock,
-        (HostRoleCommandDAO)null, (HostRoleCommandFactory)null);
+        hostRoleCommandDAO, (HostRoleCommandFactory) null);
 
     final CountDownLatch abortCalls = new CountDownLatch(2);
 


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

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


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

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

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


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

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

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

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

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


[44/50] [abbrv] ambari git commit: AMBARI-20705.Issue while adding custom job.properties(M Madhan Mohan Reddy via venkatasairam.lanka)

Posted by ja...@apache.org.
AMBARI-20705.Issue while adding custom job.properties(M Madhan Mohan Reddy via venkatasairam.lanka)


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

Branch: refs/heads/ambari-rest-api-explorer
Commit: d3036fdaaf8b28f062a3f8fa4527a9bccf3df927
Parents: a214d80
Author: Venkata Sairam <ve...@gmail.com>
Authored: Tue Apr 11 17:02:08 2017 +0530
Committer: Venkata Sairam <ve...@gmail.com>
Committed: Tue Apr 11 17:02:08 2017 +0530

----------------------------------------------------------------------
 .../src/main/resources/ui/app/components/global-config.js       | 5 +++++
 .../resources/ui/app/templates/components/global-config.hbs     | 2 +-
 2 files changed, 6 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/d3036fda/contrib/views/wfmanager/src/main/resources/ui/app/components/global-config.js
----------------------------------------------------------------------
diff --git a/contrib/views/wfmanager/src/main/resources/ui/app/components/global-config.js b/contrib/views/wfmanager/src/main/resources/ui/app/components/global-config.js
index efe8385..dd90844 100644
--- a/contrib/views/wfmanager/src/main/resources/ui/app/components/global-config.js
+++ b/contrib/views/wfmanager/src/main/resources/ui/app/components/global-config.js
@@ -30,6 +30,7 @@ export default Ember.Component.extend({
       this.set("actionModel.configuration",{});
       this.set("actionModel.configuration.property", Ember.A([]));
     }
+    this.sendAction('register','globalConfigurations',this);
   }.on('init'),
   saveClicked : false,
   initialize : function(){
@@ -46,12 +47,16 @@ export default Ember.Component.extend({
     }.bind(this));
   }.on('didInsertElement'),
   actions : {
+    register(component, context){
+      this.set('nameValueContext', context);
+    },
     close (){
       this.$('#global_properties_dialog').modal('hide');
       this.set('saveClicked', false);
     },
     save(){
       this.$('#global_properties_dialog').modal('hide');
+      this.get("nameValueContext").trigger("bindInputPlaceholder");
       this.set('saveClicked', true);
     },
     openFileBrowser(model, context){

http://git-wip-us.apache.org/repos/asf/ambari/blob/d3036fda/contrib/views/wfmanager/src/main/resources/ui/app/templates/components/global-config.hbs
----------------------------------------------------------------------
diff --git a/contrib/views/wfmanager/src/main/resources/ui/app/templates/components/global-config.hbs b/contrib/views/wfmanager/src/main/resources/ui/app/templates/components/global-config.hbs
index e3d49ec..7231bf5 100644
--- a/contrib/views/wfmanager/src/main/resources/ui/app/templates/components/global-config.hbs
+++ b/contrib/views/wfmanager/src/main/resources/ui/app/templates/components/global-config.hbs
@@ -51,7 +51,7 @@
           <div class=" panel panel-default">
             <div class="panel-heading">Properties</div>
             <div class="panel-body handlerPanel">
-              {{#name-value-config configuration=actionModel.configuration}}{{/name-value-config}}
+              {{#name-value-config configuration=actionModel.configuration register="register"}}{{/name-value-config}}
             </div>
           </div>
         </form>


[41/50] [abbrv] ambari git commit: AMBARI-20729.Need way to explicitly ask for workflow name(Venkata Sairam via padmapriyanitt)

Posted by ja...@apache.org.
AMBARI-20729.Need way to explicitly ask for workflow name(Venkata Sairam via padmapriyanitt)


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

Branch: refs/heads/ambari-rest-api-explorer
Commit: 953cc9c741bf5354de6010b84bb8a59aaaa305c8
Parents: eff2b43
Author: padmapriyanitt <pa...@gmail.com>
Authored: Tue Apr 11 15:35:26 2017 +0530
Committer: padmapriyanitt <pa...@gmail.com>
Committed: Tue Apr 11 15:35:26 2017 +0530

----------------------------------------------------------------------
 .../src/main/resources/ui/app/components/flow-designer.js      | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/953cc9c7/contrib/views/wfmanager/src/main/resources/ui/app/components/flow-designer.js
----------------------------------------------------------------------
diff --git a/contrib/views/wfmanager/src/main/resources/ui/app/components/flow-designer.js b/contrib/views/wfmanager/src/main/resources/ui/app/components/flow-designer.js
index cccf6d0..e3f3718 100644
--- a/contrib/views/wfmanager/src/main/resources/ui/app/components/flow-designer.js
+++ b/contrib/views/wfmanager/src/main/resources/ui/app/components/flow-designer.js
@@ -116,6 +116,7 @@ export default Ember.Component.extend(FindNodeMixin, Validations, {
   isDraft: false,
   jobConfigProperties: Ember.A([]),
   saveJobService : Ember.inject.service('save-job'),
+  isDefaultNameForWFEnabled : false,
   initialize : function(){
     var id = 'cy-' + Math.ceil(Math.random() * 1000);
     this.set('cyId', id);
@@ -140,7 +141,10 @@ export default Ember.Component.extend(FindNodeMixin, Validations, {
         this.restoreWorkflow();
       }
     }
-    if(Ember.isBlank(this.get('workflow.name'))){
+    /*
+       This block will enable/disable giving default name for workflow
+    */
+    if(Ember.isBlank(this.get('workflow.name')) && this.get('isDefaultNameForWFEnabled')) {
       this.set('workflow.name', Ember.copy(this.get('tabInfo.name')));
     }
   }.on('didInsertElement'),


[45/50] [abbrv] ambari git commit: AMBARI-20732. Remove duplicate condition from route (onechiponerko)

Posted by ja...@apache.org.
AMBARI-20732. Remove duplicate condition from route (onechiponerko)


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

Branch: refs/heads/ambari-rest-api-explorer
Commit: 2760cda04c2222a7fd8fa85cf643444acbb735eb
Parents: d3036fd
Author: Oleg Nechiporenko <on...@apache.org>
Authored: Tue Apr 11 13:57:44 2017 +0300
Committer: Oleg Nechiporenko <on...@apache.org>
Committed: Tue Apr 11 18:55:03 2017 +0300

----------------------------------------------------------------------
 ambari-web/app/routes/main.js            | 2 +-
 ambari-web/test/controllers/main_test.js | 1 -
 ambari-web/test/init_test.js             | 2 ++
 3 files changed, 3 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/2760cda0/ambari-web/app/routes/main.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/routes/main.js b/ambari-web/app/routes/main.js
index 0a2375e..1f881e0 100644
--- a/ambari-web/app/routes/main.js
+++ b/ambari-web/app/routes/main.js
@@ -653,7 +653,7 @@ module.exports = Em.Route.extend(App.RouterRedirections, {
 
       route: '/serviceAutoStart',
       enter: function(router, transition) {
-        if (router.get('loggedIn') && !App.isAuthorized('CLUSTER.MANAGE_AUTO_START') && !App.isAuthorized('CLUSTER.MANAGE_AUTO_START')) {
+        if (router.get('loggedIn') && !App.isAuthorized('CLUSTER.MANAGE_AUTO_START')) {
           router.transitionTo('main.dashboard.index');
         }
       },

http://git-wip-us.apache.org/repos/asf/ambari/blob/2760cda0/ambari-web/test/controllers/main_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/main_test.js b/ambari-web/test/controllers/main_test.js
index 9673092..573b1e9 100644
--- a/ambari-web/test/controllers/main_test.js
+++ b/ambari-web/test/controllers/main_test.js
@@ -17,7 +17,6 @@
  */
 
 var App = require('app');
-var testHelpers = require('test/helpers');
 
 describe('App.MainController', function () {
   var mainController = App.MainController.create();

http://git-wip-us.apache.org/repos/asf/ambari/blob/2760cda0/ambari-web/test/init_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/init_test.js b/ambari-web/test/init_test.js
index db72744..f6b572a 100644
--- a/ambari-web/test/init_test.js
+++ b/ambari-web/test/init_test.js
@@ -91,6 +91,7 @@ if (!Array.prototype.includes) {
   });
 }
 
+/* eslint-disable */
 if (typeof Object.assign != 'function') {
   Object.assign = function(target, varArgs) { // .length of function is 2
     'use strict';
@@ -115,6 +116,7 @@ if (typeof Object.assign != 'function') {
     return to;
   };
 }
+/* eslint-enable */
 
 Number.isFinite = Number.isFinite || function(value) {
   return typeof value === 'number' && isFinite(value);


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

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


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

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

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


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

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

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


[46/50] [abbrv] ambari git commit: AMBARI-20609 Fix Install Wizard data attribute. (ababiichuk)

Posted by ja...@apache.org.
AMBARI-20609 Fix Install Wizard data attribute. (ababiichuk)


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

Branch: refs/heads/ambari-rest-api-explorer
Commit: 91aa3c8e4f845a0b106d8b07e500d51ae5e08496
Parents: 2760cda
Author: ababiichuk <ab...@hortonworks.com>
Authored: Tue Apr 11 18:22:32 2017 +0300
Committer: ababiichuk <ab...@hortonworks.com>
Committed: Tue Apr 11 19:03:18 2017 +0300

----------------------------------------------------------------------
 ambari-web/app/templates/wizard/step1.hbs | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/91aa3c8e/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 793199c..769aca3 100644
--- a/ambari-web/app/templates/wizard/step1.hbs
+++ b/ambari-web/app/templates/wizard/step1.hbs
@@ -129,7 +129,7 @@
               <tbody>
                 {{#each operatingSystem in selectedStack.operatingSystems}}
                   {{#if operatingSystem.isSelected}}
-                    <tr>
+                    <tr {{QAAttr "os-wrapper"}}>
                       <td class="col-sm-2" {{QAAttr "os-type-label"}}>{{operatingSystem.osType}}</td>
                       <td class="col-sm-9" colspan="2">
                         <table class="table table-condensed no-borders inner-table" {{QAAttr "{operatingSystem.osType}"}}>


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

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


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

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

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


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

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

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

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

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

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

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

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

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

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


[34/50] [abbrv] ambari git commit: AMBARI-20689.Zooming workflows should happen more smoothly(M Madhan Mohan Reddy via padmapriyanitt)

Posted by ja...@apache.org.
AMBARI-20689.Zooming workflows should happen more smoothly(M Madhan Mohan Reddy via padmapriyanitt)


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

Branch: refs/heads/ambari-rest-api-explorer
Commit: 9405e241d3080c4192b130f00292ca44ab018f67
Parents: 28eff65
Author: padmapriyanitt <pa...@gmail.com>
Authored: Mon Apr 10 12:36:38 2017 +0530
Committer: padmapriyanitt <pa...@gmail.com>
Committed: Mon Apr 10 12:36:38 2017 +0530

----------------------------------------------------------------------
 .../src/main/resources/ui/app/domain/cytoscape-flow-renderer.js    | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/9405e241/contrib/views/wfmanager/src/main/resources/ui/app/domain/cytoscape-flow-renderer.js
----------------------------------------------------------------------
diff --git a/contrib/views/wfmanager/src/main/resources/ui/app/domain/cytoscape-flow-renderer.js b/contrib/views/wfmanager/src/main/resources/ui/app/domain/cytoscape-flow-renderer.js
index 03f0ae1..bee901e 100644
--- a/contrib/views/wfmanager/src/main/resources/ui/app/domain/cytoscape-flow-renderer.js
+++ b/contrib/views/wfmanager/src/main/resources/ui/app/domain/cytoscape-flow-renderer.js
@@ -36,7 +36,7 @@ var CytoscapeRenderer= Ember.Object.extend({
 
     // the default values of each option are outlined below:
     var defaults = {
-      zoomFactor: 2.0, // zoom factor per zoom tick
+      zoomFactor: 0.01, // zoom factor per zoom tick
       minZoom: 0.1, // min zoom level
       maxZoom: 10, // max zoom level
 


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

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


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

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

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


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

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

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

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

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


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

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


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

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

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


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


[32/50] [abbrv] ambari git commit: AMBARI-20711 Post-install host check: 'Rerun Checks' button is never disabled. (ababiichuk)

Posted by ja...@apache.org.
AMBARI-20711 Post-install host check: 'Rerun Checks' button is never disabled. (ababiichuk)


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

Branch: refs/heads/ambari-rest-api-explorer
Commit: 91028d1e93e5e211a9cb8c7c99a96c9ee83a25c1
Parents: b0ac313
Author: ababiichuk <ab...@hortonworks.com>
Authored: Fri Apr 7 19:15:34 2017 +0300
Committer: ababiichuk <ab...@hortonworks.com>
Committed: Fri Apr 7 19:15:34 2017 +0300

----------------------------------------------------------------------
 ambari-web/app/controllers/main/host/details.js | 14 ++++++++----
 .../app/controllers/wizard/step3_controller.js  | 10 +++-----
 .../main/host/details/actions/check_host.js     | 24 +++++++++++++++++---
 .../wizard/step3/hostWarningPopupFooter_view.js |  4 ++--
 .../step3/hostWarningPopupFooter_view_test.js   | 14 ++++++++----
 5 files changed, 46 insertions(+), 20 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/91028d1e/ambari-web/app/controllers/main/host/details.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/host/details.js b/ambari-web/app/controllers/main/host/details.js
index 6e85190..def75d6 100644
--- a/ambari-web/app/controllers/main/host/details.js
+++ b/ambari-web/app/controllers/main/host/details.js
@@ -2426,8 +2426,11 @@ App.MainHostDetailsController = Em.Controller.extend(App.SupportClientConfigsDow
   runHostCheck: function () {
     var dataForCheckHostRequest = this.getDataForHostCheck();
 
-    this.set('stopChecking', false);
-    this.set('checkHostFinished', false);
+    this.setProperties({
+      stopChecking: false,
+      checkHostFinished: false,
+      isRerun: false
+    });
     this.setBootHostsProp();
     this.showHostWarningsPopup();
     this.requestToPerformHostCheck(dataForCheckHostRequest);
@@ -2486,14 +2489,17 @@ App.MainHostDetailsController = Em.Controller.extend(App.SupportClientConfigsDow
       },
 
       footerClass: App.WizardStep3HostWarningPopupFooter.reopen({
-        footerControllerBinding: 'App.router.mainHostDetailsController'
+        footerControllerBinding: 'App.router.mainHostDetailsController',
+        checkHostFinished: function () {
+          return this.get('footerController.checkHostFinished');
+        }.property('footerController.checkHostFinished')
       }),
 
       bodyClass: App.WizardStep3HostWarningPopupBody.reopen({
         bodyControllerBinding: 'App.router.mainHostDetailsController',
         checkHostFinished: function () {
           return this.get('bodyController.checkHostFinished');
-        }.property('bodyController.checkHostFinished'),
+        }.property('bodyController.checkHostFinished')
       })
     });
   },

http://git-wip-us.apache.org/repos/asf/ambari/blob/91028d1e/ambari-web/app/controllers/wizard/step3_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/wizard/step3_controller.js b/ambari-web/app/controllers/wizard/step3_controller.js
index c282451..29393e3 100644
--- a/ambari-web/app/controllers/wizard/step3_controller.js
+++ b/ambari-web/app/controllers/wizard/step3_controller.js
@@ -121,12 +121,6 @@ App.WizardStep3Controller = Em.Controller.extend(App.ReloadPopupMixin, App.Check
   }.property('content.hosts'),
 
   /**
-   * Timeout for "warning"-requests
-   * @type {number}
-   */
-  warningsTimeInterval: 60000,
-
-  /**
    * Are hosts warnings loaded
    * @type {bool}
    */
@@ -909,7 +903,9 @@ App.WizardStep3Controller = Em.Controller.extend(App.ReloadPopupMixin, App.Check
         this.fitHeight();
       },
 
-      footerClass: App.WizardStep3HostWarningPopupFooter,
+      footerClass: App.WizardStep3HostWarningPopupFooter.reopen({
+        checkHostFinished: true
+      }),
 
       bodyClass: App.WizardStep3HostWarningPopupBody.reopen({
         checkHostFinished: true

http://git-wip-us.apache.org/repos/asf/ambari/blob/91028d1e/ambari-web/app/mixins/main/host/details/actions/check_host.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/mixins/main/host/details/actions/check_host.js b/ambari-web/app/mixins/main/host/details/actions/check_host.js
index c0ebf02..80f4f03 100644
--- a/ambari-web/app/mixins/main/host/details/actions/check_host.js
+++ b/ambari-web/app/mixins/main/host/details/actions/check_host.js
@@ -99,6 +99,17 @@ App.CheckHostMixin = Em.Mixin.create({
    */
   isAddHostWizard: false,
 
+  /**
+   * True if user triggered host checks rerun
+   * @type {boolean}
+   */
+  isRerun: false,
+
+  /**
+   * Timeout for "warning"-requests
+   * @type {number}
+   */
+  warningsTimeInterval: 60000,
 
   /**
    * disables host check on Add host wizard as per the experimental flag
@@ -334,7 +345,7 @@ App.CheckHostMixin = Em.Mixin.create({
     this.set('diskCategoryWarnings', diskWarnings);
     this.set('thpCategoryWarnings', thpWarnings);
     this.stopRegistration();
-    this.get('name') === 'mainHostDetailsController' && this.set('checkHostFinished', true);
+    this.get('name') === 'mainHostDetailsController' && !this.get('isRerun') && this.set('checkHostFinished', true);
   },
 
   /**
@@ -415,7 +426,10 @@ App.CheckHostMixin = Em.Mixin.create({
     var self = this;
     var currentProgress = 0;
     this.get('name') === 'wizardStep3Controller' ? this.getHostNameResolution() : this.getHostNameResolution(this.getDataForHostCheck());
-    this.set('stopChecking', false);
+    this.setProperties({
+      stopChecking: false,
+      isRerun: true
+    });
     this.get('name') === 'wizardStep3Controller' ? this.getGeneralHostCheck() : this.getGeneralHostCheck(this.getDataForHostCheck());
     this.get('name') === 'wizardStep3Controller' && this.checkHostJDK();
     var interval = setInterval(function () {
@@ -428,7 +442,11 @@ App.CheckHostMixin = Em.Mixin.create({
           name: 'wizard.step3.rerun_checks',
           sender: self,
           success: 'rerunChecksSuccessCallback',
-          error: 'rerunChecksErrorCallback'
+          error: 'rerunChecksErrorCallback',
+          callback: function () {
+            self.set('isRerun', false);
+            self.get('name') === 'mainHostDetailsController' && self.set('checkHostFinished', true);
+          }
         });
       }
     }, 1000);

http://git-wip-us.apache.org/repos/asf/ambari/blob/91028d1e/ambari-web/app/views/wizard/step3/hostWarningPopupFooter_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/wizard/step3/hostWarningPopupFooter_view.js b/ambari-web/app/views/wizard/step3/hostWarningPopupFooter_view.js
index fb2019c..9461074 100644
--- a/ambari-web/app/views/wizard/step3/hostWarningPopupFooter_view.js
+++ b/ambari-web/app/views/wizard/step3/hostWarningPopupFooter_view.js
@@ -29,9 +29,9 @@ App.WizardStep3HostWarningPopupFooter = Em.View.extend({
   progressWidth: Em.computed.format('width:{0}%', 'footerController.checksUpdateProgress'),
 
   isUpdateInProgress: function () {
-    return (this.get('footerController.checksUpdateProgress') > 0) &&
+    return !this.get('checkHostFinished') || (this.get('footerController.checksUpdateProgress') > 0) &&
       (this.get('footerController.checksUpdateProgress') < 100);
-  }.property('footerController.checksUpdateProgress'),
+  }.property('checkHostFinished', 'footerController.checksUpdateProgress'),
 
   updateStatusClass: function () {
     var status = this.get('footerController.checksUpdateStatus');

http://git-wip-us.apache.org/repos/asf/ambari/blob/91028d1e/ambari-web/test/views/wizard/step3/hostWarningPopupFooter_view_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/views/wizard/step3/hostWarningPopupFooter_view_test.js b/ambari-web/test/views/wizard/step3/hostWarningPopupFooter_view_test.js
index d1fbc24..a366fe7 100644
--- a/ambari-web/test/views/wizard/step3/hostWarningPopupFooter_view_test.js
+++ b/ambari-web/test/views/wizard/step3/hostWarningPopupFooter_view_test.js
@@ -36,13 +36,19 @@ describe('App.WizardStep3HostWarningPopupFooter', function() {
 
   describe('#isUpdateInProgress', function() {
     var tests = Em.A([
-      {checksUpdateProgress: 0, e: false},
-      {checksUpdateProgress: 100, e: false},
-      {checksUpdateProgress: 50, e: true}
+      {checksUpdateProgress: 0, checkHostFinished: true, e: false},
+      {checksUpdateProgress: 100, checkHostFinished: true, e: false},
+      {checksUpdateProgress: 50, checkHostFinished: true, e: true},
+      {checksUpdateProgress: 0, checkHostFinished: false, e: true},
+      {checksUpdateProgress: 100, checkHostFinished: false, e: true},
+      {checksUpdateProgress: 50, checkHostFinished: false, e: true}
     ]);
     tests.forEach(function(test) {
       it(test.checksUpdateProgress, function() {
-        view.set('footerController.checksUpdateProgress', test.checksUpdateProgress);
+        view.setProperties({
+          'checkHostFinished': test.checkHostFinished,
+          'footerController.checksUpdateProgress': test.checksUpdateProgress
+        });
         expect(view.get('isUpdateInProgress')).to.equal(test.e);
       });
     });


[39/50] [abbrv] ambari git commit: AMBARI-20704.Need a way to indicate the action node type in workflow manager.(Venkata Sairam via padmapriyanitt)

Posted by ja...@apache.org.
AMBARI-20704.Need a way to indicate the action node type in workflow manager.(Venkata Sairam via padmapriyanitt)


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

Branch: refs/heads/ambari-rest-api-explorer
Commit: e64bff0d99f9f159863598d00992d86b0f3c04fd
Parents: 735cbda
Author: padmapriyanitt <pa...@gmail.com>
Authored: Tue Apr 11 11:50:56 2017 +0530
Committer: padmapriyanitt <pa...@gmail.com>
Committed: Tue Apr 11 11:50:56 2017 +0530

----------------------------------------------------------------------
 .../main/resources/ui/app/domain/cytoscape-style.js  |  10 +++++++++-
 .../wfmanager/src/main/resources/ui/app/index.html   |  14 ++++++++++++++
 .../src/main/resources/ui/public/assets/custom.png   | Bin 0 -> 350 bytes
 .../src/main/resources/ui/public/assets/distcp.png   | Bin 0 -> 229 bytes
 .../src/main/resources/ui/public/assets/email.png    | Bin 0 -> 340 bytes
 .../src/main/resources/ui/public/assets/fs.png       | Bin 0 -> 254 bytes
 .../src/main/resources/ui/public/assets/hive.png     | Bin 0 -> 270 bytes
 .../src/main/resources/ui/public/assets/hive2.png    | Bin 0 -> 270 bytes
 .../src/main/resources/ui/public/assets/java.png     | Bin 0 -> 385 bytes
 .../main/resources/ui/public/assets/map-reduce.png   | Bin 0 -> 552 bytes
 .../src/main/resources/ui/public/assets/pig.png      | Bin 0 -> 342 bytes
 .../src/main/resources/ui/public/assets/shell.png    | Bin 0 -> 222 bytes
 .../src/main/resources/ui/public/assets/spark.png    | Bin 0 -> 381 bytes
 .../src/main/resources/ui/public/assets/sqoop.png    | Bin 0 -> 482 bytes
 .../src/main/resources/ui/public/assets/ssh.png      | Bin 0 -> 222 bytes
 .../main/resources/ui/public/assets/sub-workflow.png | Bin 0 -> 433 bytes
 16 files changed, 23 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/e64bff0d/contrib/views/wfmanager/src/main/resources/ui/app/domain/cytoscape-style.js
----------------------------------------------------------------------
diff --git a/contrib/views/wfmanager/src/main/resources/ui/app/domain/cytoscape-style.js b/contrib/views/wfmanager/src/main/resources/ui/app/domain/cytoscape-style.js
index 5a85573..c685038 100644
--- a/contrib/views/wfmanager/src/main/resources/ui/app/domain/cytoscape-style.js
+++ b/contrib/views/wfmanager/src/main/resources/ui/app/domain/cytoscape-style.js
@@ -28,6 +28,13 @@ var labelFunction=function(target) {
     return target.data().node.name;
   }
 };
+
+var actionNodeImage = function(target) {
+  if (target && target.data() && target.data().node && target.data().node.actionType) {
+    return 'assets/' + target.data().node.actionType + '.png';
+  }
+};
+
 export default Ember.Object.create({
   style: [
     {
@@ -100,7 +107,8 @@ export default Ember.Object.create({
     {
       selector: 'node[type = "action"]',
       style: {
-        'background-color': actionNodeColor,
+        'background-image': actionNodeImage,
+        'background-position-x': 10,
         width: 150
       }
     },

http://git-wip-us.apache.org/repos/asf/ambari/blob/e64bff0d/contrib/views/wfmanager/src/main/resources/ui/app/index.html
----------------------------------------------------------------------
diff --git a/contrib/views/wfmanager/src/main/resources/ui/app/index.html b/contrib/views/wfmanager/src/main/resources/ui/app/index.html
index df243ad..311441c 100644
--- a/contrib/views/wfmanager/src/main/resources/ui/app/index.html
+++ b/contrib/views/wfmanager/src/main/resources/ui/app/index.html
@@ -40,6 +40,20 @@
   <img src="assets/stop.png"/>
   <img src="assets/join.png"/>
   <img src="assets/sitemap.png"/>
+  <img src="assets/hive.png"/>
+  <img src="assets/hive2.png"/>
+  <img src="assets/sqoop.png"/>
+  <img src="assets/pig.png"/>
+  <img src="assets/sub-workflow.png"/>
+  <img src="assets/java.png"/>
+  <img src="assets/shell.png"/>
+  <img src="assets/distcp.png"/>
+  <img src="assets/map-reduce.png"/>
+  <img src="assets/ssh.png"/>
+  <img src="assets/spark.png"/>
+  <img src="assets/email.png"/>
+  <img src="assets/fs.png"/>
+  <img src="assets/custom.png"/>
 </div>
 
     {{content-for "body"}}

http://git-wip-us.apache.org/repos/asf/ambari/blob/e64bff0d/contrib/views/wfmanager/src/main/resources/ui/public/assets/custom.png
----------------------------------------------------------------------
diff --git a/contrib/views/wfmanager/src/main/resources/ui/public/assets/custom.png b/contrib/views/wfmanager/src/main/resources/ui/public/assets/custom.png
new file mode 100644
index 0000000..3ff3156
Binary files /dev/null and b/contrib/views/wfmanager/src/main/resources/ui/public/assets/custom.png differ

http://git-wip-us.apache.org/repos/asf/ambari/blob/e64bff0d/contrib/views/wfmanager/src/main/resources/ui/public/assets/distcp.png
----------------------------------------------------------------------
diff --git a/contrib/views/wfmanager/src/main/resources/ui/public/assets/distcp.png b/contrib/views/wfmanager/src/main/resources/ui/public/assets/distcp.png
new file mode 100644
index 0000000..c377f82
Binary files /dev/null and b/contrib/views/wfmanager/src/main/resources/ui/public/assets/distcp.png differ

http://git-wip-us.apache.org/repos/asf/ambari/blob/e64bff0d/contrib/views/wfmanager/src/main/resources/ui/public/assets/email.png
----------------------------------------------------------------------
diff --git a/contrib/views/wfmanager/src/main/resources/ui/public/assets/email.png b/contrib/views/wfmanager/src/main/resources/ui/public/assets/email.png
new file mode 100644
index 0000000..a7d9f98
Binary files /dev/null and b/contrib/views/wfmanager/src/main/resources/ui/public/assets/email.png differ

http://git-wip-us.apache.org/repos/asf/ambari/blob/e64bff0d/contrib/views/wfmanager/src/main/resources/ui/public/assets/fs.png
----------------------------------------------------------------------
diff --git a/contrib/views/wfmanager/src/main/resources/ui/public/assets/fs.png b/contrib/views/wfmanager/src/main/resources/ui/public/assets/fs.png
new file mode 100644
index 0000000..1dd73ce
Binary files /dev/null and b/contrib/views/wfmanager/src/main/resources/ui/public/assets/fs.png differ

http://git-wip-us.apache.org/repos/asf/ambari/blob/e64bff0d/contrib/views/wfmanager/src/main/resources/ui/public/assets/hive.png
----------------------------------------------------------------------
diff --git a/contrib/views/wfmanager/src/main/resources/ui/public/assets/hive.png b/contrib/views/wfmanager/src/main/resources/ui/public/assets/hive.png
new file mode 100644
index 0000000..91dfead
Binary files /dev/null and b/contrib/views/wfmanager/src/main/resources/ui/public/assets/hive.png differ

http://git-wip-us.apache.org/repos/asf/ambari/blob/e64bff0d/contrib/views/wfmanager/src/main/resources/ui/public/assets/hive2.png
----------------------------------------------------------------------
diff --git a/contrib/views/wfmanager/src/main/resources/ui/public/assets/hive2.png b/contrib/views/wfmanager/src/main/resources/ui/public/assets/hive2.png
new file mode 100644
index 0000000..91dfead
Binary files /dev/null and b/contrib/views/wfmanager/src/main/resources/ui/public/assets/hive2.png differ

http://git-wip-us.apache.org/repos/asf/ambari/blob/e64bff0d/contrib/views/wfmanager/src/main/resources/ui/public/assets/java.png
----------------------------------------------------------------------
diff --git a/contrib/views/wfmanager/src/main/resources/ui/public/assets/java.png b/contrib/views/wfmanager/src/main/resources/ui/public/assets/java.png
new file mode 100644
index 0000000..ef23574
Binary files /dev/null and b/contrib/views/wfmanager/src/main/resources/ui/public/assets/java.png differ

http://git-wip-us.apache.org/repos/asf/ambari/blob/e64bff0d/contrib/views/wfmanager/src/main/resources/ui/public/assets/map-reduce.png
----------------------------------------------------------------------
diff --git a/contrib/views/wfmanager/src/main/resources/ui/public/assets/map-reduce.png b/contrib/views/wfmanager/src/main/resources/ui/public/assets/map-reduce.png
new file mode 100644
index 0000000..69b034a
Binary files /dev/null and b/contrib/views/wfmanager/src/main/resources/ui/public/assets/map-reduce.png differ

http://git-wip-us.apache.org/repos/asf/ambari/blob/e64bff0d/contrib/views/wfmanager/src/main/resources/ui/public/assets/pig.png
----------------------------------------------------------------------
diff --git a/contrib/views/wfmanager/src/main/resources/ui/public/assets/pig.png b/contrib/views/wfmanager/src/main/resources/ui/public/assets/pig.png
new file mode 100644
index 0000000..15a65fa
Binary files /dev/null and b/contrib/views/wfmanager/src/main/resources/ui/public/assets/pig.png differ

http://git-wip-us.apache.org/repos/asf/ambari/blob/e64bff0d/contrib/views/wfmanager/src/main/resources/ui/public/assets/shell.png
----------------------------------------------------------------------
diff --git a/contrib/views/wfmanager/src/main/resources/ui/public/assets/shell.png b/contrib/views/wfmanager/src/main/resources/ui/public/assets/shell.png
new file mode 100644
index 0000000..43b431d
Binary files /dev/null and b/contrib/views/wfmanager/src/main/resources/ui/public/assets/shell.png differ

http://git-wip-us.apache.org/repos/asf/ambari/blob/e64bff0d/contrib/views/wfmanager/src/main/resources/ui/public/assets/spark.png
----------------------------------------------------------------------
diff --git a/contrib/views/wfmanager/src/main/resources/ui/public/assets/spark.png b/contrib/views/wfmanager/src/main/resources/ui/public/assets/spark.png
new file mode 100644
index 0000000..23a9043
Binary files /dev/null and b/contrib/views/wfmanager/src/main/resources/ui/public/assets/spark.png differ

http://git-wip-us.apache.org/repos/asf/ambari/blob/e64bff0d/contrib/views/wfmanager/src/main/resources/ui/public/assets/sqoop.png
----------------------------------------------------------------------
diff --git a/contrib/views/wfmanager/src/main/resources/ui/public/assets/sqoop.png b/contrib/views/wfmanager/src/main/resources/ui/public/assets/sqoop.png
new file mode 100644
index 0000000..70fb58e
Binary files /dev/null and b/contrib/views/wfmanager/src/main/resources/ui/public/assets/sqoop.png differ

http://git-wip-us.apache.org/repos/asf/ambari/blob/e64bff0d/contrib/views/wfmanager/src/main/resources/ui/public/assets/ssh.png
----------------------------------------------------------------------
diff --git a/contrib/views/wfmanager/src/main/resources/ui/public/assets/ssh.png b/contrib/views/wfmanager/src/main/resources/ui/public/assets/ssh.png
new file mode 100644
index 0000000..43b431d
Binary files /dev/null and b/contrib/views/wfmanager/src/main/resources/ui/public/assets/ssh.png differ

http://git-wip-us.apache.org/repos/asf/ambari/blob/e64bff0d/contrib/views/wfmanager/src/main/resources/ui/public/assets/sub-workflow.png
----------------------------------------------------------------------
diff --git a/contrib/views/wfmanager/src/main/resources/ui/public/assets/sub-workflow.png b/contrib/views/wfmanager/src/main/resources/ui/public/assets/sub-workflow.png
new file mode 100644
index 0000000..83cfeb7
Binary files /dev/null and b/contrib/views/wfmanager/src/main/resources/ui/public/assets/sub-workflow.png differ


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

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


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

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

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


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

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


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

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

Change-Id: I4f6460680f420a5664923136756aaa1e9cb9af09


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

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

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


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


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

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


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

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

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


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


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

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


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

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

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


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

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


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

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


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

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

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


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


[31/50] [abbrv] ambari git commit: AMBARI-20695. "ambari-server upgrade" command does not change owner for all dirs.(vbrodetskyi)

Posted by ja...@apache.org.
AMBARI-20695. "ambari-server upgrade" command does not change owner for all dirs.(vbrodetskyi)


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

Branch: refs/heads/ambari-rest-api-explorer
Commit: b0ac313e31bdd663ca5b8e3ba2f0c36060a7ce5d
Parents: 9781202
Author: Vitaly Brodetskyi <vb...@hortonworks.com>
Authored: Fri Apr 7 14:28:33 2017 +0300
Committer: Vitaly Brodetskyi <vb...@hortonworks.com>
Committed: Fri Apr 7 14:28:33 2017 +0300

----------------------------------------------------------------------
 .../src/main/python/ambari_server/serverConfiguration.py          | 3 +++
 1 file changed, 3 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/b0ac313e/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 fb016d0..7eba9db 100644
--- a/ambari-server/src/main/python/ambari_server/serverConfiguration.py
+++ b/ambari-server/src/main/python/ambari_server/serverConfiguration.py
@@ -530,6 +530,9 @@ class ServerConfigDefaultsLinux(ServerConfigDefaults):
       (AmbariPath.get("/var/lib/ambari-server/keys/.ssh"), "700", "{0}", False),
       (AmbariPath.get("/var/lib/ambari-server/resources/common-services/"), "755", "{0}", True),
       (AmbariPath.get("/var/lib/ambari-server/resources/stacks/"), "755", "{0}", True),
+      (AmbariPath.get("/var/lib/ambari-server/resources/extensions/"), "755", "{0}", True),
+      (AmbariPath.get("/var/lib/ambari-server/resources/dashboards/"), "755", "{0}", True),
+      (AmbariPath.get("/var/lib/ambari-server/resources/mpacks/"), "755", "{0}", True),
       (AmbariPath.get("/var/lib/ambari-server/resources/custom_actions/"), "755", "{0}", True),
       (AmbariPath.get("/var/lib/ambari-server/resources/host_scripts/"), "755", "{0}", True),
       (AmbariPath.get("/var/lib/ambari-server/resources/views/*"), "644", "{0}", True),


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

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


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

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

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


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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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


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

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


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

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

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


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


[29/50] [abbrv] ambari git commit: AMBARI-20551. Blueprint export fails if config-type is not mapped to any service after upgrade (Amruta Borkar via alejandro)

Posted by ja...@apache.org.
AMBARI-20551. Blueprint export fails if config-type is not mapped to any service after upgrade (Amruta Borkar via alejandro)


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

Branch: refs/heads/ambari-rest-api-explorer
Commit: bb614a0ff7cf933e513fec5a6ed7b55c5c89cb9f
Parents: 301896a
Author: Alejandro Fernandez <af...@hortonworks.com>
Authored: Thu Apr 6 16:32:58 2017 -0700
Committer: Alejandro Fernandez <af...@hortonworks.com>
Committed: Thu Apr 6 16:33:01 2017 -0700

----------------------------------------------------------------------
 .../internal/BlueprintConfigurationProcessor.java           | 9 +++++++++
 1 file changed, 9 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/bb614a0f/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/BlueprintConfigurationProcessor.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/BlueprintConfigurationProcessor.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/BlueprintConfigurationProcessor.java
index db1aa07..88a8f80 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/BlueprintConfigurationProcessor.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/BlueprintConfigurationProcessor.java
@@ -517,6 +517,15 @@ public class BlueprintConfigurationProcessor {
     Map<String, Map<String, String>> properties = configuration.getFullProperties();
     for (Map.Entry<String, Map<String, String>> configEntry : properties.entrySet()) {
       String type = configEntry.getKey();
+      try {
+          clusterTopology.getBlueprint().getStack().getServiceForConfigType(type);
+        } catch (IllegalArgumentException illegalArgumentException) {
+            LOG.error(new StringBuilder(String.format("Error encountered while trying to obtain the service name for config type [%s]. ", type))
+            .append("Further processing on this config type will be skipped. ")
+            .append("This usually means that a service's definitions have been manually removed from the Ambari stack definitions. ")
+            .append("If the stack definitions have not been changed manually, this may indicate a stack definition error in Ambari. ").toString(), illegalArgumentException);
+            continue;
+        }
       Map<String, String> typeProperties = configEntry.getValue();
 
       for (Map.Entry<String, String> propertyEntry : typeProperties.entrySet()) {


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

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


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

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

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


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

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


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

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


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

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

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


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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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


[36/50] [abbrv] ambari git commit: AMBARI-20670. Node manager start extremely slow when YARN NM local dirs are very large - ut fix (dgrinenko via echekanskiy)

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


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

Branch: refs/heads/ambari-rest-api-explorer
Commit: 753b38c74723e2ef24ead5112dacb54b127c0d1a
Parents: 5377e66
Author: Eugene Chekanskiy <ec...@hortonworks.com>
Authored: Mon Apr 10 17:08:50 2017 +0300
Committer: Eugene Chekanskiy <ec...@hortonworks.com>
Committed: Mon Apr 10 17:08:50 2017 +0300

----------------------------------------------------------------------
 .../src/test/python/stacks/2.0.6/YARN/test_nodemanager.py      | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/753b38c7/ambari-server/src/test/python/stacks/2.0.6/YARN/test_nodemanager.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/stacks/2.0.6/YARN/test_nodemanager.py b/ambari-server/src/test/python/stacks/2.0.6/YARN/test_nodemanager.py
index 10edb4b..ab5e2cd 100644
--- a/ambari-server/src/test/python/stacks/2.0.6/YARN/test_nodemanager.py
+++ b/ambari-server/src/test/python/stacks/2.0.6/YARN/test_nodemanager.py
@@ -169,8 +169,7 @@ class TestNodeManager(RMFTestCase):
                               mode = 0755,
                               create_parents = True,
                               ignore_failures = True,
-                              cd_access='a',
-                              recursive_mode_flags = {'d': 'a+rwx', 'f': 'a+rw'},
+                              cd_access='a'
                               )
     self.assertResourceCalled('Directory', '/hadoop/yarn/local1',
                               owner = 'yarn',
@@ -178,8 +177,7 @@ class TestNodeManager(RMFTestCase):
                               group = 'hadoop',
                               ignore_failures = True,
                               mode = 0755,
-                              cd_access='a',
-                              recursive_mode_flags = {'d': 'a+rwx', 'f': 'a+rw'}
+                              cd_access='a'
                               )
     self.assertResourceCalled('File', '/var/lib/ambari-agent/data/yarn/yarn_local_dir_mount.hist',
         content = '\n# This file keeps track of the last known mount-point for each dir.\n# It is safe to delete, since it will get regenerated the next time that the component of the service starts.\n# However, it is not advised to delete this file since Ambari may\n# re-create a dir that used to be mounted on a drive but is now mounted on the root.\n# Comments begin with a hash (#) symbol\n# dir,mount_point\n',


[30/50] [abbrv] ambari git commit: AMBARI-20699. Side Nav: improve views dropdown menu.(xiwang)

Posted by ja...@apache.org.
AMBARI-20699. Side Nav: improve views dropdown menu.(xiwang)


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

Branch: refs/heads/ambari-rest-api-explorer
Commit: 97812020b8a116694bff56e724a496bb9faf5bcf
Parents: bb614a0
Author: Xi Wang <xi...@apache.org>
Authored: Thu Apr 6 19:31:53 2017 -0700
Committer: Xi Wang <xi...@apache.org>
Committed: Thu Apr 6 19:32:00 2017 -0700

----------------------------------------------------------------------
 .../app/styles/theme/bootstrap-ambari.css       | 36 ++++++++------------
 1 file changed, 15 insertions(+), 21 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/97812020/ambari-web/app/styles/theme/bootstrap-ambari.css
----------------------------------------------------------------------
diff --git a/ambari-web/app/styles/theme/bootstrap-ambari.css b/ambari-web/app/styles/theme/bootstrap-ambari.css
index b063fcf..b2f5ca4 100644
--- a/ambari-web/app/styles/theme/bootstrap-ambari.css
+++ b/ambari-web/app/styles/theme/bootstrap-ambari.css
@@ -766,9 +766,16 @@ input.radio:checked + label:after {
 .navigation-bar-container ul.nav.side-nav-header li.navigation-header > a.ambari-logo > img {
   height: 25px;
   float: left;
-  margin-top: -2px;
   margin-left: -3px;
 }
+.navigation-bar-container ul.nav.side-nav-header li.navigation-header .btn-group {
+  cursor: pointer;
+  margin-top: 3px;
+}
+.navigation-bar-container ul.nav.side-nav-header li.navigation-header .btn-group:hover span.ambari-header,
+.navigation-bar-container ul.nav.side-nav-header li.navigation-header .btn-group:hover span.toggle-icon {
+  color: #fff;
+}
 .navigation-bar-container ul.nav.side-nav-header li.navigation-header .btn-group span.ambari-header {
   font-family: 'Roboto', sans-serif;
   font-weight: normal;
@@ -777,15 +784,13 @@ input.radio:checked + label:after {
   color: #333;
   font-size: 20px;
   width: 55px;
-  cursor: pointer;
   display: inline;
-  color: #fff;
+  color: #b8bec4;
   padding: 0 8px 0 10px;
 }
 .navigation-bar-container ul.nav.side-nav-header li.navigation-header .btn-group span.toggle-icon {
   margin-bottom: 5px;
   font-size: 13px;
-  cursor: pointer;
   display: inline-block;
   vertical-align: middle;
   color: #b8bec4;
@@ -795,17 +800,7 @@ input.radio:checked + label:after {
   box-shadow: none;
 }
 .navigation-bar-container ul.nav.side-nav-header li.navigation-header ul.dropdown-menu {
-  min-width: 190px;
-  max-width: 190px;
-  width: 190px;
-  right: -43px;
-  left: auto;
   top: 30px;
-  background: #323543;
-  border: none;
-}
-.navigation-bar-container ul.nav.side-nav-header li.navigation-header ul.dropdown-menu li {
-  border: none;
 }
 .navigation-bar-container ul.nav.side-nav-header li.navigation-header ul.dropdown-menu li > a {
   font-family: 'Roboto', sans-serif;
@@ -813,17 +808,15 @@ input.radio:checked + label:after {
   font-style: normal;
   line-height: 1;
   color: #333;
-  font-size: 13px;
-  color: #999;
-  padding: 15px 10px;
-  height: auto;
+  font-size: 14px;
+  color: #666;
+  line-height: 1.42;
   white-space: nowrap;
   overflow: hidden;
   text-overflow: ellipsis;
 }
 .navigation-bar-container ul.nav.side-nav-header li.navigation-header ul.dropdown-menu li > a:hover {
-  background: #404351;
-  color: #fff;
+  background: #f5f5f5;
 }
 .navigation-bar-container ul.nav.side-nav-menu,
 .navigation-bar-container ul.nav.side-nav-footer {
@@ -1139,6 +1132,7 @@ input.radio:checked + label:after {
   position: fixed;
   top: 0;
   bottom: 0;
+  left: 0;
   z-index: 2079;
 }
 .navigation-bar-fit-height .side-nav-header {
@@ -1470,4 +1464,4 @@ a.disabled:hover,
 a:visited.disabled:hover,
 a:focus.disabled:hover {
   text-decoration: none;
-}
+}
\ No newline at end of file


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

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


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

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

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


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


[28/50] [abbrv] ambari git commit: AMBARI-20674 Able to hide the Delete menu item from UI for a given service (dili)

Posted by ja...@apache.org.
AMBARI-20674 Able to hide the Delete menu item from UI for a given service (dili)


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

Branch: refs/heads/ambari-rest-api-explorer
Commit: 301896a12d7bb3b3a1402138ebf10667fc54a369
Parents: 01e3727
Author: Di Li <di...@apache.org>
Authored: Thu Apr 6 16:58:57 2017 -0400
Committer: Di Li <di...@apache.org>
Committed: Thu Apr 6 16:58:57 2017 -0400

----------------------------------------------------------------------
 .../server/controller/StackServiceResponse.java |  8 ++++
 .../internal/StackServiceResourceProvider.java  |  6 +++
 .../ambari/server/stack/ServiceModule.java      |  4 ++
 .../apache/ambari/server/state/ServiceInfo.java | 26 +++++++++++
 .../src/main/resources/properties.json          |  1 +
 .../ambari/server/state/ServiceInfoTest.java    | 47 ++++++++++++++++++++
 ambari-web/app/app.js                           |  4 ++
 ambari-web/app/mappers/stack_service_mapper.js  |  1 +
 ambari-web/app/models/host_component.js         |  3 +-
 ambari-web/app/models/stack_service.js          |  1 +
 .../test/mappers/stack_service_mapper_test.js   |  7 ++-
 ambari-web/test/views/main/service/item_test.js |  3 ++
 12 files changed, 109 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/301896a1/ambari-server/src/main/java/org/apache/ambari/server/controller/StackServiceResponse.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/StackServiceResponse.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/StackServiceResponse.java
index cbff300..8e4200d 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/StackServiceResponse.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/StackServiceResponse.java
@@ -75,6 +75,8 @@ public class StackServiceResponse {
    */
   private boolean credentialStoreRequired;
 
+  private boolean isSupportDeleteViaUI;
+
   /**
    * Constructor.
    *
@@ -112,6 +114,8 @@ public class StackServiceResponse {
     credentialStoreSupported = service.isCredentialStoreSupported();
 
     credentialStoreEnabled = service.isCredentialStoreEnabled();
+
+    isSupportDeleteViaUI = service.isSupportDeleteViaUI();
   }
 
   public ServiceInfo.Selection getSelection() {
@@ -305,4 +309,8 @@ public class StackServiceResponse {
   public void setCredentialStoreRequired(boolean credentialStoreRequired) {
     this.credentialStoreRequired = credentialStoreRequired;
   }
+
+  public boolean isSupportDeleteViaUI(){
+    return isSupportDeleteViaUI;
+  }
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/301896a1/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/StackServiceResourceProvider.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/StackServiceResourceProvider.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/StackServiceResourceProvider.java
index a30d783..2964560 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/StackServiceResourceProvider.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/StackServiceResourceProvider.java
@@ -98,6 +98,9 @@ public class StackServiceResourceProvider extends ReadOnlyResourceProvider {
   private static final String CREDENTIAL_STORE_ENABLED = PropertyHelper.getPropertyId(
       "StackServices", "credential_store_enabled");
 
+  private static final String SUPPORT_DELETE_VIA_UI = PropertyHelper.getPropertyId(
+      "StackServices", "support_delete_via_ui");
+
   private static Set<String> pkPropertyIds = new HashSet<>(
     Arrays.asList(new String[]{STACK_NAME_PROPERTY_ID,
       STACK_VERSION_PROPERTY_ID, SERVICE_NAME_PROPERTY_ID}));
@@ -206,6 +209,9 @@ public class StackServiceResourceProvider extends ReadOnlyResourceProvider {
     setResourceProperty(resource, CREDENTIAL_STORE_ENABLED,
         response.isCredentialStoreEnabled(), requestedIds);
 
+    setResourceProperty(resource, SUPPORT_DELETE_VIA_UI,
+        response.isSupportDeleteViaUI(), requestedIds);
+
     return resource;
   }
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/301896a1/ambari-server/src/main/java/org/apache/ambari/server/stack/ServiceModule.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/stack/ServiceModule.java b/ambari-server/src/main/java/org/apache/ambari/server/stack/ServiceModule.java
index fd65268..d65e758 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/stack/ServiceModule.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/stack/ServiceModule.java
@@ -278,6 +278,10 @@ public class ServiceModule extends BaseModule<ServiceModule, ServiceInfo> implem
       serviceInfo.setSelection(parent.getSelection());
     }
 
+    if(null == serviceInfo.getSupportDeleteViaUIField()){
+      serviceInfo.setSupportDeleteViaUI(parent.isSupportDeleteViaUI());
+    }
+
     mergeCustomCommands(parent.getCustomCommands(), serviceInfo.getCustomCommands());
     mergeConfigDependencies(parent);
     mergeComponents(parentModule, allStacks, commonServices, extensions);

http://git-wip-us.apache.org/repos/asf/ambari/blob/301896a1/ambari-server/src/main/java/org/apache/ambari/server/state/ServiceInfo.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/state/ServiceInfo.java b/ambari-server/src/main/java/org/apache/ambari/server/state/ServiceInfo.java
index 0d0b78b..512ca18 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/state/ServiceInfo.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/state/ServiceInfo.java
@@ -82,6 +82,11 @@ public class ServiceInfo implements Validable{
   @XmlElement(name="deleted")
   private boolean isDeleted = false;
 
+  @XmlElement(name="supportDeleteViaUI")
+  private Boolean supportDeleteViaUIField;
+
+  private boolean supportDeleteViaUIInternal = true;
+
   @JsonIgnore
   @XmlTransient
   private volatile Map<String, Set<String>> configLayout = null;
@@ -291,6 +296,27 @@ public class ServiceInfo implements Validable{
     isDeleted = deleted;
   }
 
+  public Boolean getSupportDeleteViaUIField(){
+    return supportDeleteViaUIField;
+  }
+
+  public void setSupportDeleteViaUIField(Boolean supportDeleteViaUIField) {
+    this.supportDeleteViaUIField = supportDeleteViaUIField;
+  }
+
+  public boolean isSupportDeleteViaUI() {
+    if (null != supportDeleteViaUIField) {
+      return supportDeleteViaUIField.booleanValue();
+    }
+    // If set to null and has a parent, then the value would have already been resolved and set.
+    // Otherwise, return the default value (true).
+    return this.supportDeleteViaUIInternal;
+  }
+
+  public void setSupportDeleteViaUI(boolean supportDeleteViaUI){
+    this.supportDeleteViaUIInternal = supportDeleteViaUI;
+  }
+
   public String getName() {
     return name;
   }

http://git-wip-us.apache.org/repos/asf/ambari/blob/301896a1/ambari-server/src/main/resources/properties.json
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/properties.json b/ambari-server/src/main/resources/properties.json
index 04d32ea..c2545fe 100644
--- a/ambari-server/src/main/resources/properties.json
+++ b/ambari-server/src/main/resources/properties.json
@@ -224,6 +224,7 @@
         "StackServices/credential_store_enabled",
         "StackServices/credential_store_required",
         "StackServices/properties",
+        "StackServices/support_delete_via_ui",
         "_"
     ],
     "StackConfiguration":[

http://git-wip-us.apache.org/repos/asf/ambari/blob/301896a1/ambari-server/src/test/java/org/apache/ambari/server/state/ServiceInfoTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/state/ServiceInfoTest.java b/ambari-server/src/test/java/org/apache/ambari/server/state/ServiceInfoTest.java
index 1b9296e..c10c243 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/state/ServiceInfoTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/state/ServiceInfoTest.java
@@ -651,6 +651,53 @@ public class ServiceInfoTest {
     assertTrue("true".equals(serviceProperties.get(ServiceInfo.DEFAULT_SERVICE_MONITORED_PROPERTY.getKey())));
   }
 
+  @Test
+  public void testSupportDeleteViaUI() throws Exception {
+    //Explicitly set to true
+    String serviceInfoXml =
+      "<metainfo>" +
+      "  <schemaVersion>2.0</schemaVersion>" +
+      "  <services>" +
+      "    <service>" +
+      "      <name>HDFS</name>" +
+      "      <displayName>HDFS</displayName>" +
+      "      <supportDeleteViaUI>true</supportDeleteViaUI>" +
+      "    </service>" +
+      "  </services>" +
+      "</metainfo>";
+    Map<String, ServiceInfo> serviceInfoMap = getServiceInfo(serviceInfoXml);
+    assertTrue(serviceInfoMap.get("HDFS").isSupportDeleteViaUI());
+
+    //Explicitly set to false
+    serviceInfoXml =
+        "<metainfo>" +
+        "  <schemaVersion>2.0</schemaVersion>" +
+        "  <services>" +
+        "    <service>" +
+        "      <name>HDFS</name>" +
+        "      <displayName>HDFS</displayName>" +
+        "      <supportDeleteViaUI>false</supportDeleteViaUI>" +
+        "    </service>" +
+        "  </services>" +
+        "</metainfo>";
+      serviceInfoMap = getServiceInfo(serviceInfoXml);
+      assertFalse(serviceInfoMap.get("HDFS").isSupportDeleteViaUI());
+
+      //Default to true
+      serviceInfoXml =
+          "<metainfo>" +
+          "  <schemaVersion>2.0</schemaVersion>" +
+          "  <services>" +
+          "    <service>" +
+          "      <name>HDFS</name>" +
+          "      <displayName>HDFS</displayName>" +
+          "    </service>" +
+          "  </services>" +
+          "</metainfo>";
+        serviceInfoMap = getServiceInfo(serviceInfoXml);
+        assertTrue(serviceInfoMap.get("HDFS").isSupportDeleteViaUI());
+  }
+
   public static Map<String, ServiceInfo> getServiceInfo(String xml) throws JAXBException {
     InputStream configStream = new ByteArrayInputStream(xml.getBytes());
     JAXBContext jaxbContext = JAXBContext.newInstance(ServiceMetainfoXml.class);

http://git-wip-us.apache.org/repos/asf/ambari/blob/301896a1/ambari-web/app/app.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/app.js b/ambari-web/app/app.js
index 9c7d874..e32084c 100644
--- a/ambari-web/app/app.js
+++ b/ambari-web/app/app.js
@@ -304,6 +304,10 @@ module.exports = Em.Application.create({
 
     supportsServiceCheck: function() {
       return App.StackService.find().filterProperty('serviceCheckSupported').mapProperty('serviceName');
+    }.property('App.router.clusterController.isLoaded'),
+
+    supportsDeleteViaUI: function() {
+      return App.StackService.find().filterProperty('supportDeleteViaUi').mapProperty('serviceName');
     }.property('App.router.clusterController.isLoaded')
   }),
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/301896a1/ambari-web/app/mappers/stack_service_mapper.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/mappers/stack_service_mapper.js b/ambari-web/app/mappers/stack_service_mapper.js
index 4bda89d..8931066 100644
--- a/ambari-web/app/mappers/stack_service_mapper.js
+++ b/ambari-web/app/mappers/stack_service_mapper.js
@@ -40,6 +40,7 @@ App.stackServiceMapper = App.QuickDataMapper.create({
     is_service_with_widgets: 'is_service_with_widgets',
     required_services: 'required_services',
     service_check_supported: 'service_check_supported',
+    support_delete_via_ui: 'support_delete_via_ui',
     service_components_key: 'service_components',
     service_components_type: 'array',
     service_components: {

http://git-wip-us.apache.org/repos/asf/ambari/blob/301896a1/ambari-web/app/models/host_component.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/models/host_component.js b/ambari-web/app/models/host_component.js
index 3950f97..cdcf991 100644
--- a/ambari-web/app/models/host_component.js
+++ b/ambari-web/app/models/host_component.js
@@ -412,7 +412,8 @@ App.HostComponentActionMap = {
         action: 'deleteService',
         context: ctx.get('serviceName'),
         label: Em.I18n.t('services.service.actions.deleteService'),
-        cssClass: 'glyphicon glyphicon-remove'
+        cssClass: 'glyphicon glyphicon-remove',
+        isHidden: !App.get('services.supportsDeleteViaUI').contains(ctx.get('serviceName')) //hide the menu item when the service has a custom behavior setting in its metainfo.xml to disallow Delete Services via UI
       },
       IMMEDIATE_STOP_HAWQ_SERVICE: {
         action: 'executeHawqCustomCommand',

http://git-wip-us.apache.org/repos/asf/ambari/blob/301896a1/ambari-web/app/models/stack_service.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/models/stack_service.js b/ambari-web/app/models/stack_service.js
index 4f21288..241f6ab 100644
--- a/ambari-web/app/models/stack_service.js
+++ b/ambari-web/app/models/stack_service.js
@@ -34,6 +34,7 @@ App.StackService = DS.Model.extend({
   configTypes: DS.attr('object'),
   serviceVersion: DS.attr('string'),
   serviceCheckSupported: DS.attr('boolean'),
+  supportDeleteViaUi: DS.attr('boolean'),
   stackName: DS.attr('string'),
   stackVersion: DS.attr('string'),
   selection: DS.attr('string'),

http://git-wip-us.apache.org/repos/asf/ambari/blob/301896a1/ambari-web/test/mappers/stack_service_mapper_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/mappers/stack_service_mapper_test.js b/ambari-web/test/mappers/stack_service_mapper_test.js
index 9da8b24..88b4b43 100644
--- a/ambari-web/test/mappers/stack_service_mapper_test.js
+++ b/ambari-web/test/mappers/stack_service_mapper_test.js
@@ -36,6 +36,7 @@ describe('App.stackServiceMapper', function () {
                 "ZOOKEEPER"
               ],
               "service_check_supported" : true,
+              "support_delete_via_ui" : false,
               "service_name" : "KAFKA",
               "service_version" : "0.8.1.2.2",
               "stack_name" : "HDP",
@@ -102,7 +103,8 @@ describe('App.stackServiceMapper', function () {
           },
           {
             "StackServices" : {
-              "service_name" : "ZOOKEEPER"
+              "service_name" : "ZOOKEEPER",
+              "support_delete_via_ui" : true
             },
             "components" : [ ],
             "artifacts" : [ ]
@@ -202,6 +204,7 @@ describe('App.stackServiceMapper', function () {
         isInstallable: true,
         isServiceWithWidgets: false,
         serviceCheckSupported: true,
+        supportDeleteViaUi : false,
         requiredServices: ["ZOOKEEPER"]
       },
       componentResult = {
@@ -253,6 +256,8 @@ describe('App.stackServiceMapper', function () {
       expect(components.findProperty('componentName', 'DATANODE').get('bulkCommandsMasterComponentName')).to.eql("NAMENODE");
       expect(components.findProperty('componentName', 'DATANODE').get('decommissionAllowed')).to.be.true;
       expect(components.findProperty('componentName', 'DATANODE').get('reassignAllowed')).to.be.true;
+
+      expect(services.findProperty('serviceName', 'ZOOKEEPER').get('supportDeleteViaUi')).to.be.true;
     });
 
   });

http://git-wip-us.apache.org/repos/asf/ambari/blob/301896a1/ambari-web/test/views/main/service/item_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/views/main/service/item_test.js b/ambari-web/test/views/main/service/item_test.js
index 4b2e6f9..e4a1940 100644
--- a/ambari-web/test/views/main/service/item_test.js
+++ b/ambari-web/test/views/main/service/item_test.js
@@ -144,6 +144,7 @@ describe('App.MainServiceItemView', function () {
         {
           serviceName: "HDFS",
           displayName: "HDFS",
+          supportDeleteViaUi: true,
           isSingleNode: true,
           serviceTypes: ["HA_MODE"],
           slaveComponents: [
@@ -449,6 +450,8 @@ describe('App.MainServiceItemView', function () {
             return ["NAMENODE", "SECONDARY_NAMENODE", "APP_TIMELINE_SERVER", "RESOURCEMANAGER", "WEBHCAT_SERVER", "OOZIE_SERVER"];
           case 'services.supportsServiceCheck':
             return ["HDFS", "MAPREDUCE2", "YARN", "HIVE", "HBASE", "PIG", "SQOOP", "OOZIE", "ZOOKEEPER", "FALCON", "STORM", "FLUME", "SLIDER", "KNOX", "KAFKA"];
+          case 'services.supportsDeleteViaUI':
+            return ["HDFS", "MAPREDUCE2", "YARN", "HIVE", "HBASE", "PIG", "SQOOP", "OOZIE", "ZOOKEEPER", "FALCON", "STORM", "FLUME", "SLIDER", "KNOX", "KAFKA"];
           case 'components.addableToHost':
             return ["DATANODE", "HDFS_CLIENT", "MAPREDUCE2_CLIENT", "NODEMANAGER", "YARN_CLIENT", "TEZ_CLIENT", "GANGLIA_MONITOR", "HCAT", "HIVE_CLIENT", "HIVE_METASTORE", "HIVE_SERVER", "WEBHCAT_SERVER", "HBASE_CLIENT", "HBASE_MASTER", "HBASE_REGIONSERVER", "PIG", "SQOOP", "OOZIE_CLIENT", "OOZIE_SERVER", "ZOOKEEPER_CLIENT", "ZOOKEEPER_SERVER", "FALCON_CLIENT", "SUPERVISOR", "FLUME_HANDLER", "METRICS_MONITOR", "KAFKA_BROKER", "KERBEROS_CLIENT", "KNOX_GATEWAY", "SLIDER", "SPARK_CLIENT"];
           case 'allHostNames.length':


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

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


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

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

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


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

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

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


[42/50] [abbrv] ambari git commit: AMBARI-20718.User should not be allowed to validate/Submit the workflow in case of duplicate action nodes(Venkata Sairam via padmapriyanitt)

Posted by ja...@apache.org.
AMBARI-20718.User should not be allowed to validate/Submit the workflow in case of duplicate action nodes(Venkata Sairam via padmapriyanitt)


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

Branch: refs/heads/ambari-rest-api-explorer
Commit: c0cef762666dab2619d4b4b511ed828e29325201
Parents: 953cc9c
Author: padmapriyanitt <pa...@gmail.com>
Authored: Tue Apr 11 15:40:47 2017 +0530
Committer: padmapriyanitt <pa...@gmail.com>
Committed: Tue Apr 11 15:40:47 2017 +0530

----------------------------------------------------------------------
 .../src/main/resources/ui/app/components/flow-designer.js     | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/c0cef762/contrib/views/wfmanager/src/main/resources/ui/app/components/flow-designer.js
----------------------------------------------------------------------
diff --git a/contrib/views/wfmanager/src/main/resources/ui/app/components/flow-designer.js b/contrib/views/wfmanager/src/main/resources/ui/app/components/flow-designer.js
index e3f3718..17f21ee 100644
--- a/contrib/views/wfmanager/src/main/resources/ui/app/components/flow-designer.js
+++ b/contrib/views/wfmanager/src/main/resources/ui/app/components/flow-designer.js
@@ -723,10 +723,9 @@ export default Ember.Component.extend(FindNodeMixin, Validations, {
   },
   openJobConfig () {
     this.get('workflowContext').clearErrors();
-    var workflowGenerator=WorkflowGenerator.create({workflow:this.get("workflow"),
-    workflowContext:this.get('workflowContext')});
-    var workflowXml=workflowGenerator.process();
-    if(this.get('workflowContext').hasErrors()){
+    var workflowGenerator = WorkflowGenerator.create({workflow:this.get("workflow"), workflowContext:this.get('workflowContext')});
+    var workflowXml = workflowGenerator.process();
+    if(this.get('workflowContext').hasErrors() || (this.get("validationErrors") && this.get("validationErrors").length)){
       this.set('errors',this.get('workflowContext').getErrors());
     }else{
       var dynamicProperties = this.get('propertyExtractor').getDynamicProperties(workflowXml);


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

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


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

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

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


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


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

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


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

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

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


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


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

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


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

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

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


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


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

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


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

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

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


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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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