ambari git commit: AMBARI-13474. RU: Fix hbase snapshot (dlysnichenko)

2015-10-20 Thread dmitriusan
Repository: ambari
Updated Branches:
  refs/heads/trunk fa26a59ef -> e526efa78


AMBARI-13474. RU: Fix hbase snapshot (dlysnichenko)


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

Branch: refs/heads/trunk
Commit: e526efa78572312a99453583e61392acf5b44939
Parents: fa26a59
Author: Lisnichenko Dmitro 
Authored: Tue Oct 20 10:52:12 2015 +0300
Committer: Lisnichenko Dmitro 
Committed: Tue Oct 20 10:52:12 2015 +0300

--
 .../src/main/resources/stacks/HDP/2.2/upgrades/upgrade-2.2.xml | 2 +-
 .../src/main/resources/stacks/HDP/2.2/upgrades/upgrade-2.3.xml | 2 +-
 .../src/main/resources/stacks/HDP/2.3/upgrades/upgrade-2.3.xml | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/e526efa7/ambari-server/src/main/resources/stacks/HDP/2.2/upgrades/upgrade-2.2.xml
--
diff --git 
a/ambari-server/src/main/resources/stacks/HDP/2.2/upgrades/upgrade-2.2.xml 
b/ambari-server/src/main/resources/stacks/HDP/2.2/upgrades/upgrade-2.2.xml
index e54f0d8..e787ca3 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.2/upgrades/upgrade-2.2.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.2/upgrades/upgrade-2.2.xml
@@ -48,7 +48,7 @@
   
 
   scripts/hbase_upgrade.py
-  snapshot
+  take_snapshot
 
   
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/e526efa7/ambari-server/src/main/resources/stacks/HDP/2.2/upgrades/upgrade-2.3.xml
--
diff --git 
a/ambari-server/src/main/resources/stacks/HDP/2.2/upgrades/upgrade-2.3.xml 
b/ambari-server/src/main/resources/stacks/HDP/2.2/upgrades/upgrade-2.3.xml
index 8c8db7c..233d86b 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.2/upgrades/upgrade-2.3.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.2/upgrades/upgrade-2.3.xml
@@ -48,7 +48,7 @@
   
 
   scripts/hbase_upgrade.py
-  snapshot
+  take_snapshot
 
   
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/e526efa7/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/upgrade-2.3.xml
--
diff --git 
a/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/upgrade-2.3.xml 
b/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/upgrade-2.3.xml
index 08b34be..e61bd67 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/upgrade-2.3.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/upgrade-2.3.xml
@@ -48,7 +48,7 @@
   
 
   scripts/hbase_upgrade.py
-  snapshot
+  take_snapshot
 
   
 



ambari git commit: AMBARI-13477 Unit tests failures after merging express upgrade (dsen)

2015-10-20 Thread dsen
Repository: ambari
Updated Branches:
  refs/heads/trunk 28c059f08 -> c9d75dd5d


AMBARI-13477 Unit tests failures after merging express upgrade (dsen)


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

Branch: refs/heads/trunk
Commit: c9d75dd5d5e14c5b971c86795d49a8d27bf0a454
Parents: 28c059f
Author: Dmytro Sen 
Authored: Tue Oct 20 13:51:45 2015 +0300
Committer: Dmytro Sen 
Committed: Tue Oct 20 13:51:45 2015 +0300

--
 .../ambari/server/checks/HostsMasterMaintenanceCheck.java   | 4 
 .../ambari/server/checks/HostsRepositoryVersionCheck.java   | 4 
 .../ambari/server/checks/HostsMasterMaintenanceCheckTest.java   | 4 
 .../ambari/server/checks/HostsRepositoryVersionCheckTest.java   | 5 +
 4 files changed, 17 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/c9d75dd5/ambari-server/src/main/java/org/apache/ambari/server/checks/HostsMasterMaintenanceCheck.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/checks/HostsMasterMaintenanceCheck.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/checks/HostsMasterMaintenanceCheck.java
index 39ab39f..cdb7c61 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/checks/HostsMasterMaintenanceCheck.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/checks/HostsMasterMaintenanceCheck.java
@@ -53,6 +53,10 @@ public class HostsMasterMaintenanceCheck extends 
AbstractCheckDescriptor {
 super(CheckDescription.HOSTS_MASTER_MAINTENANCE);
   }
 
