ambari git commit: AMBARI-18399. Ambari UI to auto select Slider client to get deployed on the History Server host (akovalenko)

2016-09-15 Thread akovalenko
Repository: ambari
Updated Branches:
  refs/heads/trunk cc684be15 -> 41a9190fc


AMBARI-18399. Ambari UI to auto select Slider client to get deployed on the 
History Server host (akovalenko)


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

Branch: refs/heads/trunk
Commit: 41a9190fc011dcfd9bc4b99dcba90ad0397b9f94
Parents: cc684be
Author: Aleksandr Kovalenko 
Authored: Thu Sep 15 15:19:19 2016 +0300
Committer: Aleksandr Kovalenko 
Committed: Thu Sep 15 15:22:16 2016 +0300

--
 .../resources/common-services/YARN/2.1.0.2.0/metainfo.xml | 7 +++
 1 file changed, 7 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/41a9190f/ambari-server/src/main/resources/common-services/YARN/2.1.0.2.0/metainfo.xml
--
diff --git 
a/ambari-server/src/main/resources/common-services/YARN/2.1.0.2.0/metainfo.xml 
b/ambari-server/src/main/resources/common-services/YARN/2.1.0.2.0/metainfo.xml
index f80fa8a..25e242b 100644
--- 
a/ambari-server/src/main/resources/common-services/YARN/2.1.0.2.0/metainfo.xml
+++ 
b/ambari-server/src/main/resources/common-services/YARN/2.1.0.2.0/metainfo.xml
@@ -217,6 +217,13 @@
 true
   
 
+
+  SLIDER/SLIDER
+  host
+  
+true
+  
+
   
   
 scripts/historyserver.py



ambari git commit: AMBARI-18287. status commands get all the *-env files irrespective of a service exists or not.(vbrodetskyi)

2016-09-15 Thread vbrodetskyi
Repository: ambari
Updated Branches:
  refs/heads/branch-2.5 1afecc2dd -> 53b34516a


AMBARI-18287. status commands get all the *-env files irrespective of a service 
exists or not.(vbrodetskyi)


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

Branch: refs/heads/branch-2.5
Commit: 53b34516a5c53cf1d6a93d1bf53f247815269d35
Parents: 1afecc2
Author: Vitaly Brodetskyi 
Authored: Thu Sep 15 16:50:07 2016 +0300
Committer: Vitaly Brodetskyi 
Committed: Thu Sep 15 16:50:07 2016 +0300

--
 .../ambari/server/agent/HeartbeatMonitor.java   |  7 ++-
 .../server/agent/TestHeartbeatMonitor.java  | 20 +++-
 2 files changed, 21 insertions(+), 6 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/53b34516/ambari-server/src/main/java/org/apache/ambari/server/agent/HeartbeatMonitor.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/agent/HeartbeatMonitor.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/agent/HeartbeatMonitor.java
index c353049..c53a73d 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/agent/HeartbeatMonitor.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/agent/HeartbeatMonitor.java
@@ -31,6 +31,7 @@ import java.util.Collection;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
+import java.util.Set;
 import java.util.TreeMap;
 
 import org.apache.ambari.server.AmbariException;
