ambari git commit: AMBARI-21350. ADDENDUM. Fixed version hierarchy for Oozie and Flume. (swagle)

2017-06-29 Thread swagle
Repository: ambari
Updated Branches:
  refs/heads/branch-feature-AMBARI-21348 c05393c92 -> 49773de19


AMBARI-21350. ADDENDUM. Fixed version hierarchy for Oozie and Flume. (swagle)


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

Branch: refs/heads/branch-feature-AMBARI-21348
Commit: 49773de19e097a23c1b6956e1216e874bc4fcae7
Parents: c05393c
Author: Siddharth Wagle 
Authored: Thu Jun 29 16:17:42 2017 -0700
Committer: Siddharth Wagle 
Committed: Thu Jun 29 16:17:42 2017 -0700

--
 .../resources/stacks/BigInsights/4.2.5/services/FLUME/metainfo.xml | 2 +-
 .../resources/stacks/BigInsights/4.2.5/services/OOZIE/metainfo.xml | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/49773de1/ambari-server/src/main/resources/stacks/BigInsights/4.2.5/services/FLUME/metainfo.xml
--
diff --git 
a/ambari-server/src/main/resources/stacks/BigInsights/4.2.5/services/FLUME/metainfo.xml
 
b/ambari-server/src/main/resources/stacks/BigInsights/4.2.5/services/FLUME/metainfo.xml
index bed2822..99f1f79 100755
--- 
a/ambari-server/src/main/resources/stacks/BigInsights/4.2.5/services/FLUME/metainfo.xml
+++ 
b/ambari-server/src/main/resources/stacks/BigInsights/4.2.5/services/FLUME/metainfo.xml
@@ -21,7 +21,7 @@
 
   FLUME
   1.7.0
-  common-services/FLUME/1.7.0
+  common-services/FLUME/1.4.0.2.0
   
   
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/49773de1/ambari-server/src/main/resources/stacks/BigInsights/4.2.5/services/OOZIE/metainfo.xml
--
diff --git 
a/ambari-server/src/main/resources/stacks/BigInsights/4.2.5/services/OOZIE/metainfo.xml
 
b/ambari-server/src/main/resources/stacks/BigInsights/4.2.5/services/OOZIE/metainfo.xml
index 2e74c56..4a7dc31 100755
--- 
a/ambari-server/src/main/resources/stacks/BigInsights/4.2.5/services/OOZIE/metainfo.xml
+++ 
b/ambari-server/src/main/resources/stacks/BigInsights/4.2.5/services/OOZIE/metainfo.xml
@@ -20,7 +20,7 @@
   
 
   OOZIE
-  common-services/OOZIE/4.3.0
+  common-services/OOZIE/4.2.0.2.5
   4.3.0
 
   



ambari git commit: AMBARI-21362. Ambari upgrade not idempotent due to column move

2017-06-29 Thread swagle
Repository: ambari
Updated Branches:
  refs/heads/branch-feature-AMBARI-21348 6bab5a537 -> c05393c92


AMBARI-21362. Ambari upgrade not idempotent due to column move


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

Branch: refs/heads/branch-feature-AMBARI-21348
Commit: c05393c921b8cc9c147b228e3b21a9935a148494
Parents: 6bab5a5
Author: Attila Doroszlai 
Authored: Tue Jun 27 14:33:27 2017 +0200
Committer: Siddharth Wagle 
Committed: Thu Jun 29 15:42:10 2017 -0700

--
 .../ambari/server/orm/DBAccessorImpl.java   |  5 +++-
 .../ambari/server/orm/DBAccessorImplTest.java   | 29 
 2 files changed, 33 insertions(+), 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/c05393c9/ambari-server/src/main/java/org/apache/ambari/server/orm/DBAccessorImpl.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/orm/DBAccessorImpl.java 