+  public boolean isApplicable(PrereqCheckRequest request) throws 
AmbariException {
+  return super.isApplicable(request) && request.getRepositoryVersion() != 
null;
+  }
+
   @Override
   public void perform(PrerequisiteCheck prerequisiteCheck, PrereqCheckRequest 
request) throws AmbariException {
 final String clusterName = request.getClusterName();

http://git-wip-us.apache.org/repos/asf/ambari/blob/c9d75dd5/ambari-server/src/main/java/org/apache/ambari/server/checks/HostsRepositoryVersionCheck.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/checks/HostsRepositoryVersionCheck.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/checks/HostsRepositoryVersionCheck.java
index 00862ac..30250ef 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/checks/HostsRepositoryVersionCheck.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/checks/HostsRepositoryVersionCheck.java
@@ -53,6 +53,10 @@ public class HostsRepositoryVersionCheck extends 
AbstractCheckDescriptor {
 super(CheckDescription.HOSTS_REPOSITORY_VERSION);
   }
 
+  public boolean isApplicable(PrereqCheckRequest request) throws 
AmbariException {
+return super.isApplicable(request) && request.getRepositoryVersion() != 
null;
+  }
+
   @Override
   public void perform(PrerequisiteCheck prerequisiteCheck, PrereqCheckRequest 
request)
   throws AmbariException {

http://git-wip-us.apache.org/repos/asf/ambari/blob/c9d75dd5/ambari-server/src/test/java/org/apache/ambari/server/checks/HostsMasterMaintenanceCheckTest.java
--
diff --git 
a/ambari-server/src/test/java/org/apache/ambari/server/checks/HostsMasterMaintenanceCheckTest.java
 
b/ambari-server/src/test/java/org/apache/ambari/server/checks/HostsMasterMaintenanceCheckTest.java
index 18a1d45..3f79767 100644
--- 
a/ambari-server/src/test/java/org/apache/ambari/server/checks/HostsMasterMaintenanceCheckTest.java
+++ 
b/ambari-server/src/test/java/org/apache/ambari/server/checks/HostsMasterMaintenanceCheckTest.java
@@ -65,6 +65,10 @@ public class HostsMasterMaintenanceCheckTest {
 HostsMasterMaintenanceCheck hmmc2 = new HostsMasterMaintenanceCheck();
 hmmc2.config = config;
 Assert.assertTrue(hmmc2.isApplicable(request));
+request.setRepositoryVersion(null);
+
+hmmc2.config = config;
+Assert.assertFalse(hmmc2.isApplicable(request));
   }
 
   @Test

http://git-wip-us.apache.org/repos/asf/ambari/blob/c9d75dd5/ambari-server/src/test/java/org/apache/ambari/server/checks/HostsRepositoryVersionCheckTest.java
--
diff --git 
a/ambari-server/src/test/java/org/apache/ambari/server/checks/HostsRepositoryVersionCheckTest.java
 
b/ambari-server/src/test/java/org/apache/ambari/server/checks/HostsRepositoryVersionCheckTest.java
index 0c2c92a..42a3bb4 100644
--- 

ambari git commit: AMBARI-13486. Improve configs mapping (onechiporenko)

2015-10-20 Thread onechiporenko
Repository: ambari
Updated Branches:
  refs/heads/branch-2.1 20c966f42 -> 69f501a45


AMBARI-13486. Improve configs mapping (onechiporenko)


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

Branch: refs/heads/branch-2.1
Commit: 69f501a4532d03805d77de3877f0fe9216549262
Parents: 20c966f
Author: Oleg Nechiporenko 
Authored: Tue Oct 20 12:41:11 2015 +0300
Committer: Oleg Nechiporenko 
Committed: Tue Oct 20 12:55:54 2015 +0300

--
 ambari-web/app/utils/config.js | 106 +++-
 1 file changed, 81 insertions(+), 25 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/69f501a4/ambari-web/app/utils/config.js
--
diff --git a/ambari-web/app/utils/config.js b/ambari-web/app/utils/config.js
index bb3da78..5585c82 100644
--- a/ambari-web/app/utils/config.js
+++ b/ambari-web/app/utils/config.js
@@ -19,6 +19,8 @@
 var App = require('app');
 var stringUtils = require('utils/string_utils');
 
+var configTagFromFileNameMap = {};
+
 App.config = Em.Object.create({
 
   CONFIG_GROUP_NAME_MAX_LENGTH: 18,
@@ -69,7 +71,12 @@ App.config = Em.Object.create({
* @method getConfigTagFromFileName
**/
   getConfigTagFromFileName: function (fileName) {
-return fileName.endsWith('.xml') ? fileName.slice(0, -4) : fileName;
+if (configTagFromFileNameMap[fileName]) {
+  return configTagFromFileNameMap[fileName];
+}
+var ret = fileName.endsWith('.xml') ? fileName.slice(0, -4) : fileName;
+configTagFromFileNameMap[fileName] = ret;
+return ret;
   },
 
   setPreDefinedServiceConfigs: function (isMiscTabToBeAdded) {
@@ -119,6 +126,14 @@ App.config = Em.Object.create({
 
   secureConfigs: require('data/HDP2/secure_mapping'),
 
+  secureConfigsMap: function () {
+var ret = {};
+this.get('secureConfigs').forEach(function (sc) {
+  ret[sc.name] = true;
+});
+return ret;
+  }.property('secureConfigs.[]'),
+
   customStackMapping: require('data/custom_stack_map'),
 
   mapCustomStack: function () {
@@ -204,6 +219,16 @@ App.config = Em.Object.create({
 });
   },
 
+  serviceByConfigTypeMap: function () {
+var ret = {};
+App.StackService.find().forEach(function(s) {
+  Object.keys(s.get('configTypes')).forEach(function (ct) {
+ret[ct] = s;
+  });
+});
+return ret;
+  }.property(),
+
   /**
* generates config objects
* @param configGroups
@@ -215,9 +240,10 @@ App.config = Em.Object.create({
   mergePredefinedWithSaved: function (configGroups, serviceName, 
selectedConfigGroup, canEdit) {
 var configs = [];
 var serviceConfigProperty;
+var serviceByConfigTypeMap = this.get('serviceByConfigTypeMap');
 
 configGroups.forEach(function (siteConfig) {
-  var service = this.getServiceByConfigType(siteConfig.type);
+  var service = serviceByConfigTypeMap[siteConfig.type];
   if (service && serviceName != 'MISC') {
 serviceName = service.get('serviceName');
   }
@@ -267,7 +293,7 @@ App.config = Em.Object.create({
 
   /**
* This method sets default values for config property
-   * These property values has the lowest priority and can be overriden be 
stack/UI
+   * These property values has the lowest priority and can be overridden be 
stack/UI
* config property but is used when such properties are absent in stack/UI 
configs
* @param {string} name
* @param {string} serviceName
@@ -277,7 +303,7 @@ App.config = Em.Object.create({
* @returns {Object}
*/
   createDefaultConfig: function(name, serviceName, fileName, definedInStack, 
coreObject) {
-return $.extend({
+var tpl = {
   /** core properties **/
   name: name,
   filename: fileName,
@@ -310,7 +336,9 @@ App.config = Em.Object.create({
   options: null,
   radioName: null,
   belongsToService: []
-}, coreObject);
+};
+return Object.keys(coreObject|| {}).length ?
+  $.extend(tpl, coreObject) : tpl;
   },
 
   /**
@@ -371,12 +399,19 @@ App.config = Em.Object.create({
* @returns {*}
*/
   getPropertyIfExists: function(propertyName, defaultValue, firstPriority, 
secondPriority) {
-if (firstPriority && !Em.isNone(Em.get(firstPriority, propertyName))) {
-  return Em.get(firstPriority, propertyName);
-} else if (secondPriority && !Em.isNone(Em.get(secondPriority, 
propertyName))) {
-  return Em.get(secondPriority, propertyName);
-} else {
-  return defaultValue;
+firstPriority = firstPriority || {};
+secondPriority = secondPriority || {};
+var fp = 

ambari git commit: AMBARI-13486. Improve configs mapping (onechiporenko)

2015-10-20 Thread onechiporenko
Repository: ambari
Updated Branches:
  refs/heads/trunk 3056a7642 -> 28c059f08


AMBARI-13486. Improve configs mapping (onechiporenko)


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

Branch: refs/heads/trunk
Commit: 28c059f08f26225f51e158a7ecab56bf6796ace9
Parents: 3056a76
Author: Oleg Nechiporenko 
Authored: Tue Oct 20 12:41:11 2015 +0300
Committer: Oleg Nechiporenko 
Committed: Tue Oct 20 12:41:11 2015 +0300

--
 ambari-web/app/utils/config.js | 106 +++-
 1 file changed, 81 insertions(+), 25 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/28c059f0/ambari-web/app/utils/config.js
--
diff --git a/ambari-web/app/utils/config.js b/ambari-web/app/utils/config.js
index fc47221..037c420 100644
--- a/ambari-web/app/utils/config.js
+++ b/ambari-web/app/utils/config.js
@@ -19,6 +19,8 @@
 var App = require('app');
 var stringUtils = require('utils/string_utils');
 
+var configTagFromFileNameMap = {};
+
 App.config = Em.Object.create({
 
   CONFIG_GROUP_NAME_MAX_LENGTH: 18,
@@ -69,7 +71,12 @@ App.config = Em.Object.create({
* @method getConfigTagFromFileName
**/
   getConfigTagFromFileName: function (fileName) {
-return fileName.endsWith('.xml') ? fileName.slice(0, -4) : fileName;
+if (configTagFromFileNameMap[fileName]) {
+  return configTagFromFileNameMap[fileName];
+}
+var ret = fileName.endsWith('.xml') ? fileName.slice(0, -4) : fileName;
+configTagFromFileNameMap[fileName] = ret;
+return ret;
   },
 
   /**
@@ -129,6 +136,14 @@ App.config = Em.Object.create({
 
   secureConfigs: require('data/HDP2/secure_mapping'),
 
+  secureConfigsMap: function () {
+var ret = {};
+this.get('secureConfigs').forEach(function (sc) {
+  ret[sc.name] = true;
+});
+return ret;
+  }.property('secureConfigs.[]'),
+
   customStackMapping: require('data/custom_stack_map'),
 
   mapCustomStack: function () {
@@ -206,6 +221,16 @@ App.config = Em.Object.create({
 });
   },
 
+  serviceByConfigTypeMap: function () {
+var ret = {};
+App.StackService.find().forEach(function(s) {
+  Object.keys(s.get('configTypes')).forEach(function (ct) {
+ret[ct] = s;
+  });
+});
+return ret;
+  }.property(),
+
   /**
* generates config objects
* @param configGroups
@@ -217,9 +242,10 @@ App.config = Em.Object.create({
   mergePredefinedWithSaved: function (configGroups, serviceName, 
selectedConfigGroup, canEdit) {
 var configs = [];
 var serviceConfigProperty;
+var serviceByConfigTypeMap = this.get('serviceByConfigTypeMap');
 
 configGroups.forEach(function (siteConfig) {
-  var service = this.getServiceByConfigType(siteConfig.type);
+  var service = serviceByConfigTypeMap[siteConfig.type];
   if (service && serviceName != 'MISC') {
 serviceName = service.get('serviceName');
   }
@@ -269,7 +295,7 @@ App.config = Em.Object.create({
 
   /**
* This method sets default values for config property
-   * These property values has the lowest priority and can be overriden be 
stack/UI
+   * These property values has the lowest priority and can be overridden be 
stack/UI
* config property but is used when such properties are absent in stack/UI 
configs
* @param {string} name
* @param {string} serviceName
@@ -279,7 +305,7 @@ App.config = Em.Object.create({
* @returns {Object}
*/
   createDefaultConfig: function(name, serviceName, fileName, definedInStack, 
coreObject) {
-return $.extend({
+var tpl = {
   /** core properties **/
   name: name,
   filename: fileName,
@@ -312,7 +338,9 @@ App.config = Em.Object.create({
   options: null,
   radioName: null,
   belongsToService: []
-}, coreObject);
+};
+return Object.keys(coreObject|| {}).length ?
+  $.extend(tpl, coreObject) : tpl;
   },
 
   /**
@@ -373,12 +401,19 @@ App.config = Em.Object.create({
* @returns {*}
*/
   getPropertyIfExists: function(propertyName, defaultValue, firstPriority, 
secondPriority) {
-if (firstPriority && !Em.isNone(Em.get(firstPriority, propertyName))) {
-  return Em.get(firstPriority, propertyName);
-} else if (secondPriority && !Em.isNone(Em.get(secondPriority, 
propertyName))) {
-  return Em.get(secondPriority, propertyName);
-} else {
-  return defaultValue;
+firstPriority = firstPriority || {};
+secondPriority = secondPriority || {};
+var fp = Em.get(firstPriority, propertyName);
+if (firstPriority && 

[1/2] ambari git commit: AMBARI-13489. MySQL Ambari Repository gives Key Too Long error messages for hostcomponentdesiredstate table. (dlysnichenko)

2015-10-20 Thread dmitriusan
Repository: ambari
Updated Branches:
  refs/heads/branch-2.1 37d14e429 -> 466833dc9
  refs/heads/trunk c9d75dd5d -> 99de0edb7


AMBARI-13489. MySQL Ambari Repository gives Key Too Long error messages for 
hostcomponentdesiredstate table. (dlysnichenko)


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

Branch: refs/heads/trunk
Commit: 99de0edb7f33a3e878032a5bb0d95466087ec408
Parents: c9d75dd
Author: Lisnichenko Dmitro 
Authored: Tue Oct 20 17:10:31 2015 +0300
Committer: Lisnichenko Dmitro 
Committed: Tue Oct 20 17:10:31 2015 +0300

--
 .../main/resources/Ambari-DDL-MySQL-CREATE.sql  | 130 +--
 1 file changed, 65 insertions(+), 65 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/99de0edb/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 40ec758..892eaa2 100644
--- a/ambari-server/src/main/resources/Ambari-DDL-MySQL-CREATE.sql
+++ b/ambari-server/src/main/resources/Ambari-DDL-MySQL-CREATE.sql
@@ -29,8 +29,8 @@ delimiter ;
 
 CREATE TABLE stack(
   stack_id BIGINT NOT NULL,
-  stack_name VARCHAR(255) NOT NULL,
-  stack_version VARCHAR(255) NOT NULL,
+  stack_name VARCHAR(100) NOT NULL,
+  stack_version VARCHAR(100) NOT NULL,
   PRIMARY KEY (stack_id)
 );
 
@@ -48,9 +48,9 @@ CREATE TABLE clusters (
 
 CREATE TABLE clusterconfig (
   config_id BIGINT NOT NULL,
-  version_tag VARCHAR(255) NOT NULL,
+  version_tag VARCHAR(100) NOT NULL,
   version BIGINT NOT NULL,
-  type_name VARCHAR(255) NOT NULL,
+  type_name VARCHAR(100) NOT NULL,
   cluster_id BIGINT NOT NULL,
   stack_id BIGINT NOT NULL,
   config_data LONGTEXT NOT NULL,
@@ -107,11 +107,11 @@ CREATE TABLE cluster_version (
 
 CREATE TABLE hostcomponentdesiredstate (
   cluster_id BIGINT NOT NULL,
-  component_name VARCHAR(255) NOT NULL,
+  component_name VARCHAR(100) NOT NULL,
   desired_stack_id BIGINT NOT NULL,
   desired_state VARCHAR(255) NOT NULL,
   host_id BIGINT NOT NULL,
-  service_name VARCHAR(255) NOT NULL,
+  service_name VARCHAR(100) NOT NULL,
   admin_state VARCHAR(32),
   maintenance_state VARCHAR(32) NOT NULL DEFAULT 'ACTIVE',
   security_state VARCHAR(32) NOT NULL DEFAULT 'UNSECURED',
@@ -122,12 +122,12 @@ CREATE TABLE hostcomponentdesiredstate (
 CREATE TABLE hostcomponentstate (
   id BIGINT NOT NULL,
   cluster_id BIGINT NOT NULL,
-  component_name VARCHAR(255) NOT NULL,
+  component_name VARCHAR(100) NOT NULL,
   version VARCHAR(32) NOT NULL DEFAULT 'UNKNOWN',
   current_stack_id BIGINT NOT NULL,
   current_state VARCHAR(255) NOT NULL,
   host_id BIGINT NOT NULL,
-  service_name VARCHAR(255) NOT NULL,
+  service_name VARCHAR(100) NOT NULL,
   upgrade_state VARCHAR(32) NOT NULL DEFAULT 'NONE',
   security_state VARCHAR(32) NOT NULL DEFAULT 'UNSECURED',
   CONSTRAINT pk_hostcomponentstate PRIMARY KEY (id)
@@ -172,11 +172,11 @@ CREATE TABLE host_version (
   PRIMARY KEY (id));
 
 CREATE TABLE servicecomponentdesiredstate (
-  component_name VARCHAR(255) NOT NULL,
+  component_name VARCHAR(100) NOT NULL,
   cluster_id BIGINT NOT NULL,
   desired_stack_id BIGINT NOT NULL,
   desired_state VARCHAR(255) NOT NULL,
-  service_name VARCHAR(255) NOT NULL,
+  service_name VARCHAR(100) NOT NULL,
   PRIMARY KEY (component_name, cluster_id, service_name)
 );
 
@@ -339,9 +339,9 @@ CREATE TABLE ambari_sequences (
 CREATE TABLE confgroupclusterconfigmapping (
   config_group_id BIGINT NOT NULL,
   cluster_id BIGINT NOT NULL,
-  config_type VARCHAR(255) NOT NULL,
-  version_tag VARCHAR(255) NOT NULL,
-  user_name VARCHAR(255) DEFAULT '_db',
+  config_type VARCHAR(100) NOT NULL,
+  version_tag VARCHAR(100) NOT NULL,
+  user_name VARCHAR(100) DEFAULT '_db',
   create_timestamp BIGINT NOT NULL,
   PRIMARY KEY(config_group_id, cluster_id, config_type));
 
@@ -401,28 +401,28 @@ CREATE TABLE blueprint (
 );
 
 CREATE TABLE hostgroup (
-  blueprint_name VARCHAR(255) NOT NULL,
-  name VARCHAR(255) NOT NULL,
+  blueprint_name VARCHAR(100) NOT NULL,
+  name VARCHAR(100) NOT NULL,
   cardinality VARCHAR(255) NOT NULL,
   PRIMARY KEY(blueprint_name, name));
 
 CREATE TABLE hostgroup_component (
-  blueprint_name VARCHAR(255) NOT NULL,
-  hostgroup_name VARCHAR(255) NOT NULL,
-  name VARCHAR(255) NOT NULL,
+  blueprint_name VARCHAR(100) NOT NULL,
+  hostgroup_name VARCHAR(100) NOT NULL,
+  name VARCHAR(100) NOT NULL,
   PRIMARY KEY(blueprint_name, hostgroup_name, name));
 
 CREATE TABLE 

ambari git commit: AMBARI-13484. Oozie server not showing delete option on hosts page

2015-10-20 Thread alexantonenko
Repository: ambari
Updated Branches:
  refs/heads/trunk e526efa78 -> 3056a7642


AMBARI-13484. Oozie server not showing delete option on hosts page


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

Branch: refs/heads/trunk
Commit: 3056a7642544ed11b4036b901c5f64fb8743e819
Parents: e526efa
Author: Alex Antonenko 
Authored: Tue Oct 20 10:59:27 2015 +0300
Committer: Alex Antonenko 
Committed: Tue Oct 20 11:04:48 2015 +0300

--
 .../app/models/stack_service_component.js   |   4 +-
 .../test/models/stack_service_component_test.js |  64 ++-
 ambari-web/test/service_components.js   | 165 +++
 3 files changed, 230 insertions(+), 3 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/3056a764/ambari-web/app/models/stack_service_component.js
--
diff --git a/ambari-web/app/models/stack_service_component.js 
b/ambari-web/app/models/stack_service_component.js
index f11b0a2..b51ed1f 100644
--- a/ambari-web/app/models/stack_service_component.js
+++ b/ambari-web/app/models/stack_service_component.js
@@ -151,7 +151,7 @@ App.StackServiceComponent = DS.Model.extend({
* @property {Boolean} isMasterAddableOnlyOnHA
*/
   isMasterAddableOnlyOnHA: function () {
-return ['NAMENODE', 'RESOURCEMANAGER', 'RANGER_ADMIN', 
'OOZIE_SERVER'].contains(this.get('componentName'));
+return ['NAMENODE', 'RESOURCEMANAGER', 
'RANGER_ADMIN'].contains(this.get('componentName'));
   }.property('componentName'),
 
   /** @property {Boolean} isHAComponentOnly - Components that can be installed 
only if HA enabled **/
@@ -197,7 +197,7 @@ App.StackServiceComponent = DS.Model.extend({
 
   /** @property {Boolean} isNotAddableOnlyInInstall - is this component 
addable, except Install and Add Service Wizards  **/
   isNotAddableOnlyInInstall: function() {
-return ['HIVE_METASTORE', 'HIVE_SERVER', 
'RANGER_KMS_SERVER'].contains(this.get('componentName'));
+return ['HIVE_METASTORE', 'HIVE_SERVER', 'RANGER_KMS_SERVER', 
'OOZIE_SERVER'].contains(this.get('componentName'));
   }.property('componentName')
 
 });

http://git-wip-us.apache.org/repos/asf/ambari/blob/3056a764/ambari-web/test/models/stack_service_component_test.js
--
diff --git a/ambari-web/test/models/stack_service_component_test.js 
b/ambari-web/test/models/stack_service_component_test.js
index 8774a1f..cc58fcb 100644
--- a/ambari-web/test/models/stack_service_component_test.js
+++ b/ambari-web/test/models/stack_service_component_test.js
@@ -294,7 +294,7 @@ var componentPropertiesValidationTests = [
 expected: {
   isShownOnInstallerAssignMasterPage: false
 }
-  },
+  }
 ];
 
 describe('App.StackServiceComponent', function() {
@@ -316,6 +316,68 @@ describe('App.StackServiceComponent', function() {
 });
   });
 
+  describe('#isMasterAddableOnlyOnHA', function () {
+
+var cases = [
+  {
+componentName: 'NAMENODE',
+isMasterAddableOnlyOnHA: true
+  },
+  {
+componentName: 'RESOURCEMANAGER',
+isMasterAddableOnlyOnHA: true
+  },
+  {
+componentName: 'RANGER_ADMIN',
+isMasterAddableOnlyOnHA: true
+  },
+  {
+componentName: 'OOZIE_SERVER',
+isMasterAddableOnlyOnHA: false
+  }
+];
+
+cases.forEach(function (item) {
+  it(item.componentName, function () {
+expect(App.StackServiceComponent.find().findProperty('componentName', 
item.componentName).get('isMasterAddableOnlyOnHA')).to.equal(item.isMasterAddableOnlyOnHA);
+  });
+});
+
+  });
+
+  describe('#isNotAddableOnlyInInstall', function () {
+
+var cases = [
+  {
+componentName: 'HIVE_METASTORE',
+isNotAddableOnlyInInstall: true
+  },
+  {
+componentName: 'HIVE_SERVER',
+isNotAddableOnlyInInstall: true
+  },
+  {
+componentName: 'RANGER_KMS_SERVER',
+isNotAddableOnlyInInstall: true
+  },
+  {
+componentName: 'OOZIE_SERVER',
+isNotAddableOnlyInInstall: true
+  },
+  {
+componentName: 'NAMENODE',
+isNotAddableOnlyInInstall: false
+  }
+];
+
+cases.forEach(function (item) {
+  it(item.componentName, function () {
+expect(App.StackServiceComponent.find().findProperty('componentName', 
item.componentName).get('isNotAddableOnlyInInstall')).to.equal(item.isNotAddableOnlyInInstall);
+  });
+});
+
+  });
+
   after(function() {
 modelSetup.cleanStackServiceComponent();
   });


ambari git commit: AMBARI-13458. Expose in the API whether downgrade is supported or not (dgrinenko via dlysnichenko)

2015-10-20 Thread dmitriusan
Repository: ambari
Updated Branches:
  refs/heads/branch-2.1 792b81094 -> bad8603c8


AMBARI-13458. Expose in the API whether downgrade is supported or not 
(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/bad8603c
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/bad8603c
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/bad8603c

Branch: refs/heads/branch-2.1
Commit: bad8603c8ad543eb0688f73bd3a6fcc159963efa
Parents: 792b810
Author: Lisnichenko Dmitro 
Authored: Tue Oct 20 10:38:30 2015 +0300
Committer: Lisnichenko Dmitro 
Committed: Tue Oct 20 10:38:30 2015 +0300

--
 .../internal/UpgradeResourceProvider.java   |  4 ++
 .../server/orm/entities/UpgradeEntity.java  | 15 +-
 .../ambari/server/state/stack/UpgradePack.java  | 18 +++
 .../server/upgrade/UpgradeCatalog213.java   | 28 --
 .../main/resources/Ambari-DDL-MySQL-CREATE.sql  |  1 +
 .../main/resources/Ambari-DDL-Oracle-CREATE.sql |  1 +
 .../resources/Ambari-DDL-Postgres-CREATE.sql|  1 +
 .../Ambari-DDL-Postgres-EMBEDDED-CREATE.sql |  1 +
 .../resources/Ambari-DDL-SQLAnywhere-CREATE.sql |  1 +
 .../resources/Ambari-DDL-SQLServer-CREATE.sql   |  1 +
 .../HDP/2.1/upgrades/nonrolling-upgrade-2.3.xml |  1 +
 .../ambari/server/orm/dao/UpgradeDAOTest.java   |  4 ++
 .../server/upgrade/UpgradeCatalog213Test.java   | 55 +++-
 13 files changed, 126 insertions(+), 5 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/bad8603c/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 27e3377..153fc9c 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
@@ -126,6 +126,7 @@ public class UpgradeResourceProvider extends 
AbstractControllerResourceProvider
   protected static final String UPGRADE_FROM_VERSION = "Upgrade/from_version";
   protected static final String UPGRADE_TO_VERSION = "Upgrade/to_version";
   protected static final String UPGRADE_DIRECTION = "Upgrade/direction";
+  protected static final String UPGRADE_DOWNGRADE_ALLOWED = 
"Upgrade/downgrade_allowed";
   protected static final String UPGRADE_REQUEST_STATUS = 
"Upgrade/request_status";
   protected static final String UPGRADE_ABORT_REASON = "Upgrade/abort_reason";
   protected static final String UPGRADE_SKIP_PREREQUISITE_CHECKS = 
"Upgrade/skip_prerequisite_checks";
@@ -240,6 +241,7 @@ public class UpgradeResourceProvider extends 
AbstractControllerResourceProvider
 PROPERTY_IDS.add(UPGRADE_FROM_VERSION);
 PROPERTY_IDS.add(UPGRADE_TO_VERSION);
 PROPERTY_IDS.add(UPGRADE_DIRECTION);
+PROPERTY_IDS.add(UPGRADE_DOWNGRADE_ALLOWED);
 PROPERTY_IDS.add(UPGRADE_SKIP_FAILURES);
 PROPERTY_IDS.add(UPGRADE_SKIP_SC_FAILURES);
 PROPERTY_IDS.add(UPGRADE_SKIP_MANUAL_VERIFICATION);
@@ -464,6 +466,7 @@ public class UpgradeResourceProvider extends 
AbstractControllerResourceProvider
 setResourceProperty(resource, UPGRADE_FROM_VERSION, 
entity.getFromVersion(), requestedIds);
 setResourceProperty(resource, UPGRADE_TO_VERSION, entity.getToVersion(), 
requestedIds);
 setResourceProperty(resource, UPGRADE_DIRECTION, entity.getDirection(), 
requestedIds);
+setResourceProperty(resource, UPGRADE_DOWNGRADE_ALLOWED, 
entity.isDowngradeAllowed(), requestedIds);
 
 return resource;
   }
@@ -805,6 +808,7 @@ public class UpgradeResourceProvider extends 
AbstractControllerResourceProvider
 entity.setDirection(direction);
 entity.setUpgradePackage(pack.getName());
 entity.setUpgradeType(pack.getType());
+entity.setDowngradeAllowed(pack.isDowngradeAllowed());
 
 req.getRequestStatusResponse();
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/bad8603c/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 ad9073a..297fc8d 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/UpgradeEntity.java
+++ 

ambari git commit: AMBARI-13484. Oozie server not showing delete option on hosts page

2015-10-20 Thread alexantonenko
Repository: ambari
Updated Branches:
  refs/heads/branch-2.1 bad8603c8 -> 20c966f42


AMBARI-13484. Oozie server not showing delete option on hosts page


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

Branch: refs/heads/branch-2.1
Commit: 20c966f42f962cd03f780261767954420525495a
Parents: bad8603
Author: Alex Antonenko 
Authored: Tue Oct 20 10:59:27 2015 +0300
Committer: Alex Antonenko 
Committed: Tue Oct 20 11:06:44 2015 +0300

--
 .../app/models/stack_service_component.js   |   4 +-
 .../test/models/stack_service_component_test.js |  64 ++-
 ambari-web/test/service_components.js   | 165 +++
 3 files changed, 230 insertions(+), 3 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/20c966f4/ambari-web/app/models/stack_service_component.js
--
diff --git a/ambari-web/app/models/stack_service_component.js 
b/ambari-web/app/models/stack_service_component.js
index f11b0a2..b51ed1f 100644
--- a/ambari-web/app/models/stack_service_component.js
+++ b/ambari-web/app/models/stack_service_component.js
@@ -151,7 +151,7 @@ App.StackServiceComponent = DS.Model.extend({
* @property {Boolean} isMasterAddableOnlyOnHA
*/
   isMasterAddableOnlyOnHA: function () {
-return ['NAMENODE', 'RESOURCEMANAGER', 'RANGER_ADMIN', 
'OOZIE_SERVER'].contains(this.get('componentName'));
+return ['NAMENODE', 'RESOURCEMANAGER', 
'RANGER_ADMIN'].contains(this.get('componentName'));
   }.property('componentName'),
 
   /** @property {Boolean} isHAComponentOnly - Components that can be installed 
only if HA enabled **/
@@ -197,7 +197,7 @@ App.StackServiceComponent = DS.Model.extend({
 
   /** @property {Boolean} isNotAddableOnlyInInstall - is this component 
addable, except Install and Add Service Wizards  **/
   isNotAddableOnlyInInstall: function() {
-return ['HIVE_METASTORE', 'HIVE_SERVER', 
'RANGER_KMS_SERVER'].contains(this.get('componentName'));
+return ['HIVE_METASTORE', 'HIVE_SERVER', 'RANGER_KMS_SERVER', 
'OOZIE_SERVER'].contains(this.get('componentName'));
   }.property('componentName')
 
 });

http://git-wip-us.apache.org/repos/asf/ambari/blob/20c966f4/ambari-web/test/models/stack_service_component_test.js
--
diff --git a/ambari-web/test/models/stack_service_component_test.js 
b/ambari-web/test/models/stack_service_component_test.js
index 8774a1f..cc58fcb 100644
--- a/ambari-web/test/models/stack_service_component_test.js
+++ b/ambari-web/test/models/stack_service_component_test.js
@@ -294,7 +294,7 @@ var componentPropertiesValidationTests = [
 expected: {
   isShownOnInstallerAssignMasterPage: false
 }
-  },
+  }
 ];
 
 describe('App.StackServiceComponent', function() {
@@ -316,6 +316,68 @@ describe('App.StackServiceComponent', function() {
 });
   });
 
+  describe('#isMasterAddableOnlyOnHA', function () {
+
+var cases = [
+  {
+componentName: 'NAMENODE',
+isMasterAddableOnlyOnHA: true
+  },
+  {
+componentName: 'RESOURCEMANAGER',
+isMasterAddableOnlyOnHA: true
+  },
+  {
+componentName: 'RANGER_ADMIN',
+isMasterAddableOnlyOnHA: true
+  },
+  {
+componentName: 'OOZIE_SERVER',
+isMasterAddableOnlyOnHA: false
+  }
+];
+
+cases.forEach(function (item) {
+  it(item.componentName, function () {
+expect(App.StackServiceComponent.find().findProperty('componentName', 
item.componentName).get('isMasterAddableOnlyOnHA')).to.equal(item.isMasterAddableOnlyOnHA);
+  });
+});
+
+  });
+
+  describe('#isNotAddableOnlyInInstall', function () {
+
+var cases = [
+  {
+componentName: 'HIVE_METASTORE',
+isNotAddableOnlyInInstall: true
+  },
+  {
+componentName: 'HIVE_SERVER',
+isNotAddableOnlyInInstall: true
+  },
+  {
+componentName: 'RANGER_KMS_SERVER',
+isNotAddableOnlyInInstall: true
+  },
+  {
+componentName: 'OOZIE_SERVER',
+isNotAddableOnlyInInstall: true
+  },
+  {
+componentName: 'NAMENODE',
+isNotAddableOnlyInInstall: false
+  }
+];
+
+cases.forEach(function (item) {
+  it(item.componentName, function () {
+expect(App.StackServiceComponent.find().findProperty('componentName', 
item.componentName).get('isNotAddableOnlyInInstall')).to.equal(item.isNotAddableOnlyInInstall);
+  });
+});
+
+  });
+
   after(function() {
 modelSetup.cleanStackServiceComponent();
   

[2/2] ambari git commit: AMBARI-13489. MySQL Ambari Repository gives Key Too Long error messages for hostcomponentdesiredstate table. (dlysnichenko)

2015-10-20 Thread dmitriusan
AMBARI-13489. MySQL Ambari Repository gives Key Too Long error messages for 
hostcomponentdesiredstate table. (dlysnichenko)


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

Branch: refs/heads/branch-2.1
Commit: 466833dc9ea4b744300d6ef5c56a6ffe8050a129
Parents: 37d14e4
Author: Lisnichenko Dmitro 
Authored: Tue Oct 20 17:13:16 2015 +0300
Committer: Lisnichenko Dmitro 
Committed: Tue Oct 20 17:13:16 2015 +0300

--
 .../main/resources/Ambari-DDL-MySQL-CREATE.sql  | 130 +--
 1 file changed, 65 insertions(+), 65 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/466833dc/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 94a5cd9..c7dd7e3 100644
--- a/ambari-server/src/main/resources/Ambari-DDL-MySQL-CREATE.sql
+++ b/ambari-server/src/main/resources/Ambari-DDL-MySQL-CREATE.sql
@@ -29,8 +29,8 @@ delimiter ;
 
 CREATE TABLE stack(
   stack_id BIGINT NOT NULL,
-  stack_name VARCHAR(255) NOT NULL,
-  stack_version VARCHAR(255) NOT NULL,
+  stack_name VARCHAR(100) NOT NULL,
+  stack_version VARCHAR(100) NOT NULL,
   PRIMARY KEY (stack_id)
 );
 
@@ -48,9 +48,9 @@ CREATE TABLE clusters (
 
 CREATE TABLE clusterconfig (
   config_id BIGINT NOT NULL,
-  version_tag VARCHAR(255) NOT NULL,
+  version_tag VARCHAR(100) NOT NULL,
   version BIGINT NOT NULL,
-  type_name VARCHAR(255) NOT NULL,
+  type_name VARCHAR(100) NOT NULL,
   cluster_id BIGINT NOT NULL,
   stack_id BIGINT NOT NULL,
   config_data LONGTEXT NOT NULL,
@@ -107,11 +107,11 @@ CREATE TABLE cluster_version (
 
 CREATE TABLE hostcomponentdesiredstate (
   cluster_id BIGINT NOT NULL,
-  component_name VARCHAR(255) NOT NULL,
+  component_name VARCHAR(100) NOT NULL,
   desired_stack_id BIGINT NOT NULL,
   desired_state VARCHAR(255) NOT NULL,
   host_id BIGINT NOT NULL,
-  service_name VARCHAR(255) NOT NULL,
+  service_name VARCHAR(100) NOT NULL,
   admin_state VARCHAR(32),
   maintenance_state VARCHAR(32) NOT NULL DEFAULT 'ACTIVE',
   security_state VARCHAR(32) NOT NULL DEFAULT 'UNSECURED',
@@ -122,12 +122,12 @@ CREATE TABLE hostcomponentdesiredstate (
 CREATE TABLE hostcomponentstate (
   id BIGINT NOT NULL,
   cluster_id BIGINT NOT NULL,
-  component_name VARCHAR(255) NOT NULL,
+  component_name VARCHAR(100) NOT NULL,
   version VARCHAR(32) NOT NULL DEFAULT 'UNKNOWN',
   current_stack_id BIGINT NOT NULL,
   current_state VARCHAR(255) NOT NULL,
   host_id BIGINT NOT NULL,
-  service_name VARCHAR(255) NOT NULL,
+  service_name VARCHAR(100) NOT NULL,
   upgrade_state VARCHAR(32) NOT NULL DEFAULT 'NONE',
   security_state VARCHAR(32) NOT NULL DEFAULT 'UNSECURED',
   CONSTRAINT pk_hostcomponentstate PRIMARY KEY (id)
@@ -172,11 +172,11 @@ CREATE TABLE host_version (
   PRIMARY KEY (id));
 
 CREATE TABLE servicecomponentdesiredstate (
-  component_name VARCHAR(255) NOT NULL,
+  component_name VARCHAR(100) NOT NULL,
   cluster_id BIGINT NOT NULL,
   desired_stack_id BIGINT NOT NULL,
   desired_state VARCHAR(255) NOT NULL,
-  service_name VARCHAR(255) NOT NULL,
+  service_name VARCHAR(100) NOT NULL,
   PRIMARY KEY (component_name, cluster_id, service_name)
 );
 
@@ -339,9 +339,9 @@ CREATE TABLE ambari_sequences (
 CREATE TABLE confgroupclusterconfigmapping (
   config_group_id BIGINT NOT NULL,
   cluster_id BIGINT NOT NULL,
-  config_type VARCHAR(255) NOT NULL,
-  version_tag VARCHAR(255) NOT NULL,
-  user_name VARCHAR(255) DEFAULT '_db',
+  config_type VARCHAR(100) NOT NULL,
+  version_tag VARCHAR(100) NOT NULL,
+  user_name VARCHAR(100) DEFAULT '_db',
   create_timestamp BIGINT NOT NULL,
   PRIMARY KEY(config_group_id, cluster_id, config_type));
 
@@ -401,28 +401,28 @@ CREATE TABLE blueprint (
 );
 
 CREATE TABLE hostgroup (
-  blueprint_name VARCHAR(255) NOT NULL,
-  name VARCHAR(255) NOT NULL,
+  blueprint_name VARCHAR(100) NOT NULL,
+  name VARCHAR(100) NOT NULL,
   cardinality VARCHAR(255) NOT NULL,
   PRIMARY KEY(blueprint_name, name));
 
 CREATE TABLE hostgroup_component (
-  blueprint_name VARCHAR(255) NOT NULL,
-  hostgroup_name VARCHAR(255) NOT NULL,
-  name VARCHAR(255) NOT NULL,
+  blueprint_name VARCHAR(100) NOT NULL,
+  hostgroup_name VARCHAR(100) NOT NULL,
+  name VARCHAR(100) NOT NULL,
   PRIMARY KEY(blueprint_name, hostgroup_name, name));
 
 CREATE TABLE blueprint_configuration (
-  blueprint_name VARCHAR(255) NOT NULL,
-  type_name VARCHAR(255) NOT NULL,
+  blueprint_name VARCHAR(100) NOT NULL,

[1/2] ambari git commit: AMBARI-13490. If there are more than one ambari-server*jar in classpath we should fail to start (aonishuk)

2015-10-20 Thread aonishuk
Repository: ambari
Updated Branches:
  refs/heads/branch-2.1 466833dc9 -> 8bc1a98a5
  refs/heads/trunk 99de0edb7 -> 1cd72bddd


AMBARI-13490. If there are more than one ambari-server*jar in classpath we 
should fail to start (aonishuk)


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

Branch: refs/heads/trunk
Commit: 1cd72bddd362dbc8916759ef4f0e5b7b5531b0bd
Parents: 99de0ed
Author: Andrew Onishuk 
Authored: Tue Oct 20 17:19:54 2015 +0300
Committer: Andrew Onishuk 
Committed: Tue Oct 20 17:19:54 2015 +0300

--
 .../ambari/server/controller/AmbariServer.java  | 26 
 1 file changed, 26 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/1cd72bdd/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariServer.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariServer.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariServer.java
index 8f3869f..5bc0962 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariServer.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariServer.java
@@ -20,10 +20,13 @@ package org.apache.ambari.server.controller;
 
 
 import java.io.File;
+import java.io.IOException;
 import java.net.Authenticator;
 import java.net.BindException;
 import java.net.PasswordAuthentication;
+import java.net.URL;
 import java.util.EnumSet;
+import java.util.Enumeration;
 import java.util.Map;
 
 import javax.crypto.BadPaddingException;
@@ -150,6 +153,29 @@ public class AmbariServer {
   static {
 Velocity.setProperty("runtime.log.logsystem.log4j.logger", 
VELOCITY_LOG_CATEGORY);
   }
+  
+  private static final String CLASSPATH_CHECK_CLASS = 
"org/apache/ambari/server/controller/AmbariServer.class";
+  private static final String CLASSPATH_SANITY_CHECK_FAILURE_MESSAGE = "%s 
class is found in multiple jar files. Possible reasons include multiple ambari 
server jar files in the ambari classpath.\n" +
+  "Check for additional ambari server jar files and check that 
/usr/lib/ambari-server/ambari-server*.jar matches only one file.";
+  
+  static {
+Enumeration ambariServerClassUrls;
+try {
+  ambariServerClassUrls = 
AmbariServer.class.getClassLoader().getResources(CLASSPATH_CHECK_CLASS);
+  
+  int ambariServerClassUrlsSize = 0;
+  while(ambariServerClassUrls.hasMoreElements()){
+ambariServerClassUrlsSize++;
+URL url = ambariServerClassUrls.nextElement();
+LOG.info(String.format("Found %s class in %s", CLASSPATH_CHECK_CLASS, 
url.getPath()));
+  }
+  if(ambariServerClassUrlsSize>1) {
+throw new 
RuntimeException(String.format(CLASSPATH_SANITY_CHECK_FAILURE_MESSAGE, 
CLASSPATH_CHECK_CLASS));
+  }
+} catch (IOException e) {
+e.printStackTrace();
+}
+  }
 
   private Server server = null;
 



[2/2] ambari git commit: AMBARI-13490. If there are more than one ambari-server*jar in classpath we should fail to start (aonishuk)

2015-10-20 Thread aonishuk
AMBARI-13490. If there are more than one ambari-server*jar in classpath we 
should fail to start (aonishuk)


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

Branch: refs/heads/branch-2.1
Commit: 8bc1a98a5d50c78d9adb0f350d3dedaa9d723548
Parents: 466833d
Author: Andrew Onishuk 
Authored: Tue Oct 20 17:19:59 2015 +0300
Committer: Andrew Onishuk 
Committed: Tue Oct 20 17:19:59 2015 +0300

--
 .../ambari/server/controller/AmbariServer.java  | 26 
 1 file changed, 26 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/8bc1a98a/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariServer.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariServer.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariServer.java
index d1444d4..6a7fd6a 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariServer.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariServer.java
@@ -20,10 +20,13 @@ package org.apache.ambari.server.controller;
 
 
 import java.io.File;
+import java.io.IOException;
 import java.net.Authenticator;
 import java.net.BindException;
 import java.net.PasswordAuthentication;
+import java.net.URL;
 import java.util.EnumSet;
+import java.util.Enumeration;
 import java.util.Map;
 
 import javax.crypto.BadPaddingException;
@@ -151,6 +154,29 @@ public class AmbariServer {
   static {
 Velocity.setProperty("runtime.log.logsystem.log4j.logger", 
VELOCITY_LOG_CATEGORY);
   }
+  
+  private static final String CLASSPATH_CHECK_CLASS = 
"org/apache/ambari/server/controller/AmbariServer.class";
+  private static final String CLASSPATH_SANITY_CHECK_FAILURE_MESSAGE = "%s 
class is found in multiple jar files. Possible reasons include multiple ambari 
server jar files in the ambari classpath.\n" +
+  "Check for additional ambari server jar files and check that 
/usr/lib/ambari-server/ambari-server*.jar matches only one file.";
+  
+  static {
+Enumeration ambariServerClassUrls;
+try {
+  ambariServerClassUrls = 
AmbariServer.class.getClassLoader().getResources(CLASSPATH_CHECK_CLASS);
+  
+  int ambariServerClassUrlsSize = 0;
+  while(ambariServerClassUrls.hasMoreElements()){
+ambariServerClassUrlsSize++;
+URL url = ambariServerClassUrls.nextElement();
+LOG.info(String.format("Found %s class in %s", CLASSPATH_CHECK_CLASS, 
url.getPath()));
+  }
+  if(ambariServerClassUrlsSize>1) {
+throw new 
RuntimeException(String.format(CLASSPATH_SANITY_CHECK_FAILURE_MESSAGE, 
CLASSPATH_CHECK_CLASS));
+  }
+} catch (IOException e) {
+e.printStackTrace();
+}
+  }
 
   private Server server = null;
 



ambari git commit: AMBARI-13492. NN HA wizard gets stuck when JournalNodes fail after getting started. (akovalenko)

2015-10-20 Thread akovalenko
Repository: ambari
Updated Branches:
  refs/heads/trunk f1e9e3460 -> 02814780f


AMBARI-13492. NN HA wizard gets stuck when JournalNodes fail after getting 
started. (akovalenko)


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

Branch: refs/heads/trunk
Commit: 02814780fa779b08a778754a0aeee1f5b1da3097
Parents: f1e9e34
Author: Aleksandr Kovalenko 
Authored: Tue Oct 20 20:01:14 2015 +0300
Committer: Aleksandr Kovalenko 
Committed: Tue Oct 20 20:06:08 2015 +0300

--
 .../nameNode/step6_controller.js| 69 +---
 ambari-web/app/messages.js  |  1 +
 .../highAvailability/nameNode/step6_view.js | 17 +++--
 .../nameNode/step6_view_test.js | 23 ---
 4 files changed, 86 insertions(+), 24 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/02814780/ambari-web/app/controllers/main/admin/highAvailability/nameNode/step6_controller.js
--
diff --git 
a/ambari-web/app/controllers/main/admin/highAvailability/nameNode/step6_controller.js
 
b/ambari-web/app/controllers/main/admin/highAvailability/nameNode/step6_controller.js
index a44f5e0..0ef3048 100644
--- 
a/ambari-web/app/controllers/main/admin/highAvailability/nameNode/step6_controller.js
+++ 
b/ambari-web/app/controllers/main/admin/highAvailability/nameNode/step6_controller.js
@@ -24,22 +24,56 @@ App.HighAvailabilityWizardStep6Controller = 
Em.Controller.extend({
 
   POLL_INTERVAL: 1000,
 
-  isNextEnabled: function(){
-//only 3 JournalNodes could be installed
-return (this.get('initJnCounter') === 3);
-  }.property('initJnCounter'),
+  /**
+   * Define whether next button should be enabled
+   * @type {Boolean}
+   */
+  isNextEnabled: false,
 
+  /**
+   * Counter of initialized JournalNodes
+   * @type {Number}
+   */
   initJnCounter: 0,
 
+  /**
+   * Counter of completed requests
+   * @type {Number}
+   */
+  requestsCounter: 0,
+
+  /**
+   * Define whether are some not started JournalNodes
+   * @type {Boolean}
+   */
+  hasStoppedJNs: false,
+
+  /**
+   * Current status for step.
+   * waiting - for waiting for initializing
+   * done - for completed initializing check
+   * journalnode_stopped - if there are stopped JournalNode
+   * @type {String}
+   */
+  status: 'waiting',
+
+  loadStep: function () {
+this.set('status', 'waiting');
+this.set('isNextEnabled', false);
+this.pullCheckPointStatus();
+  },
+
   pullCheckPointStatus: function () {
 this.set('initJnCounter', 0);
+this.set('requestsCounter', 0);
+this.set('hasStoppedJNs', false);
 var hostNames = 
this.get('content.masterComponentHosts').filterProperty('component', 
"JOURNALNODE").mapProperty('hostName');
 hostNames.forEach(function (hostName) {
   this.pullEachJnStatus(hostName);
 }, this);
   },
 
-  pullEachJnStatus: function(hostName){
+  pullEachJnStatus: function (hostName) {
 App.ajax.send({
   name: 'admin.high_availability.getJnCheckPointStatus',
   sender: this,
@@ -53,17 +87,32 @@ App.HighAvailabilityWizardStep6Controller = 
Em.Controller.extend({
   checkJnCheckPointStatus: function (data) {
 var self = this;
 var journalStatusInfo;
+var initJnCounter = 0;
+
 if (data.metrics && data.metrics.dfs) {
   journalStatusInfo = 
$.parseJSON(data.metrics.dfs.journalnode.journalsStatus);
   if (journalStatusInfo[this.get('content.nameServiceId')] && 
journalStatusInfo[this.get('content.nameServiceId')].Formatted === "true") {
-this.set("initJnCounter", (this.get('initJnCounter') + 1));
-return;
+initJnCounter = this.incrementProperty('initJnCounter');
   }
+} else {
+  this.set('hasStoppedJNs', true);
 }
 
-window.setTimeout(function () {
-  self.pullEachJnStatus(data.HostRoles.host_name);
-}, self.POLL_INTERVAL);
+if (this.incrementProperty('requestsCounter') === 3) {
+  if (initJnCounter === 3) {
+this.set('status', 'done');
+this.set('isNextEnabled', true);
+  } else {
+if (this.get('hasStoppedJNs')) {
+  this.set('status', 'journalnode_stopped')
+} else {
+  this.set('status', 'waiting');
+}
+window.setTimeout(function () {
+  self.pullCheckPointStatus();
+}, self.POLL_INTERVAL);
+  }
+}
   },
 
   done: function () {

http://git-wip-us.apache.org/repos/asf/ambari/blob/02814780/ambari-web/app/messages.js
--
diff --git 

ambari git commit: AMBARI-13492. NN HA wizard gets stuck when JournalNodes fail after getting started. (akovalenko)

2015-10-20 Thread akovalenko
Repository: ambari
Updated Branches:
  refs/heads/branch-2.1 fc4787530 -> 2aee7bf10


AMBARI-13492. NN HA wizard gets stuck when JournalNodes fail after getting 
started. (akovalenko)


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

Branch: refs/heads/branch-2.1
Commit: 2aee7bf1028095669d0f38978efa65066eb7bf5b
Parents: fc47875
Author: Aleksandr Kovalenko 
Authored: Tue Oct 20 19:12:36 2015 +0300
Committer: Aleksandr Kovalenko 
Committed: Tue Oct 20 20:01:14 2015 +0300

--
 .../nameNode/step6_controller.js| 69 +---
 ambari-web/app/messages.js  |  1 +
 .../highAvailability/nameNode/step6_view.js | 17 +++--
 .../nameNode/step6_view_test.js | 23 ---
 4 files changed, 86 insertions(+), 24 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/2aee7bf1/ambari-web/app/controllers/main/admin/highAvailability/nameNode/step6_controller.js
--
diff --git 
a/ambari-web/app/controllers/main/admin/highAvailability/nameNode/step6_controller.js
 
b/ambari-web/app/controllers/main/admin/highAvailability/nameNode/step6_controller.js
index a44f5e0..0ef3048 100644
--- 
a/ambari-web/app/controllers/main/admin/highAvailability/nameNode/step6_controller.js
+++ 
b/ambari-web/app/controllers/main/admin/highAvailability/nameNode/step6_controller.js
@@ -24,22 +24,56 @@ App.HighAvailabilityWizardStep6Controller = 
Em.Controller.extend({
 
   POLL_INTERVAL: 1000,
 
-  isNextEnabled: function(){
-//only 3 JournalNodes could be installed
-return (this.get('initJnCounter') === 3);
-  }.property('initJnCounter'),
+  /**
+   * Define whether next button should be enabled
+   * @type {Boolean}
+   */
+  isNextEnabled: false,
 
+  /**
+   * Counter of initialized JournalNodes
+   * @type {Number}
+   */
   initJnCounter: 0,
 
+  /**
+   * Counter of completed requests
+   * @type {Number}
+   */
+  requestsCounter: 0,
+
+  /**
+   * Define whether are some not started JournalNodes
+   * @type {Boolean}
+   */
+  hasStoppedJNs: false,
+
+  /**
+   * Current status for step.
+   * waiting - for waiting for initializing
+   * done - for completed initializing check
+   * journalnode_stopped - if there are stopped JournalNode
+   * @type {String}
+   */
+  status: 'waiting',
+
+  loadStep: function () {
+this.set('status', 'waiting');
+this.set('isNextEnabled', false);
+this.pullCheckPointStatus();
+  },
+
   pullCheckPointStatus: function () {
 this.set('initJnCounter', 0);
+this.set('requestsCounter', 0);
+this.set('hasStoppedJNs', false);
 var hostNames = 
this.get('content.masterComponentHosts').filterProperty('component', 
"JOURNALNODE").mapProperty('hostName');
 hostNames.forEach(function (hostName) {
   this.pullEachJnStatus(hostName);
 }, this);
   },
 
-  pullEachJnStatus: function(hostName){
+  pullEachJnStatus: function (hostName) {
 App.ajax.send({
   name: 'admin.high_availability.getJnCheckPointStatus',
   sender: this,
@@ -53,17 +87,32 @@ App.HighAvailabilityWizardStep6Controller = 
Em.Controller.extend({
   checkJnCheckPointStatus: function (data) {
 var self = this;
 var journalStatusInfo;
+var initJnCounter = 0;
+
 if (data.metrics && data.metrics.dfs) {
   journalStatusInfo = 
$.parseJSON(data.metrics.dfs.journalnode.journalsStatus);
   if (journalStatusInfo[this.get('content.nameServiceId')] && 
journalStatusInfo[this.get('content.nameServiceId')].Formatted === "true") {
-this.set("initJnCounter", (this.get('initJnCounter') + 1));
-return;
+initJnCounter = this.incrementProperty('initJnCounter');
   }
+} else {
+  this.set('hasStoppedJNs', true);
 }
 
-window.setTimeout(function () {
-  self.pullEachJnStatus(data.HostRoles.host_name);
-}, self.POLL_INTERVAL);
+if (this.incrementProperty('requestsCounter') === 3) {
+  if (initJnCounter === 3) {
+this.set('status', 'done');
+this.set('isNextEnabled', true);
+  } else {
+if (this.get('hasStoppedJNs')) {
+  this.set('status', 'journalnode_stopped')
+} else {
+  this.set('status', 'waiting');
+}
+window.setTimeout(function () {
+  self.pullCheckPointStatus();
+}, self.POLL_INTERVAL);
+  }
+}
   },
 
   done: function () {

http://git-wip-us.apache.org/repos/asf/ambari/blob/2aee7bf1/ambari-web/app/messages.js
--
diff --git 

ambari git commit: AMBARI-13383. Ambari to install/manage Slider tarball to HDFS (aonishuk)

2015-10-20 Thread aonishuk
Repository: ambari
Updated Branches:
  refs/heads/branch-2.1 8bc1a98a5 -> fc4787530


AMBARI-13383. Ambari to install/manage Slider tarball to HDFS (aonishuk)


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

Branch: refs/heads/branch-2.1
Commit: fc4787530356814bcd65dc1dcbe558488d15603d
Parents: 8bc1a98
Author: Andrew Onishuk 
Authored: Tue Oct 20 20:00:18 2015 +0300
Committer: Andrew Onishuk 
Committed: Tue Oct 20 20:00:18 2015 +0300

--
 .../libraries/functions/copy_tarball.py |  2 +
 .../0.60.0.2.2/package/scripts/params_linux.py  | 50 ++--
 .../0.60.0.2.2/package/scripts/service_check.py |  5 ++
 .../SLIDER/0.60.0.2.2/package/scripts/slider.py |  5 ++
 .../2.1.0.2.0/package/scripts/historyserver.py  |  6 +++
 .../stacks/HDP/2.3/upgrades/upgrade-2.3.xml | 16 +++
 .../stacks/2.0.6/YARN/test_historyserver.py |  5 +-
 .../stacks/2.2/SLIDER/test_slider_client.py |  8 
 8 files changed, 84 insertions(+), 13 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/fc478753/ambari-common/src/main/python/resource_management/libraries/functions/copy_tarball.py
--
diff --git 
a/ambari-common/src/main/python/resource_management/libraries/functions/copy_tarball.py
 
b/ambari-common/src/main/python/resource_management/libraries/functions/copy_tarball.py
index badf2fe..51a6a3c 100644
--- 
a/ambari-common/src/main/python/resource_management/libraries/functions/copy_tarball.py
+++ 
b/ambari-common/src/main/python/resource_management/libraries/functions/copy_tarball.py
@@ -35,6 +35,8 @@ STACK_VERSION_PATTERN = "{{ stack_version }}"
 
 TARBALL_MAP = {
   "HDP": {
+"slider":  
("/usr/hdp/{0}/slider/slider.tar.gz".format(STACK_VERSION_PATTERN),
+  
"/hdp/apps/{0}/slider/slider.tar.gz".format(STACK_VERSION_PATTERN)),
 "tez":   
("/usr/hdp/{0}/tez/lib/tez.tar.gz".format(STACK_VERSION_PATTERN),
   
"/hdp/apps/{0}/tez/tez.tar.gz".format(STACK_VERSION_PATTERN)),
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/fc478753/ambari-server/src/main/resources/common-services/SLIDER/0.60.0.2.2/package/scripts/params_linux.py
--
diff --git 
a/ambari-server/src/main/resources/common-services/SLIDER/0.60.0.2.2/package/scripts/params_linux.py
 
b/ambari-server/src/main/resources/common-services/SLIDER/0.60.0.2.2/package/scripts/params_linux.py
index 5d60e21..d7bd296 100644
--- 
a/ambari-server/src/main/resources/common-services/SLIDER/0.60.0.2.2/package/scripts/params_linux.py
+++ 
b/ambari-server/src/main/resources/common-services/SLIDER/0.60.0.2.2/package/scripts/params_linux.py
@@ -16,16 +16,60 @@ See the License for the specific language governing 
permissions and
 limitations under the License.
 
 """
+from resource_management.libraries.resources import HdfsResource
+from resource_management.libraries.functions import conf_select
+from resource_management.libraries.functions import hdp_select
 from resource_management.libraries.script.script import Script
+from resource_management.libraries.functions.format import format
+from resource_management.libraries.functions.default import default
+from resource_management.libraries.functions import get_kinit_path
 
 # server configurations
 config = Script.get_config()
 
+slider_home_dir = '/usr/hdp/current/slider-client'
+
 #hadoop params
 slider_bin_dir = "/usr/lib/slider/bin"
 if Script.is_hdp_stack_greater_or_equal("2.2"):
-slider_bin_dir = '/usr/hdp/current/slider-client/bin'
+slider_bin_dir = format('{slider_home_dir}/bin')
 
-slider_conf_dir = "/usr/hdp/current/slider-client/conf"
+slider_conf_dir = format("{slider_home_dir}/conf")
 storm_slider_conf_dir = '/usr/hdp/current/storm-slider-client/conf'
-slider_home_dir = '/usr/hdp/current/slider-client'
+
+slider_tar_gz = format('{slider_home_dir}/slider.tar.gz')
+slider_lib_dir = format('{slider_home_dir}/lib')
+
+user_group = config['configurations']['cluster-env']['user_group']
+hdfs_user = config['configurations']['hadoop-env']['hdfs_user']
+
+host_sys_prepped = default("/hostLevelParams/host_sys_prepped", False)
+
+
+kinit_path_local = 
get_kinit_path(default('/configurations/kerberos-env/executable_search_paths', 
None))
+security_enabled = config['configurations']['cluster-env']['security_enabled']
+hdfs_user = config['configurations']['hadoop-env']['hdfs_user']
+hdfs_principal_name = 
config['configurations']['hadoop-env']['hdfs_principal_name']
+hdfs_user_keytab = 

ambari git commit: AMBARI-13383. Ambari to install/manage Slider tarball to HDFS (aonishuk)

2015-10-20 Thread aonishuk
Repository: ambari
Updated Branches:
  refs/heads/trunk 1cd72bddd -> f1e9e3460


AMBARI-13383. Ambari to install/manage Slider tarball to HDFS (aonishuk)


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

Branch: refs/heads/trunk
Commit: f1e9e3460ea4c50154a91c0aaa8c827bc39f3fde
Parents: 1cd72bd
Author: Andrew Onishuk 
Authored: Tue Oct 20 19:58:53 2015 +0300
Committer: Andrew Onishuk 
Committed: Tue Oct 20 19:58:53 2015 +0300

--
 .../libraries/functions/copy_tarball.py |  2 +
 .../0.60.0.2.2/package/scripts/params_linux.py  | 50 ++--
 .../0.60.0.2.2/package/scripts/service_check.py |  5 ++
 .../SLIDER/0.60.0.2.2/package/scripts/slider.py |  5 ++
 .../2.1.0.2.0/package/scripts/historyserver.py  |  6 +++
 .../stacks/HDP/2.3/upgrades/upgrade-2.3.xml | 16 +++
 .../stacks/2.0.6/YARN/test_historyserver.py |  6 ++-
 .../stacks/2.2/SLIDER/test_slider_client.py |  8 
 8 files changed, 85 insertions(+), 13 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/f1e9e346/ambari-common/src/main/python/resource_management/libraries/functions/copy_tarball.py
--
diff --git 
a/ambari-common/src/main/python/resource_management/libraries/functions/copy_tarball.py
 
b/ambari-common/src/main/python/resource_management/libraries/functions/copy_tarball.py
index badf2fe..51a6a3c 100644
--- 
a/ambari-common/src/main/python/resource_management/libraries/functions/copy_tarball.py
+++ 
b/ambari-common/src/main/python/resource_management/libraries/functions/copy_tarball.py
@@ -35,6 +35,8 @@ STACK_VERSION_PATTERN = "{{ stack_version }}"
 
 TARBALL_MAP = {
   "HDP": {
+"slider":  
("/usr/hdp/{0}/slider/slider.tar.gz".format(STACK_VERSION_PATTERN),
+  
"/hdp/apps/{0}/slider/slider.tar.gz".format(STACK_VERSION_PATTERN)),
 "tez":   
("/usr/hdp/{0}/tez/lib/tez.tar.gz".format(STACK_VERSION_PATTERN),
   
"/hdp/apps/{0}/tez/tez.tar.gz".format(STACK_VERSION_PATTERN)),
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/f1e9e346/ambari-server/src/main/resources/common-services/SLIDER/0.60.0.2.2/package/scripts/params_linux.py
--
diff --git 
a/ambari-server/src/main/resources/common-services/SLIDER/0.60.0.2.2/package/scripts/params_linux.py
 
b/ambari-server/src/main/resources/common-services/SLIDER/0.60.0.2.2/package/scripts/params_linux.py
index 5d60e21..d7bd296 100644
--- 
a/ambari-server/src/main/resources/common-services/SLIDER/0.60.0.2.2/package/scripts/params_linux.py
+++ 
b/ambari-server/src/main/resources/common-services/SLIDER/0.60.0.2.2/package/scripts/params_linux.py
@@ -16,16 +16,60 @@ See the License for the specific language governing 
permissions and
 limitations under the License.
 
 """
+from resource_management.libraries.resources import HdfsResource
+from resource_management.libraries.functions import conf_select
+from resource_management.libraries.functions import hdp_select
 from resource_management.libraries.script.script import Script
+from resource_management.libraries.functions.format import format
+from resource_management.libraries.functions.default import default
+from resource_management.libraries.functions import get_kinit_path
 
 # server configurations
 config = Script.get_config()
 
+slider_home_dir = '/usr/hdp/current/slider-client'
+
 #hadoop params
 slider_bin_dir = "/usr/lib/slider/bin"
 if Script.is_hdp_stack_greater_or_equal("2.2"):
-slider_bin_dir = '/usr/hdp/current/slider-client/bin'
+slider_bin_dir = format('{slider_home_dir}/bin')
 
-slider_conf_dir = "/usr/hdp/current/slider-client/conf"
+slider_conf_dir = format("{slider_home_dir}/conf")
 storm_slider_conf_dir = '/usr/hdp/current/storm-slider-client/conf'
-slider_home_dir = '/usr/hdp/current/slider-client'
+
+slider_tar_gz = format('{slider_home_dir}/slider.tar.gz')
+slider_lib_dir = format('{slider_home_dir}/lib')
+
+user_group = config['configurations']['cluster-env']['user_group']
+hdfs_user = config['configurations']['hadoop-env']['hdfs_user']
+
+host_sys_prepped = default("/hostLevelParams/host_sys_prepped", False)
+
+
+kinit_path_local = 
get_kinit_path(default('/configurations/kerberos-env/executable_search_paths', 
None))
+security_enabled = config['configurations']['cluster-env']['security_enabled']
+hdfs_user = config['configurations']['hadoop-env']['hdfs_user']
+hdfs_principal_name = 
config['configurations']['hadoop-env']['hdfs_principal_name']
+hdfs_user_keytab = 

ambari git commit: AMBARI-13491 - Expose Failure Auto-Skip Setting On Upgrade Endpoint (jonathanhurley)

2015-10-20 Thread jonathanhurley
Repository: ambari
Updated Branches:
  refs/heads/trunk 02814780f -> 476d2700d


AMBARI-13491 - Expose Failure Auto-Skip Setting On Upgrade Endpoint 
(jonathanhurley)


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

Branch: refs/heads/trunk
Commit: 476d2700d88264dbaf29f2608a3c07e3a2c7e768
Parents: 0281478
Author: Jonathan Hurley 
Authored: Tue Oct 20 12:05:11 2015 -0400
Committer: Jonathan Hurley 
Committed: Tue Oct 20 16:46:24 2015 -0400

--
 .../internal/UpgradeResourceProvider.java   |  6 +-
 .../server/orm/entities/UpgradeEntity.java  | 57 +-
 .../server/upgrade/UpgradeCatalog213.java   | 82 +++-
 .../main/resources/Ambari-DDL-MySQL-CREATE.sql  |  2 +
 .../main/resources/Ambari-DDL-Oracle-CREATE.sql |  2 +
 .../resources/Ambari-DDL-Postgres-CREATE.sql|  2 +
 .../Ambari-DDL-Postgres-EMBEDDED-CREATE.sql |  2 +
 .../resources/Ambari-DDL-SQLAnywhere-CREATE.sql |  2 +
 .../resources/Ambari-DDL-SQLServer-CREATE.sql   |  2 +
 .../internal/UpgradeResourceProviderTest.java   | 52 -
 .../ambari/server/orm/dao/UpgradeDAOTest.java   | 31 
 .../server/upgrade/UpgradeCatalog213Test.java   | 61 ---
 12 files changed, 248 insertions(+), 53 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/476d2700/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 a1d2451..82ce49f 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
@@ -465,6 +465,8 @@ public class UpgradeResourceProvider extends 
AbstractControllerResourceProvider
 setResourceProperty(resource, UPGRADE_TO_VERSION, entity.getToVersion(), 
requestedIds);
 setResourceProperty(resource, UPGRADE_DIRECTION, entity.getDirection(), 
requestedIds);
 setResourceProperty(resource, UPGRADE_DOWNGRADE_ALLOWED, 
entity.isDowngradeAllowed(), requestedIds);
+setResourceProperty(resource, UPGRADE_SKIP_FAILURES, 
entity.isComponentFailureAutoSkipped(), requestedIds);
+setResourceProperty(resource, UPGRADE_SKIP_SC_FAILURES, 
entity.isServiceCheckFailureAutoSkipped(), requestedIds);
 
 return resource;
   }
@@ -762,7 +764,7 @@ public class UpgradeResourceProvider extends 
AbstractControllerResourceProvider
   itemEntity.setTasks(wrapper.getTasksJson());
   itemEntity.setHosts(wrapper.getHostsJson());
   itemEntities.add(itemEntity);
-  
+
   // At this point, need to change the effective Stack Id so that 
subsequent tasks run on the newer value.
   // TODO AMBARI-12698, check if this works during a 
Stop-the-World Downgrade.
   if (UpdateStackGrouping.class.equals(group.groupClass)) {
@@ -806,6 +808,8 @@ public class UpgradeResourceProvider extends 
AbstractControllerResourceProvider
 entity.setDirection(direction);
 entity.setUpgradePackage(pack.getName());
 entity.setUpgradeType(pack.getType());
+entity.setAutoSkipComponentFailures(skipComponentFailures);
+entity.setAutoSkipServiceCheckFailures(skipServiceCheckFailures);
 entity.setDowngradeAllowed(pack.isDowngradeAllowed());
 
 req.getRequestStatusResponse();

http://git-wip-us.apache.org/repos/asf/ambari/blob/476d2700/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 297fc8d..e14fc75 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
@@ -33,14 +33,15 @@ import javax.persistence.OneToMany;
 import javax.persistence.Table;
 import javax.persistence.TableGenerator;
 
+import org.apache.ambari.server.actionmanager.HostRoleStatus;
 import org.apache.ambari.server.state.stack.upgrade.Direction;
 import org.apache.ambari.server.state.stack.upgrade.UpgradeType;
 
 /**
  * 

ambari git commit: AMBARI-13491 - Expose Failure Auto-Skip Setting On Upgrade Endpoint (jonathanhurley)

2015-10-20 Thread jonathanhurley
Repository: ambari
Updated Branches:
  refs/heads/branch-2.1 2aee7bf10 -> d2dc26350


AMBARI-13491 - Expose Failure Auto-Skip Setting On Upgrade Endpoint 
(jonathanhurley)


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

Branch: refs/heads/branch-2.1
Commit: d2dc2635002a719172c083e443a7a251b8ad2737
Parents: 2aee7bf
Author: Jonathan Hurley 
Authored: Tue Oct 20 12:05:11 2015 -0400
Committer: Jonathan Hurley 
Committed: Tue Oct 20 17:02:14 2015 -0400

--
 .../internal/UpgradeResourceProvider.java   |   6 +-
 .../server/orm/entities/UpgradeEntity.java  |  57 ++-
 .../server/upgrade/UpgradeCatalog213.java   | 100 +--
 .../main/resources/Ambari-DDL-MySQL-CREATE.sql  |   2 +
 .../main/resources/Ambari-DDL-Oracle-CREATE.sql |   2 +
 .../resources/Ambari-DDL-Postgres-CREATE.sql|   2 +
 .../Ambari-DDL-Postgres-EMBEDDED-CREATE.sql |   2 +
 .../resources/Ambari-DDL-SQLAnywhere-CREATE.sql |   2 +
 .../resources/Ambari-DDL-SQLServer-CREATE.sql   |   2 +
 .../internal/UpgradeResourceProviderTest.java   |  58 ++-
 .../ambari/server/orm/dao/UpgradeDAOTest.java   |  31 ++
 .../server/upgrade/UpgradeCatalog213Test.java   |  78 ---
 12 files changed, 268 insertions(+), 74 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/d2dc2635/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 153fc9c..d1b5102 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
@@ -467,6 +467,8 @@ public class UpgradeResourceProvider extends 
AbstractControllerResourceProvider
 setResourceProperty(resource, UPGRADE_TO_VERSION, entity.getToVersion(), 
requestedIds);
 setResourceProperty(resource, UPGRADE_DIRECTION, entity.getDirection(), 
requestedIds);
 setResourceProperty(resource, UPGRADE_DOWNGRADE_ALLOWED, 
entity.isDowngradeAllowed(), requestedIds);
+setResourceProperty(resource, UPGRADE_SKIP_FAILURES, 
entity.isComponentFailureAutoSkipped(), requestedIds);
+setResourceProperty(resource, UPGRADE_SKIP_SC_FAILURES, 
entity.isServiceCheckFailureAutoSkipped(), requestedIds);
 
 return resource;
   }
@@ -764,7 +766,7 @@ public class UpgradeResourceProvider extends 
AbstractControllerResourceProvider
   itemEntity.setTasks(wrapper.getTasksJson());
   itemEntity.setHosts(wrapper.getHostsJson());
   itemEntities.add(itemEntity);
-  
+
   // At this point, need to change the effective Stack Id so that 
subsequent tasks run on the newer value.
   // TODO AMBARI-12698, check if this works during a 
Stop-the-World Downgrade.
   if (UpdateStackGrouping.class.equals(group.groupClass)) {
@@ -808,6 +810,8 @@ public class UpgradeResourceProvider extends 
AbstractControllerResourceProvider
 entity.setDirection(direction);
 entity.setUpgradePackage(pack.getName());
 entity.setUpgradeType(pack.getType());
+entity.setAutoSkipComponentFailures(skipComponentFailures);
+entity.setAutoSkipServiceCheckFailures(skipServiceCheckFailures);
 entity.setDowngradeAllowed(pack.isDowngradeAllowed());
 
 req.getRequestStatusResponse();

http://git-wip-us.apache.org/repos/asf/ambari/blob/d2dc2635/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 297fc8d..e14fc75 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
@@ -33,14 +33,15 @@ import javax.persistence.OneToMany;
 import javax.persistence.Table;
 import javax.persistence.TableGenerator;
 
+import org.apache.ambari.server.actionmanager.HostRoleStatus;
 import org.apache.ambari.server.state.stack.upgrade.Direction;
 import 

ambari git commit: AMBARI-12320. Develop HAWQ plugin for HDP and PHD stacks under common-services (Newton Alex via odiachenko).

2015-10-20 Thread odiachenko
Repository: ambari
Updated Branches:
  refs/heads/trunk 476d2700d -> f19a8da03


AMBARI-12320. Develop HAWQ plugin for HDP and PHD stacks under common-services 
(Newton Alex via odiachenko).


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

Branch: refs/heads/trunk
Commit: f19a8da034698060f75afabb42ee96f27c7aec05
Parents: 476d270
Author: Oleksandr Diachenko 
Authored: Tue Oct 20 14:56:53 2015 -0700
Committer: Oleksandr Diachenko 
Committed: Tue Oct 20 14:56:53 2015 -0700

--
 ambari-server/pom.xml   |   3 +
 .../HAWQ/2.0.0.0/configuration/gpcheck-env.xml  |  86 +++
 .../HAWQ/2.0.0.0/configuration/hawq-site.xml| 167 
 .../common-services/HAWQ/2.0.0.0/metainfo.xml   | 129 ++
 .../HAWQ/2.0.0.0/package/scripts/common.py  | 253 +++
 .../HAWQ/2.0.0.0/package/scripts/constants.py   |  62 +
 .../HAWQ/2.0.0.0/package/scripts/hawqmaster.py  |  55 
 .../HAWQ/2.0.0.0/package/scripts/hawqsegment.py | 102 
 .../HAWQ/2.0.0.0/package/scripts/hawqstandby.py |  58 +
 .../HAWQ/2.0.0.0/package/scripts/hawqstatus.py  |  65 +
 .../2.0.0.0/package/scripts/master_helper.py| 194 ++
 .../HAWQ/2.0.0.0/package/scripts/params.py  |  88 +++
 .../2.0.0.0/package/scripts/service_check.py| 102 
 .../HAWQ/2.0.0.0/package/scripts/utils.py   | 108 
 .../2.0.0.0/package/templates/hawq-hosts.j2 |   5 +
 .../package/templates/hawq-profile.sh.j2|   8 +
 .../package/templates/hawq.limits.conf.j2   |   7 +
 .../package/templates/hawq.sysctl.conf.j2   |  27 ++
 .../HAWQ/2.0.0.0/package/templates/slaves.j2|   3 +
 .../common-services/PXF/3.0.0.0/metainfo.xml|  71 ++
 .../PXF/3.0.0.0/package/scripts/pxfservice.py   |  41 +++
 21 files changed, 1634 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/f19a8da0/ambari-server/pom.xml
--
diff --git a/ambari-server/pom.xml b/ambari-server/pom.xml
index 17e9ea9..5a7ddc4 100644
--- a/ambari-server/pom.xml
+++ b/ambari-server/pom.xml
@@ -203,6 +203,9 @@
 
src/main/resources/stacks/HDP/2.0._/services/HBASE/package/templates/regionservers.j2
 
src/main/resources/stacks/HDPWIN/2.1/services/*/configuration*/*
 
+
+
src/main/resources/common-services/HAWQ/2.0.0.0/package/templates/*.j2
+
 
 src/test/resources/TestAmbaryServer.samples/**
 src/test/resources/*.txt

http://git-wip-us.apache.org/repos/asf/ambari/blob/f19a8da0/ambari-server/src/main/resources/common-services/HAWQ/2.0.0.0/configuration/gpcheck-env.xml
--
diff --git 
a/ambari-server/src/main/resources/common-services/HAWQ/2.0.0.0/configuration/gpcheck-env.xml
 
b/ambari-server/src/main/resources/common-services/HAWQ/2.0.0.0/configuration/gpcheck-env.xml
new file mode 100755
index 000..a61a34f
--- /dev/null
+++ 
b/ambari-server/src/main/resources/common-services/HAWQ/2.0.0.0/configuration/gpcheck-env.xml
@@ -0,0 +1,86 @@
+
+
+
+
+
+  
+
+  content
+  Content
+  Contents of the configuration file 
/usr/local/hawq/etc/gpcheck.cnf. This file is used by 'hawq check' command, 
which can be run manually by gpadmin user on the HAWQ master host. This command 
validates the system parameters and HDFS parameters mentioned in this file to 
ensure optimal HAWQ operation.
+
+[global]
+configfile_version = 4
+
+[linux.mount]
+mount.points = /
+
+[linux.sysctl]
+sysctl.kernel.shmmax = 5
+sysctl.kernel.shmmni = 4096
+sysctl.kernel.shmall = 40
+sysctl.kernel.sem = 250 512000 100 2048
+sysctl.kernel.sysrq = 1
+sysctl.kernel.core_uses_pid = 1
+sysctl.kernel.msgmnb = 65536
+sysctl.kernel.msgmax = 65536
+sysctl.kernel.msgmni = 2048
+sysctl.net.ipv4.tcp_syncookies = 0
+sysctl.net.ipv4.ip_forward = 0
+sysctl.net.ipv4.conf.default.accept_source_route = 0
+sysctl.net.ipv4.tcp_tw_recycle = 1
+sysctl.net.ipv4.tcp_max_syn_backlog = 20
+sysctl.net.ipv4.conf.all.arp_filter = 1
+sysctl.net.ipv4.ip_local_port_range = 1281 65535
+sysctl.net.core.netdev_max_backlog = 20
+sysctl.vm.overcommit_memory = 2
+sysctl.fs.nr_open = 300
+sysctl.kernel.threads-max = 798720
+sysctl.kernel.pid_max = 798720
+# increase network
+sysctl.net.core.rmem_max = 2097152
+sysctl.net.core.wmem_max = 2097152
+
+[linux.limits]
+soft.nofile = 290
+hard.nofile = 290
+soft.nproc  = 131072
+hard.nproc  = 131072
+
+[linux.diskusage]
+diskusage.monitor.mounts = 

[1/2] ambari git commit: AMBARI-13441. If Ambari Server is not part of the cluster, basic operations throw 500 (NPE) when Kerberos is enabled (even if it is Manual Kerberos) (rlevas)

2015-10-20 Thread rlevas
Repository: ambari
Updated Branches:
  refs/heads/branch-2.1 d2dc26350 -> 24ce16b5a


http://git-wip-us.apache.org/repos/asf/ambari/blob/24ce16b5/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 73b1649..f8f9ce9 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
@@ -46,10 +46,6 @@ import java.util.TreeMap;
 import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.TimeUnit;
 
-import com.google.inject.Inject;
-import com.google.inject.persist.PersistService;
-import junit.framework.Assert;
-
 import org.apache.ambari.server.AmbariException;
 import org.apache.ambari.server.Role;
 import org.apache.ambari.server.RoleCommand;
@@ -98,9 +94,13 @@ import org.slf4j.LoggerFactory;
 import com.google.common.reflect.TypeToken;
 import com.google.inject.AbstractModule;
 import com.google.inject.Guice;
+import com.google.inject.Inject;
 import com.google.inject.Injector;
+import com.google.inject.persist.PersistService;
 import com.google.inject.persist.UnitOfWork;
 
+import junit.framework.Assert;
+
 public class TestActionScheduler {
 
   private static final Logger log = 
LoggerFactory.getLogger(TestActionScheduler.class);
@@ -113,7 +113,6 @@ public class TestActionScheduler {
 
   private static Injector injector;
 
-  private final String serverHostname = StageUtils.getHostName();
   private final String hostname = "ahost.ambari.apache.org";
   private final int MAX_CYCLE_ITERATIONS = 100;
 
@@ -291,9 +290,9 @@ public class TestActionScheduler {
 when(request.isExclusive()).thenReturn(false);
 when(db.getRequestEntity(anyLong())).thenReturn(request);
 
-doAnswer(new Answer() {
+doAnswer(new Answer() {
   @Override
-  public Object answer(InvocationOnMock invocation) throws Throwable {
+  public Void answer(InvocationOnMock invocation) throws Throwable {
 String host = (String) invocation.getArguments()[0];
 String role = (String) invocation.getArguments()[3];
 HostRoleCommand command = s.getHostRoleCommand(host, role);
@@ -371,9 +370,9 @@ public class TestActionScheduler {
 
 when(db.getCommandsInProgressCount()).thenReturn(stages.size());
 when(db.getStagesInProgress()).thenReturn(stages);
-doAnswer(new Answer() {
+doAnswer(new Answer() {
   @Override
-  public Object answer(InvocationOnMock invocation) throws Throwable {
+  public Void answer(InvocationOnMock invocation) throws Throwable {
 String host = (String) invocation.getArguments()[0];
 String role = (String) invocation.getArguments()[3];
 HostRoleCommand command = s.getHostRoleCommand(host, role);
@@ -466,9 +465,9 @@ public class TestActionScheduler {
 when(db.getCommandsInProgressCount()).thenReturn(stages.size());
 when(db.getStagesInProgress()).thenReturn(stages);
 
-doAnswer(new Answer() {
+doAnswer(new Answer() {
   @Override
-  public Object answer(InvocationOnMock invocation) throws Throwable {
+  public Void answer(InvocationOnMock invocation) throws Throwable {
 String host = (String) invocation.getArguments()[0];
 String role = (String) invocation.getArguments()[3];
 //HostRoleCommand command = stages.get(0).getHostRoleCommand(host, 
role);
@@ -482,9 +481,9 @@ public class TestActionScheduler {
   }
 }).when(db).timeoutHostRole(anyString(), anyLong(), anyLong(), 
anyString());
 
-doAnswer(new Answer() {
+doAnswer(new Answer() {
   @Override
-  public Object answer(InvocationOnMock invocation) throws Throwable {
+  public Void answer(InvocationOnMock invocation) throws Throwable {
 Long requestId = (Long) invocation.getArguments()[0];
 for (Stage stage : stages) {
   if (requestId.equals(stage.getRequestId())) {
@@ -564,27 +563,7 @@ public class TestActionScheduler {
 Properties properties = new Properties();
 Configuration conf = new Configuration(properties);
 Clusters fsm = mock(Clusters.class);
-Cluster oneClusterMock = mock(Cluster.class);
-Service serviceObj = mock(Service.class);
-ServiceComponent scomp = mock(ServiceComponent.class);
-ServiceComponentHost sch = mock(ServiceComponentHost.class);
 UnitOfWork unitOfWork = mock(UnitOfWork.class);
-Host host = mock(Host.class);
-
-when(host.getHostName()).thenReturn(serverHostname);
-when(host.getState()).thenReturn(HostState.HEALTHY);
-
-when(fsm.getCluster(anyString())).thenReturn(oneClusterMock);
-when(fsm.getHost(anyString())).thenReturn(host);
-

[2/2] ambari git commit: AMBARI-13441. If Ambari Server is not part of the cluster, basic operations throw 500 (NPE) when Kerberos is enabled (even if it is Manual Kerberos) (rlevas)

2015-10-20 Thread rlevas
AMBARI-13441. If Ambari Server is not part of the cluster, basic operations 
throw 500 (NPE) when Kerberos is enabled (even if it is Manual Kerberos) 
(rlevas)


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

Branch: refs/heads/branch-2.1
Commit: 24ce16b5a3ced0944caa516fe07fc446435ce036
Parents: d2dc263
Author: Robert Levas 
Authored: Tue Oct 20 20:42:25 2015 -0700
Committer: Robert Levas 
Committed: Tue Oct 20 20:42:25 2015 -0700

--
 .../actionmanager/ActionDBAccessorImpl.java |  57 ++--
 .../server/actionmanager/ActionScheduler.java   |  65 +++-
 .../server/actionmanager/HostRoleCommand.java   |   6 +-
 .../ambari/server/actionmanager/Stage.java  | 200 +++-
 .../server/controller/KerberosHelperImpl.java   |   2 +-
 .../internal/UpgradeResourceProvider.java   |  24 +-
 .../server/orm/dao/HostRoleCommandDAO.java  |  23 +-
 .../orm/entities/HostRoleCommandEntity.java |   4 +-
 .../serveraction/ServerActionExecutor.java  |   2 +-
 .../server/upgrade/UpgradeCatalog213.java   |   7 +
 .../main/resources/Ambari-DDL-MySQL-CREATE.sql  |   2 +-
 .../main/resources/Ambari-DDL-Oracle-CREATE.sql |   2 +-
 .../resources/Ambari-DDL-Postgres-CREATE.sql|   2 +-
 .../Ambari-DDL-Postgres-EMBEDDED-CREATE.sql |   2 +-
 .../resources/Ambari-DDL-SQLAnywhere-CREATE.sql |   2 +-
 .../resources/Ambari-DDL-SQLServer-CREATE.sql   |   2 +-
 .../ambari/server/actionmanager/StageTest.java  |   4 +-
 .../actionmanager/TestActionDBAccessorImpl.java |  36 +--
 .../actionmanager/TestActionScheduler.java  | 309 +++
 .../AmbariManagementControllerTest.java |  10 +-
 .../internal/UpgradeResourceProviderTest.java   |  18 +-
 .../serveraction/ServerActionExecutorTest.java  |   8 +-
 .../server/stageplanner/TestStagePlanner.java   |   4 +-
 .../server/upgrade/UpgradeCatalog213Test.java   |  19 ++
 24 files changed, 424 insertions(+), 386 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/24ce16b5/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/ActionDBAccessorImpl.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/ActionDBAccessorImpl.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/ActionDBAccessorImpl.java
index 30da833..21d9f2b 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/ActionDBAccessorImpl.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/ActionDBAccessorImpl.java
@@ -54,6 +54,7 @@ import org.apache.ambari.server.utils.LoopBody;
 import org.apache.ambari.server.utils.Parallel;
 import org.apache.ambari.server.utils.ParallelLoopResult;
 import org.apache.ambari.server.utils.StageUtils;
+import org.apache.commons.lang.StringUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -297,35 +298,45 @@ public class ActionDBAccessorImpl implements 
ActionDBAccessor {
 HostRoleCommandEntity hostRoleCommandEntity = 
hostRoleCommand.constructNewPersistenceEntity();
 hostRoleCommandEntity.setStage(stageEntity);
 
-HostEntity hostEntity = 
hostDAO.findById(hostRoleCommandEntity.getHostId());
-if (hostEntity == null) {
-  String msg = String.format("Host %s doesn't exist in database", 
hostRoleCommandEntity.getHostName());
-  LOG.error(msg);
-  throw new AmbariException(msg);
-}
-hostRoleCommandEntity.setHostEntity(hostEntity);
+HostEntity hostEntity = null;
+
 hostRoleCommandDAO.create(hostRoleCommandEntity);
 
-assert hostRoleCommandEntity.getTaskId() != null;
 hostRoleCommand.setTaskId(hostRoleCommandEntity.getTaskId());
 
-try {
-  // Get the in-memory host object and its prefix to construct the 
output and error log paths.
-  Host hostObject = 
clusters.getHost(hostRoleCommandEntity.getHostName());
-  String prefix = hostObject.getPrefix();
-  if (null != prefix && !prefix.isEmpty()) {
-if (!prefix.endsWith("/")) {
-  prefix = prefix + "/";
+String prefix = "";
+String output = "output-" + hostRoleCommandEntity.getTaskId() + ".txt";
+String error = "errors-" + hostRoleCommandEntity.getTaskId() + ".txt";
+
+if (null != hostRoleCommandEntity.getHostId()) {
+  hostEntity = hostDAO.findById(hostRoleCommandEntity.getHostId());
+  if (hostEntity == null) {
+String msg = String.format("Host %s doesn't exist in database",