@@ -256,12 +257,16 @@ public class HeartbeatMonitor implements Runnable {
 //Config clusterConfig = cluster.getDesiredConfigByType(GLOBAL);
 Collection clusterConfigs = cluster.getAllConfigs();
 
+// creating list with desired config types to validate if cluster config 
actual
+Set desiredConfigTypes = cluster.getDesiredConfigs().keySet();
+
 // Apply global properties for this host from all config groups
 Map> allConfigTags = configHelper
 .getEffectiveDesiredTags(cluster, hostname);
 
 for(Config clusterConfig: clusterConfigs) {
-  if(!clusterConfig.getType().endsWith("-env")) {
+  String configType = clusterConfig.getType();
+  if(!configType.endsWith("-env") || 
!desiredConfigTypes.contains(configType)) {
 continue;
   }
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/53b34516/ambari-server/src/test/java/org/apache/ambari/server/agent/TestHeartbeatMonitor.java
--
diff --git 
a/ambari-server/src/test/java/org/apache/ambari/server/agent/TestHeartbeatMonitor.java
 
b/ambari-server/src/test/java/org/apache/ambari/server/agent/TestHeartbeatMonitor.java
index d8e8879..b6f5ec2 100644
--- 
a/ambari-server/src/test/java/org/apache/ambari/server/agent/TestHeartbeatMonitor.java
+++ 
b/ambari-server/src/test/java/org/apache/ambari/server/agent/TestHeartbeatMonitor.java
@@ -266,13 +266,19 @@ public class TestHeartbeatMonitor {
 }};
 
 ConfigFactory configFactory = injector.getInstance(ConfigFactory.class);
-Config config = configFactory.createNew(cluster, "hadoop-env",
+Config hadoopEnvConfig = configFactory.createNew(cluster, "hadoop-env",
   new HashMap() {{
 put("a", "b");
   }}, new HashMap>());
-config.setTag("version1");
-cluster.addConfig(config);
-cluster.addDesiredConfig("_test", Collections.singleton(config));
+Config hbaseEnvConfig = configFactory.createNew(cluster, "hbase-env",
+new HashMap() {{
+  put("a", "b");
+}}, new HashMap>());
+hadoopEnvConfig.setTag("version1");
+cluster.addConfig(hadoopEnvConfig);
+hbaseEnvConfig.setTag("version1");
+cluster.addConfig(hbaseEnvConfig);
+cluster.addDesiredConfig("_test", Collections.singleton(hadoopEnvConfig));
 
 
 clusters.mapHostsToCluster(hostNames, clusterName);
@@ -318,7 +324,7 @@ public class TestHeartbeatMonitor {
 HostInfo hi = new HostInfo();
 hi.setOS("Centos5");
 reg.setHardwareProfile(hi);
-handler.handleRegistration(reg);
+RegistrationResponse registrationResponse = 
handler.handleRegistration(reg);
 
 HeartBeat hb = new HeartBeat();
 hb.setHostname(hostname1);
@@ -327,6 +333,10 @@ public class TestHeartbeatMonitor {
 hb.setResponseId(12);
 handler.handleHeartBeat(hb);
 
+Map> statusCommandConfig = 

[2/2] ambari git commit: AMBARI-15538. Support service-specific repo for add-on services (Balazs bence Sari via magyari_sandor)

2016-09-15 Thread magyari_sandor
AMBARI-15538. Support service-specific repo for add-on services (Balazs bence 
Sari via magyari_sandor)


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

Branch: refs/heads/branch-2.5
Commit: 7961cd114566d035ee844098865195667d1cb4f5
Parents: 6a947a9
Author: Balazs Bence Sari 
Authored: Thu Sep 15 15:08:16 2016 +0200
Committer: Sandor Magyari 
Committed: Thu Sep 15 15:20:27 2016 +0200

--
 .../checks/DatabaseConsistencyCheckHelper.java  |   1 +
 .../AmbariManagementControllerImpl.java |  13 +-
 .../ambari/server/controller/AmbariServer.java  |   2 +
 .../VersionDefinitionResourceProvider.java  |  18 +-
 .../apache/ambari/server/stack/RepoUtil.java| 208 +++
 .../ambari/server/stack/ServiceModule.java  |   7 +
 .../ambari/server/stack/StackDirectory.java |  23 +-
 .../apache/ambari/server/stack/StackModule.java | 135 ++--
 .../server/stack/StackServiceDirectory.java |  70 ++-
 .../stack/UpdateActiveRepoVersionOnStartup.java | 118 +++
 .../ambari/server/state/RepositoryInfo.java |  57 +
 .../apache/ambari/server/state/StackInfo.java   |  13 +-
 .../stack/upgrade/RepositoryVersionHelper.java  |  28 ++-
 .../src/main/resources/version_definition.xsd   |  24 +--
 .../ambari/server/stack/RepoUtilTest.java   | 166 +++
 .../stack/StackManagerCommonServicesTest.java   |  20 ++
 .../ambari/server/stack/StackModuleTest.java| 188 +
 .../UpdateActiveRepoVersionOnStartupTest.java   | 143 +
 .../ADDON/1.0/configuration/addon-env.xml   |  35 
 .../common-services/ADDON/1.0/metainfo.xml  |  35 
 ...veRepoVersionOnStartupTest_initialRepos.json |  32 +++
 .../HDP/0.2/services/ADDON/metainfo.xml |  28 +++
 .../HDP/0.2/services/ADDON/repos/repoinfo.xml   |  26 +++
 .../8.0.0/configuration/microsoft-r-env.xml |  35 
 .../8.0.0/package/scripts/microsoft_r.py|  22 +-
 .../MICROSOFT_R/8.0.0/repos/repoinfo.xml|  33 +++
 26 files changed, 1400 insertions(+), 80 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/7961cd11/ambari-server/src/main/java/org/apache/ambari/server/checks/DatabaseConsistencyCheckHelper.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/checks/DatabaseConsistencyCheckHelper.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/checks/DatabaseConsistencyCheckHelper.java
index f302b8b..2d91eca 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/checks/DatabaseConsistencyCheckHelper.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/checks/DatabaseConsistencyCheckHelper.java
@@ -545,6 +545,7 @@ public class DatabaseConsistencyCheckHelper {
 String stackVersion = stackInfo.get(stackName);
 Map serviceInfoMap = 
ambariMetaInfo.getServices(stackName, stackVersion);
 for (String serviceName : serviceNames) {
+  LOG.info("Processing {}-{} / {}", stackName, stackVersion, 
serviceName);
   ServiceInfo serviceInfo = serviceInfoMap.get(serviceName);
   if (serviceInfo != null) {
 Set configTypes = 
serviceInfo.getConfigTypeAttributes().keySet();

http://git-wip-us.apache.org/repos/asf/ambari/blob/7961cd11/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java
index 3acf490..a35b0e9 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java
@@ -140,6 +140,7 @@ import org.apache.ambari.server.security.ldap.LdapSyncDto;
 import 
org.apache.ambari.server.serveraction.kerberos.KerberosInvalidConfigurationException;
 import 
org.apache.ambari.server.serveraction.kerberos.KerberosOperationException;
 import org.apache.ambari.server.stack.ExtensionHelper;
+import org.apache.ambari.server.stack.RepoUtil;
 import org.apache.ambari.server.stageplanner.RoleGraph;
 import org.apache.ambari.server.stageplanner.RoleGraphFactory;
 import org.apache.ambari.server.state.Cluster;
@@ -206,6 +207,7 @@ import com.google.inject.Inject;
 import com.google.inject.Injector;
 import 

[1/2] ambari git commit: AMBARI-15538. Support service-specific repo for add-on services (Balazs bence Sari via magyari_sandor)

2016-09-15 Thread magyari_sandor
Repository: ambari
Updated Branches:
  refs/heads/branch-2.5 6a947a9fd -> 7961cd114


http://git-wip-us.apache.org/repos/asf/ambari/blob/7961cd11/ambari-server/src/test/resources/stacks_with_common_services/HDP/0.2/services/ADDON/repos/repoinfo.xml
--
diff --git 
a/ambari-server/src/test/resources/stacks_with_common_services/HDP/0.2/services/ADDON/repos/repoinfo.xml
 
b/ambari-server/src/test/resources/stacks_with_common_services/HDP/0.2/services/ADDON/repos/repoinfo.xml
new file mode 100644
index 000..8d7c255
--- /dev/null
+++ 
b/ambari-server/src/test/resources/stacks_with_common_services/HDP/0.2/services/ADDON/repos/repoinfo.xml
@@ -0,0 +1,26 @@
+
+
+
+
+
+http:add.on/repo
+ADDON_REPO-1.0
+ADDON_REPO
+
+
+

http://git-wip-us.apache.org/repos/asf/ambari/blob/7961cd11/contrib/management-packs/microsoft-r_mpack/src/main/resources/common-services/MICROSOFT_R/8.0.0/configuration/microsoft-r-env.xml
--
diff --git 
a/contrib/management-packs/microsoft-r_mpack/src/main/resources/common-services/MICROSOFT_R/8.0.0/configuration/microsoft-r-env.xml
 
b/contrib/management-packs/microsoft-r_mpack/src/main/resources/common-services/MICROSOFT_R/8.0.0/configuration/microsoft-r-env.xml
new file mode 100644
index 000..5bc4a31
--- /dev/null
+++ 
b/contrib/management-packs/microsoft-r_mpack/src/main/resources/common-services/MICROSOFT_R/8.0.0/configuration/microsoft-r-env.xml
@@ -0,0 +1,35 @@
+
+
+
+
+
+
+R Open Version
+Version of R Open
+Version of R Open
+3.2.2
+
+string
+false
+
+
+
+

http://git-wip-us.apache.org/repos/asf/ambari/blob/7961cd11/contrib/management-packs/microsoft-r_mpack/src/main/resources/common-services/MICROSOFT_R/8.0.0/package/scripts/microsoft_r.py
--
diff --git 
a/contrib/management-packs/microsoft-r_mpack/src/main/resources/common-services/MICROSOFT_R/8.0.0/package/scripts/microsoft_r.py
 
b/contrib/management-packs/microsoft-r_mpack/src/main/resources/common-services/MICROSOFT_R/8.0.0/package/scripts/microsoft_r.py
index 61ea96b..382bd0f 100644
--- 
a/contrib/management-packs/microsoft-r_mpack/src/main/resources/common-services/MICROSOFT_R/8.0.0/package/scripts/microsoft_r.py
+++ 
b/contrib/management-packs/microsoft-r_mpack/src/main/resources/common-services/MICROSOFT_R/8.0.0/package/scripts/microsoft_r.py
@@ -19,30 +19,24 @@ limitations under the License.
 """
 from resource_management.libraries.script import Script
 from resource_management.core.logger import Logger
-from resource_management.core.source import DownloadSource
-from resource_management.core.resources import File, Package
+from resource_management.core.resources import Package
 
-rpm_location = 'http://104.196.87.250/msft-r/8.1/'
-rpms = ['microsoft-r-server-mro-8.0.rpm',
-'microsoft-r-server-intel-mkl-8.0.rpm',
-'microsoft-r-server-packages-8.0.rpm',
-'microsoft-r-server-hadoop-8.0.rpm']
+
+rpms = ['microsoft-r-server-mro-8.0',
+'microsoft-r-server-intel-mkl-8.0',
+'microsoft-r-server-packages-8.0',
+'microsoft-r-server-hadoop-8.0']
 
 class MicrosoftR(Script):
+
   def install(self, env):
 Logger.info('Installing R Server Client...')
 tmp_dir = Script.tmp_dir
 Logger.debug('Using temp dir: {0}'.format(tmp_dir))
-Logger.info("Will download and install the following rpm's from {0}: 
{1}".format(rpm_location, rpms))
 
 for rpm in rpms:
-  Logger.info('Downloading {0}'.format(rpm))
-  rpmFile = '{0}/{1}'.format(tmp_dir, rpm)
-  File(rpmFile, \
-   content = DownloadSource(rpm_location + rpm), \
-   mode = 0644)
   Logger.info('Installing {0}'.format(rpm))
-  Package(rpmFile)
+  Package(rpm)
 
 Logger.info('Installed R Server')
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/7961cd11/contrib/management-packs/microsoft-r_mpack/src/main/resources/custom-services/MICROSOFT_R/8.0.0/repos/repoinfo.xml
--
diff --git 
a/contrib/management-packs/microsoft-r_mpack/src/main/resources/custom-services/MICROSOFT_R/8.0.0/repos/repoinfo.xml
 
b/contrib/management-packs/microsoft-r_mpack/src/main/resources/custom-services/MICROSOFT_R/8.0.0/repos/repoinfo.xml
new file mode 100644
index 000..4c82514
--- /dev/null
+++ 
b/contrib/management-packs/microsoft-r_mpack/src/main/resources/custom-services/MICROSOFT_R/8.0.0/repos/repoinfo.xml
@@ -0,0 +1,33 @@
+
+
+
+
+
+http://104.196.87.250/msft-r/MICROSOFT_R-8.0/
+MSFT_R-8.1
+MSFT_R
+
+
+
+
+http://104.196.87.250/msft-r/MICROSOFT_R-8.0/
+MSFT_R-8.1
+MSFT_R
+

ambari git commit: AMBARI-18326. Add custom jdbc path to ambari-server classpath.(vbrodetskyi)

2016-09-15 Thread vbrodetskyi
Repository: ambari
Updated Branches:
  refs/heads/branch-2.5 7961cd114 -> 1afecc2dd


AMBARI-18326. Add custom jdbc path to ambari-server classpath.(vbrodetskyi)


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

Branch: refs/heads/branch-2.5
Commit: 1afecc2dde6951202512dd1cc03f5c215839dfd4
Parents: 7961cd1
Author: Vitaly Brodetskyi 
Authored: Thu Sep 15 16:42:45 2016 +0300
Committer: Vitaly Brodetskyi 
Committed: Thu Sep 15 16:42:45 2016 +0300

--
 .../java/org/apache/ambari/server/orm/DBAccessorImpl.java | 10 --
 .../main/python/ambari_server/dbConfiguration_linux.py| 10 +-
 2 files changed, 13 insertions(+), 7 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/1afecc2d/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 bb3f826..123fa96 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
@@ -105,9 +105,15 @@ public class DBAccessorImpl implements DBAccessor {
   dbmsHelper = loadHelper(databasePlatform);
   dbSchema = convertObjectName(configuration.getDatabaseSchema());
 } catch (Exception e) {
-  String message = "Error while creating database accessor ";
+  String message = "";
+  if (e instanceof ClassNotFoundException) {
+message = "If you are using a non-default database for Ambari and a 
custom JDBC driver jar, you need to set property 
\"server.jdbc.driver.path={path/to/custom_jdbc_driver}\" " +
+"in ambari.properties config file, to include it in 
ambari-server classpath.";
+  } else {
+message = "Error while creating database accessor ";
+  }
   LOG.error(message, e);
-  throw new RuntimeException(e);
+  throw new RuntimeException(message,e);
 }
   }
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/1afecc2d/ambari-server/src/main/python/ambari_server/dbConfiguration_linux.py
--
diff --git 
a/ambari-server/src/main/python/ambari_server/dbConfiguration_linux.py 
b/ambari-server/src/main/python/ambari_server/dbConfiguration_linux.py
index c595e41..429a36e 100644
--- a/ambari-server/src/main/python/ambari_server/dbConfiguration_linux.py
+++ b/ambari-server/src/main/python/ambari_server/dbConfiguration_linux.py
@@ -370,7 +370,7 @@ class PGConfig(LinuxDBMSConfig):
 self.database_url_pattern_alt = "jdbc:postgresql://{0}:{1}/{2}"
 
 self.JDBC_DRIVER_INSTALL_MSG = 'Before starting Ambari Server, ' \
-   'you must copy the {0} JDBC driver JAR file 
to {1}.'.format(
+   'you must copy the {0} JDBC driver JAR file 
to {1} and set property "server.jdbc.driver.path=[path/to/custom_jdbc_driver]" 
in ambari.properties.'.format(
 self.dbms_full_name, configDefaults.JAVA_SHARE_PATH)
 
 self._is_user_changed = False
@@ -788,7 +788,7 @@ class OracleConfig(LinuxDBMSConfig):
 self.database_url_pattern_alt = "jdbc:oracle:thin:@{0}:{1}:{2}"
 
 self.JDBC_DRIVER_INSTALL_MSG = 'Before starting Ambari Server, ' \
-   'you must copy the {0} JDBC driver JAR file 
to {1}.'.format(
+   'you must copy the {0} JDBC driver JAR file 
to {1} and set property "server.jdbc.driver.path=[path/to/custom_jdbc_driver]" 
in ambari.properties.'.format(
 self.dbms_full_name, configDefaults.JAVA_SHARE_PATH)
 
 self.init_script_file = 
AmbariPath.get("/var/lib/ambari-server/resources/Ambari-DDL-Oracle-CREATE.sql'")
@@ -899,7 +899,7 @@ class MySQLConfig(LinuxDBMSConfig):
 self.database_url_pattern_alt = "jdbc:mysql://{0}:{1}/{2}"
 
 self.JDBC_DRIVER_INSTALL_MSG = 'Before starting Ambari Server, ' \
- 'you must copy the {0} JDBC driver JAR 
file to {1}.'.format(
+ 'you must copy the {0} JDBC driver JAR 
file to {1} and set property 
"server.jdbc.driver.path=[path/to/custom_jdbc_driver]" in 
ambari.properties.'.format(
 self.dbms_full_name, configDefaults.JAVA_SHARE_PATH)
 
 self.init_script_file = 
AmbariPath.get("/var/lib/ambari-server/resources/Ambari-DDL-MySQL-CREATE.sql")
@@ -977,7 +977,7 @@ class 

ambari git commit: AMBARI-18399. Ambari UI to auto select Slider client to get deployed on the History Server host (akovalenko)

2016-09-15 Thread akovalenko
Repository: ambari
Updated Branches:
  refs/heads/branch-2.5 bc236bd95 -> b539bebd4


AMBARI-18399. Ambari UI to auto select Slider client to get deployed on the 
History Server host (akovalenko)


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

Branch: refs/heads/branch-2.5
Commit: b539bebd40e184bfe5b1c82cfe223857f42cdaec
Parents: bc236bd
Author: Aleksandr Kovalenko 
Authored: Thu Sep 15 15:19:19 2016 +0300
Committer: Aleksandr Kovalenko 
Committed: Thu Sep 15 15:19:19 2016 +0300

--
 .../resources/common-services/YARN/2.1.0.2.0/metainfo.xml | 7 +++
 1 file changed, 7 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/b539bebd/ambari-server/src/main/resources/common-services/YARN/2.1.0.2.0/metainfo.xml
--
diff --git 
a/ambari-server/src/main/resources/common-services/YARN/2.1.0.2.0/metainfo.xml 
b/ambari-server/src/main/resources/common-services/YARN/2.1.0.2.0/metainfo.xml
index f80fa8a..25e242b 100644
--- 
a/ambari-server/src/main/resources/common-services/YARN/2.1.0.2.0/metainfo.xml
+++ 
b/ambari-server/src/main/resources/common-services/YARN/2.1.0.2.0/metainfo.xml
@@ -217,6 +217,13 @@
 true
   
 
+
+  SLIDER/SLIDER
+  host
+  
+true
+  
+
   
   
 scripts/historyserver.py



ambari git commit: AMBARI-18384. Analyze and Optimize Ambari Server Unit Tests - Group 3.(vbrodetskyi)

2016-09-15 Thread vbrodetskyi
Repository: ambari
Updated Branches:
  refs/heads/branch-2.5 b539bebd4 -> 6a947a9fd


AMBARI-18384. Analyze and Optimize Ambari Server Unit Tests - Group 
3.(vbrodetskyi)


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

Branch: refs/heads/branch-2.5
Commit: 6a947a9fd01b9d905d9027be260eb38416267a87
Parents: b539beb
Author: Vitaly Brodetskyi 
Authored: Thu Sep 15 16:05:06 2016 +0300
Committer: Vitaly Brodetskyi 
Committed: Thu Sep 15 16:05:49 2016 +0300

--
 .../server/agent/TestHeartbeatMonitor.java  | 100 +++---
 .../security/authorization/TestUsers.java   | 321 ++-
 .../upgrades/UpgradeActionTest.java | 137 +---
 .../svccomphost/ServiceComponentHostTest.java   | 142 
 .../server/upgrade/UpgradeCatalog210Test.java   |  63 ++--
 5 files changed, 441 insertions(+), 322 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/6a947a9f/ambari-server/src/test/java/org/apache/ambari/server/agent/TestHeartbeatMonitor.java
--
diff --git 
a/ambari-server/src/test/java/org/apache/ambari/server/agent/TestHeartbeatMonitor.java
 
b/ambari-server/src/test/java/org/apache/ambari/server/agent/TestHeartbeatMonitor.java
index a5396d8..d8e8879 100644
--- 
a/ambari-server/src/test/java/org/apache/ambari/server/agent/TestHeartbeatMonitor.java
+++ 
b/ambari-server/src/test/java/org/apache/ambari/server/agent/TestHeartbeatMonitor.java
@@ -58,6 +58,7 @@ import 
org.apache.ambari.server.state.svccomphost.ServiceComponentHostOpSucceede
 import 
org.apache.ambari.server.state.svccomphost.ServiceComponentHostStartedEvent;
 import org.junit.After;
 import org.junit.Before;
+import org.junit.BeforeClass;
 import org.junit.Test;
 import org.mockito.ArgumentCaptor;
 import org.slf4j.Logger;
@@ -65,7 +66,6 @@ import org.slf4j.LoggerFactory;
 
 import com.google.inject.Guice;
 import com.google.inject.Injector;
-import com.google.inject.persist.PersistService;
 
 public class TestHeartbeatMonitor {
 
@@ -76,23 +76,42 @@ public class TestHeartbeatMonitor {
   private String clusterName = "cluster1";
   private String serviceName = "HDFS";
   private int heartbeatMonitorWakeupIntervalMS = 30;
-  private AmbariMetaInfo ambariMetaInfo;
-  private OrmTestHelper helper;
+  private static AmbariMetaInfo ambariMetaInfo;
+  private static OrmTestHelper helper;
 
   private static final Logger LOG =
   LoggerFactory.getLogger(TestHeartbeatMonitor.class);
 
-  @Before
-  public void setup() throws Exception {
+  @BeforeClass
+  public static void classSetUp() {
 injector = Guice.createInjector(new InMemoryDefaultTestModule());
 injector.getInstance(GuiceJpaInitializer.class);
 helper = injector.getInstance(OrmTestHelper.class);
 ambariMetaInfo = injector.getInstance(AmbariMetaInfo.class);
   }
 
+  @Before
+  public void setup() throws Exception {
+cleanup();
+  }
+
   @After
   public void teardown() {
-injector.getInstance(PersistService.class).stop();
+
+  }
+
+  private void cleanup() throws AmbariException {
+Clusters clusters = injector.getInstance(Clusters.class);
+Map clusterMap = clusters.getClusters();
+
+
+for (String clusterName : clusterMap.keySet()) {
+  clusters.deleteCluster(clusterName);
+}
+
+for (Host host : clusters.getHosts()) {
+  clusters.deleteHost(host.getHostName());
+}
   }
 
   private void setOsFamily(Host host, String osFamily, String osVersion) {
@@ -104,6 +123,41 @@ public class TestHeartbeatMonitor {
   }
 
   @Test
+  public void testHeartbeatLoss() throws AmbariException, InterruptedException,
+  InvalidStateTransitionException {
+Clusters fsm = injector.getInstance(Clusters.class);
+String hostname = "host1";
+fsm.addHost(hostname);
+ActionQueue aq = new ActionQueue();
+ActionManager am = mock(ActionManager.class);
+HeartbeatMonitor hm = new HeartbeatMonitor(fsm, aq, am, 10, injector);
+HeartBeatHandler handler = new HeartBeatHandler(fsm, aq, am, injector);
+Register reg = new Register();
+reg.setHostname(hostname);
+reg.setResponseId(12);
+reg.setTimestamp(System.currentTimeMillis() - 300);
+reg.setAgentVersion(ambariMetaInfo.getServerVersion());
+HostInfo hi = new HostInfo();
+hi.setOS("Centos5");
+reg.setHardwareProfile(hi);
+handler.handleRegistration(reg);
+HeartBeat hb = new HeartBeat();
+hb.setHostname(hostname);
+hb.setNodeStatus(new HostStatus(HostStatus.Status.HEALTHY, "cool"));
+

ambari git commit: AMBARI-18392 : Cluster failure due to APP_TIMELINE_SERVER and RESOURCEMANAGER failed to start. (avijayan)

2016-09-15 Thread avijayan
Repository: ambari
Updated Branches:
  refs/heads/branch-2.5 6c3fd1560 -> 47a1545ec


AMBARI-18392 : Cluster failure due to APP_TIMELINE_SERVER and RESOURCEMANAGER 
failed to start. (avijayan)


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

Branch: refs/heads/branch-2.5
Commit: 47a1545ec82ee2da3aef6260ac55a66577f996f6
Parents: 6c3fd15
Author: Aravindan Vijayan 
Authored: Thu Sep 15 09:25:23 2016 -0700
Committer: Aravindan Vijayan 
Committed: Thu Sep 15 09:25:23 2016 -0700

--
 .../main/resources/scripts/Ambaripreupload.py   | 76 ++--
 1 file changed, 38 insertions(+), 38 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/47a1545e/ambari-server/src/main/resources/scripts/Ambaripreupload.py
--
diff --git a/ambari-server/src/main/resources/scripts/Ambaripreupload.py 
b/ambari-server/src/main/resources/scripts/Ambaripreupload.py
index 09dcd7e..1082b5e 100644
--- a/ambari-server/src/main/resources/scripts/Ambaripreupload.py
+++ b/ambari-server/src/main/resources/scripts/Ambaripreupload.py
@@ -331,50 +331,50 @@ with Environment() as env:
 spark_client_dir = format("/usr/hdp/{stack_version}/spark")
 
 if os.path.exists(spark_client_dir):
-  # Rename /usr/hdp/{stack_version}/oozie/share/lib/spark to spark-orig
-  Execute(("mv",
-   format("{oozie_shared_lib}/lib/spark"),
-   format("{oozie_shared_lib}/lib/spark-orig")),
-   sudo=True)
+  try:
+# Rename /usr/hdp/{stack_version}/oozie/share/lib/spark to spark-orig
+if not os.path.exists(format("{oozie_shared_lib}/lib/spark-orig")):
+  Execute(("mv",
+   format("{oozie_shared_lib}/lib/spark"),
+   format("{oozie_shared_lib}/lib/spark-orig")),
+   sudo=True)
 
-  # Create /usr/hdp/{stack_version}/oozie/share/lib/spark
-  Directory(format("{oozie_shared_lib}/lib/spark"),
-owner = oozie_user,
-create_parents = True
-)
+# Create /usr/hdp/{stack_version}/oozie/share/lib/spark
+if not os.path.exists(format("{oozie_shared_lib}/lib/spark")):
+  Execute(('mkdir', format('{oozie_shared_lib}/lib/spark')),
+sudo=True)
 
-  # Copy oozie-sharelib-spark from 
/usr/hdp/{stack_version}/oozie/share/lib/spark-orig to spark
-  Execute(format("cp -f 
{oozie_shared_lib}/lib/spark-orig/oozie-sharelib-spark*.jar 
{oozie_shared_lib}/lib/spark"),
-  user=oozie_user)
+# Copy oozie-sharelib-spark from 
/usr/hdp/{stack_version}/oozie/share/lib/spark-orig to spark
+Execute(format("cp -f 
{oozie_shared_lib}/lib/spark-orig/oozie-sharelib-spark*.jar 
{oozie_shared_lib}/lib/spark"))
 
-  # Copy /usr/hdp/{stack_version}/spark-client/*.jar except 
spark-examples*.jar
-  Execute(format("cp -P {spark_client_dir}/lib/*.jar 
{oozie_shared_lib}/lib/spark"),
-  user=oozie_user)
-  Execute(format("find {oozie_shared_lib}/lib/spark/ -type l -delete"),
-  user=oozie_user)
-  try:
-Execute(format("rm -f 
{oozie_shared_lib}/lib/spark/spark-examples*.jar"),
-user=oozie_user)
-  except:
-print "No spark-examples jar files found in Spark client lib."
+# Copy /usr/hdp/{stack_version}/spark-client/*.jar except 
spark-examples*.jar
+Execute(format("cp -P {spark_client_dir}/lib/*.jar 
{oozie_shared_lib}/lib/spark"))
+Execute(format("find {oozie_shared_lib}/lib/spark/ -type l -delete"))
+try:
+  Execute(format("rm -f 
{oozie_shared_lib}/lib/spark/spark-examples*.jar"))
+except:
+  print "No spark-examples jar files found in Spark client lib."
 
-  # Copy /usr/hdp/{stack_version}/spark-client/python/lib/*.zip & *.jar to 
/usr/hdp/{stack_version}/oozie/share/lib/spark
-  Execute(format("cp -f {spark_client_dir}/python/lib/*.zip 
{oozie_shared_lib}/lib/spark"),
-  user=oozie_user)
+# Copy /usr/hdp/{stack_version}/spark-client/python/lib/*.zip & *.jar 
to /usr/hdp/{stack_version}/oozie/share/lib/spark
+Execute(format("cp -f {spark_client_dir}/python/lib/*.zip 
{oozie_shared_lib}/lib/spark"))
 
-  try:
-Execute(format("cp -f {spark_client_dir}/python/lib/*.jar 
{oozie_shared_lib}/lib/spark"),
-  user=oozie_user)
-  except:
-print "No jar files found in Spark client python lib."
+try:
+  Execute(format("cp -f {spark_client_dir}/python/lib/*.jar 

ambari git commit: AMBARI-18392 : Cluster failure due to APP_TIMELINE_SERVER and RESOURCEMANAGER failed to start. (avijayan)

2016-09-15 Thread avijayan
Repository: ambari
Updated Branches:
  refs/heads/trunk 513965f58 -> bead01cfe


AMBARI-18392 : Cluster failure due to APP_TIMELINE_SERVER and RESOURCEMANAGER 
failed to start. (avijayan)


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

Branch: refs/heads/trunk
Commit: bead01cfe1a10be6a8dae0c9e681d4254b35db4e
Parents: 513965f
Author: Aravindan Vijayan 
Authored: Thu Sep 15 09:25:50 2016 -0700
Committer: Aravindan Vijayan 
Committed: Thu Sep 15 09:25:50 2016 -0700

--
 .../main/resources/scripts/Ambaripreupload.py   | 76 ++--
 1 file changed, 38 insertions(+), 38 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/bead01cf/ambari-server/src/main/resources/scripts/Ambaripreupload.py
--
diff --git a/ambari-server/src/main/resources/scripts/Ambaripreupload.py 
b/ambari-server/src/main/resources/scripts/Ambaripreupload.py
index 09dcd7e..1082b5e 100644
--- a/ambari-server/src/main/resources/scripts/Ambaripreupload.py
+++ b/ambari-server/src/main/resources/scripts/Ambaripreupload.py
@@ -331,50 +331,50 @@ with Environment() as env:
 spark_client_dir = format("/usr/hdp/{stack_version}/spark")
 
 if os.path.exists(spark_client_dir):
-  # Rename /usr/hdp/{stack_version}/oozie/share/lib/spark to spark-orig
-  Execute(("mv",
-   format("{oozie_shared_lib}/lib/spark"),
-   format("{oozie_shared_lib}/lib/spark-orig")),
-   sudo=True)
+  try:
+# Rename /usr/hdp/{stack_version}/oozie/share/lib/spark to spark-orig
+if not os.path.exists(format("{oozie_shared_lib}/lib/spark-orig")):
+  Execute(("mv",
+   format("{oozie_shared_lib}/lib/spark"),
+   format("{oozie_shared_lib}/lib/spark-orig")),
+   sudo=True)
 
-  # Create /usr/hdp/{stack_version}/oozie/share/lib/spark
-  Directory(format("{oozie_shared_lib}/lib/spark"),
-owner = oozie_user,
-create_parents = True
-)
+# Create /usr/hdp/{stack_version}/oozie/share/lib/spark
+if not os.path.exists(format("{oozie_shared_lib}/lib/spark")):
+  Execute(('mkdir', format('{oozie_shared_lib}/lib/spark')),
+sudo=True)
 
-  # Copy oozie-sharelib-spark from 
/usr/hdp/{stack_version}/oozie/share/lib/spark-orig to spark
-  Execute(format("cp -f 
{oozie_shared_lib}/lib/spark-orig/oozie-sharelib-spark*.jar 
{oozie_shared_lib}/lib/spark"),
-  user=oozie_user)
+# Copy oozie-sharelib-spark from 
/usr/hdp/{stack_version}/oozie/share/lib/spark-orig to spark
+Execute(format("cp -f 
{oozie_shared_lib}/lib/spark-orig/oozie-sharelib-spark*.jar 
{oozie_shared_lib}/lib/spark"))
 
-  # Copy /usr/hdp/{stack_version}/spark-client/*.jar except 
spark-examples*.jar
-  Execute(format("cp -P {spark_client_dir}/lib/*.jar 
{oozie_shared_lib}/lib/spark"),
-  user=oozie_user)
-  Execute(format("find {oozie_shared_lib}/lib/spark/ -type l -delete"),
-  user=oozie_user)
-  try:
-Execute(format("rm -f 
{oozie_shared_lib}/lib/spark/spark-examples*.jar"),
-user=oozie_user)
-  except:
-print "No spark-examples jar files found in Spark client lib."
+# Copy /usr/hdp/{stack_version}/spark-client/*.jar except 
spark-examples*.jar
+Execute(format("cp -P {spark_client_dir}/lib/*.jar 
{oozie_shared_lib}/lib/spark"))
+Execute(format("find {oozie_shared_lib}/lib/spark/ -type l -delete"))
+try:
+  Execute(format("rm -f 
{oozie_shared_lib}/lib/spark/spark-examples*.jar"))
+except:
+  print "No spark-examples jar files found in Spark client lib."
 
-  # Copy /usr/hdp/{stack_version}/spark-client/python/lib/*.zip & *.jar to 
/usr/hdp/{stack_version}/oozie/share/lib/spark
-  Execute(format("cp -f {spark_client_dir}/python/lib/*.zip 
{oozie_shared_lib}/lib/spark"),
-  user=oozie_user)
+# Copy /usr/hdp/{stack_version}/spark-client/python/lib/*.zip & *.jar 
to /usr/hdp/{stack_version}/oozie/share/lib/spark
+Execute(format("cp -f {spark_client_dir}/python/lib/*.zip 
{oozie_shared_lib}/lib/spark"))
 
-  try:
-Execute(format("cp -f {spark_client_dir}/python/lib/*.jar 
{oozie_shared_lib}/lib/spark"),
-  user=oozie_user)
-  except:
-print "No jar files found in Spark client python lib."
+try:
+  Execute(format("cp -f {spark_client_dir}/python/lib/*.jar 

ambari git commit: AMBARI-18405. Fix parent POM version (smohanty)

2016-09-15 Thread smohanty
Repository: ambari
Updated Branches:
  refs/heads/branch-2.5 877077a63 -> 6c3fd1560


AMBARI-18405. Fix parent POM version (smohanty)


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

Branch: refs/heads/branch-2.5
Commit: 6c3fd1560bce2f82288ae496ede90d8007132980
Parents: 877077a
Author: Sumit Mohanty 
Authored: Thu Sep 15 09:19:27 2016 -0700
Committer: Sumit Mohanty 
Committed: Thu Sep 15 09:19:27 2016 -0700

--
 contrib/views/hawq/pom.xml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/6c3fd156/contrib/views/hawq/pom.xml
--
diff --git a/contrib/views/hawq/pom.xml b/contrib/views/hawq/pom.xml
index 9a563f6..391d0c1 100644
--- a/contrib/views/hawq/pom.xml
+++ b/contrib/views/hawq/pom.xml
@@ -24,7 +24,7 @@
   
 org.apache.ambari.contrib.views
 ambari-contrib-views
-2.0.0.0-SNAPSHOT
+2.5.0.0.0
   
   
 



ambari git commit: AMBARI-18402 - Alert definition should include AGGREGATE source type

2016-09-15 Thread tthorpe
Repository: ambari
Updated Branches:
  refs/heads/trunk 3c06ca3b6 -> 513965f58


AMBARI-18402 - Alert definition should include AGGREGATE source type


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

Branch: refs/heads/trunk
Commit: 513965f5850e4d3d900eb63d6b429d841498d529
Parents: 3c06ca3
Author: Tim Thorpe 
Authored: Thu Sep 15 09:19:40 2016 -0700
Committer: Tim Thorpe 
Committed: Thu Sep 15 09:19:40 2016 -0700

--
 ambari-server/docs/api/v1/alert-definitions.md | 25 -
 1 file changed, 24 insertions(+), 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/513965f5/ambari-server/docs/api/v1/alert-definitions.md
--
diff --git a/ambari-server/docs/api/v1/alert-definitions.md 
b/ambari-server/docs/api/v1/alert-definitions.md
index fae356a..9785379 100644
--- a/ambari-server/docs/api/v1/alert-definitions.md
+++ b/ambari-server/docs/api/v1/alert-definitions.md
@@ -136,6 +136,29 @@ PORT definitions are used to check TCP connectivity to a 
remote endpoint.
 }
   }
 
+## AGGREGATE
+AGGREGATE definitions are used to combine the results of another alert 
definition from different nodes.  The `source/alert_name` field must match the 
`name` field of another alert definition.
+
+"source": {
+  "type": "AGGREGATE",
+  "alert_name": "datanode_process",
+  "reporting": {
+"ok": {
+  "text": "affected: [{1}], total: [{0}]"
+},
+"warning": {
+  "text": "affected: [{1}], total: [{0}]",
+  "value": 10
+},
+"critical": {
+  "text": "affected: [{1}], total: [{0}]",
+  "value": 30
+},
+"units" : "%",
+"type": "PERCENT"
+  }
+}
+
  Structures & Concepts
 - `uri` Definition types that contain a URI can depend on any number of valid 
subproperties. In some cases, the URI may be very simple and only include a 
single port. In other scenarios, the URI may be more complex and include 
properties for plaintext, SSL, and secure endpoints protected by Kerberos.
 
@@ -309,4 +332,4 @@ Using the `run_now` directive, a definition can be 
scheduled to run immediately
 PUT 
http:///api/v1/clusters//alert_definitions/?run_now=true
 
 ## Response
-HTTP 200 OK
\ No newline at end of file
+HTTP 200 OK



ambari git commit: AMBARI-17889. Bad error message if user has not performed ambari-server setup for jdbc driver before configuring custom DB.(vbrodetskyi)

2016-09-15 Thread vbrodetskyi
Repository: ambari
Updated Branches:
  refs/heads/branch-2.5 3bf3bc593 -> e3a0cc5f7


AMBARI-17889. Bad error message if user has not performed ambari-server setup 
for jdbc driver before configuring custom DB.(vbrodetskyi)


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

Branch: refs/heads/branch-2.5
Commit: e3a0cc5f762657c5640724fb19be9a0414db4490
Parents: 3bf3bc5
Author: Vitaly Brodetskyi 
Authored: Thu Sep 15 17:27:46 2016 +0300
Committer: Vitaly Brodetskyi 
Committed: Thu Sep 15 17:27:46 2016 +0300

--
 .../custom_actions/scripts/check_host.py| 53 ++--
 1 file changed, 37 insertions(+), 16 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/e3a0cc5f/ambari-server/src/main/resources/custom_actions/scripts/check_host.py
--
diff --git 
a/ambari-server/src/main/resources/custom_actions/scripts/check_host.py 
b/ambari-server/src/main/resources/custom_actions/scripts/check_host.py
index 3d9dfa8..4077610 100644
--- a/ambari-server/src/main/resources/custom_actions/scripts/check_host.py
+++ b/ambari-server/src/main/resources/custom_actions/scripts/check_host.py
@@ -279,33 +279,54 @@ class CheckHost(Script):
 jdk_location = config['commandParams']['jdk_location']
 java_home = config['commandParams']['java_home']
 db_name = config['commandParams']['db_name']
+no_jdbc_error_message = None
 
 if db_name == DB_MYSQL:
   jdbc_driver_mysql_name = 
default("/hostLevelParams/custom_mysql_jdbc_name", None)
-  jdbc_url = jdk_location + jdbc_driver_mysql_name
-  jdbc_driver_class = JDBC_DRIVER_CLASS_MYSQL
-  jdbc_name = jdbc_driver_mysql_name
+  if not jdbc_driver_mysql_name:
+no_jdbc_error_message = "The MySQL JDBC driver has not been set. 
Please ensure that you have executed 'ambari-server setup --jdbc-db=mysql 
--jdbc-driver=/path/to/jdbc_driver'."
+  else:
+jdbc_url = jdk_location + jdbc_driver_mysql_name
+jdbc_driver_class = JDBC_DRIVER_CLASS_MYSQL
+jdbc_name = jdbc_driver_mysql_name
 elif db_name == DB_ORACLE:
   jdbc_driver_oracle_name = 
default("/hostLevelParams/custom_oracle_jdbc_name", None)
-  jdbc_url = jdk_location + jdbc_driver_oracle_name
-  jdbc_driver_class = JDBC_DRIVER_CLASS_ORACLE
-  jdbc_name = jdbc_driver_oracle_name
+  if not jdbc_driver_oracle_name:
+no_jdbc_error_message = "The Oracle JDBC driver has not been set. 
Please ensure that you have executed 'ambari-server setup --jdbc-db=oracle 
--jdbc-driver=/path/to/jdbc_driver'."
+  else:
+jdbc_url = jdk_location + jdbc_driver_oracle_name
+jdbc_driver_class = JDBC_DRIVER_CLASS_ORACLE
+jdbc_name = jdbc_driver_oracle_name
 elif db_name == DB_POSTGRESQL:
   jdbc_driver_postgres_name = 
default("/hostLevelParams/custom_postgres_jdbc_name", None)
-  jdbc_url = jdk_location + jdbc_driver_postgres_name
-  jdbc_driver_class = JDBC_DRIVER_CLASS_POSTGRESQL
-  jdbc_name = jdbc_driver_postgres_name
+  if not jdbc_driver_postgres_name:
+no_jdbc_error_message = "The Postgres JDBC driver has not been set. 
Please ensure that you have executed 'ambari-server setup --jdbc-db=postgres 
--jdbc-driver=/path/to/jdbc_driver'."
+  else:
+jdbc_url = jdk_location + jdbc_driver_postgres_name
+jdbc_driver_class = JDBC_DRIVER_CLASS_POSTGRESQL
+jdbc_name = jdbc_driver_postgres_name
 elif db_name == DB_MSSQL:
   jdbc_driver_mssql_name = 
default("/hostLevelParams/custom_mssql_jdbc_name", None)
-  jdbc_url = jdk_location + jdbc_driver_mssql_name
-  jdbc_driver_class = JDBC_DRIVER_CLASS_MSSQL
-  jdbc_name = jdbc_driver_mssql_name
+  if not jdbc_driver_mssql_name:
+no_jdbc_error_message = "The MSSQL JDBC driver has not been set. 
Please ensure that you have executed 'ambari-server setup --jdbc-db=mssql 
--jdbc-driver=/path/to/jdbc_driver'."
+  else:
+jdbc_url = jdk_location + jdbc_driver_mssql_name
+jdbc_driver_class = JDBC_DRIVER_CLASS_MSSQL
+jdbc_name = jdbc_driver_mssql_name
 elif db_name == DB_SQLA:
   jdbc_driver_sqla_name = 
default("/hostLevelParams/custom_sqlanywhere_jdbc_name", None)
-  jdbc_url = jdk_location + jdbc_driver_sqla_name
-  jdbc_driver_class = JDBC_DRIVER_CLASS_SQLA
-  jdbc_name = jdbc_driver_sqla_name
-  
+  if not jdbc_driver_sqla_name:
+no_jdbc_error_message = "The SQLAnywhere JDBC driver has not been set. 
Please ensure that you have executed 'ambari-server 

ambari git commit: AMBARI-18403 - YAML Maps Can Include Dashes and Other Non-Word Characters (jonathanhurley)

2016-09-15 Thread jonathanhurley
Repository: ambari
Updated Branches:
  refs/heads/trunk bead01cfe -> edf1b9b9f


AMBARI-18403 - YAML Maps Can Include Dashes and Other Non-Word Characters 
(jonathanhurley)


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

Branch: refs/heads/trunk
Commit: edf1b9b9f2182de2e14a194c5ca243f6cf39170d
Parents: bead01c
Author: Jonathan Hurley 
Authored: Thu Sep 15 11:51:12 2016 -0400
Committer: Jonathan Hurley 
Committed: Thu Sep 15 12:37:27 2016 -0400

--
 .../main/python/ambari_commons/yaml_utils.py| 16 ---
 ambari-server/src/test/python/TestYAMLUtils.py  | 30 ++--
 2 files changed, 34 insertions(+), 12 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/edf1b9b9/ambari-common/src/main/python/ambari_commons/yaml_utils.py
--
diff --git a/ambari-common/src/main/python/ambari_commons/yaml_utils.py 
b/ambari-common/src/main/python/ambari_commons/yaml_utils.py
index 9753177..dae5b56 100644
--- a/ambari-common/src/main/python/ambari_commons/yaml_utils.py
+++ b/ambari-common/src/main/python/ambari_commons/yaml_utils.py
@@ -26,13 +26,21 @@ REGEX_LIST = '^\w*\[.+\]\w*$'
 REGEX_DICTIONARY = '^\w*\{.+\}\w*$'
 
 """
-storm:
+storm-cluster:
   hosts:
-[c6401.ambari.apache.org, c6402.ambari.apache.org]
+[c6401.ambari.apache.org, c6402.ambari.apache.org, 
c6403-master.ambari.apache.org]
   groups:
-[hadoop, foo]
+[hadoop, hadoop-secure]
+
+^\s* - allow any whitespace or newlines to start
+\S+ - at least 1 word character (including dashes)
+[ ]*:[ ]* - followed by a colon (allowing spaces around the colon)
+[\r\n\f]+ - at least 1 newline
+
+\s*\S+[ ]*:[ ]*[\r\n\f] - follow with the same basically to ensure a map of 
maps
 """
-REGEX_NESTED_MAPS = '^[\w+\s*:\s*\n\s*]+\[(.*?)\]+'
+REGEX_NESTED_MAPS = "^\s*\S+[ ]*:[ ]*[\r\n\f]+\s*\S+[ ]*:[ ]*[\r\n\f]"
+
 
 def escape_yaml_property(value):
   unquouted_values = ["null", "Null", "NULL", "true", "True", "TRUE", "false",

http://git-wip-us.apache.org/repos/asf/ambari/blob/edf1b9b9/ambari-server/src/test/python/TestYAMLUtils.py
--
diff --git a/ambari-server/src/test/python/TestYAMLUtils.py 
b/ambari-server/src/test/python/TestYAMLUtils.py
index c6ee343..4d2d035 100644
--- a/ambari-server/src/test/python/TestYAMLUtils.py
+++ b/ambari-server/src/test/python/TestYAMLUtils.py
@@ -64,19 +64,33 @@ class TestYAMLUtils(TestCase):
 
 # test maps
 map = """
-  storm:
+  storm-cluster:
 hosts:
-  [c6401.ambari.apache.org, c6402.ambari.apache.org]
+  [c6401.ambari.apache.org, c6402.ambari.apache.org, 
c6403-master.ambari.apache.org]
 groups:
-  [hadoop, foo]
-foo:
-  [bar, baz]
-foo2:
-  bar2:
-[baz2]
+  [hadoop, hadoop-secure]
 """
 escaped_map = yaml_utils.escape_yaml_property(map)
 self.assertTrue(escaped_map.startswith("\n"))
 self.assertFalse("'" in escaped_map)
 
+# try some weird but valid formatting
+map = """
+
+
+  storm-cluster:
+  hosts   :
+[c6401.ambari.apache.org, c6402.ambari.apache.org, 
c6403-master.ambari.apache.org]
+  groups   :
+  [hadoop!!!, hadoop-secure-]
+"""
+escaped_map = yaml_utils.escape_yaml_property(map)
+self.assertTrue(escaped_map.startswith("\n"))
+self.assertFalse("'" in escaped_map)
 
+# try some bad formatting - this is not a map
+map = """ foo : bar :
+  [baz]"""
+escaped_map = yaml_utils.escape_yaml_property(map)
+self.assertFalse(escaped_map.startswith("\n"))
+self.assertTrue("'" in escaped_map)



ambari git commit: AMBARI-18403 - YAML Maps Can Include Dashes and Other Non-Word Characters (jonathanhurley)

2016-09-15 Thread jonathanhurley
Repository: ambari
Updated Branches:
  refs/heads/branch-2.5 01df0d5b6 -> a06682f55


AMBARI-18403 - YAML Maps Can Include Dashes and Other Non-Word Characters 
(jonathanhurley)


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

Branch: refs/heads/branch-2.5
Commit: a06682f552a6e591f27833b9b55ef82a037c0ac6
Parents: 01df0d5
Author: Jonathan Hurley 
Authored: Thu Sep 15 11:51:12 2016 -0400
Committer: Jonathan Hurley 
Committed: Thu Sep 15 13:12:39 2016 -0400

--
 .../main/python/ambari_commons/yaml_utils.py| 16 ---
 ambari-server/src/test/python/TestYAMLUtils.py  | 30 ++--
 2 files changed, 34 insertions(+), 12 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/a06682f5/ambari-common/src/main/python/ambari_commons/yaml_utils.py
--
diff --git a/ambari-common/src/main/python/ambari_commons/yaml_utils.py 
b/ambari-common/src/main/python/ambari_commons/yaml_utils.py
index 9753177..dae5b56 100644
--- a/ambari-common/src/main/python/ambari_commons/yaml_utils.py
+++ b/ambari-common/src/main/python/ambari_commons/yaml_utils.py
@@ -26,13 +26,21 @@ REGEX_LIST = '^\w*\[.+\]\w*$'
 REGEX_DICTIONARY = '^\w*\{.+\}\w*$'
 
 """
-storm:
+storm-cluster:
   hosts:
-[c6401.ambari.apache.org, c6402.ambari.apache.org]
+[c6401.ambari.apache.org, c6402.ambari.apache.org, 
c6403-master.ambari.apache.org]
   groups:
-[hadoop, foo]
+[hadoop, hadoop-secure]
+
+^\s* - allow any whitespace or newlines to start
+\S+ - at least 1 word character (including dashes)
+[ ]*:[ ]* - followed by a colon (allowing spaces around the colon)
+[\r\n\f]+ - at least 1 newline
+
+\s*\S+[ ]*:[ ]*[\r\n\f] - follow with the same basically to ensure a map of 
maps
 """
-REGEX_NESTED_MAPS = '^[\w+\s*:\s*\n\s*]+\[(.*?)\]+'
+REGEX_NESTED_MAPS = "^\s*\S+[ ]*:[ ]*[\r\n\f]+\s*\S+[ ]*:[ ]*[\r\n\f]"
+
 
 def escape_yaml_property(value):
   unquouted_values = ["null", "Null", "NULL", "true", "True", "TRUE", "false",

http://git-wip-us.apache.org/repos/asf/ambari/blob/a06682f5/ambari-server/src/test/python/TestYAMLUtils.py
--
diff --git a/ambari-server/src/test/python/TestYAMLUtils.py 
b/ambari-server/src/test/python/TestYAMLUtils.py
index c6ee343..4d2d035 100644
--- a/ambari-server/src/test/python/TestYAMLUtils.py
+++ b/ambari-server/src/test/python/TestYAMLUtils.py
@@ -64,19 +64,33 @@ class TestYAMLUtils(TestCase):
 
 # test maps
 map = """
-  storm:
+  storm-cluster:
 hosts:
-  [c6401.ambari.apache.org, c6402.ambari.apache.org]
+  [c6401.ambari.apache.org, c6402.ambari.apache.org, 
c6403-master.ambari.apache.org]
 groups:
-  [hadoop, foo]
-foo:
-  [bar, baz]
-foo2:
-  bar2:
-[baz2]
+  [hadoop, hadoop-secure]
 """
 escaped_map = yaml_utils.escape_yaml_property(map)
 self.assertTrue(escaped_map.startswith("\n"))
 self.assertFalse("'" in escaped_map)
 
+# try some weird but valid formatting
+map = """
+
+
+  storm-cluster:
+  hosts   :
+[c6401.ambari.apache.org, c6402.ambari.apache.org, 
c6403-master.ambari.apache.org]
+  groups   :
+  [hadoop!!!, hadoop-secure-]
+"""
+escaped_map = yaml_utils.escape_yaml_property(map)
+self.assertTrue(escaped_map.startswith("\n"))
+self.assertFalse("'" in escaped_map)
 
+# try some bad formatting - this is not a map
+map = """ foo : bar :
+  [baz]"""
+escaped_map = yaml_utils.escape_yaml_property(map)
+self.assertFalse(escaped_map.startswith("\n"))
+self.assertTrue("'" in escaped_map)



ambari git commit: AMBARI-18347 - Setting fetch_nonlocal_groups to false Can Prevent Services From Starting (jonathanhurley)

2016-09-15 Thread jonathanhurley
Repository: ambari
Updated Branches:
  refs/heads/branch-2.4 341fcf186 -> 3f316575c


AMBARI-18347 - Setting fetch_nonlocal_groups to false Can Prevent Services From 
Starting (jonathanhurley)


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

Branch: refs/heads/branch-2.4
Commit: 3f316575c9637fa1a1d29f309991b5aad246e81b
Parents: 341fcf1
Author: Jonathan Hurley 
Authored: Thu Sep 8 16:44:07 2016 -0400
Committer: Jonathan Hurley 
Committed: Thu Sep 15 12:38:33 2016 -0400

--
 .../resource_management/TestUserResource.py | 36 
 .../core/providers/accounts.py  | 26 --
 2 files changed, 52 insertions(+), 10 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/3f316575/ambari-agent/src/test/python/resource_management/TestUserResource.py
--
diff --git 
a/ambari-agent/src/test/python/resource_management/TestUserResource.py 
b/ambari-agent/src/test/python/resource_management/TestUserResource.py
index 2a97676..4bba469 100644
--- a/ambari-agent/src/test/python/resource_management/TestUserResource.py
+++ b/ambari-agent/src/test/python/resource_management/TestUserResource.py
@@ -214,6 +214,42 @@ class TestUserResource(TestCase):
 popen_mock.assert_called_with(['/bin/bash', '--login', '--noprofile', 
'-c', "ambari-sudo.sh  PATH=/bin -H -E useradd -m mapred"], shell=False, 
preexec_fn=None, stderr=-2, stdout=-1, env={'PATH': '/bin'}, cwd=None, 
close_fds=True)
 self.assertEqual(popen_mock.call_count, 1)
 
+  @patch('__builtin__.open')
+  @patch("pwd.getpwnam")
+  def test_parsing_local_users(self, pwd_mock, open_mock):
+"""
+Tests that parsing users out of /etc/groups can tolerate some bad lines
+"""
+class MagicFile(object):
+  def read(self):
+return  """
+  group1:x:1:
+  group2:x:2:user1,user2
+  group3:x:3
+  invalid
+"""
+
+  def __exit__(self, exc_type, exc_val, exc_tb):
+pass
+
+  def __enter__(self):
+return self
+
+pwd_mock.return_value = "user1"
+open_mock.return_value = MagicFile()
+
+from resource_management.core.providers.accounts import UserProvider
+
+user = MagicMock()
+provider = UserProvider(user)
+provider.resource.username = "user1"
+provider.resource.fetch_nonlocal_groups = False
+groups = provider.user_groups
+
+self.assertEquals(1, len(groups))
+self.assertTrue("group2" in groups)
+
+
 def _get_user_entity():
   user = MagicMock()
   user.pw_name='mapred'

http://git-wip-us.apache.org/repos/asf/ambari/blob/3f316575/ambari-common/src/main/python/resource_management/core/providers/accounts.py
--
diff --git 
a/ambari-common/src/main/python/resource_management/core/providers/accounts.py 
b/ambari-common/src/main/python/resource_management/core/providers/accounts.py
index 5169b12..c4f2496 100644
--- 
a/ambari-common/src/main/python/resource_management/core/providers/accounts.py
+++ 
b/ambari-common/src/main/python/resource_management/core/providers/accounts.py
@@ -98,19 +98,25 @@ class UserProvider(Provider):
   def user_groups(self):
 if self.resource.fetch_nonlocal_groups:
   return [g.gr_name for g in grp.getgrall() if self.resource.username in 
g.gr_mem]
-else:
-  with open('/etc/group', 'rb') as fp:
-content = fp.read()
-  
-  groups = []
-  for line in content.splitlines():
-entries = line.split(':')
-group_name = entries[0]
+
+with open('/etc/group', 'rb') as fp:
+  content = fp.read()
+
+# Each line should have 4 parts, even with no members (trailing colon)
+# group-name:group-password:group-id:
+# group-name:group-password:group-id:group-members
+groups = []
+for line in content.splitlines():
+  entries = line.split(':')
+
+  # attempt to parse the users in the group only if there are 4 parts
+  if(len(entries) >= 4):
+group_name = entries[0].strip()
 group_users = entries[3].split(',')
 if self.user in group_users:
   groups.append(group_name)
-  
-  return groups
+
+return groups
 
 class GroupProvider(Provider):
   options = dict(



ambari git commit: AMBARI-18402 - Alert definition should include AGGREGATE source type

2016-09-15 Thread tthorpe
Repository: ambari
Updated Branches:
  refs/heads/branch-2.5 47a1545ec -> 01df0d5b6


AMBARI-18402 - Alert definition should include AGGREGATE source type


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

Branch: refs/heads/branch-2.5
Commit: 01df0d5b627b26e437853d113e87b75acda0e63e
Parents: 47a1545
Author: Tim Thorpe 
Authored: Thu Sep 15 10:11:12 2016 -0700
Committer: Tim Thorpe 
Committed: Thu Sep 15 10:11:12 2016 -0700

--
 ambari-server/docs/api/v1/alert-definitions.md | 25 -
 1 file changed, 24 insertions(+), 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/01df0d5b/ambari-server/docs/api/v1/alert-definitions.md
--
diff --git a/ambari-server/docs/api/v1/alert-definitions.md 
b/ambari-server/docs/api/v1/alert-definitions.md
index fae356a..9785379 100644
--- a/ambari-server/docs/api/v1/alert-definitions.md
+++ b/ambari-server/docs/api/v1/alert-definitions.md
@@ -136,6 +136,29 @@ PORT definitions are used to check TCP connectivity to a 
remote endpoint.
 }
   }
 
+## AGGREGATE
+AGGREGATE definitions are used to combine the results of another alert 
definition from different nodes.  The `source/alert_name` field must match the 
`name` field of another alert definition.
+
+"source": {
+  "type": "AGGREGATE",
+  "alert_name": "datanode_process",
+  "reporting": {
+"ok": {
+  "text": "affected: [{1}], total: [{0}]"
+},
+"warning": {
+  "text": "affected: [{1}], total: [{0}]",
+  "value": 10
+},
+"critical": {
+  "text": "affected: [{1}], total: [{0}]",
+  "value": 30
+},
+"units" : "%",
+"type": "PERCENT"
+  }
+}
+
  Structures & Concepts
 - `uri` Definition types that contain a URI can depend on any number of valid 
subproperties. In some cases, the URI may be very simple and only include a 
single port. In other scenarios, the URI may be more complex and include 
properties for plaintext, SSL, and secure endpoints protected by Kerberos.
 
@@ -309,4 +332,4 @@ Using the `run_now` directive, a definition can be 
scheduled to run immediately
 PUT 
http:///api/v1/clusters//alert_definitions/?run_now=true
 
 ## Response
-HTTP 200 OK
\ No newline at end of file
+HTTP 200 OK



ambari git commit: AMBARI-18273. Add logging to differentiate between ambari-server start/restart commands vs. other commands.(vbrodetskyi)

2016-09-15 Thread vbrodetskyi
Repository: ambari
Updated Branches:
  refs/heads/branch-2.5 e3a0cc5f7 -> 877077a63


AMBARI-18273. Add logging to differentiate between ambari-server start/restart 
commands vs. other commands.(vbrodetskyi)


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

Branch: refs/heads/branch-2.5
Commit: 877077a6395ffc77d80209fc5adfa1d00d0d8329
Parents: e3a0cc5
Author: Vitaly Brodetskyi 
Authored: Thu Sep 15 17:34:37 2016 +0300
Committer: Vitaly Brodetskyi 
Committed: Thu Sep 15 17:34:37 2016 +0300

--
 ambari-server/conf/unix/ambari.properties   |   6 +-
 ambari-server/sbin/ambari-server|   3 +-
 ambari-server/src/main/python/ambari-server.py  |  66 ++-
 .../main/python/ambari_server/checkDatabase.py  |   5 +-
 .../src/main/python/ambari_server/dbCleanup.py  |   4 +
 .../src/main/python/ambari_server/hostUpdate.py |   4 +
 .../main/python/ambari_server/serverSetup.py|   6 +
 .../main/python/ambari_server/serverUpgrade.py  |   6 +
 .../main/python/ambari_server/setupActions.py   |   1 +
 .../main/python/ambari_server/setupMpacks.py|   5 +
 .../main/python/ambari_server/setupSecurity.py  |   4 +
 .../src/main/python/ambari_server/setupSso.py   |   4 +
 .../src/main/python/ambari_server_main.py   |  17 ++-
 .../src/test/python/TestAmbariServer.py | 117 ++-
 14 files changed, 209 insertions(+), 39 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/877077a6/ambari-server/conf/unix/ambari.properties
--
diff --git a/ambari-server/conf/unix/ambari.properties 
b/ambari-server/conf/unix/ambari.properties
index 52f4959..4dcbe99 100644
--- a/ambari-server/conf/unix/ambari.properties
+++ b/ambari-server/conf/unix/ambari.properties
@@ -122,4 +122,8 @@ views.http.x-frame-options=SAMEORIGIN
 mpacks.staging.path=$ROOT/var/lib/ambari-server/resources/mpacks
 
 # exclude some ciphers that are not supported by old versions of ssl (this fix 
was added for SLES12)
-security.server.disabled.ciphers=TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384|TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384|TLS_RSA_WITH_AES_256_CBC_SHA256|TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA384|TLS_ECDH_RSA_WITH_AES_256_CBC_SHA384|TLS_DHE_RSA_WITH_AES_256_CBC_SHA256|TLS_DHE_DSS_WITH_AES_256_CBC_SHA256|TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA|TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA|TLS_RSA_WITH_AES_256_CBC_SHA|TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA|TLS_ECDH_RSA_WITH_AES_256_CBC_SHA|TLS_DHE_RSA_WITH_AES_256_CBC_SHA|TLS_DHE_DSS_WITH_AES_256_CBC_SHA|TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256|TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256|TLS_RSA_WITH_AES_128_CBC_SHA256|TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA256|TLS_ECDH_RSA_WITH_AES_128_CBC_SHA256|TLS_DHE_RSA_WITH_AES_128_CBC_SHA256|TLS_DHE_DSS_WITH_AES_128_CBC_SHA256|TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA|TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA|TLS_RSA_WITH_AES_128_CBC_SHA|TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA|TLS_ECDH_RSA_WITH_AES_128_CBC_SHA|TLS_DHE_RSA_WITH_AES_128_CBC_SHA|TLS_DHE
 
_DSS_WITH_AES_128_CBC_SHA|TLS_ECDHE_ECDSA_WITH_3DES_EDE_CBC_SHA|TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA|TLS_ECDH_ECDSA_WITH_3DES_EDE_CBC_SHA|TLS_ECDH_RSA_WITH_3DES_EDE_CBC_SHA|SSL_DHE_RSA_WITH_3DES_EDE_CBC_SHA|SSL_DHE_DSS_WITH_3DES_EDE_CBC_SHA|TLS_EMPTY_RENEGOTIATION_INFO_SCSV|TLS_DH_anon_WITH_AES_256_CBC_SHA256|TLS_ECDH_anon_WITH_AES_256_CBC_SHA|TLS_DH_anon_WITH_AES_256_CBC_SHA|TLS_DH_anon_WITH_AES_128_CBC_SHA256|TLS_ECDH_anon_WITH_AES_128_CBC_SHA|TLS_DH_anon_WITH_AES_128_CBC_SHA|TLS_ECDH_anon_WITH_3DES_EDE_CBC_SHA|SSL_DH_anon_WITH_3DES_EDE_CBC_SHA|SSL_RSA_WITH_DES_CBC_SHA|SSL_DHE_RSA_WITH_DES_CBC_SHA|SSL_DHE_DSS_WITH_DES_CBC_SHA|SSL_DH_anon_WITH_DES_CBC_SHA|SSL_RSA_EXPORT_WITH_DES40_CBC_SHA|SSL_DHE_RSA_EXPORT_WITH_DES40_CBC_SHA|SSL_DHE_DSS_EXPORT_WITH_DES40_CBC_SHA|SSL_DH_anon_EXPORT_WITH_DES40_CBC_SHA|TLS_RSA_WITH_NULL_SHA256|TLS_ECDHE_ECDSA_WITH_NULL_SHA|TLS_ECDHE_RSA_WITH_NULL_SHA|SSL_RSA_WITH_NULL_SHA|TLS_ECDH_ECDSA_WITH_NULL_SHA|TLS_ECDH_RSA_WITH_NULL_SHA|TLS_ECDH_anon_WITH_NULL_
 
SHA|SSL_RSA_WITH_NULL_MD5|TLS_KRB5_WITH_3DES_EDE_CBC_SHA|TLS_KRB5_WITH_3DES_EDE_CBC_MD5|TLS_KRB5_WITH_DES_CBC_SHA|TLS_KRB5_WITH_DES_CBC_MD5|TLS_KRB5_EXPORT_WITH_DES_CBC_40_SHA|TLS_KRB5_EXPORT_WITH_DES_CBC_40_MD5
\ No newline at end of file

ambari git commit: AMBARI-18048. ambari-server upgrade should report all the config properties it added/modified.(vbrodetskyi)

2016-09-15 Thread vbrodetskyi
Repository: ambari
Updated Branches:
  refs/heads/branch-2.5 53b34516a -> 3bf3bc593


AMBARI-18048. ambari-server upgrade should report all the config properties it 
added/modified.(vbrodetskyi)


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

Branch: refs/heads/branch-2.5
Commit: 3bf3bc593b5ea4c294547c41c03cf2bd14fbfde8
Parents: 53b3451
Author: Vitaly Brodetskyi 
Authored: Thu Sep 15 17:20:53 2016 +0300
Committer: Vitaly Brodetskyi 
Committed: Thu Sep 15 17:20:53 2016 +0300

--
 .../server/configuration/Configuration.java | 147 +++
 .../server/upgrade/AbstractUpgradeCatalog.java  |  66 +++--
 .../server/upgrade/SchemaUpgradeHelper.java |  41 +++---
 .../ambari/server/upgrade/UpgradeCatalog.java   |   7 +
 .../ambari/server/upgrade/UpgradeTest.java  |   2 +-
 5 files changed, 235 insertions(+), 28 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/3bf3bc59/ambari-server/src/main/java/org/apache/ambari/server/configuration/Configuration.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/configuration/Configuration.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/configuration/Configuration.java
index b70c5f4..c5a8d65 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/configuration/Configuration.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/configuration/Configuration.java
@@ -20,8 +20,10 @@ package org.apache.ambari.server.configuration;
 import java.io.File;
 import java.io.FileNotFoundException;
 import java.io.FileReader;
+import java.io.FileWriter;
 import java.io.IOException;
 import java.io.InputStream;
+import java.io.Writer;
 import java.lang.annotation.ElementType;
 import java.lang.annotation.Retention;
 import java.lang.annotation.RetentionPolicy;
@@ -65,6 +67,7 @@ import 
org.apache.ambari.server.security.encryption.CredentialProvider;
 import org.apache.ambari.server.state.services.MetricsRetrievalService;
 import org.apache.ambari.server.state.services.RetryUpgradeActionService;
 import org.apache.ambari.server.state.stack.OsFamily;
+import org.apache.ambari.server.upgrade.AbstractUpgradeCatalog;
 import org.apache.ambari.server.utils.AmbariPath;
 import org.apache.ambari.server.utils.DateUtils;
 import org.apache.ambari.server.utils.HostUtils;
@@ -84,10 +87,14 @@ import org.apache.commons.lang.math.NumberUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import com.google.common.collect.Multimap;
 import com.google.common.collect.Sets;
+import com.google.gson.Gson;
+import com.google.gson.GsonBuilder;
 import com.google.gson.JsonElement;
 import com.google.gson.JsonObject;
 import com.google.gson.JsonParser;
+import com.google.gson.JsonPrimitive;
 import com.google.inject.Inject;
 import com.google.inject.Singleton;
 
@@ -2326,6 +2333,10 @@ public class Configuration {
   public static final ConfigurationProperty 
METRIC_RETRIEVAL_SERVICE_REQUEST_TTL = new ConfigurationProperty<>(
   "metrics.retrieval-service.request.ttl", 5);
 
+  // Ambari server log4j file name
+  public static final String AMBARI_LOG_FILE = "log4j.properties";
+
+
   /**
* The number of tasks that can be queried from the database at once In the
* case of more tasks, multiple queries are issued
@@ -2340,6 +2351,8 @@ public class Configuration {
 Configuration.class);
 
   private Properties properties;
+  private Properties log4jProperties = new Properties();
+  private String ambariUpgradeConfigUpdatesFilePath;
   private JsonObject hostChangesJson;
   private Map configsMap;
   private Map agentConfigsMap;
@@ -2352,6 +2365,140 @@ public class Configuration {
   private Map databaseConnectorNames = new HashMap<>();
   private Map databasePreviousConnectorNames = new HashMap<>();
 
+
+  /**
+   * Find, read, and parse the log4j.properties file.
+   * @return the properties that were found or empty if no file was found
+   */
+  public Properties getLog4jProperties() {
+if (!log4jProperties.isEmpty()) {
+  return log4jProperties;
+}
+
+//Get log4j.properties file stream from classpath
+InputStream inputStream = 
Configuration.class.getClassLoader().getResourceAsStream(AMBARI_LOG_FILE);
+
+if (inputStream == null) {
+  throw new RuntimeException(AMBARI_LOG_FILE + " not found in classpath");
+}
+
+// load the properties
+try {
+  log4jProperties.load(inputStream);
+  inputStream.close();
+

ambari git commit: AMBARI-18400 Config group other than Default group takes forever to load (atkach)

2016-09-15 Thread atkach
Repository: ambari
Updated Branches:
  refs/heads/trunk 41a9190fc -> 3c06ca3b6


AMBARI-18400 Config group other than Default group takes forever to load 
(atkach)


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

Branch: refs/heads/trunk
Commit: 3c06ca3b654e0abd6fd4265fb16693e1d1f7f97f
Parents: 41a9190
Author: Andrii Tkach 
Authored: Thu Sep 15 15:51:39 2016 +0300
Committer: Andrii Tkach 
Committed: Thu Sep 15 17:28:59 2016 +0300

--
 .../common/configs/config_with_override_recommendation_parser.js | 4 +++-
 .../configs/config_with_override_recommendation_parser_test.js   | 4 ++--
 2 files changed, 5 insertions(+), 3 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/3c06ca3b/ambari-web/app/mixins/common/configs/config_with_override_recommendation_parser.js
--
diff --git 
a/ambari-web/app/mixins/common/configs/config_with_override_recommendation_parser.js
 
b/ambari-web/app/mixins/common/configs/config_with_override_recommendation_parser.js
index f866451..86ccb65 100644
--- 
a/ambari-web/app/mixins/common/configs/config_with_override_recommendation_parser.js
+++ 
b/ambari-web/app/mixins/common/configs/config_with_override_recommendation_parser.js
@@ -107,10 +107,12 @@ App.ConfigWithOverrideRecommendationParser = 
Em.Mixin.create(App.ConfigRecommend
* @param {Object} stackProperty
* @param {string} attr
* @param {Number|String|Boolean} value
+   * @param {String} name
+   * @param {String} fileName
* @param {App.ServiceConfigGroup} configGroup
* @protected
*/
-  _updateOverrideBoundaries: function(stackProperty, attr, value, configGroup) 
{
+  _updateOverrideBoundaries: function(stackProperty, attr, value, name, 
fileName, configGroup) {
 if (!stackProperty.valueAttributes[configGroup.get('name')]) {
   stackProperty.valueAttributes[configGroup.get('name')] = {};
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/3c06ca3b/ambari-web/test/mixins/common/configs/config_with_override_recommendation_parser_test.js
--
diff --git 
a/ambari-web/test/mixins/common/configs/config_with_override_recommendation_parser_test.js
 
b/ambari-web/test/mixins/common/configs/config_with_override_recommendation_parser_test.js
index 5b7b48c..dc92e88 100644
--- 
a/ambari-web/test/mixins/common/configs/config_with_override_recommendation_parser_test.js
+++ 
b/ambari-web/test/mixins/common/configs/config_with_override_recommendation_parser_test.js
@@ -193,12 +193,12 @@ describe('App.ConfigWithOverrideRecommendationParser', 
function() {
 };
 
 it("modify attributes on existing group", function() {
-  mixin._updateOverrideBoundaries(stackProperty, 'attr1', 'false', 
Em.Object.create({name: 'g1'}));
+  mixin._updateOverrideBoundaries(stackProperty, 'attr1', 'false', 'n1', 
'file1', Em.Object.create({name: 'g1'}));
   expect(stackProperty.valueAttributes.g1.attr1).to.be.equal('false');
 });
 
 it("modify attributes on new group", function() {
-  mixin._updateOverrideBoundaries(stackProperty, 'attr1', 'true', 
Em.Object.create({name: 'g2'}));
+  mixin._updateOverrideBoundaries(stackProperty, 'attr1', 'true', 'n2', 
'file1', Em.Object.create({name: 'g2'}));
   expect(stackProperty.valueAttributes.g2.attr1).to.be.equal('true');
 });
   });



[2/2] ambari git commit: AMBARI-18367. Create authentication filter to encapsulate the various Ambari authentication methods (rlevas)

2016-09-15 Thread rlevas
AMBARI-18367. Create authentication filter to encapsulate the various Ambari 
authentication methods (rlevas)


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

Branch: refs/heads/branch-2.5
Commit: cc39d115bdfad81b273579a5c1ac5452f31a8519
Parents: a06682f
Author: Robert Levas 
Authored: Thu Sep 15 13:20:35 2016 -0400
Committer: Robert Levas 
Committed: Thu Sep 15 13:20:35 2016 -0400

--
 .../ambari/server/controller/AmbariServer.java  |  15 +-
 .../server/controller/ControllerModule.java |  12 +-
 .../AmbariAuthenticationFilter.java | 158 ++
 .../AmbariBasicAuthenticationFilter.java| 211 +++
 .../AmbariDelegatingAuthenticationFilter.java   | 146 +
 .../AmbariJWTAuthenticationFilter.java  | 139 
 .../AmbariAuthorizationFilter.java  |  49 -
 .../AuthenticationJwtUserNotFoundException.java |  43 
 .../jwt/JwtAuthenticationFilter.java| 162 --
 .../webapp/WEB-INF/spring-security.xml  |  31 ++-
 .../AmbariAuthenticationFilterTest.java | 139 
 .../AmbariBasicAuthenticationFilterTest.java| 139 
 ...mbariDelegatingAuthenticationFilterTest.java | 186 
 .../AmbariJWTAuthenticationFilterTest.java  | 190 +
 .../AmbariAuthorizationFilterTest.java  |  48 ++---
 .../jwt/JwtAuthenticationFilterTest.java|  77 ++-
 16 files changed, 1347 insertions(+), 398 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/cc39d115/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 89cdb93..56bafbb 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
@@ -1,4 +1,4 @@
-/**
+/*
  * 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
@@ -7,7 +7,7 @@
  * "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
+ * 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,
@@ -95,15 +95,12 @@ import 
org.apache.ambari.server.security.AmbariServerSecurityHeaderFilter;
 import org.apache.ambari.server.security.AmbariViewsSecurityHeaderFilter;
 import org.apache.ambari.server.security.CertificateManager;
 import org.apache.ambari.server.security.SecurityFilter;
-import 
org.apache.ambari.server.security.authentication.AmbariAuthenticationFilter;
-import 
org.apache.ambari.server.security.authorization.AmbariAuthorizationFilter;
 import 
org.apache.ambari.server.security.authorization.AmbariLdapAuthenticationProvider;
 import org.apache.ambari.server.security.authorization.AmbariLocalUserProvider;
 import 
org.apache.ambari.server.security.authorization.AmbariUserAuthorizationFilter;
 import org.apache.ambari.server.security.authorization.PermissionHelper;
 import org.apache.ambari.server.security.authorization.Users;
 import 
org.apache.ambari.server.security.authorization.internal.AmbariInternalAuthenticationProvider;
-import 
org.apache.ambari.server.security.authorization.jwt.JwtAuthenticationFilter;
 import org.apache.ambari.server.security.ldap.AmbariLdapDataPopulator;
 import org.apache.ambari.server.security.unsecured.rest.CertificateDownload;
 import org.apache.ambari.server.security.unsecured.rest.CertificateSign;
@@ -311,6 +308,8 @@ public class AmbariServer {
   getBeanFactory();
 
   factory.registerSingleton("guiceInjector", injector);
+  factory.registerSingleton("ambariConfiguration", 
injector.getInstance(Configuration.class));
+  factory.registerSingleton("ambariUsers", 
injector.getInstance(Users.class));
   factory.registerSingleton("passwordEncoder",
 injector.getInstance(PasswordEncoder.class));
   factory.registerSingleton("auditLogger",
@@ -323,16 +322,10 @@ public class AmbariServer {
 injector.getInstance(AmbariLocalUserProvider.class));
   

[1/2] ambari git commit: AMBARI-18367. Create authentication filter to encapsulate the various Ambari authentication methods (rlevas)

2016-09-15 Thread rlevas
Repository: ambari
Updated Branches:
  refs/heads/trunk edf1b9b9f -> d5cca62c8


http://git-wip-us.apache.org/repos/asf/ambari/blob/d5cca62c/ambari-server/src/test/java/org/apache/ambari/server/security/authentication/AmbariJWTAuthenticationFilterTest.java
--
diff --git 
a/ambari-server/src/test/java/org/apache/ambari/server/security/authentication/AmbariJWTAuthenticationFilterTest.java
 
b/ambari-server/src/test/java/org/apache/ambari/server/security/authentication/AmbariJWTAuthenticationFilterTest.java
new file mode 100644
index 000..f042a70
--- /dev/null
+++ 
b/ambari-server/src/test/java/org/apache/ambari/server/security/authentication/AmbariJWTAuthenticationFilterTest.java
@@ -0,0 +1,190 @@
+/*
+ * 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.security.authentication;
+
+import com.nimbusds.jose.JOSEException;
+import com.nimbusds.jose.JWSAlgorithm;
+import com.nimbusds.jose.JWSHeader;
+import com.nimbusds.jose.crypto.RSASSASigner;
+import com.nimbusds.jwt.JWTClaimsSet;
+import com.nimbusds.jwt.SignedJWT;
+import org.apache.ambari.server.audit.AuditLogger;
+import org.apache.ambari.server.configuration.Configuration;
+import org.apache.ambari.server.security.AmbariEntryPoint;
+import org.apache.ambari.server.security.authorization.PermissionHelper;
+import org.apache.ambari.server.security.authorization.User;
+import org.apache.ambari.server.security.authorization.UserType;
+import org.apache.ambari.server.security.authorization.Users;
+import 
org.apache.ambari.server.security.authorization.jwt.JwtAuthenticationProperties;
+import org.easymock.EasyMockSupport;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+import javax.servlet.FilterChain;
+import javax.servlet.http.Cookie;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import java.security.KeyPair;
+import java.security.KeyPairGenerator;
+import java.security.NoSuchAlgorithmException;
+import java.security.interfaces.RSAPrivateKey;
+import java.security.interfaces.RSAPublicKey;
+import java.util.Calendar;
+import java.util.Collections;
+import java.util.Date;
+
+import static org.easymock.EasyMock.expect;
+import static org.easymock.EasyMock.expectLastCall;
+
+public class AmbariJWTAuthenticationFilterTest extends EasyMockSupport {
+  private static RSAPublicKey publicKey;
+  private static RSAPrivateKey privateKey;
+
+  @BeforeClass
+  public static void generateKeyPair() throws NoSuchAlgorithmException {
+KeyPairGenerator keyPairGenerator = KeyPairGenerator.getInstance("RSA");
+keyPairGenerator.initialize(512);
+KeyPair keyPair = keyPairGenerator.generateKeyPair();
+publicKey = (RSAPublicKey) keyPair.getPublic();
+privateKey = (RSAPrivateKey) keyPair.getPrivate();
+  }
+
+  @Test
+  public void testDoFilterSuccess() throws Exception {
+SignedJWT token = getSignedToken("foobar");
+
+AmbariEntryPoint entryPoint = createMock(AmbariEntryPoint.class);
+
+JwtAuthenticationProperties properties = 
createMock(JwtAuthenticationProperties.class);
+expect(properties.getAuthenticationProviderUrl()).andReturn("some 
url").once();
+expect(properties.getPublicKey()).andReturn(publicKey).once();
+
expect(properties.getAudiences()).andReturn(Collections.singletonList("foobar")).once();
+expect(properties.getCookieName()).andReturn("chocolate chip").once();
+expect(properties.getOriginalUrlQueryParam()).andReturn("question").once();
+
+Configuration configuration = createMock(Configuration.class);
+expect(configuration.getJwtProperties()).andReturn(properties).once();
+
+User user = createMock(User.class);
+expect(user.getUserName()).andReturn("test-user").once();
+expect(user.getUserType()).andReturn(UserType.JWT).once();
+
+Users users = createMock(Users.class);
+expect(users.getUser("test-user", UserType.JWT)).andReturn(user).once();
+expect(users.getUserAuthorities("test-user", 
UserType.JWT)).andReturn(null).once();
+
+AuditLogger auditLogger = createMock(AuditLogger.class);
+expect(auditLogger.isEnabled()).andReturn(false).times(2);
+
+

[2/2] ambari git commit: AMBARI-18403 - YAML Maps Can Include Dashes and Other Non-Word Characters (jonathanhurley)

2016-09-15 Thread jonathanhurley
AMBARI-18403 - YAML Maps Can Include Dashes and Other Non-Word Characters 
(jonathanhurley)


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

Branch: refs/heads/branch-2.4
Commit: 5cd1d306ff95d534414707f10faedc6e1b1437f6
Parents: 19e3715
Author: Jonathan Hurley 
Authored: Thu Sep 15 11:51:12 2016 -0400
Committer: Jonathan Hurley 
Committed: Thu Sep 15 13:14:40 2016 -0400

--
 .../main/python/ambari_commons/yaml_utils.py| 16 ---
 ambari-server/src/test/python/TestYAMLUtils.py  | 30 ++--
 2 files changed, 34 insertions(+), 12 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/5cd1d306/ambari-common/src/main/python/ambari_commons/yaml_utils.py
--
diff --git a/ambari-common/src/main/python/ambari_commons/yaml_utils.py 
b/ambari-common/src/main/python/ambari_commons/yaml_utils.py
index 9753177..dae5b56 100644
--- a/ambari-common/src/main/python/ambari_commons/yaml_utils.py
+++ b/ambari-common/src/main/python/ambari_commons/yaml_utils.py
@@ -26,13 +26,21 @@ REGEX_LIST = '^\w*\[.+\]\w*$'
 REGEX_DICTIONARY = '^\w*\{.+\}\w*$'
 
 """
-storm:
+storm-cluster:
   hosts:
-[c6401.ambari.apache.org, c6402.ambari.apache.org]
+[c6401.ambari.apache.org, c6402.ambari.apache.org, 
c6403-master.ambari.apache.org]
   groups:
-[hadoop, foo]
+[hadoop, hadoop-secure]
+
+^\s* - allow any whitespace or newlines to start
+\S+ - at least 1 word character (including dashes)
+[ ]*:[ ]* - followed by a colon (allowing spaces around the colon)
+[\r\n\f]+ - at least 1 newline
+
+\s*\S+[ ]*:[ ]*[\r\n\f] - follow with the same basically to ensure a map of 
maps
 """
-REGEX_NESTED_MAPS = '^[\w+\s*:\s*\n\s*]+\[(.*?)\]+'
+REGEX_NESTED_MAPS = "^\s*\S+[ ]*:[ ]*[\r\n\f]+\s*\S+[ ]*:[ ]*[\r\n\f]"
+
 
 def escape_yaml_property(value):
   unquouted_values = ["null", "Null", "NULL", "true", "True", "TRUE", "false",

http://git-wip-us.apache.org/repos/asf/ambari/blob/5cd1d306/ambari-server/src/test/python/TestYAMLUtils.py
--
diff --git a/ambari-server/src/test/python/TestYAMLUtils.py 
b/ambari-server/src/test/python/TestYAMLUtils.py
index c6ee343..4d2d035 100644
--- a/ambari-server/src/test/python/TestYAMLUtils.py
+++ b/ambari-server/src/test/python/TestYAMLUtils.py
@@ -64,19 +64,33 @@ class TestYAMLUtils(TestCase):
 
 # test maps
 map = """
-  storm:
+  storm-cluster:
 hosts:
-  [c6401.ambari.apache.org, c6402.ambari.apache.org]
+  [c6401.ambari.apache.org, c6402.ambari.apache.org, 
c6403-master.ambari.apache.org]
 groups:
-  [hadoop, foo]
-foo:
-  [bar, baz]
-foo2:
-  bar2:
-[baz2]
+  [hadoop, hadoop-secure]
 """
 escaped_map = yaml_utils.escape_yaml_property(map)
 self.assertTrue(escaped_map.startswith("\n"))
 self.assertFalse("'" in escaped_map)
 
+# try some weird but valid formatting
+map = """
+
+
+  storm-cluster:
+  hosts   :
+[c6401.ambari.apache.org, c6402.ambari.apache.org, 
c6403-master.ambari.apache.org]
+  groups   :
+  [hadoop!!!, hadoop-secure-]
+"""
+escaped_map = yaml_utils.escape_yaml_property(map)
+self.assertTrue(escaped_map.startswith("\n"))
+self.assertFalse("'" in escaped_map)
 
+# try some bad formatting - this is not a map
+map = """ foo : bar :
+  [baz]"""
+escaped_map = yaml_utils.escape_yaml_property(map)
+self.assertFalse(escaped_map.startswith("\n"))
+self.assertTrue("'" in escaped_map)



[2/2] ambari git commit: AMBARI-18367. Create authentication filter to encapsulate the various Ambari authentication methods (rlevas)

2016-09-15 Thread rlevas
AMBARI-18367. Create authentication filter to encapsulate the various Ambari 
authentication methods (rlevas)


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

Branch: refs/heads/trunk
Commit: d5cca62c85f97118ed9e2a3e14729d9e6cb6023d
Parents: edf1b9b
Author: Robert Levas 
Authored: Thu Sep 15 13:19:32 2016 -0400
Committer: Robert Levas 
Committed: Thu Sep 15 13:19:40 2016 -0400

--
 .../ambari/server/controller/AmbariServer.java  |  15 +-
 .../server/controller/ControllerModule.java |  12 +-
 .../AmbariAuthenticationFilter.java | 158 ++
 .../AmbariBasicAuthenticationFilter.java| 211 +++
 .../AmbariDelegatingAuthenticationFilter.java   | 146 +
 .../AmbariJWTAuthenticationFilter.java  | 139 
 .../AmbariAuthorizationFilter.java  |  49 -
 .../AuthenticationJwtUserNotFoundException.java |  43 
 .../jwt/JwtAuthenticationFilter.java| 162 --
 .../webapp/WEB-INF/spring-security.xml  |  31 ++-
 .../AmbariAuthenticationFilterTest.java | 139 
 .../AmbariBasicAuthenticationFilterTest.java| 139 
 ...mbariDelegatingAuthenticationFilterTest.java | 186 
 .../AmbariJWTAuthenticationFilterTest.java  | 190 +
 .../AmbariAuthorizationFilterTest.java  |  48 ++---
 .../jwt/JwtAuthenticationFilterTest.java|  77 ++-
 16 files changed, 1347 insertions(+), 398 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/d5cca62c/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 deac313..0e6e6b1 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
@@ -1,4 +1,4 @@
-/**
+/*
  * 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
@@ -7,7 +7,7 @@
  * "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
+ * 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,
@@ -99,15 +99,12 @@ import 
org.apache.ambari.server.security.AmbariServerSecurityHeaderFilter;
 import org.apache.ambari.server.security.AmbariViewsSecurityHeaderFilter;
 import org.apache.ambari.server.security.CertificateManager;
 import org.apache.ambari.server.security.SecurityFilter;
-import 
org.apache.ambari.server.security.authentication.AmbariAuthenticationFilter;
-import 
org.apache.ambari.server.security.authorization.AmbariAuthorizationFilter;
 import 
org.apache.ambari.server.security.authorization.AmbariLdapAuthenticationProvider;
 import org.apache.ambari.server.security.authorization.AmbariLocalUserProvider;
 import 
org.apache.ambari.server.security.authorization.AmbariUserAuthorizationFilter;
 import org.apache.ambari.server.security.authorization.PermissionHelper;
 import org.apache.ambari.server.security.authorization.Users;
 import 
org.apache.ambari.server.security.authorization.internal.AmbariInternalAuthenticationProvider;
-import 
org.apache.ambari.server.security.authorization.jwt.JwtAuthenticationFilter;
 import org.apache.ambari.server.security.ldap.AmbariLdapDataPopulator;
 import org.apache.ambari.server.security.unsecured.rest.CertificateDownload;
 import org.apache.ambari.server.security.unsecured.rest.CertificateSign;
@@ -319,6 +316,8 @@ public class AmbariServer {
   getBeanFactory();
 
   factory.registerSingleton("guiceInjector", injector);
+  factory.registerSingleton("ambariConfiguration", 
injector.getInstance(Configuration.class));
+  factory.registerSingleton("ambariUsers", 
injector.getInstance(Users.class));
   factory.registerSingleton("passwordEncoder",
 injector.getInstance(PasswordEncoder.class));
   factory.registerSingleton("auditLogger",
@@ -331,16 +330,10 @@ public class AmbariServer {
 injector.getInstance(AmbariLocalUserProvider.class));
   

[1/2] ambari git commit: AMBARI-18366 - YAML Maps For Storm Are Not Being Escaped Correctly (jonathanhurley)

2016-09-15 Thread jonathanhurley
Repository: ambari
Updated Branches:
  refs/heads/branch-2.4 3f316575c -> 5cd1d306f


AMBARI-18366 - YAML Maps For Storm Are Not Being Escaped Correctly 
(jonathanhurley)


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

Branch: refs/heads/branch-2.4
Commit: 19e37155b2a435e898550b5d3e9e5d586c0bc965
Parents: 3f31657
Author: Jonathan Hurley 
Authored: Mon Sep 12 15:10:15 2016 -0400
Committer: Jonathan Hurley 
Committed: Thu Sep 15 13:14:24 2016 -0400

--
 .../main/python/ambari_commons/yaml_utils.py| 45 +++-
 ambari-server/src/test/python/TestYAMLUtils.py  | 40 -
 2 files changed, 73 insertions(+), 12 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/19e37155/ambari-common/src/main/python/ambari_commons/yaml_utils.py
--
diff --git a/ambari-common/src/main/python/ambari_commons/yaml_utils.py 
b/ambari-common/src/main/python/ambari_commons/yaml_utils.py
index bb05c8a..9753177 100644
--- a/ambari-common/src/main/python/ambari_commons/yaml_utils.py
+++ b/ambari-common/src/main/python/ambari_commons/yaml_utils.py
@@ -19,37 +19,60 @@ limitations under the License.
 """
 import re
 
+# [a,b,c]
+REGEX_LIST = '^\w*\[.+\]\w*$'
+
+# {a: v, b: v2, c: v3}
+REGEX_DICTIONARY = '^\w*\{.+\}\w*$'
+
+"""
+storm:
+  hosts:
+[c6401.ambari.apache.org, c6402.ambari.apache.org]
+  groups:
+[hadoop, foo]
+"""
+REGEX_NESTED_MAPS = '^[\w+\s*:\s*\n\s*]+\[(.*?)\]+'
+
 def escape_yaml_property(value):
-  unquouted = False
   unquouted_values = ["null", "Null", "NULL", "true", "True", "TRUE", "false",
 "False", "FALSE", "YES", "Yes", "yes", "NO", "No", "no", "ON", "On", "on",
 "OFF", "Off", "off"]
 
+  # known list of boolean/null types
   if value in unquouted_values:
-unquouted = True
-
-  # if is list [a,b,c] or dictionary {a: v, b: v2, c: v3}
-  if re.match('^\w*\[.+\]\w*$', value) or re.match('^\w*\{.+\}\w*$', value):
-unquouted = True
+return value
 
+  # quick pythonic check for integer
   try:
 int(value)
-unquouted = True
+return value
   except ValueError:
 pass
 
+  # quick pythonic check for float
   try:
 float(value)
-unquouted = True
+return value
   except ValueError:
 pass
 
-  if not unquouted:
-value = value.replace("'", "''")
-value = "'" + value + "'"
+  # if is list [a,b,c] or dictionary {a: v, b: v2, c: v3}
+  if re.match(REGEX_LIST, value) or re.match(REGEX_DICTIONARY, value):
+return value
 
+  # check for a nested map
+  if re.match(REGEX_NESTED_MAPS, value):
+# nested maps must begin on a newline and not have whitespace on the first 
line
+value = value.lstrip()
+return "\n" + value
+
+  # no more checks, so assume it's a string a quote it
+  value = value.replace("'", "''")
+  value = "'" + value + "'"
   return value
 
+
 def get_values_from_yaml_array(yaml_array):
   """
   Converts a YAML array into a normal array of values. For example, this

http://git-wip-us.apache.org/repos/asf/ambari/blob/19e37155/ambari-server/src/test/python/TestYAMLUtils.py
--
diff --git a/ambari-server/src/test/python/TestYAMLUtils.py 
b/ambari-server/src/test/python/TestYAMLUtils.py
index bdbb11f..c6ee343 100644
--- a/ambari-server/src/test/python/TestYAMLUtils.py
+++ b/ambari-server/src/test/python/TestYAMLUtils.py
@@ -41,4 +41,42 @@ class TestYAMLUtils(TestCase):
 self.assertEquals(expected_values, values)
 
 values = 
yaml_utils.get_values_from_yaml_array('[\'c6401.ambari.apache.org\', 
"c6402.ambari.apache.org"]')
-self.assertEquals(expected_values, values)
\ No newline at end of file
+self.assertEquals(expected_values, values)
+
+
+  def test_yaml_property_escaping(self):
+"""
+Tests that YAML values are escaped with quotes properly when needed
+"""
+self.assertEquals("True", yaml_utils.escape_yaml_property("True"))
+self.assertEquals("FALSE", yaml_utils.escape_yaml_property("FALSE"))
+self.assertEquals("yes", yaml_utils.escape_yaml_property("yes"))
+self.assertEquals("NO", yaml_utils.escape_yaml_property("NO"))
+self.assertEquals("28", yaml_utils.escape_yaml_property("28"))
+self.assertEquals("28.0", yaml_utils.escape_yaml_property("28.0"))
+self.assertEquals("[a,b,c]", yaml_utils.escape_yaml_property("[a,b,c]"))
+self.assertEquals("{ foo : bar }", yaml_utils.escape_yaml_property("{ foo 
: bar }"))
+
+# some strings which should be escaped
+self.assertEquals("'5f'", 

[1/2] ambari git commit: AMBARI-18367. Create authentication filter to encapsulate the various Ambari authentication methods (rlevas)

2016-09-15 Thread rlevas
Repository: ambari
Updated Branches:
  refs/heads/branch-2.5 a06682f55 -> cc39d115b


http://git-wip-us.apache.org/repos/asf/ambari/blob/cc39d115/ambari-server/src/test/java/org/apache/ambari/server/security/authentication/AmbariJWTAuthenticationFilterTest.java
--
diff --git 
a/ambari-server/src/test/java/org/apache/ambari/server/security/authentication/AmbariJWTAuthenticationFilterTest.java
 
b/ambari-server/src/test/java/org/apache/ambari/server/security/authentication/AmbariJWTAuthenticationFilterTest.java
new file mode 100644
index 000..f042a70
--- /dev/null
+++ 
b/ambari-server/src/test/java/org/apache/ambari/server/security/authentication/AmbariJWTAuthenticationFilterTest.java
@@ -0,0 +1,190 @@
+/*
+ * 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.security.authentication;
+
+import com.nimbusds.jose.JOSEException;
+import com.nimbusds.jose.JWSAlgorithm;
+import com.nimbusds.jose.JWSHeader;
+import com.nimbusds.jose.crypto.RSASSASigner;
+import com.nimbusds.jwt.JWTClaimsSet;
+import com.nimbusds.jwt.SignedJWT;
+import org.apache.ambari.server.audit.AuditLogger;
+import org.apache.ambari.server.configuration.Configuration;
+import org.apache.ambari.server.security.AmbariEntryPoint;
+import org.apache.ambari.server.security.authorization.PermissionHelper;
+import org.apache.ambari.server.security.authorization.User;
+import org.apache.ambari.server.security.authorization.UserType;
+import org.apache.ambari.server.security.authorization.Users;
+import 
org.apache.ambari.server.security.authorization.jwt.JwtAuthenticationProperties;
+import org.easymock.EasyMockSupport;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+import javax.servlet.FilterChain;
+import javax.servlet.http.Cookie;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import java.security.KeyPair;
+import java.security.KeyPairGenerator;
+import java.security.NoSuchAlgorithmException;
+import java.security.interfaces.RSAPrivateKey;
+import java.security.interfaces.RSAPublicKey;
+import java.util.Calendar;
+import java.util.Collections;
+import java.util.Date;
+
+import static org.easymock.EasyMock.expect;
+import static org.easymock.EasyMock.expectLastCall;
+
+public class AmbariJWTAuthenticationFilterTest extends EasyMockSupport {
+  private static RSAPublicKey publicKey;
+  private static RSAPrivateKey privateKey;
+
+  @BeforeClass
+  public static void generateKeyPair() throws NoSuchAlgorithmException {
+KeyPairGenerator keyPairGenerator = KeyPairGenerator.getInstance("RSA");
+keyPairGenerator.initialize(512);
+KeyPair keyPair = keyPairGenerator.generateKeyPair();
+publicKey = (RSAPublicKey) keyPair.getPublic();
+privateKey = (RSAPrivateKey) keyPair.getPrivate();
+  }
+
+  @Test
+  public void testDoFilterSuccess() throws Exception {
+SignedJWT token = getSignedToken("foobar");
+
+AmbariEntryPoint entryPoint = createMock(AmbariEntryPoint.class);
+
+JwtAuthenticationProperties properties = 
createMock(JwtAuthenticationProperties.class);
+expect(properties.getAuthenticationProviderUrl()).andReturn("some 
url").once();
+expect(properties.getPublicKey()).andReturn(publicKey).once();
+
expect(properties.getAudiences()).andReturn(Collections.singletonList("foobar")).once();
+expect(properties.getCookieName()).andReturn("chocolate chip").once();
+expect(properties.getOriginalUrlQueryParam()).andReturn("question").once();
+
+Configuration configuration = createMock(Configuration.class);
+expect(configuration.getJwtProperties()).andReturn(properties).once();
+
+User user = createMock(User.class);
+expect(user.getUserName()).andReturn("test-user").once();
+expect(user.getUserType()).andReturn(UserType.JWT).once();
+
+Users users = createMock(Users.class);
+expect(users.getUser("test-user", UserType.JWT)).andReturn(user).once();
+expect(users.getUserAuthorities("test-user", 
UserType.JWT)).andReturn(null).once();
+
+AuditLogger auditLogger = createMock(AuditLogger.class);
+expect(auditLogger.isEnabled()).andReturn(false).times(2);
+
+

ambari git commit: AMBARI-18404 - Upgrade Summary Endpoint Throws NPEs Due To JPA Cached Entities With Missing IDs (jonathanhurley)

2016-09-15 Thread jonathanhurley
Repository: ambari
Updated Branches:
  refs/heads/branch-2.4 d7056ba9a -> 1f43692b1


AMBARI-18404 - Upgrade Summary Endpoint Throws NPEs Due To JPA Cached Entities 
With Missing IDs (jonathanhurley)


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

Branch: refs/heads/branch-2.4
Commit: 1f43692b14dd9776f7687b1705d8d43f674528b0
Parents: d7056ba
Author: Jonathan Hurley 
Authored: Thu Sep 15 12:12:06 2016 -0400
Committer: Jonathan Hurley 
Committed: Fri Sep 16 00:11:20 2016 -0400

--
 .../actionmanager/ActionDBAccessorImpl.java | 14 +-
 .../server/actionmanager/HostRoleCommand.java   | 16 +++
 .../orm/entities/HostRoleCommandEntity.java | 19 +
 .../ambari/server/topology/HostRequest.java | 21 ++
 .../actionmanager/TestActionDBAccessorImpl.java | 29 
 5 files changed, 80 insertions(+), 19 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/1f43692b/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 b7e7f2d..c31ca7e 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
@@ -344,7 +344,6 @@ public class ActionDBAccessorImpl implements 
ActionDBAccessor {
   StageEntity stageEntity = stage.constructNewPersistenceEntity();
   stageEntities.add(stageEntity);
   stageEntity.setClusterId(clusterId);
-  //TODO refactor to reduce merges
   stageEntity.setRequest(requestEntity);
   stageDAO.create(stageEntity);
 
@@ -353,9 +352,6 @@ public class ActionDBAccessorImpl implements 
ActionDBAccessor {
   for (HostRoleCommand hostRoleCommand : orderedHostRoleCommands) {
 HostRoleCommandEntity hostRoleCommandEntity = 
hostRoleCommand.constructNewPersistenceEntity();
 hostRoleCommandEntity.setStage(stageEntity);
-
-HostEntity hostEntity = null;
-
 hostRoleCommandDAO.create(hostRoleCommandEntity);
 
 assert hostRoleCommandEntity.getTaskId() != null;
@@ -365,6 +361,7 @@ public class ActionDBAccessorImpl implements 
ActionDBAccessor {
 String output = "output-" + hostRoleCommandEntity.getTaskId() + ".txt";
 String error = "errors-" + hostRoleCommandEntity.getTaskId() + ".txt";
 
+HostEntity hostEntity = null;
 if (null != hostRoleCommandEntity.getHostId()) {
   hostEntity = hostDAO.findById(hostRoleCommandEntity.getHostId());
   if (hostEntity == null) {
@@ -372,6 +369,7 @@ public class ActionDBAccessorImpl implements 
ActionDBAccessor {
 LOG.error(msg);
 throw new AmbariException(msg);
   }
+
   hostRoleCommandEntity.setHostEntity(hostEntity);
 
   try {
@@ -401,9 +399,10 @@ public class ActionDBAccessorImpl implements 
ActionDBAccessor {
 hostRoleCommandEntity.setExecutionCommand(executionCommandEntity);
 
 
executionCommandDAO.create(hostRoleCommandEntity.getExecutionCommand());
-hostRoleCommandDAO.merge(hostRoleCommandEntity);
+hostRoleCommandEntity = 
hostRoleCommandDAO.merge(hostRoleCommandEntity);
+
 if (null != hostEntity) {
-  hostDAO.merge(hostEntity);
+  hostEntity = hostDAO.merge(hostEntity);
 }
   }
 
@@ -411,8 +410,9 @@ public class ActionDBAccessorImpl implements 
ActionDBAccessor {
 roleSuccessCriteriaDAO.create(roleSuccessCriteriaEntity);
   }
 
-  stageDAO.create(stageEntity);
+  stageEntity = stageDAO.merge(stageEntity);
 }
+
 requestEntity.setStages(stageEntities);
 requestDAO.merge(requestEntity);
   }

http://git-wip-us.apache.org/repos/asf/ambari/blob/1f43692b/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/HostRoleCommand.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/HostRoleCommand.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/HostRoleCommand.java
index ff2ce92..85c8e9f 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/HostRoleCommand.java
+++ 

ambari git commit: AMBARI-18386. Handle Ranger hive repo config jdbc url change for stack 2.5 (mugdha)

2016-09-15 Thread mugdha
Repository: ambari
Updated Branches:
  refs/heads/trunk da5605706 -> bdd261ef1


AMBARI-18386. Handle Ranger hive repo config jdbc url change for stack 2.5 
(mugdha)


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

Branch: refs/heads/trunk
Commit: bdd261ef10eef1a5daa9d89f7b509bf6e23c370c
Parents: da56057
Author: Mugdha Varadkar 
Authored: Thu Sep 15 10:37:06 2016 +0530
Committer: Mugdha Varadkar 
Committed: Fri Sep 16 10:33:32 2016 +0530

--
 .../resource_management/libraries/functions/constants.py  |  3 ++-
 .../HIVE/0.12.0.2.0/package/scripts/params_linux.py   | 10 +-
 .../stacks/HDP/2.0.6/properties/stack_features.json   |  5 +
 3 files changed, 16 insertions(+), 2 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/bdd261ef/ambari-common/src/main/python/resource_management/libraries/functions/constants.py
--
diff --git 
a/ambari-common/src/main/python/resource_management/libraries/functions/constants.py
 
b/ambari-common/src/main/python/resource_management/libraries/functions/constants.py
index 169fbff..1396bd8 100644
--- 
a/ambari-common/src/main/python/resource_management/libraries/functions/constants.py
+++ 
b/ambari-common/src/main/python/resource_management/libraries/functions/constants.py
@@ -99,4 +99,5 @@ class StackFeature:
   RANGER_ADMIN_PASSWD_CHANGE = "ranger_admin_password_change"
   STORM_METRICS_APACHE_CLASSES = "storm_metrics_apache_classes"
   SPARK_JAVA_OPTS_SUPPORT = "spark_java_opts_support"
-  ATLAS_HBASE_SETUP="atlas_hbase_setup"
+  ATLAS_HBASE_SETUP = "atlas_hbase_setup"
+  RANGER_HIVE_PLUGIN_JDBC_URL = "ranger_hive_plugin_jdbc_url"

http://git-wip-us.apache.org/repos/asf/ambari/blob/bdd261ef/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/params_linux.py
--
diff --git 
a/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/params_linux.py
 
b/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/params_linux.py
index 56e3ce6..5f78a1f 100644
--- 
a/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/params_linux.py
+++ 
b/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/params_linux.py
@@ -89,6 +89,7 @@ version_for_stack_feature_checks = 
get_stack_feature_version(config)
 upgrade_direction = default("/commandParams/upgrade_direction", None)
 stack_supports_ranger_kerberos = 
check_stack_feature(StackFeature.RANGER_KERBEROS_SUPPORT, 
version_for_stack_feature_checks)
 stack_supports_ranger_audit_db = 
check_stack_feature(StackFeature.RANGER_AUDIT_DB_SUPPORT, 
version_for_stack_feature_checks)
+stack_supports_ranger_hive_jdbc_url_change = 
check_stack_feature(StackFeature.RANGER_HIVE_PLUGIN_JDBC_URL, 
version_for_stack_feature_checks)
 
 # component ROLE directory (like hive-metastore or hive-server2-hive2)
 component_directory = status_params.component_directory
@@ -617,6 +618,9 @@ if has_hive_interactive:
 hive_llap_principal = 
(config['configurations']['hive-interactive-site']['hive.llap.zk.sm.principal']).replace('_HOST',hostname.lower())
   pass
 
+hive_server2_zookeeper_namespace = 
config['configurations']['hive-site']['hive.server2.zookeeper.namespace']
+hive_zookeeper_quorum = 
config['configurations']['hive-site']['hive.zookeeper.quorum']
+
 # ranger host
 ranger_admin_hosts = default("/clusterHostInfo/ranger_admin_hosts", [])
 has_ranger_admin = not len(ranger_admin_hosts) == 0
@@ -688,11 +692,15 @@ if has_ranger_admin:
   ranger_previous_jdbc_jar = 
format("{hive_lib}/{ranger_previous_jdbc_jar_name}") if 
stack_supports_ranger_audit_db else None
   sql_connector_jar = ''
 
+  ranger_hive_url = format("{hive_url}/default;principal={hive_principal}") if 
security_enabled else hive_url
+  if stack_supports_ranger_hive_jdbc_url_change:
+ranger_hive_url = 
format("jdbc:hive2://{hive_zookeeper_quorum}/;serviceDiscoveryMode=zooKeeper;zooKeeperNamespace={hive_server2_zookeeper_namespace}")
+
   hive_ranger_plugin_config = {
 'username': repo_config_username,
 'password': repo_config_password,
 'jdbc.driverClassName': jdbc_driver_class_name,
-'jdbc.url': format("{hive_url}/default;principal={hive_principal}") if 
security_enabled else hive_url,
+'jdbc.url': ranger_hive_url,
 'commonNameForCertificate': common_name_for_certificate
   }
 


ambari git commit: AMBARI-18386. Handle Ranger hive repo config jdbc url change for stack 2.5 (mugdha)

2016-09-15 Thread mugdha
Repository: ambari
Updated Branches:
  refs/heads/branch-2.5 d6773ce6c -> 357ba0a9a


AMBARI-18386. Handle Ranger hive repo config jdbc url change for stack 2.5 
(mugdha)


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

Branch: refs/heads/branch-2.5
Commit: 357ba0a9a15e42f57671a9d19c751b64650c88f6
Parents: d6773ce
Author: Mugdha Varadkar 
Authored: Thu Sep 15 10:37:06 2016 +0530
Committer: Mugdha Varadkar 
Committed: Fri Sep 16 10:30:23 2016 +0530

--
 .../resource_management/libraries/functions/constants.py  |  3 ++-
 .../HIVE/0.12.0.2.0/package/scripts/params_linux.py   | 10 +-
 .../stacks/HDP/2.0.6/properties/stack_features.json   |  5 +
 3 files changed, 16 insertions(+), 2 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/357ba0a9/ambari-common/src/main/python/resource_management/libraries/functions/constants.py
--
diff --git 
a/ambari-common/src/main/python/resource_management/libraries/functions/constants.py
 
b/ambari-common/src/main/python/resource_management/libraries/functions/constants.py
index 169fbff..1396bd8 100644
--- 
a/ambari-common/src/main/python/resource_management/libraries/functions/constants.py
+++ 
b/ambari-common/src/main/python/resource_management/libraries/functions/constants.py
@@ -99,4 +99,5 @@ class StackFeature:
   RANGER_ADMIN_PASSWD_CHANGE = "ranger_admin_password_change"
   STORM_METRICS_APACHE_CLASSES = "storm_metrics_apache_classes"
   SPARK_JAVA_OPTS_SUPPORT = "spark_java_opts_support"
-  ATLAS_HBASE_SETUP="atlas_hbase_setup"
+  ATLAS_HBASE_SETUP = "atlas_hbase_setup"
+  RANGER_HIVE_PLUGIN_JDBC_URL = "ranger_hive_plugin_jdbc_url"

http://git-wip-us.apache.org/repos/asf/ambari/blob/357ba0a9/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/params_linux.py
--
diff --git 
a/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/params_linux.py
 
b/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/params_linux.py
index 5e3e233..cba6feb 100644
--- 
a/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/params_linux.py
+++ 
b/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/params_linux.py
@@ -88,6 +88,7 @@ version_for_stack_feature_checks = 
get_stack_feature_version(config)
 upgrade_direction = default("/commandParams/upgrade_direction", None)
 stack_supports_ranger_kerberos = 
check_stack_feature(StackFeature.RANGER_KERBEROS_SUPPORT, 
version_for_stack_feature_checks)
 stack_supports_ranger_audit_db = 
check_stack_feature(StackFeature.RANGER_AUDIT_DB_SUPPORT, 
version_for_stack_feature_checks)
+stack_supports_ranger_hive_jdbc_url_change = 
check_stack_feature(StackFeature.RANGER_HIVE_PLUGIN_JDBC_URL, 
version_for_stack_feature_checks)
 
 # component ROLE directory (like hive-metastore or hive-server2-hive2)
 component_directory = status_params.component_directory
@@ -615,6 +616,9 @@ if has_hive_interactive:
 hive_llap_principal = 
(config['configurations']['hive-interactive-site']['hive.llap.zk.sm.principal']).replace('_HOST',hostname.lower())
   pass
 
+hive_server2_zookeeper_namespace = 
config['configurations']['hive-site']['hive.server2.zookeeper.namespace']
+hive_zookeeper_quorum = 
config['configurations']['hive-site']['hive.zookeeper.quorum']
+
 # ranger host
 ranger_admin_hosts = default("/clusterHostInfo/ranger_admin_hosts", [])
 has_ranger_admin = not len(ranger_admin_hosts) == 0
@@ -686,11 +690,15 @@ if has_ranger_admin:
   ranger_previous_jdbc_jar = 
format("{hive_lib}/{ranger_previous_jdbc_jar_name}") if 
stack_supports_ranger_audit_db else None
   sql_connector_jar = ''
 
+  ranger_hive_url = format("{hive_url}/default;principal={hive_principal}") if 
security_enabled else hive_url
+  if stack_supports_ranger_hive_jdbc_url_change:
+ranger_hive_url = 
format("jdbc:hive2://{hive_zookeeper_quorum}/;serviceDiscoveryMode=zooKeeper;zooKeeperNamespace={hive_server2_zookeeper_namespace}")
+
   hive_ranger_plugin_config = {
 'username': repo_config_username,
 'password': repo_config_password,
 'jdbc.driverClassName': jdbc_driver_class_name,
-'jdbc.url': format("{hive_url}/default;principal={hive_principal}") if 
security_enabled else hive_url,
+'jdbc.url': ranger_hive_url,
 'commonNameForCertificate': common_name_for_certificate
   }
 


ambari git commit: AMBARI-18404 - Upgrade Summary Endpoint Throws NPEs Due To JPA Cached Entities With Missing IDs (jonathanhurley)

2016-09-15 Thread jonathanhurley
Repository: ambari
Updated Branches:
  refs/heads/trunk 1efc99c5a -> da5605706


AMBARI-18404 - Upgrade Summary Endpoint Throws NPEs Due To JPA Cached Entities 
With Missing IDs (jonathanhurley)


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

Branch: refs/heads/trunk
Commit: da5605706555d3aecca7a67fb399d9c501972ad4
Parents: 1efc99c
Author: Jonathan Hurley 
Authored: Thu Sep 15 12:12:06 2016 -0400
Committer: Jonathan Hurley 
Committed: Thu Sep 15 23:57:36 2016 -0400

--
 .../actionmanager/ActionDBAccessorImpl.java | 14 +-
 .../server/actionmanager/HostRoleCommand.java   | 16 +++
 .../orm/entities/HostRoleCommandEntity.java | 19 +
 .../ambari/server/topology/HostRequest.java | 25 -
 .../actionmanager/TestActionDBAccessorImpl.java | 29 
 5 files changed, 82 insertions(+), 21 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/da560570/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 b7e7f2d..c31ca7e 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
@@ -344,7 +344,6 @@ public class ActionDBAccessorImpl implements 
ActionDBAccessor {
   StageEntity stageEntity = stage.constructNewPersistenceEntity();
   stageEntities.add(stageEntity);
   stageEntity.setClusterId(clusterId);
-  //TODO refactor to reduce merges
   stageEntity.setRequest(requestEntity);
   stageDAO.create(stageEntity);
 
@@ -353,9 +352,6 @@ public class ActionDBAccessorImpl implements 
ActionDBAccessor {
   for (HostRoleCommand hostRoleCommand : orderedHostRoleCommands) {
 HostRoleCommandEntity hostRoleCommandEntity = 
hostRoleCommand.constructNewPersistenceEntity();
 hostRoleCommandEntity.setStage(stageEntity);
-
-HostEntity hostEntity = null;
-
 hostRoleCommandDAO.create(hostRoleCommandEntity);
 
 assert hostRoleCommandEntity.getTaskId() != null;
@@ -365,6 +361,7 @@ public class ActionDBAccessorImpl implements 
ActionDBAccessor {
 String output = "output-" + hostRoleCommandEntity.getTaskId() + ".txt";
 String error = "errors-" + hostRoleCommandEntity.getTaskId() + ".txt";
 
+HostEntity hostEntity = null;
 if (null != hostRoleCommandEntity.getHostId()) {
   hostEntity = hostDAO.findById(hostRoleCommandEntity.getHostId());
   if (hostEntity == null) {
@@ -372,6 +369,7 @@ public class ActionDBAccessorImpl implements 
ActionDBAccessor {
 LOG.error(msg);
 throw new AmbariException(msg);
   }
+
   hostRoleCommandEntity.setHostEntity(hostEntity);
 
   try {
@@ -401,9 +399,10 @@ public class ActionDBAccessorImpl implements 
ActionDBAccessor {
 hostRoleCommandEntity.setExecutionCommand(executionCommandEntity);
 
 
executionCommandDAO.create(hostRoleCommandEntity.getExecutionCommand());
-hostRoleCommandDAO.merge(hostRoleCommandEntity);
+hostRoleCommandEntity = 
hostRoleCommandDAO.merge(hostRoleCommandEntity);
+
 if (null != hostEntity) {
-  hostDAO.merge(hostEntity);
+  hostEntity = hostDAO.merge(hostEntity);
 }
   }
 
@@ -411,8 +410,9 @@ public class ActionDBAccessorImpl implements 
ActionDBAccessor {
 roleSuccessCriteriaDAO.create(roleSuccessCriteriaEntity);
   }
 
-  stageDAO.create(stageEntity);
+  stageEntity = stageDAO.merge(stageEntity);
 }
+
 requestEntity.setStages(stageEntities);
 requestDAO.merge(requestEntity);
   }

http://git-wip-us.apache.org/repos/asf/ambari/blob/da560570/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/HostRoleCommand.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/HostRoleCommand.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/HostRoleCommand.java
index ff2ce92..85c8e9f 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/HostRoleCommand.java
+++ 

ambari git commit: AMBARI-18404 - Upgrade Summary Endpoint Throws NPEs Due To JPA Cached Entities With Missing IDs (jonathanhurley)

2016-09-15 Thread jonathanhurley
Repository: ambari
Updated Branches:
  refs/heads/branch-2.5 cec090224 -> d6773ce6c


AMBARI-18404 - Upgrade Summary Endpoint Throws NPEs Due To JPA Cached Entities 
With Missing IDs (jonathanhurley)


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

Branch: refs/heads/branch-2.5
Commit: d6773ce6c76dc0c09fe607880a53bcaab8e06387
Parents: cec0902
Author: Jonathan Hurley 
Authored: Thu Sep 15 12:12:06 2016 -0400
Committer: Jonathan Hurley 
Committed: Thu Sep 15 23:58:07 2016 -0400

--
 .../actionmanager/ActionDBAccessorImpl.java | 14 +-
 .../server/actionmanager/HostRoleCommand.java   | 16 +++
 .../orm/entities/HostRoleCommandEntity.java | 19 +
 .../ambari/server/topology/HostRequest.java | 25 -
 .../actionmanager/TestActionDBAccessorImpl.java | 29 
 5 files changed, 82 insertions(+), 21 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/d6773ce6/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 b7e7f2d..c31ca7e 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
@@ -344,7 +344,6 @@ public class ActionDBAccessorImpl implements 
ActionDBAccessor {
   StageEntity stageEntity = stage.constructNewPersistenceEntity();
   stageEntities.add(stageEntity);
   stageEntity.setClusterId(clusterId);
-  //TODO refactor to reduce merges
   stageEntity.setRequest(requestEntity);
   stageDAO.create(stageEntity);
 
@@ -353,9 +352,6 @@ public class ActionDBAccessorImpl implements 
ActionDBAccessor {
   for (HostRoleCommand hostRoleCommand : orderedHostRoleCommands) {
 HostRoleCommandEntity hostRoleCommandEntity = 
hostRoleCommand.constructNewPersistenceEntity();
 hostRoleCommandEntity.setStage(stageEntity);
-
-HostEntity hostEntity = null;
-
 hostRoleCommandDAO.create(hostRoleCommandEntity);
 
 assert hostRoleCommandEntity.getTaskId() != null;
@@ -365,6 +361,7 @@ public class ActionDBAccessorImpl implements 
ActionDBAccessor {
 String output = "output-" + hostRoleCommandEntity.getTaskId() + ".txt";
 String error = "errors-" + hostRoleCommandEntity.getTaskId() + ".txt";
 
+HostEntity hostEntity = null;
 if (null != hostRoleCommandEntity.getHostId()) {
   hostEntity = hostDAO.findById(hostRoleCommandEntity.getHostId());
   if (hostEntity == null) {
@@ -372,6 +369,7 @@ public class ActionDBAccessorImpl implements 
ActionDBAccessor {
 LOG.error(msg);
 throw new AmbariException(msg);
   }
+
   hostRoleCommandEntity.setHostEntity(hostEntity);
 
   try {
@@ -401,9 +399,10 @@ public class ActionDBAccessorImpl implements 
ActionDBAccessor {
 hostRoleCommandEntity.setExecutionCommand(executionCommandEntity);
 
 
executionCommandDAO.create(hostRoleCommandEntity.getExecutionCommand());
-hostRoleCommandDAO.merge(hostRoleCommandEntity);
+hostRoleCommandEntity = 
hostRoleCommandDAO.merge(hostRoleCommandEntity);
+
 if (null != hostEntity) {
-  hostDAO.merge(hostEntity);
+  hostEntity = hostDAO.merge(hostEntity);
 }
   }
 
@@ -411,8 +410,9 @@ public class ActionDBAccessorImpl implements 
ActionDBAccessor {
 roleSuccessCriteriaDAO.create(roleSuccessCriteriaEntity);
   }
 
-  stageDAO.create(stageEntity);
+  stageEntity = stageDAO.merge(stageEntity);
 }
+
 requestEntity.setStages(stageEntities);
 requestDAO.merge(requestEntity);
   }

http://git-wip-us.apache.org/repos/asf/ambari/blob/d6773ce6/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/HostRoleCommand.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/HostRoleCommand.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/HostRoleCommand.java
index ff2ce92..85c8e9f 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/HostRoleCommand.java
+++ 

ambari git commit: AMBARI-18368. ADDENDUM. Atlas web UI inaccessible alert after adding Atlas service on upgraded cluster (alejandro) [Forced Update!]

2016-09-15 Thread alejandro
Repository: ambari
Updated Branches:
  refs/heads/branch-2.5 6950af1a5 -> cec090224 (forced update)


AMBARI-18368. ADDENDUM. Atlas web UI inaccessible alert after adding Atlas 
service on upgraded cluster (alejandro)


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

Branch: refs/heads/branch-2.5
Commit: cec090224e09518a19a88e7b3e61f9837d92fb88
Parents: cc39d11
Author: Alejandro Fernandez 
Authored: Thu Sep 15 14:54:59 2016 -0700
Committer: Alejandro Fernandez 
Committed: Thu Sep 15 14:56:56 2016 -0700

--
 .../libraries/functions/conf_select.py  | 39 +---
 .../hooks/after-INSTALL/test_after_install.py   | 18 +
 2 files changed, 52 insertions(+), 5 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/cec09022/ambari-common/src/main/python/resource_management/libraries/functions/conf_select.py
--
diff --git 
a/ambari-common/src/main/python/resource_management/libraries/functions/conf_select.py
 
b/ambari-common/src/main/python/resource_management/libraries/functions/conf_select.py
index c60b324..8d54053 100644
--- 
a/ambari-common/src/main/python/resource_management/libraries/functions/conf_select.py
+++ 
b/ambari-common/src/main/python/resource_management/libraries/functions/conf_select.py
@@ -343,7 +343,27 @@ def select(stack_name, package, version, try_create=True, 
ignore_errors=False):
   else:
 # missing entirely
 # /etc//conf -> /current//conf
-Link(conf_dir, to = current_dir)
+if package in ["atlas", ]:
+  #HACK for Atlas
+  '''
+  In the case of Atlas, the Hive RPM installs 
/usr/$stack/$version/atlas with some partial packages that
+  contain Hive hooks, while the Atlas RPM is responsible for 
installing the full content.
+
+  If the user does not have Atlas currently installed on their 
stack, then /usr/$stack/current/atlas-client
+  will be a broken symlink, and we should not create the
+  symlink /etc/atlas/conf -> /usr/$stack/current/atlas-client/conf 
.
+  If we mistakenly create this symlink, then when the user 
performs an EU/RU and then adds Atlas service
+  then the Atlas RPM will not be able to copy its artifacts into 
/etc/atlas/conf directory and therefore
+  prevent Ambari from by copying those unmanaged contents into 
/etc/atlas/$version/0
+  '''
+  parent_dir = os.path.dirname(current_dir)
+  if os.path.exists(parent_dir):
+Link(conf_dir, to=current_dir)
+  else:
+Logger.info("Will not create symlink from {0} to {1} because 
the destination's parent dir does not exist.".format(conf_dir, current_dir))
+else:
+  # Normal path for other packages
+  Link(conf_dir, to=current_dir)
 
   except Exception, exception:
 if ignore_errors is True:
@@ -579,15 +599,24 @@ def convert_conf_directories_to_symlinks(package, 
version, dirs, skip_existing_l
   else:
 Link(new_symlink, action = "delete")
 
+  old_conf = dir_def['conf_dir']
+  backup_dir = _get_backup_conf_directory(old_conf)
   # link /etc/[component]/conf -> /etc/[component]/conf.backup
   # or
   # link /etc/[component]/conf -> 
/current/[component]-client/conf
   if link_to == DIRECTORY_TYPE_BACKUP:
-old_conf = dir_def['conf_dir']
-backup_dir = _get_backup_conf_directory(old_conf)
-Link(new_symlink, to = backup_dir)
+Link(new_symlink, to=backup_dir)
   else:
-Link(new_symlink, to = dir_def['current_dir'])
+Link(new_symlink, to=dir_def['current_dir'])
+
+#HACK
+if package in ["atlas", ]:
+  Logger.info("Seeding the new conf symlink {0} from the old backup 
directory {1} in case any "
+  "unmanaged artifacts are needed.".format(new_symlink, 
backup_dir))
+  # If /etc/[component]/conf.backup exists, then copy any artifacts 
not managed by Ambari to the new symlink target
+  # Be careful not to clobber any existing files.
+  Execute(as_sudo(["cp", "-R", "--no-clobber", 
os.path.join(backup_dir, "*"), new_symlink], auto_escape=False),
+  only_if=format("test -e {new_symlink}"))
   except Exception, e:
 Logger.warning("Could not change symlink for package {0} to point to {1} 
directory. Error: {2}".format(package, link_to, e))
 


ambari git commit: AMBARI-18368. ADDENDUM. Atlas web UI alert after performing stack upgrade to HDP 2.5 and adding Atlas Service (alejandro)

2016-09-15 Thread alejandro
Repository: ambari
Updated Branches:
  refs/heads/trunk d5cca62c8 -> 1efc99c5a


AMBARI-18368. ADDENDUM. Atlas web UI alert after performing stack upgrade to 
HDP 2.5 and adding Atlas Service (alejandro)


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

Branch: refs/heads/trunk
Commit: 1efc99c5adc536044425b9df45b72421c5a8323c
Parents: d5cca62
Author: Alejandro Fernandez 
Authored: Wed Sep 14 18:42:59 2016 -0700
Committer: Alejandro Fernandez 
Committed: Thu Sep 15 14:46:37 2016 -0700

--
 .../libraries/functions/conf_select.py  | 39 +---
 .../hooks/after-INSTALL/test_after_install.py   | 18 +
 2 files changed, 52 insertions(+), 5 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/1efc99c5/ambari-common/src/main/python/resource_management/libraries/functions/conf_select.py
--
diff --git 
a/ambari-common/src/main/python/resource_management/libraries/functions/conf_select.py
 
b/ambari-common/src/main/python/resource_management/libraries/functions/conf_select.py
index c60b324..8d54053 100644
--- 
a/ambari-common/src/main/python/resource_management/libraries/functions/conf_select.py
+++ 
b/ambari-common/src/main/python/resource_management/libraries/functions/conf_select.py
@@ -343,7 +343,27 @@ def select(stack_name, package, version, try_create=True, 
ignore_errors=False):
   else:
 # missing entirely
 # /etc//conf -> /current//conf
-Link(conf_dir, to = current_dir)
+if package in ["atlas", ]:
+  #HACK for Atlas
+  '''
+  In the case of Atlas, the Hive RPM installs 
/usr/$stack/$version/atlas with some partial packages that
+  contain Hive hooks, while the Atlas RPM is responsible for 
installing the full content.
+
+  If the user does not have Atlas currently installed on their 
stack, then /usr/$stack/current/atlas-client
+  will be a broken symlink, and we should not create the
+  symlink /etc/atlas/conf -> /usr/$stack/current/atlas-client/conf 
.
+  If we mistakenly create this symlink, then when the user 
performs an EU/RU and then adds Atlas service
+  then the Atlas RPM will not be able to copy its artifacts into 
/etc/atlas/conf directory and therefore
+  prevent Ambari from by copying those unmanaged contents into 
/etc/atlas/$version/0
+  '''
+  parent_dir = os.path.dirname(current_dir)
+  if os.path.exists(parent_dir):
+Link(conf_dir, to=current_dir)
+  else:
+Logger.info("Will not create symlink from {0} to {1} because 
the destination's parent dir does not exist.".format(conf_dir, current_dir))
+else:
+  # Normal path for other packages
+  Link(conf_dir, to=current_dir)
 
   except Exception, exception:
 if ignore_errors is True:
@@ -579,15 +599,24 @@ def convert_conf_directories_to_symlinks(package, 
version, dirs, skip_existing_l
   else:
 Link(new_symlink, action = "delete")
 
+  old_conf = dir_def['conf_dir']
+  backup_dir = _get_backup_conf_directory(old_conf)
   # link /etc/[component]/conf -> /etc/[component]/conf.backup
   # or
   # link /etc/[component]/conf -> 
/current/[component]-client/conf
   if link_to == DIRECTORY_TYPE_BACKUP:
-old_conf = dir_def['conf_dir']
-backup_dir = _get_backup_conf_directory(old_conf)
-Link(new_symlink, to = backup_dir)
+Link(new_symlink, to=backup_dir)
   else:
-Link(new_symlink, to = dir_def['current_dir'])
+Link(new_symlink, to=dir_def['current_dir'])
+
+#HACK
+if package in ["atlas", ]:
+  Logger.info("Seeding the new conf symlink {0} from the old backup 
directory {1} in case any "
+  "unmanaged artifacts are needed.".format(new_symlink, 
backup_dir))
+  # If /etc/[component]/conf.backup exists, then copy any artifacts 
not managed by Ambari to the new symlink target
+  # Be careful not to clobber any existing files.
+  Execute(as_sudo(["cp", "-R", "--no-clobber", 
os.path.join(backup_dir, "*"), new_symlink], auto_escape=False),
+  only_if=format("test -e {new_symlink}"))
   except Exception, e:
 Logger.warning("Could not change symlink for package {0} to point to {1} 
directory. Error: {2}".format(package, link_to, e))
 


ambari git commit: AMBARI-18368. ADDENDUM. Atlas web UI alert after performing stack upgrade to HDP 2.5 and adding Atlas Service (alejandro)

2016-09-15 Thread alejandro
Repository: ambari
Updated Branches:
  refs/heads/branch-2.4 5cd1d306f -> d7056ba9a


AMBARI-18368. ADDENDUM. Atlas web UI alert after performing stack upgrade to 
HDP 2.5 and adding Atlas Service (alejandro)


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

Branch: refs/heads/branch-2.4
Commit: d7056ba9a0158ccb053097c6277ae9e939e85496
Parents: 5cd1d30
Author: Alejandro Fernandez 
Authored: Thu Sep 15 14:59:04 2016 -0700
Committer: Alejandro Fernandez 
Committed: Thu Sep 15 14:59:06 2016 -0700

--
 .../libraries/functions/conf_select.py  | 39 +---
 .../hooks/after-INSTALL/test_after_install.py   | 18 +
 2 files changed, 52 insertions(+), 5 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/d7056ba9/ambari-common/src/main/python/resource_management/libraries/functions/conf_select.py
--
diff --git 
a/ambari-common/src/main/python/resource_management/libraries/functions/conf_select.py
 
b/ambari-common/src/main/python/resource_management/libraries/functions/conf_select.py
index c60b324..8d54053 100644
--- 
a/ambari-common/src/main/python/resource_management/libraries/functions/conf_select.py
+++ 
b/ambari-common/src/main/python/resource_management/libraries/functions/conf_select.py
@@ -343,7 +343,27 @@ def select(stack_name, package, version, try_create=True, 
ignore_errors=False):
   else:
 # missing entirely
 # /etc//conf -> /current//conf
-Link(conf_dir, to = current_dir)
+if package in ["atlas", ]:
+  #HACK for Atlas
+  '''
+  In the case of Atlas, the Hive RPM installs 
/usr/$stack/$version/atlas with some partial packages that
+  contain Hive hooks, while the Atlas RPM is responsible for 
installing the full content.
+
+  If the user does not have Atlas currently installed on their 
stack, then /usr/$stack/current/atlas-client
+  will be a broken symlink, and we should not create the
+  symlink /etc/atlas/conf -> /usr/$stack/current/atlas-client/conf 
.
+  If we mistakenly create this symlink, then when the user 
performs an EU/RU and then adds Atlas service
+  then the Atlas RPM will not be able to copy its artifacts into 
/etc/atlas/conf directory and therefore
+  prevent Ambari from by copying those unmanaged contents into 
/etc/atlas/$version/0
+  '''
+  parent_dir = os.path.dirname(current_dir)
+  if os.path.exists(parent_dir):
+Link(conf_dir, to=current_dir)
+  else:
+Logger.info("Will not create symlink from {0} to {1} because 
the destination's parent dir does not exist.".format(conf_dir, current_dir))
+else:
+  # Normal path for other packages
+  Link(conf_dir, to=current_dir)
 
   except Exception, exception:
 if ignore_errors is True:
@@ -579,15 +599,24 @@ def convert_conf_directories_to_symlinks(package, 
version, dirs, skip_existing_l
   else:
 Link(new_symlink, action = "delete")
 
+  old_conf = dir_def['conf_dir']
+  backup_dir = _get_backup_conf_directory(old_conf)
   # link /etc/[component]/conf -> /etc/[component]/conf.backup
   # or
   # link /etc/[component]/conf -> 
/current/[component]-client/conf
   if link_to == DIRECTORY_TYPE_BACKUP:
-old_conf = dir_def['conf_dir']
-backup_dir = _get_backup_conf_directory(old_conf)
-Link(new_symlink, to = backup_dir)
+Link(new_symlink, to=backup_dir)
   else:
-Link(new_symlink, to = dir_def['current_dir'])
+Link(new_symlink, to=dir_def['current_dir'])
+
+#HACK
+if package in ["atlas", ]:
+  Logger.info("Seeding the new conf symlink {0} from the old backup 
directory {1} in case any "
+  "unmanaged artifacts are needed.".format(new_symlink, 
backup_dir))
+  # If /etc/[component]/conf.backup exists, then copy any artifacts 
not managed by Ambari to the new symlink target
+  # Be careful not to clobber any existing files.
+  Execute(as_sudo(["cp", "-R", "--no-clobber", 
os.path.join(backup_dir, "*"), new_symlink], auto_escape=False),
+  only_if=format("test -e {new_symlink}"))
   except Exception, e:
 Logger.warning("Could not change symlink for package {0} to point to {1} 
directory. Error: {2}".format(package, link_to, e))
 


ambari git commit: AMBARI-65080. ADDENDUM. Atlas web UI inaccessible alert after adding Atlas service on upgraded cluster (alejandro)

2016-09-15 Thread alejandro
Repository: ambari
Updated Branches:
  refs/heads/branch-2.5 cc39d115b -> 6950af1a5


AMBARI-65080. ADDENDUM. Atlas web UI inaccessible alert after adding Atlas 
service on upgraded cluster (alejandro)


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

Branch: refs/heads/branch-2.5
Commit: 6950af1a50024d48c56023f033ec9126f301a746
Parents: cc39d11
Author: Alejandro Fernandez 
Authored: Thu Sep 15 14:54:59 2016 -0700
Committer: Alejandro Fernandez 
Committed: Thu Sep 15 14:54:59 2016 -0700

--
 .../libraries/functions/conf_select.py  | 39 +---
 .../hooks/after-INSTALL/test_after_install.py   | 18 +
 2 files changed, 52 insertions(+), 5 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/6950af1a/ambari-common/src/main/python/resource_management/libraries/functions/conf_select.py
--
diff --git 
a/ambari-common/src/main/python/resource_management/libraries/functions/conf_select.py
 
b/ambari-common/src/main/python/resource_management/libraries/functions/conf_select.py
index c60b324..8d54053 100644
--- 
a/ambari-common/src/main/python/resource_management/libraries/functions/conf_select.py
+++ 
b/ambari-common/src/main/python/resource_management/libraries/functions/conf_select.py
@@ -343,7 +343,27 @@ def select(stack_name, package, version, try_create=True, 
ignore_errors=False):
   else:
 # missing entirely
 # /etc//conf -> /current//conf
-Link(conf_dir, to = current_dir)
+if package in ["atlas", ]:
+  #HACK for Atlas
+  '''
+  In the case of Atlas, the Hive RPM installs 
/usr/$stack/$version/atlas with some partial packages that
+  contain Hive hooks, while the Atlas RPM is responsible for 
installing the full content.
+
+  If the user does not have Atlas currently installed on their 
stack, then /usr/$stack/current/atlas-client
+  will be a broken symlink, and we should not create the
+  symlink /etc/atlas/conf -> /usr/$stack/current/atlas-client/conf 
.
+  If we mistakenly create this symlink, then when the user 
performs an EU/RU and then adds Atlas service
+  then the Atlas RPM will not be able to copy its artifacts into 
/etc/atlas/conf directory and therefore
+  prevent Ambari from by copying those unmanaged contents into 
/etc/atlas/$version/0
+  '''
+  parent_dir = os.path.dirname(current_dir)
+  if os.path.exists(parent_dir):
+Link(conf_dir, to=current_dir)
+  else:
+Logger.info("Will not create symlink from {0} to {1} because 
the destination's parent dir does not exist.".format(conf_dir, current_dir))
+else:
+  # Normal path for other packages
+  Link(conf_dir, to=current_dir)
 
   except Exception, exception:
 if ignore_errors is True:
@@ -579,15 +599,24 @@ def convert_conf_directories_to_symlinks(package, 
version, dirs, skip_existing_l
   else:
 Link(new_symlink, action = "delete")
 
+  old_conf = dir_def['conf_dir']
+  backup_dir = _get_backup_conf_directory(old_conf)
   # link /etc/[component]/conf -> /etc/[component]/conf.backup
   # or
   # link /etc/[component]/conf -> 
/current/[component]-client/conf
   if link_to == DIRECTORY_TYPE_BACKUP:
-old_conf = dir_def['conf_dir']
-backup_dir = _get_backup_conf_directory(old_conf)
-Link(new_symlink, to = backup_dir)
+Link(new_symlink, to=backup_dir)
   else:
-Link(new_symlink, to = dir_def['current_dir'])
+Link(new_symlink, to=dir_def['current_dir'])
+
+#HACK
+if package in ["atlas", ]:
+  Logger.info("Seeding the new conf symlink {0} from the old backup 
directory {1} in case any "
+  "unmanaged artifacts are needed.".format(new_symlink, 
backup_dir))
+  # If /etc/[component]/conf.backup exists, then copy any artifacts 
not managed by Ambari to the new symlink target
+  # Be careful not to clobber any existing files.
+  Execute(as_sudo(["cp", "-R", "--no-clobber", 
os.path.join(backup_dir, "*"), new_symlink], auto_escape=False),
+  only_if=format("test -e {new_symlink}"))
   except Exception, e:
 Logger.warning("Could not change symlink for package {0} to point to {1} 
directory. Error: {2}".format(package, link_to, e))
 


ambari git commit: AMBARI-18338. Microsoft-R client should work in a secured cluster (Balazs bence Sari via magyari_sandor)

2016-09-15 Thread magyari_sandor
Repository: ambari
Updated Branches:
  refs/heads/trunk 561dc8ee0 -> cc684be15


AMBARI-18338. Microsoft-R client should work in a secured cluster (Balazs bence 
Sari via magyari_sandor)


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

Branch: refs/heads/trunk
Commit: cc684be15b1fa5404ed86918f8b13d8ae2b0f1ae
Parents: 561dc8e
Author: Balazs Bence Sari 
Authored: Thu Sep 15 14:18:38 2016 +0200
Committer: Sandor Magyari 
Committed: Thu Sep 15 14:18:38 2016 +0200

--
 .../MICROSOFT_R/8.0.0/kerberos.json | 15 ++
 .../MICROSOFT_R/8.0.0/package/scripts/params.py |  1 +
 .../8.0.0/package/scripts/params_linux.py   | 29 
 .../8.0.0/package/scripts/service_check.py  | 11 +++-
 4 files changed, 55 insertions(+), 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/cc684be1/contrib/management-packs/microsoft-r_mpack/src/main/resources/common-services/MICROSOFT_R/8.0.0/kerberos.json
--
diff --git 
a/contrib/management-packs/microsoft-r_mpack/src/main/resources/common-services/MICROSOFT_R/8.0.0/kerberos.json
 
b/contrib/management-packs/microsoft-r_mpack/src/main/resources/common-services/MICROSOFT_R/8.0.0/kerberos.json
new file mode 100644
index 000..86fab2d
--- /dev/null
+++ 
b/contrib/management-packs/microsoft-r_mpack/src/main/resources/common-services/MICROSOFT_R/8.0.0/kerberos.json
@@ -0,0 +1,15 @@
+{
+  "services": [
+{
+  "name": "MICROSOFT_R",
+  "identities": [
+{
+  "name": "/HDFS/NAMENODE/hdfs"
+},
+{
+  "name": "/smokeuser"
+}
+  ]
+}
+  ]
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/cc684be1/contrib/management-packs/microsoft-r_mpack/src/main/resources/common-services/MICROSOFT_R/8.0.0/package/scripts/params.py
--
diff --git 
a/contrib/management-packs/microsoft-r_mpack/src/main/resources/common-services/MICROSOFT_R/8.0.0/package/scripts/params.py
 
b/contrib/management-packs/microsoft-r_mpack/src/main/resources/common-services/MICROSOFT_R/8.0.0/package/scripts/params.py
index 36541e7..aa20797 100644
--- 
a/contrib/management-packs/microsoft-r_mpack/src/main/resources/common-services/MICROSOFT_R/8.0.0/package/scripts/params.py
+++ 
b/contrib/management-packs/microsoft-r_mpack/src/main/resources/common-services/MICROSOFT_R/8.0.0/package/scripts/params.py
@@ -28,3 +28,4 @@ else:
 
 host_sys_prepped = default("/hostLevelParams/host_sys_prepped", False)
 
+revo_share_hdfs_folder = "/user/RevoShare"
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/cc684be1/contrib/management-packs/microsoft-r_mpack/src/main/resources/common-services/MICROSOFT_R/8.0.0/package/scripts/params_linux.py
--
diff --git 
a/contrib/management-packs/microsoft-r_mpack/src/main/resources/common-services/MICROSOFT_R/8.0.0/package/scripts/params_linux.py
 
b/contrib/management-packs/microsoft-r_mpack/src/main/resources/common-services/MICROSOFT_R/8.0.0/package/scripts/params_linux.py
index d72c42e..71f17b6 100644
--- 
a/contrib/management-packs/microsoft-r_mpack/src/main/resources/common-services/MICROSOFT_R/8.0.0/package/scripts/params_linux.py
+++ 
b/contrib/management-packs/microsoft-r_mpack/src/main/resources/common-services/MICROSOFT_R/8.0.0/package/scripts/params_linux.py
@@ -44,7 +44,36 @@ smoke_hdfs_user_mode = 0770
 user_group = config['configurations']['cluster-env']['user_group']
 security_enabled = config['configurations']['cluster-env']['security_enabled']
 smoke_user_keytab = config['configurations']['cluster-env']['smokeuser_keytab']
+hdfs_user_keytab = config['configurations']['hadoop-env']['hdfs_user_keytab']
+hdfs_user = config['configurations']['hadoop-env']['hdfs_user']
 kinit_path_local = 
get_kinit_path(default('/configurations/kerberos-env/executable_search_paths', 
None))
 
 # not supporting 32 bit jdk.
 java64_home = config['hostLevelParams']['java_home']
+
+hadoop_bin_dir = stack_select.get_hadoop_dir("bin")
+hdfs_user_principal = 
default('/configurations/hadoop-env/hdfs_principal_name', None)
+hdfs_site = config['configurations']['hdfs-site']
+default_fs = config['configurations']['core-site']['fs.defaultFS']
+dfs_type = default("/commandParams/dfs_type", "")
+hadoop_conf_dir = "/etc/hadoop/conf"
+
+
+import functools
+#create partial functions with common arguments for every HdfsResource call
+#to create/delete/copyfromlocal hdfs 

ambari git commit: AMBARI-18384. Analyze and Optimize Ambari Server Unit Tests - Group 3.(vbrodetskyi)

2016-09-15 Thread vbrodetskyi
Repository: ambari
Updated Branches:
  refs/heads/trunk 565685d32 -> 1123ba265


AMBARI-18384. Analyze and Optimize Ambari Server Unit Tests - Group 
3.(vbrodetskyi)


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

Branch: refs/heads/trunk
Commit: 1123ba265592958f188eaf9b1eac843bcb4d3f1c
Parents: 565685d
Author: Vitaly Brodetskyi 
Authored: Thu Sep 15 14:40:43 2016 +0300
Committer: Vitaly Brodetskyi 
Committed: Thu Sep 15 14:40:43 2016 +0300

--
 .../server/agent/TestHeartbeatMonitor.java  | 100 +++---
 .../security/authorization/TestUsers.java   | 321 ++-
 .../upgrades/UpgradeActionTest.java | 119 ---
 .../svccomphost/ServiceComponentHostTest.java   | 142 
 .../server/upgrade/UpgradeCatalog210Test.java   |  63 ++--
 5 files changed, 419 insertions(+), 326 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/1123ba26/ambari-server/src/test/java/org/apache/ambari/server/agent/TestHeartbeatMonitor.java
--
diff --git 
a/ambari-server/src/test/java/org/apache/ambari/server/agent/TestHeartbeatMonitor.java
 
b/ambari-server/src/test/java/org/apache/ambari/server/agent/TestHeartbeatMonitor.java
index 31e3a09..b6f5ec2 100644
--- 
a/ambari-server/src/test/java/org/apache/ambari/server/agent/TestHeartbeatMonitor.java
+++ 
b/ambari-server/src/test/java/org/apache/ambari/server/agent/TestHeartbeatMonitor.java
@@ -58,6 +58,7 @@ import 
org.apache.ambari.server.state.svccomphost.ServiceComponentHostOpSucceede
 import 
org.apache.ambari.server.state.svccomphost.ServiceComponentHostStartedEvent;
 import org.junit.After;
 import org.junit.Before;
+import org.junit.BeforeClass;
 import org.junit.Test;
 import org.mockito.ArgumentCaptor;
 import org.slf4j.Logger;
@@ -65,7 +66,6 @@ import org.slf4j.LoggerFactory;
 
 import com.google.inject.Guice;
 import com.google.inject.Injector;
-import com.google.inject.persist.PersistService;
 
 public class TestHeartbeatMonitor {
 
@@ -76,23 +76,42 @@ public class TestHeartbeatMonitor {
   private String clusterName = "cluster1";
   private String serviceName = "HDFS";
   private int heartbeatMonitorWakeupIntervalMS = 30;
-  private AmbariMetaInfo ambariMetaInfo;
-  private OrmTestHelper helper;
+  private static AmbariMetaInfo ambariMetaInfo;
+  private static OrmTestHelper helper;
 
   private static final Logger LOG =
   LoggerFactory.getLogger(TestHeartbeatMonitor.class);
 
-  @Before
-  public void setup() throws Exception {
+  @BeforeClass
+  public static void classSetUp() {
 injector = Guice.createInjector(new InMemoryDefaultTestModule());
 injector.getInstance(GuiceJpaInitializer.class);
 helper = injector.getInstance(OrmTestHelper.class);
 ambariMetaInfo = injector.getInstance(AmbariMetaInfo.class);
   }
 
+  @Before
+  public void setup() throws Exception {
+cleanup();
+  }
+
   @After
   public void teardown() {
-injector.getInstance(PersistService.class).stop();
+
+  }
+
+  private void cleanup() throws AmbariException {
+Clusters clusters = injector.getInstance(Clusters.class);
+Map clusterMap = clusters.getClusters();
+
+
+for (String clusterName : clusterMap.keySet()) {
+  clusters.deleteCluster(clusterName);
+}
+
+for (Host host : clusters.getHosts()) {
+  clusters.deleteHost(host.getHostName());
+}
   }
 
   private void setOsFamily(Host host, String osFamily, String osVersion) {
@@ -104,6 +123,41 @@ public class TestHeartbeatMonitor {
   }
 
   @Test
+  public void testHeartbeatLoss() throws AmbariException, InterruptedException,
+  InvalidStateTransitionException {
+Clusters fsm = injector.getInstance(Clusters.class);
+String hostname = "host1";
+fsm.addHost(hostname);
+ActionQueue aq = new ActionQueue();
+ActionManager am = mock(ActionManager.class);
+HeartbeatMonitor hm = new HeartbeatMonitor(fsm, aq, am, 10, injector);
+HeartBeatHandler handler = new HeartBeatHandler(fsm, aq, am, injector);
+Register reg = new Register();
+reg.setHostname(hostname);
+reg.setResponseId(12);
+reg.setTimestamp(System.currentTimeMillis() - 300);
+reg.setAgentVersion(ambariMetaInfo.getServerVersion());
+HostInfo hi = new HostInfo();
+hi.setOS("Centos5");
+reg.setHardwareProfile(hi);
+handler.handleRegistration(reg);
+HeartBeat hb = new HeartBeat();
+hb.setHostname(hostname);
+hb.setNodeStatus(new HostStatus(HostStatus.Status.HEALTHY, "cool"));
+

ambari git commit: AMBARI-18389 - Config compare shows incorrect value after enabling kerberos (rzang)

2016-09-15 Thread rzang
Repository: ambari
Updated Branches:
  refs/heads/trunk 1123ba265 -> 561dc8ee0


AMBARI-18389 - Config compare shows incorrect value after enabling kerberos 
 (rzang)


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

Branch: refs/heads/trunk
Commit: 561dc8ee0f524744b92c19e860e923ed890c1a36
Parents: 1123ba2
Author: Richard Zang 
Authored: Thu Sep 15 04:42:32 2016 -0700
Committer: Richard Zang 
Committed: Thu Sep 15 04:52:05 2016 -0700

--
 .../configs/widgets/plain_config_text_field.js  |  2 +-
 .../objects/service_config_property_test.js | 38 
 2 files changed, 39 insertions(+), 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/561dc8ee/ambari-web/app/views/common/configs/widgets/plain_config_text_field.js
--
diff --git 
a/ambari-web/app/views/common/configs/widgets/plain_config_text_field.js 
b/ambari-web/app/views/common/configs/widgets/plain_config_text_field.js
index 5444b27..b70fb40 100644
--- a/ambari-web/app/views/common/configs/widgets/plain_config_text_field.js
+++ b/ambari-web/app/views/common/configs/widgets/plain_config_text_field.js
@@ -29,7 +29,7 @@ App.PlainConfigTextField = 
Ember.View.extend(App.SupportsDependentConfigs, App.W
   templateName: 
require('templates/common/configs/widgets/plain_config_text_field'),
   valueBinding: 'config.value',
   classNames: ['widget-config-plain-text-field'],
-  placeholderBinding: 'config.savedValue',
+  placeholderBinding: 'config.placeholder',
 
   disabled: Em.computed.not('config.isEditable'),
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/561dc8ee/ambari-web/test/models/configs/objects/service_config_property_test.js
--
diff --git 
a/ambari-web/test/models/configs/objects/service_config_property_test.js 
b/ambari-web/test/models/configs/objects/service_config_property_test.js
index d462025..49613a44 100644
--- a/ambari-web/test/models/configs/objects/service_config_property_test.js
+++ b/ambari-web/test/models/configs/objects/service_config_property_test.js
@@ -188,6 +188,44 @@ describe('App.ServiceConfigProperty', function () {
 
   App.TestAliases.testAsComputedAnd(getProperty(), 'hideFinalIcon', 
['!isFinal', 'isNotEditable']);
 
+  describe('#placeholder', function () {
+it('should equal foo', function() {
+  serviceConfigProperty.set('isEditable', true);
+  var testCases = [
+{
+  placeholderText: 'foo',
+  savedValue: ''
+},
+{
+  placeholderText: '',
+  savedValue: 'foo'
+},
+{
+  placeholderText: 'foo',
+  savedValue: 'bar'
+}
+  ];
+  testCases.forEach(function (item) {
+serviceConfigProperty.set('placeholderText', item.placeholderText);
+serviceConfigProperty.set('savedValue', item.savedValue);
+expect(serviceConfigProperty.get('placeholder')).to.equal('foo');
+  });
+});
+it('should equal null', function() {
+  serviceConfigProperty.set('isEditable', false);
+  var testCases = [
+{
+  placeholderText: 'foo',
+  savedValue: 'bar'
+}
+  ];
+  testCases.forEach(function (item) {
+serviceConfigProperty.set('placeholderText', item.placeholderText);
+serviceConfigProperty.set('savedValue', item.savedValue);
+expect(serviceConfigProperty.get('placeholder')).to.equal(null);
+  });
+});
+  });
   describe('#isPropertyOverridable', function () {
 overridableFalseData.forEach(function (item) {
   it('should be false', function () {



ambari git commit: AMBARI-18389 - Config compare shows incorrect value after enabling kerberos (rzang)

2016-09-15 Thread rzang
Repository: ambari
Updated Branches:
  refs/heads/branch-2.5 7594857e4 -> 863aed631


AMBARI-18389 - Config compare shows incorrect value after enabling kerberos 
 (rzang)


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

Branch: refs/heads/branch-2.5
Commit: 863aed63160ac70cdb818efe78e96bf1c9537483
Parents: 7594857
Author: Richard Zang 
Authored: Thu Sep 15 04:42:32 2016 -0700
Committer: Richard Zang 
Committed: Thu Sep 15 04:57:21 2016 -0700

--
 .../configs/widgets/plain_config_text_field.js  |  2 +-
 .../objects/service_config_property_test.js | 38 
 2 files changed, 39 insertions(+), 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/863aed63/ambari-web/app/views/common/configs/widgets/plain_config_text_field.js
--
diff --git 
a/ambari-web/app/views/common/configs/widgets/plain_config_text_field.js 
b/ambari-web/app/views/common/configs/widgets/plain_config_text_field.js
index cdfd347..f4dac9d 100644
--- a/ambari-web/app/views/common/configs/widgets/plain_config_text_field.js
+++ b/ambari-web/app/views/common/configs/widgets/plain_config_text_field.js
@@ -29,7 +29,7 @@ App.PlainConfigTextField = 
Ember.View.extend(App.SupportsDependentConfigs, App.W
   templateName: 
require('templates/common/configs/widgets/plain_config_text_field'),
   valueBinding: 'config.value',
   classNames: ['widget-config-plain-text-field'],
-  placeholderBinding: 'config.savedValue',
+  placeholderBinding: 'config.placeholder',
 
   disabled: Em.computed.not('config.isEditable'),
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/863aed63/ambari-web/test/models/configs/objects/service_config_property_test.js
--
diff --git 
a/ambari-web/test/models/configs/objects/service_config_property_test.js 
b/ambari-web/test/models/configs/objects/service_config_property_test.js
index d462025..49613a44 100644
--- a/ambari-web/test/models/configs/objects/service_config_property_test.js
+++ b/ambari-web/test/models/configs/objects/service_config_property_test.js
@@ -188,6 +188,44 @@ describe('App.ServiceConfigProperty', function () {
 
   App.TestAliases.testAsComputedAnd(getProperty(), 'hideFinalIcon', 
['!isFinal', 'isNotEditable']);
 
+  describe('#placeholder', function () {
+it('should equal foo', function() {
+  serviceConfigProperty.set('isEditable', true);
+  var testCases = [
+{
+  placeholderText: 'foo',
+  savedValue: ''
+},
+{
+  placeholderText: '',
+  savedValue: 'foo'
+},
+{
+  placeholderText: 'foo',
+  savedValue: 'bar'
+}
+  ];
+  testCases.forEach(function (item) {
+serviceConfigProperty.set('placeholderText', item.placeholderText);
+serviceConfigProperty.set('savedValue', item.savedValue);
+expect(serviceConfigProperty.get('placeholder')).to.equal('foo');
+  });
+});
+it('should equal null', function() {
+  serviceConfigProperty.set('isEditable', false);
+  var testCases = [
+{
+  placeholderText: 'foo',
+  savedValue: 'bar'
+}
+  ];
+  testCases.forEach(function (item) {
+serviceConfigProperty.set('placeholderText', item.placeholderText);
+serviceConfigProperty.set('savedValue', item.savedValue);
+expect(serviceConfigProperty.get('placeholder')).to.equal(null);
+  });
+});
+  });
   describe('#isPropertyOverridable', function () {
 overridableFalseData.forEach(function (item) {
   it('should be false', function () {



ambari git commit: AMBARI-18338. Microsoft-R client should work in a secured cluster (Balazs bence Sari via magyari_sandor)

2016-09-15 Thread magyari_sandor
Repository: ambari
Updated Branches:
  refs/heads/branch-2.5 863aed631 -> bc236bd95


AMBARI-18338. Microsoft-R client should work in a secured cluster (Balazs bence 
Sari via magyari_sandor)


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

Branch: refs/heads/branch-2.5
Commit: bc236bd956d531d2b12f4bcadaa83e3c5df31a8a
Parents: 863aed6
Author: Balazs Bence Sari 
Authored: Thu Sep 15 14:11:50 2016 +0200
Committer: Sandor Magyari 
Committed: Thu Sep 15 14:14:06 2016 +0200

--
 .../MICROSOFT_R/8.0.0/kerberos.json | 15 ++
 .../MICROSOFT_R/8.0.0/package/scripts/params.py |  1 +
 .../8.0.0/package/scripts/params_linux.py   | 29 
 .../8.0.0/package/scripts/service_check.py  | 11 +++-
 4 files changed, 55 insertions(+), 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/bc236bd9/contrib/management-packs/microsoft-r_mpack/src/main/resources/common-services/MICROSOFT_R/8.0.0/kerberos.json
--
diff --git 
a/contrib/management-packs/microsoft-r_mpack/src/main/resources/common-services/MICROSOFT_R/8.0.0/kerberos.json
 
b/contrib/management-packs/microsoft-r_mpack/src/main/resources/common-services/MICROSOFT_R/8.0.0/kerberos.json
new file mode 100644
index 000..86fab2d
--- /dev/null
+++ 
b/contrib/management-packs/microsoft-r_mpack/src/main/resources/common-services/MICROSOFT_R/8.0.0/kerberos.json
@@ -0,0 +1,15 @@
+{
+  "services": [
+{
+  "name": "MICROSOFT_R",
+  "identities": [
+{
+  "name": "/HDFS/NAMENODE/hdfs"
+},
+{
+  "name": "/smokeuser"
+}
+  ]
+}
+  ]
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/bc236bd9/contrib/management-packs/microsoft-r_mpack/src/main/resources/common-services/MICROSOFT_R/8.0.0/package/scripts/params.py
--
diff --git 
a/contrib/management-packs/microsoft-r_mpack/src/main/resources/common-services/MICROSOFT_R/8.0.0/package/scripts/params.py
 
b/contrib/management-packs/microsoft-r_mpack/src/main/resources/common-services/MICROSOFT_R/8.0.0/package/scripts/params.py
index 36541e7..aa20797 100644
--- 
a/contrib/management-packs/microsoft-r_mpack/src/main/resources/common-services/MICROSOFT_R/8.0.0/package/scripts/params.py
+++ 
b/contrib/management-packs/microsoft-r_mpack/src/main/resources/common-services/MICROSOFT_R/8.0.0/package/scripts/params.py
@@ -28,3 +28,4 @@ else:
 
 host_sys_prepped = default("/hostLevelParams/host_sys_prepped", False)
 
+revo_share_hdfs_folder = "/user/RevoShare"
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/bc236bd9/contrib/management-packs/microsoft-r_mpack/src/main/resources/common-services/MICROSOFT_R/8.0.0/package/scripts/params_linux.py
--
diff --git 
a/contrib/management-packs/microsoft-r_mpack/src/main/resources/common-services/MICROSOFT_R/8.0.0/package/scripts/params_linux.py
 
b/contrib/management-packs/microsoft-r_mpack/src/main/resources/common-services/MICROSOFT_R/8.0.0/package/scripts/params_linux.py
index d72c42e..71f17b6 100644
--- 
a/contrib/management-packs/microsoft-r_mpack/src/main/resources/common-services/MICROSOFT_R/8.0.0/package/scripts/params_linux.py
+++ 
b/contrib/management-packs/microsoft-r_mpack/src/main/resources/common-services/MICROSOFT_R/8.0.0/package/scripts/params_linux.py
@@ -44,7 +44,36 @@ smoke_hdfs_user_mode = 0770
 user_group = config['configurations']['cluster-env']['user_group']
 security_enabled = config['configurations']['cluster-env']['security_enabled']
 smoke_user_keytab = config['configurations']['cluster-env']['smokeuser_keytab']
+hdfs_user_keytab = config['configurations']['hadoop-env']['hdfs_user_keytab']
+hdfs_user = config['configurations']['hadoop-env']['hdfs_user']
 kinit_path_local = 
get_kinit_path(default('/configurations/kerberos-env/executable_search_paths', 
None))
 
 # not supporting 32 bit jdk.
 java64_home = config['hostLevelParams']['java_home']
+
+hadoop_bin_dir = stack_select.get_hadoop_dir("bin")
+hdfs_user_principal = 
default('/configurations/hadoop-env/hdfs_principal_name', None)
+hdfs_site = config['configurations']['hdfs-site']
+default_fs = config['configurations']['core-site']['fs.defaultFS']
+dfs_type = default("/commandParams/dfs_type", "")
+hadoop_conf_dir = "/etc/hadoop/conf"
+
+
+import functools
+#create partial functions with common arguments for every HdfsResource call
+#to create/delete/copyfromlocal hdfs 

ambari git commit: AMBARI-18389 - Config compare shows incorrect value after enabling kerberos (rzang)

2016-09-15 Thread rzang
Repository: ambari
Updated Branches:
  refs/heads/branch-2.4 05ecaae27 -> 341fcf186


AMBARI-18389 - Config compare shows incorrect value after enabling kerberos 
 (rzang)


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

Branch: refs/heads/branch-2.4
Commit: 341fcf186de0e06b0313cf8fbc63786f1ffe20b4
Parents: 05ecaae
Author: Richard Zang 
Authored: Thu Sep 15 04:42:32 2016 -0700
Committer: Richard Zang 
Committed: Thu Sep 15 04:53:25 2016 -0700

--
 .../configs/widgets/plain_config_text_field.js  |  2 +-
 .../objects/service_config_property_test.js | 38 
 2 files changed, 39 insertions(+), 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/341fcf18/ambari-web/app/views/common/configs/widgets/plain_config_text_field.js
--
diff --git 
a/ambari-web/app/views/common/configs/widgets/plain_config_text_field.js 
b/ambari-web/app/views/common/configs/widgets/plain_config_text_field.js
index cdfd347..f4dac9d 100644
--- a/ambari-web/app/views/common/configs/widgets/plain_config_text_field.js
+++ b/ambari-web/app/views/common/configs/widgets/plain_config_text_field.js
@@ -29,7 +29,7 @@ App.PlainConfigTextField = 
Ember.View.extend(App.SupportsDependentConfigs, App.W
   templateName: 
require('templates/common/configs/widgets/plain_config_text_field'),
   valueBinding: 'config.value',
   classNames: ['widget-config-plain-text-field'],
-  placeholderBinding: 'config.savedValue',
+  placeholderBinding: 'config.placeholder',
 
   disabled: Em.computed.not('config.isEditable'),
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/341fcf18/ambari-web/test/models/configs/objects/service_config_property_test.js
--
diff --git 
a/ambari-web/test/models/configs/objects/service_config_property_test.js 
b/ambari-web/test/models/configs/objects/service_config_property_test.js
index d462025..49613a44 100644
--- a/ambari-web/test/models/configs/objects/service_config_property_test.js
+++ b/ambari-web/test/models/configs/objects/service_config_property_test.js
@@ -188,6 +188,44 @@ describe('App.ServiceConfigProperty', function () {
 
   App.TestAliases.testAsComputedAnd(getProperty(), 'hideFinalIcon', 
['!isFinal', 'isNotEditable']);
 
+  describe('#placeholder', function () {
+it('should equal foo', function() {
+  serviceConfigProperty.set('isEditable', true);
+  var testCases = [
+{
+  placeholderText: 'foo',
+  savedValue: ''
+},
+{
+  placeholderText: '',
+  savedValue: 'foo'
+},
+{
+  placeholderText: 'foo',
+  savedValue: 'bar'
+}
+  ];
+  testCases.forEach(function (item) {
+serviceConfigProperty.set('placeholderText', item.placeholderText);
+serviceConfigProperty.set('savedValue', item.savedValue);
+expect(serviceConfigProperty.get('placeholder')).to.equal('foo');
+  });
+});
+it('should equal null', function() {
+  serviceConfigProperty.set('isEditable', false);
+  var testCases = [
+{
+  placeholderText: 'foo',
+  savedValue: 'bar'
+}
+  ];
+  testCases.forEach(function (item) {
+serviceConfigProperty.set('placeholderText', item.placeholderText);
+serviceConfigProperty.set('savedValue', item.savedValue);
+expect(serviceConfigProperty.get('placeholder')).to.equal(null);
+  });
+});
+  });
   describe('#isPropertyOverridable', function () {
 overridableFalseData.forEach(function (item) {
   it('should be false', function () {