b/ambari-server/src/main/java/org/apache/ambari/server/orm/DBAccessorImpl.java
index c11a1dd..f3250b8 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/orm/DBAccessorImpl.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/orm/DBAccessorImpl.java
@@ -1410,7 +1410,10 @@ public class DBAccessorImpl implements DBAccessor {
   public void moveColumnToAnotherTable(String sourceTableName, DBColumnInfo 
sourceColumn, String sourceIDFieldName,
   String targetTableName, DBColumnInfo targetColumn, String 
targetIDFieldName, Object initialValue) throws SQLException {
 
-if (this.tableHasColumn(sourceTableName, sourceIDFieldName)) {
+if (tableHasColumn(sourceTableName, sourceIDFieldName) &&
+  tableHasColumn(sourceTableName, sourceColumn.getName()) &&
+  tableHasColumn(targetTableName, targetIDFieldName)
+) {
 
   final String moveSQL = 
dbmsHelper.getCopyColumnToAnotherTableStatement(sourceTableName, 
sourceColumn.getName(),
 sourceIDFieldName, targetTableName, 
targetColumn.getName(),targetIDFieldName);

http://git-wip-us.apache.org/repos/asf/ambari/blob/c05393c9/ambari-server/src/test/java/org/apache/ambari/server/orm/DBAccessorImplTest.java
--
diff --git 
a/ambari-server/src/test/java/org/apache/ambari/server/orm/DBAccessorImplTest.java
 
b/ambari-server/src/test/java/org/apache/ambari/server/orm/DBAccessorImplTest.java
index ea43bb2..d576cc8 100644
--- 
a/ambari-server/src/test/java/org/apache/ambari/server/orm/DBAccessorImplTest.java
+++ 
b/ambari-server/src/test/java/org/apache/ambari/server/orm/DBAccessorImplTest.java
@@ -639,4 +639,33 @@ public class DBAccessorImplTest {
 }
 
}
+
+  @Test
+  public void testMoveNonexistentColumnIsNoop() throws Exception {
+DBAccessorImpl dbAccessor = injector.getInstance(DBAccessorImpl.class);
+String sourceTableName = getFreeTableName();
+String targetTableName = getFreeTableName();
+int testRowAmount = 10;
+
+createMyTable(sourceTableName, "col1");
+createMyTable(targetTableName, "col1", "col2");
+
+for (Integer i=0; i < testRowAmount; i++){
+  dbAccessor.insertRow(sourceTableName,
+new String[] {"id", "col1"},
+new String[]{i.toString(), String.format("'source,1,%s'", i)}, false);
+
+  dbAccessor.insertRow(targetTableName,
+new String[] {"id", "col1", "col2"},
+new String[]{i.toString(), String.format("'target,1,%s'", i), 
String.format("'target,2,%s'", i)}, false);
+}
+
+DBColumnInfo sourceColumn = new DBColumnInfo("col2", String.class, null, 
null, false);
+DBColumnInfo targetColumn = new DBColumnInfo("col2", String.class, null, 
null, false);
+
+dbAccessor.moveColumnToAnotherTable(sourceTableName, sourceColumn, "id",
+  targetTableName, targetColumn, "id", "initial");
+
+// should not result in exception due to unknown column in source table
+  }
 }



ambari git commit: AMBARI-21361 - Finalization Can Fail When Host Versions Changed on Stack Distribution (jonathanhurley)

2017-06-29 Thread jonathanhurley
Repository: ambari
Updated Branches:
  refs/heads/branch-feature-AMBARI-21348 98f77089c -> 6bab5a537


AMBARI-21361 - Finalization Can Fail When Host Versions Changed on Stack 
Distribution (jonathanhurley)


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

Branch: refs/heads/branch-feature-AMBARI-21348
Commit: 6bab5a53789d0c50cc75b1e1397cabcc0630f385
Parents: 98f7708
Author: Jonathan Hurley 
Authored: Thu Jun 29 09:26:33 2017 -0400
Committer: Jonathan Hurley 
Committed: Thu Jun 29 16:53:51 2017 -0400

--
 .../actionmanager/ExecutionCommandWrapper.java  |  32 ++-
 .../AmbariCustomCommandExecutionHelper.java |   4 -
 .../internal/UpgradeResourceProvider.java   |  23 --
 .../listeners/upgrade/StackVersionListener.java | 227 +++
 4 files changed, 159 insertions(+), 127 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/6bab5a53/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/ExecutionCommandWrapper.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/ExecutionCommandWrapper.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/ExecutionCommandWrapper.java
index 4773c75..fc66f53 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/ExecutionCommandWrapper.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/ExecutionCommandWrapper.java
@@ -17,6 +17,9 @@
  */
 package org.apache.ambari.server.actionmanager;
 
+import static 
org.apache.ambari.server.agent.ExecutionCommand.KeyNames.HOOKS_FOLDER;
+import static 
org.apache.ambari.server.agent.ExecutionCommand.KeyNames.SERVICE_PACKAGE_FOLDER;
+
 import java.util.HashMap;
 import java.util.Map;
 import java.util.Set;
@@ -27,12 +30,17 @@ import org.apache.ambari.server.ClusterNotFoundException;
 import org.apache.ambari.server.agent.AgentCommand.AgentCommandType;
 import org.apache.ambari.server.agent.ExecutionCommand;
 import org.apache.ambari.server.agent.ExecutionCommand.KeyNames;
+import org.apache.ambari.server.api.services.AmbariMetaInfo;
 import org.apache.ambari.server.orm.dao.HostRoleCommandDAO;
 import org.apache.ambari.server.orm.entities.ClusterVersionEntity;
 import org.apache.ambari.server.state.Cluster;
 import org.apache.ambari.server.state.Clusters;
 import org.apache.ambari.server.state.ConfigHelper;
 import org.apache.ambari.server.state.DesiredConfig;
+import org.apache.ambari.server.state.ServiceInfo;
+import org.apache.ambari.server.state.StackId;
+import org.apache.ambari.server.state.StackInfo;
+import org.apache.commons.lang.StringUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -59,6 +67,12 @@ public class ExecutionCommandWrapper {
   @Inject
   private Gson gson;
 
+  /**
+   * Used for injecting hooks and common-services into the command.
+   */
+  @Inject
+  private AmbariMetaInfo ambariMetaInfo;
+
   @AssistedInject
   public ExecutionCommandWrapper(@Assisted String jsonExecutionCommand) {
 this.jsonExecutionCommand = jsonExecutionCommand;
@@ -182,12 +196,28 @@ public class ExecutionCommandWrapper {
 }
   }
 
+  Map commandParams = executionCommand.getCommandParams();
+
   ClusterVersionEntity effectiveClusterVersion = 
cluster.getEffectiveClusterVersion();
   if (null != effectiveClusterVersion) {
-executionCommand.getCommandParams().put(KeyNames.VERSION,
+commandParams.put(KeyNames.VERSION,
 effectiveClusterVersion.getRepositoryVersion().getVersion());
   }
 
+  // add the stack and common-services folders to the command
+  StackId stackId = cluster.getDesiredStackVersion();
+  StackInfo stackInfo = ambariMetaInfo.getStack(stackId.getStackName(),
+  stackId.getStackVersion());
+
+  commandParams.put(HOOKS_FOLDER, stackInfo.getStackHooksFolder());
+
+  String serviceName = executionCommand.getServiceName();
+  if (!StringUtils.isEmpty(serviceName)) {
+ServiceInfo serviceInfo = 
ambariMetaInfo.getService(stackId.getStackName(),
+stackId.getStackVersion(), serviceName);
+
+commandParams.put(SERVICE_PACKAGE_FOLDER, 
serviceInfo.getServicePackageFolder());
+  }
 } catch (ClusterNotFoundException cnfe) {
   // it's possible that there are commands without clusters; in such cases,
   // just return the de-serialized command and don't try to read configs


[1/2] ambari git commit: AMBARI-21376. Using URI naming format in dfs.datanode.data.dir causing datanodes startup failure (aonishuk)

2017-06-29 Thread aonishuk
Repository: ambari
Updated Branches:
  refs/heads/branch-2.5 fde1cced9 -> 2f162cace
  refs/heads/trunk aa7a8c657 -> 7554509f5


AMBARI-21376. Using URI naming format in dfs.datanode.data.dir causing 
datanodes startup failure  (aonishuk)


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

Branch: refs/heads/trunk
Commit: 7554509f5ab1ddf262746ddab3c74f88c9f8154a
Parents: aa7a8c6
Author: Andrew Onishuk 
Authored: Thu Jun 29 20:44:11 2017 +0300
Committer: Andrew Onishuk 
Committed: Thu Jun 29 20:44:11 2017 +0300

--
 .../resource_management/libraries/functions/mounted_dirs_helper.py  | 1 +
 1 file changed, 1 insertion(+)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/7554509f/ambari-common/src/main/python/resource_management/libraries/functions/mounted_dirs_helper.py
--
diff --git 
a/ambari-common/src/main/python/resource_management/libraries/functions/mounted_dirs_helper.py
 
b/ambari-common/src/main/python/resource_management/libraries/functions/mounted_dirs_helper.py
index 0ebd7e2..712eacf 100644
--- 
a/ambari-common/src/main/python/resource_management/libraries/functions/mounted_dirs_helper.py
+++ 
b/ambari-common/src/main/python/resource_management/libraries/functions/mounted_dirs_helper.py
@@ -115,6 +115,7 @@ def handle_mounted_dirs(func, dirs_string, 
history_filename, update_cache=True):
   dirs_unmounted = set() # set of dirs that have become unmounted
   valid_existing_dirs = []
 
+  dirs_string = dirs_string.replace("file:///","/")
   dirs_string = ",".join([re.sub(r'^\[.+\]', '', dfs_dir.strip()) for dfs_dir 
in dirs_string.split(",")])
   for dir in dirs_string.split(","):
 if dir is None or dir.strip() == "":



[2/2] ambari git commit: AMBARI-21376. Using URI naming format in dfs.datanode.data.dir causing datanodes startup failure (aonishuk)

2017-06-29 Thread aonishuk
AMBARI-21376. Using URI naming format in dfs.datanode.data.dir causing 
datanodes startup failure  (aonishuk)


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

Branch: refs/heads/branch-2.5
Commit: 2f162cace09cb51ad20c0bed96f79cdeda02c598
Parents: fde1cce
Author: Andrew Onishuk 
Authored: Thu Jun 29 20:44:14 2017 +0300
Committer: Andrew Onishuk 
Committed: Thu Jun 29 20:44:14 2017 +0300

--
 .../resource_management/libraries/functions/mounted_dirs_helper.py  | 1 +
 1 file changed, 1 insertion(+)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/2f162cac/ambari-common/src/main/python/resource_management/libraries/functions/mounted_dirs_helper.py
--
diff --git 
a/ambari-common/src/main/python/resource_management/libraries/functions/mounted_dirs_helper.py
 
b/ambari-common/src/main/python/resource_management/libraries/functions/mounted_dirs_helper.py
index 0ebd7e2..712eacf 100644
--- 
a/ambari-common/src/main/python/resource_management/libraries/functions/mounted_dirs_helper.py
+++ 
b/ambari-common/src/main/python/resource_management/libraries/functions/mounted_dirs_helper.py
@@ -115,6 +115,7 @@ def handle_mounted_dirs(func, dirs_string, 
history_filename, update_cache=True):
   dirs_unmounted = set() # set of dirs that have become unmounted
   valid_existing_dirs = []
 
+  dirs_string = dirs_string.replace("file:///","/")
   dirs_string = ",".join([re.sub(r'^\[.+\]', '', dfs_dir.strip()) for dfs_dir 
in dirs_string.split(",")])
   for dir in dirs_string.split(","):
 if dir is None or dir.strip() == "":



ambari git commit: AMBARI-21373 Remove clean repo logic not suitable for Apache Ambari Python API (dili)

2017-06-29 Thread dili
Repository: ambari
Updated Branches:
  refs/heads/branch-feature-AMBARI-21348 ab85eeb19 -> 98f77089c


AMBARI-21373 Remove clean repo logic not suitable for Apache Ambari Python API 
(dili)


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

Branch: refs/heads/branch-feature-AMBARI-21348
Commit: 98f77089c97db7e49498107b9641d39cb0e6a527
Parents: ab85eeb
Author: Di Li 
Authored: Thu Jun 29 13:13:16 2017 -0400
Committer: Di Li 
Committed: Thu Jun 29 13:13:16 2017 -0400

--
 .../scripts/repo_initialization.py  | 27 
 .../scripts/repo_initialization.py  | 27 
 2 files changed, 54 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/98f77089/ambari-server/src/main/resources/stacks/BigInsights/4.0/hooks/before-INSTALL/scripts/repo_initialization.py
--
diff --git 
a/ambari-server/src/main/resources/stacks/BigInsights/4.0/hooks/before-INSTALL/scripts/repo_initialization.py
 
b/ambari-server/src/main/resources/stacks/BigInsights/4.0/hooks/before-INSTALL/scripts/repo_initialization.py
index 1b0f5c6..dffcc39 100755
--- 
a/ambari-server/src/main/resources/stacks/BigInsights/4.0/hooks/before-INSTALL/scripts/repo_initialization.py
+++ 
b/ambari-server/src/main/resources/stacks/BigInsights/4.0/hooks/before-INSTALL/scripts/repo_initialization.py
@@ -52,33 +52,6 @@ def _alter_repo(action, repo_string, repo_template):
components = ubuntu_components, # ubuntu specific
 )
 
-if action == "create":
-  #Attempt to clean cache against the given repo
-  repo_id=repo['repoId']
-  print "Clean cache against " + repo_id + "; file:" + repo['repoName']
-  current_repo_ids = []
-  current_repo_files = set() 
-  
-  if OSCheck.is_ubuntu_family():
-current_repo_files.add("base")
-current_repo_files.add(repo['repoName'])
-  elif OSCheck.is_suse_family():
-current_repo_ids.append("base")
-current_repo_ids.append(repo_id)
-  else:  
-current_repo_ids.append(repo_id)
-  
-  Repository(repo_id,
- action = "clearcache",
- base_url = repo['baseUrl'],
- mirror_list = repo['mirrorsList'],
- repo_file_name = repo['repoName'],
- repo_template = repo_template,
- components = ubuntu_components,  # ubuntu specific
- use_repos=list(current_repo_files) if 
OSCheck.is_ubuntu_family() else current_repo_ids,
- skip_repos=["*"] if OSCheck.is_redhat_family() else []
-  )  
-
 def install_repos():
   import params
   if params.host_sys_prepped:

http://git-wip-us.apache.org/repos/asf/ambari/blob/98f77089/ambari-server/src/main/resources/stacks/BigInsights/4.2.5/hooks/before-INSTALL/scripts/repo_initialization.py
--
diff --git 
a/ambari-server/src/main/resources/stacks/BigInsights/4.2.5/hooks/before-INSTALL/scripts/repo_initialization.py
 
b/ambari-server/src/main/resources/stacks/BigInsights/4.2.5/hooks/before-INSTALL/scripts/repo_initialization.py
index 98fa131..0de2f5b 100755
--- 
a/ambari-server/src/main/resources/stacks/BigInsights/4.2.5/hooks/before-INSTALL/scripts/repo_initialization.py
+++ 
b/ambari-server/src/main/resources/stacks/BigInsights/4.2.5/hooks/before-INSTALL/scripts/repo_initialization.py
@@ -59,33 +59,6 @@ def _alter_repo(action, repo_string, repo_template):
components = ubuntu_components, # ubuntu specific
 )
 
-if action == "create":
-  #Attempt to clean cache against the given repo
-  repo_id=repo['repoId']
-  print "Clean cache against " + repo_id + "; file:" + repo['repoName']
-  current_repo_ids = []
-  current_repo_files = set() 
-  
-  if OSCheck.is_ubuntu_family():
-current_repo_files.add("base")
-current_repo_files.add(repo['repoName'])
-  elif OSCheck.is_suse_family():
-current_repo_ids.append("base")
-current_repo_ids.append(repo_id)
-  else:  
-current_repo_ids.append(repo_id)
-  
-  Repository(repo_id,
- action = "clearcache",
- base_url = repo['baseUrl'],
- mirror_list = repo['mirrorsList'],
- repo_file_name = repo['repoName'],
- repo_template = repo_template,
- components = ubuntu_components,  # ubuntu specific
- use_repos=list(current_repo_files) if 
OSCheck.is_ubuntu_family() 

ambari git commit: AMBARI-21370: Support VIPs instead of Host Names -- fix imports

2017-06-29 Thread adoroszlai
Repository: ambari
Updated Branches:
  refs/heads/trunk 4d7cc7f39 -> aa7a8c657


AMBARI-21370: Support VIPs instead of Host Names -- fix imports


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

Branch: refs/heads/trunk
Commit: aa7a8c657f07caa0be3db89d1e8146978d7d438c
Parents: 4d7cc7f
Author: Attila Doroszlai 
Authored: Thu Jun 29 19:02:45 2017 +0200
Committer: Attila Doroszlai 
Committed: Thu Jun 29 19:02:45 2017 +0200

--
 .../org/apache/ambari/server/controller/jmx/JMXHostProvider.java | 4 +---
 .../apache/ambari/server/controller/jmx/JMXPropertyProvider.java | 1 -
 2 files changed, 1 insertion(+), 4 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/aa7a8c65/ambari-server/src/main/java/org/apache/ambari/server/controller/jmx/JMXHostProvider.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/controller/jmx/JMXHostProvider.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/controller/jmx/JMXHostProvider.java
index dbf8eb7..4e48b53 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/controller/jmx/JMXHostProvider.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/controller/jmx/JMXHostProvider.java
@@ -17,12 +17,10 @@
  */
 package org.apache.ambari.server.controller.jmx;
 
-import org.apache.ambari.server.controller.spi.SystemException;
-import org.apache.ambari.server.state.Host;
-
 import java.util.Set;
 
 import org.apache.ambari.server.controller.spi.SystemException;
+import org.apache.ambari.server.state.Host;
 
 /**
  * Provider of JMX host information.

http://git-wip-us.apache.org/repos/asf/ambari/blob/aa7a8c65/ambari-server/src/main/java/org/apache/ambari/server/controller/jmx/JMXPropertyProvider.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/controller/jmx/JMXPropertyProvider.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/controller/jmx/JMXPropertyProvider.java
index e4de377..832d9ae 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/controller/jmx/JMXPropertyProvider.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/controller/jmx/JMXPropertyProvider.java
@@ -40,7 +40,6 @@ import org.apache.ambari.server.controller.spi.Request;
 import org.apache.ambari.server.controller.spi.Resource;
 import org.apache.ambari.server.controller.spi.SystemException;
 import org.apache.ambari.server.controller.utilities.StreamProvider;
-import org.apache.ambari.server.state.Host;
 import org.apache.ambari.server.state.services.MetricsRetrievalService;
 import 
org.apache.ambari.server.state.services.MetricsRetrievalService.MetricSourceType;
 import org.slf4j.Logger;



ambari git commit: AMBARI-21375 Pass Down More Specific Repository When Creating an Upgrade. (atkach)

2017-06-29 Thread atkach
Repository: ambari
Updated Branches:
  refs/heads/branch-feature-AMBARI-21348 b928e7aba -> ab85eeb19


AMBARI-21375 Pass Down More Specific Repository When Creating an Upgrade. 
(atkach)


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

Branch: refs/heads/branch-feature-AMBARI-21348
Commit: ab85eeb1945de81c1d9cde24747308fec179f2c9
Parents: b928e7a
Author: Andrii Tkach 
Authored: Thu Jun 29 18:12:26 2017 +0300
Committer: Andrii Tkach 
Committed: Thu Jun 29 18:12:26 2017 +0300

--
 .../app/controllers/main/admin/stack_and_upgrade_controller.js | 1 +
 ambari-web/app/utils/ajax/ajax.js  | 1 +
 .../views/main/admin/stack_upgrade/upgrade_version_box_view.js | 6 +-
 .../main/admin/stack_and_upgrade_controller_test.js| 2 ++
 4 files changed, 9 insertions(+), 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/ab85eeb1/ambari-web/app/controllers/main/admin/stack_and_upgrade_controller.js
--
diff --git 
a/ambari-web/app/controllers/main/admin/stack_and_upgrade_controller.js 
b/ambari-web/app/controllers/main/admin/stack_and_upgrade_controller.js
index 5c0a88c..7ff513e 100644
--- a/ambari-web/app/controllers/main/admin/stack_and_upgrade_controller.js
+++ b/ambari-web/app/controllers/main/admin/stack_and_upgrade_controller.js
@@ -1310,6 +1310,7 @@ App.MainAdminStackAndUpgradeController = 
Em.Controller.extend(App.LocalStorage,
*/
   runPreUpgradeCheck: function(version) {
 var params = {
+  id: version.get('id'),
   value: version.get('repositoryVersion'),
   label: version.get('displayName'),
   type: version.get('upgradeType'),

http://git-wip-us.apache.org/repos/asf/ambari/blob/ab85eeb1/ambari-web/app/utils/ajax/ajax.js
--
diff --git a/ambari-web/app/utils/ajax/ajax.js 
b/ambari-web/app/utils/ajax/ajax.js
index eab94bb..a952ee4 100644
--- a/ambari-web/app/utils/ajax/ajax.js
+++ b/ambari-web/app/utils/ajax/ajax.js
@@ -1709,6 +1709,7 @@ var urls = {
 timeout : 60,
 data: JSON.stringify({
   "Upgrade": {
+"repository_id": data.id,
 "repository_version": data.value,
 "upgrade_type": data.type,
 "skip_failures": data.skipComponentFailures,

http://git-wip-us.apache.org/repos/asf/ambari/blob/ab85eeb1/ambari-web/app/views/main/admin/stack_upgrade/upgrade_version_box_view.js
--
diff --git 
a/ambari-web/app/views/main/admin/stack_upgrade/upgrade_version_box_view.js 
b/ambari-web/app/views/main/admin/stack_upgrade/upgrade_version_box_view.js
index 03d0621..86034fd 100644
--- a/ambari-web/app/views/main/admin/stack_upgrade/upgrade_version_box_view.js
+++ b/ambari-web/app/views/main/admin/stack_upgrade/upgrade_version_box_view.js
@@ -153,6 +153,10 @@ App.UpgradeVersionBoxView = Em.View.extend({
 var statePropertiesMap = this.get('statePropertiesMap');
 var requestInProgressRepoId = 
this.get('controller.requestInProgressRepoId');
 var status = this.get('content.status');
+var isVersionHigherThanCurrent = stringUtils.compareVersions(
+this.get('content.repositoryVersion'),
+Em.get(currentVersion, 'repository_version')
+  ) === 1;
 var element = Em.Object.create({
   status: status,
   isInstalling: function () {
@@ -172,7 +176,7 @@ App.UpgradeVersionBoxView = Em.View.extend({
 }
 else if ((status === 'INSTALLED' && !this.get('isUpgrading')) ||
  (['INSTALL_FAILED', 'OUT_OF_SYNC'].contains(status))) {
-  if (stringUtils.compareVersions(this.get('content.repositoryVersion'), 
Em.get(currentVersion, 'repository_version')) === 1) {
+  if (Em.get(currentVersion, 'stack_name') !== 
this.get('content.stackVersionType') || isVersionHigherThanCurrent) {
 var isDisabled = this.isDisabledOnInstalled();
 element.set('isButtonGroup', true);
 if (status === 'OUT_OF_SYNC') {

http://git-wip-us.apache.org/repos/asf/ambari/blob/ab85eeb1/ambari-web/test/controllers/main/admin/stack_and_upgrade_controller_test.js
--
diff --git 
a/ambari-web/test/controllers/main/admin/stack_and_upgrade_controller_test.js 
b/ambari-web/test/controllers/main/admin/stack_and_upgrade_controller_test.js
index b0e8922..f7c84e9 100644
--- 
a/ambari-web/test/controllers/main/admin/stack_and_upgrade_controller_test.js
+++ 

ambari git commit: AMBARI-21370: Support VIPs instead of Host Names (jluniya)

2017-06-29 Thread jluniya
Repository: ambari
Updated Branches:
  refs/heads/branch-2.5 52980df6f -> fde1cced9


AMBARI-21370: Support VIPs instead of Host Names (jluniya)


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

Branch: refs/heads/branch-2.5
Commit: fde1cced9d46bc6812b0336403bd6622a513
Parents: 52980df
Author: Jayush Luniya 
Authored: Thu Jun 29 07:17:24 2017 -0700
Committer: Jayush Luniya 
Committed: Thu Jun 29 07:26:30 2017 -0700

--
 .../ambari_agent/AlertSchedulerHandler.py   |  10 +-
 .../python/ambari_agent/alerts/base_alert.py|   8 +-
 .../python/ambari_agent/alerts/port_alert.py| 107 +++
 .../ambari_agent/TestAlertSchedulerHandler.py   |  17 +--
 .../server/agent/AlertDefinitionCommand.java|   7 +-
 .../ambari/server/agent/HeartBeatHandler.java   |   4 +-
 .../internal/AbstractProviderModule.java|  49 +++--
 .../server/controller/jmx/JMXHostProvider.java  |  15 +++
 .../controller/jmx/JMXPropertyProvider.java |  25 +
 .../org/apache/ambari/server/state/Cluster.java |   8 ++
 .../server/state/alert/AlertDefinitionHash.java |  14 +--
 .../server/state/cluster/ClusterImpl.java   |  18 
 .../2.1.0.2.0/package/scripts/hdfs_namenode.py  |   4 +-
 .../package/scripts/namenode_upgrade.py |   2 +-
 .../2.1.0.2.0/package/scripts/params_linux.py   |   4 +
 .../metrics/JMXPropertyProviderTest.java|   9 ++
 .../state/alerts/AlertDefinitionHashTest.java   |   4 +-
 .../configs/ha_bootstrap_standby_node.json  |   2 +-
 ...ha_bootstrap_standby_node_initial_start.json |   2 +-
 ...dby_node_initial_start_dfs_nameservices.json |   2 +-
 20 files changed, 227 insertions(+), 84 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/fde1cced/ambari-agent/src/main/python/ambari_agent/AlertSchedulerHandler.py
--
diff --git a/ambari-agent/src/main/python/ambari_agent/AlertSchedulerHandler.py 
b/ambari-agent/src/main/python/ambari_agent/AlertSchedulerHandler.py
index 6c1d29c..55c3d6e 100644
--- a/ambari-agent/src/main/python/ambari_agent/AlertSchedulerHandler.py
+++ b/ambari-agent/src/main/python/ambari_agent/AlertSchedulerHandler.py
@@ -283,6 +283,7 @@ class AlertSchedulerHandler():
 for command_json in all_commands:
   clusterName = '' if not 'clusterName' in command_json else 
command_json['clusterName']
   hostName = '' if not 'hostName' in command_json else 
command_json['hostName']
+  publicHostName = '' if not 'publicHostName' in command_json else 
command_json['publicHostName']
   clusterHash = None if not 'hash' in command_json else 
command_json['hash']
 
   # cache the cluster and cluster hash after loading the JSON
@@ -291,7 +292,7 @@ class AlertSchedulerHandler():
 self._cluster_hashes[clusterName] = clusterHash
 
   for definition in command_json['alertDefinitions']:
-alert = self.__json_to_callable(clusterName, hostName, definition)
+alert = self.__json_to_callable(clusterName, hostName, publicHostName, 
definition)
 
 if alert is None:
   continue
@@ -303,7 +304,7 @@ class AlertSchedulerHandler():
 return definitions
 
 
-  def __json_to_callable(self, clusterName, hostName, json_definition):
+  def __json_to_callable(self, clusterName, hostName, publicHostName, 
json_definition):
 """
 converts the json that represents all aspects of a definition
 and makes an object that extends BaseAlert that is used for individual
@@ -336,7 +337,7 @@ class AlertSchedulerHandler():
 alert = RecoveryAlert(json_definition, source, self.config, 
self.recovery_manger)
 
   if alert is not None:
-alert.set_cluster(clusterName, hostName)
+alert.set_cluster(clusterName, hostName, publicHostName)
 
 except Exception, exception:
   logger.exception("[AlertScheduler] Unable to load an invalid alert 
definition. It will be skipped.")
@@ -402,8 +403,9 @@ class AlertSchedulerHandler():
 
 clusterName = '' if not 'clusterName' in execution_command else 
execution_command['clusterName']
 hostName = '' if not 'hostName' in execution_command else 
execution_command['hostName']
+publicHostName = '' if not 'publicHostName' in execution_command else 
execution_command['publicHostName']
 
-alert = self.__json_to_callable(clusterName, hostName, 
alert_definition)
+alert = self.__json_to_callable(clusterName, hostName, publicHostName, 
alert_definition)
 
 if alert is None:
   continue


ambari git commit: AMBARI-21370: Support VIPs instead of Host Names (jluniya)

2017-06-29 Thread jluniya
Repository: ambari
Updated Branches:
  refs/heads/trunk 4cd315011 -> 4d7cc7f39


AMBARI-21370: Support VIPs instead of Host Names (jluniya)


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

Branch: refs/heads/trunk
Commit: 4d7cc7f392a6c4b52d39456504ad490d74fd019a
Parents: 4cd3150
Author: Jayush Luniya 
Authored: Thu Jun 29 07:17:24 2017 -0700
Committer: Jayush Luniya 
Committed: Thu Jun 29 07:17:24 2017 -0700

--
 .../ambari_agent/AlertSchedulerHandler.py   |  10 +-
 .../python/ambari_agent/alerts/base_alert.py|   8 +-
 .../python/ambari_agent/alerts/port_alert.py| 107 +++
 .../ambari_agent/TestAlertSchedulerHandler.py   |  17 +--
 .../server/agent/AlertDefinitionCommand.java|   7 +-
 .../ambari/server/agent/HeartBeatHandler.java   |   4 +-
 .../internal/AbstractProviderModule.java|  47 ++--
 .../server/controller/jmx/JMXHostProvider.java  |  13 +++
 .../controller/jmx/JMXPropertyProvider.java |  25 +
 .../org/apache/ambari/server/state/Cluster.java |   8 ++
 .../server/state/alert/AlertDefinitionHash.java |  14 +--
 .../server/state/cluster/ClusterImpl.java   |  18 
 .../2.1.0.2.0/package/scripts/hdfs_namenode.py  |   4 +-
 .../package/scripts/namenode_upgrade.py |   2 +-
 .../2.1.0.2.0/package/scripts/params_linux.py   |   4 +
 .../metrics/JMXPropertyProviderTest.java|   9 ++
 .../state/alerts/AlertDefinitionHashTest.java   |   4 +-
 .../configs/ha_bootstrap_standby_node.json  |   2 +-
 ...ha_bootstrap_standby_node_initial_start.json |   2 +-
 ...dby_node_initial_start_dfs_nameservices.json |   2 +-
 20 files changed, 224 insertions(+), 83 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/4d7cc7f3/ambari-agent/src/main/python/ambari_agent/AlertSchedulerHandler.py
--
diff --git a/ambari-agent/src/main/python/ambari_agent/AlertSchedulerHandler.py 
b/ambari-agent/src/main/python/ambari_agent/AlertSchedulerHandler.py
index 6c1d29c..55c3d6e 100644
--- a/ambari-agent/src/main/python/ambari_agent/AlertSchedulerHandler.py
+++ b/ambari-agent/src/main/python/ambari_agent/AlertSchedulerHandler.py
@@ -283,6 +283,7 @@ class AlertSchedulerHandler():
 for command_json in all_commands:
   clusterName = '' if not 'clusterName' in command_json else 
command_json['clusterName']
   hostName = '' if not 'hostName' in command_json else 
command_json['hostName']
+  publicHostName = '' if not 'publicHostName' in command_json else 
command_json['publicHostName']
   clusterHash = None if not 'hash' in command_json else 
command_json['hash']
 
   # cache the cluster and cluster hash after loading the JSON
@@ -291,7 +292,7 @@ class AlertSchedulerHandler():
 self._cluster_hashes[clusterName] = clusterHash
 
   for definition in command_json['alertDefinitions']:
-alert = self.__json_to_callable(clusterName, hostName, definition)
+alert = self.__json_to_callable(clusterName, hostName, publicHostName, 
definition)
 
 if alert is None:
   continue
@@ -303,7 +304,7 @@ class AlertSchedulerHandler():
 return definitions
 
 
-  def __json_to_callable(self, clusterName, hostName, json_definition):
+  def __json_to_callable(self, clusterName, hostName, publicHostName, 
json_definition):
 """
 converts the json that represents all aspects of a definition
 and makes an object that extends BaseAlert that is used for individual
@@ -336,7 +337,7 @@ class AlertSchedulerHandler():
 alert = RecoveryAlert(json_definition, source, self.config, 
self.recovery_manger)
 
   if alert is not None:
-alert.set_cluster(clusterName, hostName)
+alert.set_cluster(clusterName, hostName, publicHostName)
 
 except Exception, exception:
   logger.exception("[AlertScheduler] Unable to load an invalid alert 
definition. It will be skipped.")
@@ -402,8 +403,9 @@ class AlertSchedulerHandler():
 
 clusterName = '' if not 'clusterName' in execution_command else 
execution_command['clusterName']
 hostName = '' if not 'hostName' in execution_command else 
execution_command['hostName']
+publicHostName = '' if not 'publicHostName' in execution_command else 
execution_command['publicHostName']
 
-alert = self.__json_to_callable(clusterName, hostName, 
alert_definition)
+alert = self.__json_to_callable(clusterName, hostName, publicHostName, 
alert_definition)
 
 if alert is None:
   continue


ambari git commit: AMBARI-21363 ORA-00911 error during Ambari server schema upgrade due to incorrect syntax of Update statement (dgrinenko)

2017-06-29 Thread hapylestat
Repository: ambari
Updated Branches:
  refs/heads/trunk 09e5d41c5 -> 4cd315011


AMBARI-21363 ORA-00911 error during Ambari server schema upgrade due to 
incorrect syntax of Update statement (dgrinenko)


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

Branch: refs/heads/trunk
Commit: 4cd3150111560a43dd8028e6f14b2abf753e3d8b
Parents: 09e5d41
Author: Dmytro Grinenko 
Authored: Thu Jun 29 15:17:29 2017 +0300
Committer: Dmytro Grinenko 
Committed: Thu Jun 29 15:17:29 2017 +0300

--
 .../ambari/server/orm/DBAccessorImpl.java   | 43 +++-
 .../orm/helpers/dbms/GenericDbmsHelper.java |  2 +-
 2 files changed, 25 insertions(+), 20 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/4cd31501/ambari-server/src/main/java/org/apache/ambari/server/orm/DBAccessorImpl.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/orm/DBAccessorImpl.java 
b/ambari-server/src/main/java/org/apache/ambari/server/orm/DBAccessorImpl.java
index 83ea8e1..a88430b 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/orm/DBAccessorImpl.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/orm/DBAccessorImpl.java
@@ -204,6 +204,27 @@ public class DBAccessorImpl implements DBAccessor {
 return objectName;
   }
 
+  /**
+   * Setting arguments for prepared statement
+   *
+   * @param preparedStatement {@link PreparedStatement} object
+   * @param arguments array of arguments
+   *
+   * @throws SQLException
+   */
+  private void setArgumentsForPreparedStatement(PreparedStatement 
preparedStatement, Object[] arguments) throws SQLException{
+for (int i = 0; i < arguments.length; i++) {
+  if (arguments[i] instanceof byte[]) {
+byte[] binaryData = (byte[]) arguments[i];
+
+// JDBC drivers supports only this function signature
+preparedStatement.setBinaryStream(i+1, new 
ByteArrayInputStream(binaryData), binaryData.length);
+  } else {
+preparedStatement.setObject(i+1, arguments[i]);
+  }
+}
+  }
+
   @Override
   public boolean tableExists(String tableName) throws SQLException {
 boolean result = false;
@@ -878,16 +899,8 @@ public class DBAccessorImpl implements DBAccessor {
 LOG.info("Executing prepared query: {}", query);
 
 PreparedStatement preparedStatement = 
getConnection().prepareStatement(query);
+setArgumentsForPreparedStatement(preparedStatement, arguments);
 
-  for (int i = 0; i < arguments.length; i++) {
-if (arguments[i] instanceof byte[]) {
-  byte[] binaryData = (byte[]) arguments[i];
-  // JDBC drivers supports only this function signature
-  preparedStatement.setBinaryStream(i+1, new 
ByteArrayInputStream(binaryData), binaryData.length);
-} else {
-  preparedStatement.setObject(i+1, arguments[i]);
-}
-  }
 try {
 preparedStatement.execute();
 } catch (SQLException e) {
@@ -908,7 +921,7 @@ public class DBAccessorImpl implements DBAccessor {
{@inheritDoc}
*/
   public void executePreparedUpdate(String query, Object...arguments) throws 
SQLException {
-executePreparedQuery(query, false, arguments);
+executePreparedUpdate(query, false, arguments);
   }
 
   /**
@@ -918,16 +931,8 @@ public class DBAccessorImpl implements DBAccessor {
 LOG.info("Executing prepared query: {}", query);
 
 PreparedStatement preparedStatement = 
getConnection().prepareStatement(query);
+setArgumentsForPreparedStatement(preparedStatement, arguments);
 
-for (int i = 0; i <= arguments.length; i++) {
-  if (arguments[i] instanceof byte[]) {
-byte[] binaryData = (byte[]) arguments[i];
-// JDBC drivers supports only this function signature
-preparedStatement.setBinaryStream(i+1, new 
ByteArrayInputStream(binaryData), binaryData.length);
-  } else {
-preparedStatement.setObject(i+1, arguments[i]);
-  }
-}
 try {
   preparedStatement.executeUpdate();
 } catch (SQLException e) {

http://git-wip-us.apache.org/repos/asf/ambari/blob/4cd31501/ambari-server/src/main/java/org/apache/ambari/server/orm/helpers/dbms/GenericDbmsHelper.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/orm/helpers/dbms/GenericDbmsHelper.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/orm/helpers/dbms/GenericDbmsHelper.java
index 56274c5..e2a1f38 100644
--- 

ambari git commit: AMBARI-21363 ORA-00911 error during Ambari server schema upgrade due to incorrect syntax of Update statement (dgrinenko)

2017-06-29 Thread hapylestat
Repository: ambari
Updated Branches:
  refs/heads/branch-2.5 777434efb -> 52980df6f


AMBARI-21363 ORA-00911 error during Ambari server schema upgrade due to 
incorrect syntax of Update statement (dgrinenko)


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

Branch: refs/heads/branch-2.5
Commit: 52980df6f7ac8ee22895c2b102f4c5fe6346a12b
Parents: 777434e
Author: Dmytro Grinenko 
Authored: Thu Jun 29 15:15:23 2017 +0300
Committer: Dmytro Grinenko 
Committed: Thu Jun 29 15:15:23 2017 +0300

--
 .../ambari/server/orm/DBAccessorImpl.java   | 43 +++-
 .../orm/helpers/dbms/GenericDbmsHelper.java |  2 +-
 2 files changed, 25 insertions(+), 20 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/52980df6/ambari-server/src/main/java/org/apache/ambari/server/orm/DBAccessorImpl.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/orm/DBAccessorImpl.java 
b/ambari-server/src/main/java/org/apache/ambari/server/orm/DBAccessorImpl.java
index f3250b8..2256d44 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/orm/DBAccessorImpl.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/orm/DBAccessorImpl.java
@@ -204,6 +204,27 @@ public class DBAccessorImpl implements DBAccessor {
 return objectName;
   }
 
+  /**
+   * Setting arguments for prepared statement
+   *
+   * @param preparedStatement {@link PreparedStatement} object
+   * @param arguments array of arguments
+   *
+   * @throws SQLException
+   */
+  private void setArgumentsForPreparedStatement(PreparedStatement 
preparedStatement, Object[] arguments) throws SQLException{
+for (int i = 0; i < arguments.length; i++) {
+  if (arguments[i] instanceof byte[]) {
+byte[] binaryData = (byte[]) arguments[i];
+
+// JDBC drivers supports only this function signature
+preparedStatement.setBinaryStream(i+1, new 
ByteArrayInputStream(binaryData), binaryData.length);
+  } else {
+preparedStatement.setObject(i+1, arguments[i]);
+  }
+}
+  }
+
   @Override
   public boolean tableExists(String tableName) throws SQLException {
 boolean result = false;
@@ -878,16 +899,8 @@ public class DBAccessorImpl implements DBAccessor {
 LOG.info("Executing prepared query: {}", query);
 
 PreparedStatement preparedStatement = 
getConnection().prepareStatement(query);
+setArgumentsForPreparedStatement(preparedStatement, arguments);
 
-  for (int i = 0; i < arguments.length; i++) {
-if (arguments[i] instanceof byte[]) {
-  byte[] binaryData = (byte[]) arguments[i];
-  // JDBC drivers supports only this function signature
-  preparedStatement.setBinaryStream(i+1, new 
ByteArrayInputStream(binaryData), binaryData.length);
-} else {
-  preparedStatement.setObject(i+1, arguments[i]);
-}
-  }
 try {
 preparedStatement.execute();
 } catch (SQLException e) {
@@ -908,7 +921,7 @@ public class DBAccessorImpl implements DBAccessor {
{@inheritDoc}
*/
   public void executePreparedUpdate(String query, Object...arguments) throws 
SQLException {
-executePreparedQuery(query, false, arguments);
+executePreparedUpdate(query, false, arguments);
   }
 
   /**
@@ -918,16 +931,8 @@ public class DBAccessorImpl implements DBAccessor {
 LOG.info("Executing prepared query: {}", query);
 
 PreparedStatement preparedStatement = 
getConnection().prepareStatement(query);
+setArgumentsForPreparedStatement(preparedStatement, arguments);
 
-for (int i = 0; i <= arguments.length; i++) {
-  if (arguments[i] instanceof byte[]) {
-byte[] binaryData = (byte[]) arguments[i];
-// JDBC drivers supports only this function signature
-preparedStatement.setBinaryStream(i+1, new 
ByteArrayInputStream(binaryData), binaryData.length);
-  } else {
-preparedStatement.setObject(i+1, arguments[i]);
-  }
-}
 try {
   preparedStatement.executeUpdate();
 } catch (SQLException e) {

http://git-wip-us.apache.org/repos/asf/ambari/blob/52980df6/ambari-server/src/main/java/org/apache/ambari/server/orm/helpers/dbms/GenericDbmsHelper.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/orm/helpers/dbms/GenericDbmsHelper.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/orm/helpers/dbms/GenericDbmsHelper.java
index 4b4ce8d..11cbcf9 100644
--- 

ambari git commit: AMBARI-21343. Cleanup relevant Kerberos identities when a component is removed - addendum: fix missing copyrights (amagyar)

2017-06-29 Thread amagyar
Repository: ambari
Updated Branches:
  refs/heads/trunk 8b5c7db60 -> 09e5d41c5


AMBARI-21343. Cleanup relevant Kerberos identities when a component is removed 
- addendum: fix missing copyrights (amagyar)


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

Branch: refs/heads/trunk
Commit: 09e5d41c5d52339a0edea97886acf0fd38ee8a91
Parents: 8b5c7db
Author: Attila Magyar 
Authored: Thu Jun 29 12:14:54 2017 +0200
Committer: Attila Magyar 
Committed: Thu Jun 29 12:14:54 2017 +0200

--
 .../controller/OrderedRequestStageContainer.java   | 17 +
 1 file changed, 17 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/09e5d41c/ambari-server/src/main/java/org/apache/ambari/server/controller/OrderedRequestStageContainer.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/controller/OrderedRequestStageContainer.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/controller/OrderedRequestStageContainer.java
index 6d8b5a3..4ac6896 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/controller/OrderedRequestStageContainer.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/controller/OrderedRequestStageContainer.java
@@ -1,3 +1,20 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
 package org.apache.ambari.server.controller;
 
 import org.apache.ambari.server.AmbariException;



ambari git commit: AMBARI-21343. Cleanup relevant Kerberos identities when a component is removed (amagyar)

2017-06-29 Thread amagyar
Repository: ambari
Updated Branches:
  refs/heads/trunk 9d224f73b -> 8b5c7db60


AMBARI-21343. Cleanup relevant Kerberos identities when a component is removed 
(amagyar)


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

Branch: refs/heads/trunk
Commit: 8b5c7db602a0e1e2dfb214ec1d51884c16219467
Parents: 9d224f7
Author: Attila Magyar 
Authored: Thu Jun 29 11:05:25 2017 +0200
Committer: Attila Magyar 
Committed: Thu Jun 29 11:05:25 2017 +0200

--
 .../ambari/server/controller/AmbariServer.java  |   4 +
 .../controller/DeleteIdentityHandler.java   | 283 +++
 .../server/controller/KerberosHelper.java   |   3 +
 .../server/controller/KerberosHelperImpl.java   |  31 +-
 .../OrderedRequestStageContainer.java   |  45 +++
 .../utilities/KerberosIdentityCleaner.java  | 135 +
 .../AbstractPrepareKerberosServerAction.java|  19 +-
 .../server/serveraction/kerberos/Component.java |  74 +
 .../kerberos/FinalizeKerberosServerAction.java  |  27 +-
 .../kerberos/KerberosServerAction.java  |  27 ++
 .../kerberos/AbstractKerberosDescriptor.java|  15 +
 .../kerberos/KerberosComponentDescriptor.java   |  15 +
 .../state/kerberos/KerberosDescriptor.java  |   8 -
 .../kerberos/KerberosIdentityDescriptor.java|  30 ++
 .../kerberos/KerberosServiceDescriptor.java |   6 +
 .../utilities/KerberosIdentityCleanerTest.java  | 204 +
 ambari-web/app/controllers/main/service/item.js |   6 +-
 17 files changed, 894 insertions(+), 38 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/8b5c7db6/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 aeba739..8988be0 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
@@ -76,6 +76,7 @@ import 
org.apache.ambari.server.controller.internal.UserPrivilegeResourceProvide
 import 
org.apache.ambari.server.controller.internal.ViewPermissionResourceProvider;
 import 
org.apache.ambari.server.controller.metrics.ThreadPoolEnabledPropertyProvider;
 import org.apache.ambari.server.controller.utilities.KerberosChecker;
+import org.apache.ambari.server.controller.utilities.KerberosIdentityCleaner;
 import org.apache.ambari.server.metrics.system.MetricsService;
 import org.apache.ambari.server.orm.GuiceJpaInitializer;
 import org.apache.ambari.server.orm.PersistenceType;
@@ -941,6 +942,9 @@ public class AmbariServer {
 BaseService.init(injector.getInstance(RequestAuditLogger.class));
 
 RetryHelper.init(injector.getInstance(Clusters.class), 
configs.getOperationsRetryAttempts());
+
+KerberosIdentityCleaner identityCleaner = 
injector.getInstance(KerberosIdentityCleaner.class);
+identityCleaner.register();
   }
 
   /**

http://git-wip-us.apache.org/repos/asf/ambari/blob/8b5c7db6/ambari-server/src/main/java/org/apache/ambari/server/controller/DeleteIdentityHandler.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/controller/DeleteIdentityHandler.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/controller/DeleteIdentityHandler.java
new file mode 100644
index 000..aa098b6
--- /dev/null
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/controller/DeleteIdentityHandler.java
@@ -0,0 +1,283 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.ambari.server.controller;
+
+import static