ambari git commit: AMBARI-17456 : Support round-robin scheduling with failover for monitors with distributed collector - Bug fix (avijayan)
Repository: ambari Updated Branches: refs/heads/trunk a4185754b -> 54a6525f8 AMBARI-17456 : Support round-robin scheduling with failover for monitors with distributed collector - Bug fix (avijayan) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/54a6525f Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/54a6525f Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/54a6525f Branch: refs/heads/trunk Commit: 54a6525f8c49759fe9a013b35ce476693d1e855f Parents: a418575 Author: Aravindan VijayanAuthored: Fri Sep 16 13:23:21 2016 -0700 Committer: Aravindan Vijayan Committed: Fri Sep 16 13:23:21 2016 -0700 -- .../src/main/python/core/config_reader.py | 12 ++-- .../0.1.0/package/templates/metric_monitor.ini.j2 | 1 + 2 files changed, 11 insertions(+), 2 deletions(-) -- http://git-wip-us.apache.org/repos/asf/ambari/blob/54a6525f/ambari-metrics/ambari-metrics-host-monitoring/src/main/python/core/config_reader.py -- diff --git a/ambari-metrics/ambari-metrics-host-monitoring/src/main/python/core/config_reader.py b/ambari-metrics/ambari-metrics-host-monitoring/src/main/python/core/config_reader.py index 2e8a170..3ca3a31 100644 --- a/ambari-metrics/ambari-metrics-host-monitoring/src/main/python/core/config_reader.py +++ b/ambari-metrics/ambari-metrics-host-monitoring/src/main/python/core/config_reader.py @@ -22,6 +22,7 @@ import ConfigParser import StringIO import json import os +import ast from ambari_commons import OSConst from ambari_commons.os_family_impl import OsFamilyImpl @@ -100,7 +101,7 @@ AMBARI_AGENT_CONF = '/etc/ambari-agent/conf/ambari-agent.ini' config_content = """ [default] debug_level = INFO -metrics_servers = localhost,host1,host2 +metrics_servers = ['localhost','host1','host2'] enable_time_threshold = false enable_value_threshold = false @@ -210,8 +211,15 @@ class Configuration: def get_collector_sleep_interval(self): return int(self.get("collector", "collector_sleep_interval", 10)) + def get_hostname_config(self): +return self.get("default", "hostname", None) + def get_metrics_collector_hosts(self): -return self.get("default", "metrics_servers", "localhost").split(",") +hosts = self.get("default", "metrics_servers", "localhost") +if hosts is not "localhost": + return ast.literal_eval(hosts) +else: + return hosts def get_failover_strategy(self): return self.get("collector", "failover_strategy", ROUND_ROBIN_FAILOVER_STRATEGY) http://git-wip-us.apache.org/repos/asf/ambari/blob/54a6525f/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/package/templates/metric_monitor.ini.j2 -- diff --git a/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/package/templates/metric_monitor.ini.j2 b/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/package/templates/metric_monitor.ini.j2 index b011fd5..3823912 100644 --- a/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/package/templates/metric_monitor.ini.j2 +++ b/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/package/templates/metric_monitor.ini.j2 @@ -18,6 +18,7 @@ [default] debug_level = INFO +hostname = {{hostname}} metrics_servers = {{ams_collector_hosts}} enable_time_threshold = false enable_value_threshold = false
ambari git commit: AMBARI-18391. Prerequisite checks should only check services that are getting upgraded (ncole)
Repository: ambari Updated Branches: refs/heads/branch-dev-patch-upgrade 9dbcac6d5 -> e2085dd6f AMBARI-18391. Prerequisite checks should only check services that are getting upgraded (ncole) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/e2085dd6 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/e2085dd6 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/e2085dd6 Branch: refs/heads/branch-dev-patch-upgrade Commit: e2085dd6fdeb7add7eacbccc293fe4df7a617fe7 Parents: 9dbcac6 Author: Nate ColeAuthored: Fri Sep 16 10:18:28 2016 -0400 Committer: Nate Cole Committed: Fri Sep 16 14:17:44 2016 -0400 -- .../server/checks/AbstractCheckDescriptor.java | 30 +- .../orm/entities/RepositoryVersionEntity.java | 10 +- .../state/repository/VersionDefinitionXml.java | 22 .../checks/AbstractCheckDescriptorTest.java | 104 +-- ...duce2JobHistoryStatePreservingCheckTest.java | 23 +++- .../ServicesNamenodeTruncateCheckTest.java | 20 +++- 6 files changed, 164 insertions(+), 45 deletions(-) -- http://git-wip-us.apache.org/repos/asf/ambari/blob/e2085dd6/ambari-server/src/main/java/org/apache/ambari/server/checks/AbstractCheckDescriptor.java -- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/checks/AbstractCheckDescriptor.java b/ambari-server/src/main/java/org/apache/ambari/server/checks/AbstractCheckDescriptor.java index 4bc64d4..5b9cd00 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/checks/AbstractCheckDescriptor.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/checks/AbstractCheckDescriptor.java @@ -22,23 +22,27 @@ import java.util.List; import java.util.Map; import java.util.Set; +import org.apache.ambari.annotations.Experimental; +import org.apache.ambari.annotations.ExperimentalFeature; import org.apache.ambari.server.AmbariException; import org.apache.ambari.server.api.services.AmbariMetaInfo; -import org.apache.ambari.server.controller.PrereqCheckRequest; import org.apache.ambari.server.configuration.Configuration; +import org.apache.ambari.server.controller.PrereqCheckRequest; import org.apache.ambari.server.orm.dao.ClusterVersionDAO; import org.apache.ambari.server.orm.dao.HostVersionDAO; import org.apache.ambari.server.orm.dao.RepositoryVersionDAO; import org.apache.ambari.server.orm.dao.UpgradeDAO; +import org.apache.ambari.server.orm.entities.RepositoryVersionEntity; import org.apache.ambari.server.state.Cluster; import org.apache.ambari.server.state.Clusters; import org.apache.ambari.server.state.Config; import org.apache.ambari.server.state.DesiredConfig; +import org.apache.ambari.server.state.RepositoryType; import org.apache.ambari.server.state.ServiceInfo; -import org.apache.ambari.server.state.StackId; import org.apache.ambari.server.state.stack.PrereqCheckType; import org.apache.ambari.server.state.stack.PrerequisiteCheck; import org.apache.ambari.server.state.stack.upgrade.RepositoryVersionHelper; +import org.apache.commons.collections.CollectionUtils; import org.apache.commons.lang.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -120,6 +124,7 @@ public abstract class AbstractCheckDescriptor { * @throws org.apache.ambari.server.AmbariException * if server error happens */ + @Experimental(feature = ExperimentalFeature.PATCH_UPGRADES) public boolean isApplicable(PrereqCheckRequest request, List requiredServices, boolean requiredAll) throws AmbariException { final Cluster cluster = clustersProvider.get().getCluster(request.getClusterName()); Set services = cluster.getServices().keySet(); @@ -137,6 +142,25 @@ public abstract class AbstractCheckDescriptor { } } +// !!! service is found and deployed - now check if it is part of the VDF +if (serviceFound && null != request.getTargetStackId()) { + String stackName = request.getTargetStackId().getStackName(); + RepositoryVersionEntity rve = repositoryVersionDaoProvider.get(). +findByStackNameAndVersion(stackName, request.getRepositoryVersion()); + + if (RepositoryType.STANDARD != rve.getType()) { +try { + Set availableServices = rve.getRepositoryXml().getAvailableServiceNames(); + + if (!CollectionUtils.containsAny(availableServices, requiredServices)) { +serviceFound = false; + } +} catch (Exception e) { + LOG.warn("Could not parse xml for %s", request.getRepositoryVersion(), e); +} + } +} + return serviceFound; } @@ -290,7 +314,7 @@ public abstract class AbstractCheckDescriptor { public Boolean
[2/2] ambari git commit: AMBARI-18397. Update version-builder to include unique element (dlysnichenko)
AMBARI-18397. Update version-builder to include unique element (dlysnichenko) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/6c3f75e1 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/6c3f75e1 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/6c3f75e1 Branch: refs/heads/branch-2.5 Commit: 6c3f75e1da6c9b9321b6106daa161cb2f2110dca Parents: 20eacc6 Author: Lisnichenko DmitroAuthored: Fri Sep 16 19:10:45 2016 +0300 Committer: Lisnichenko Dmitro Committed: Fri Sep 16 19:12:45 2016 +0300 -- contrib/version-builder/example.py | 4 ++-- contrib/version-builder/example.sh | 4 ++-- contrib/version-builder/version_builder.py | 12 +--- 3 files changed, 13 insertions(+), 7 deletions(-) -- http://git-wip-us.apache.org/repos/asf/ambari/blob/6c3f75e1/contrib/version-builder/example.py -- diff --git a/contrib/version-builder/example.py b/contrib/version-builder/example.py index b9cdf56..8c7be5f 100644 --- a/contrib/version-builder/example.py +++ b/contrib/version-builder/example.py @@ -28,8 +28,8 @@ def main(args): vb.add_manifest("HDFS-271", "HDFS", "2.7.1.2.4.0") - vb.add_repo("redhat6", "HDP-2.4", "HDP", "http://public-repo-1.hortonworks.com/HDP/centos6/2.x/updates/2.4.2.0;) - vb.add_repo("redhat6", "HDP-UTILS-1.1.0.20", "HDP-UTILS", "http://public-repo-1.hortonworks.com/HDP-UTILS-1.1.0.20/repos/centos6;) + vb.add_repo("redhat6", "HDP-2.4", "HDP", "http://public-repo-1.hortonworks.com/HDP/centos6/2.x/updates/2.4.2.0;, "true") + vb.add_repo("redhat6", "HDP-UTILS-1.1.0.20", "HDP-UTILS", "http://public-repo-1.hortonworks.com/HDP-UTILS-1.1.0.20/repos/centos6;, "false") vb.persist() vb.finalize("../../ambari-server/src/main/resources/version_definition.xsd") http://git-wip-us.apache.org/repos/asf/ambari/blob/6c3f75e1/contrib/version-builder/example.sh -- diff --git a/contrib/version-builder/example.sh b/contrib/version-builder/example.sh index bc76fd0..ca7ba10 100755 --- a/contrib/version-builder/example.sh +++ b/contrib/version-builder/example.sh @@ -40,8 +40,8 @@ python version_builder.py --file $filename --available --manifest-id HDFS-271 python version_builder.py --file $filename --os --os-family redhat6 --os-package-version 2_4_1_1_12345 #call any number of times for repo per os -python version_builder.py --file $filename --repo --repo-os redhat6 --repo-id HDP-2.4 --repo-name HDP --repo-url http://public-repo-1.hortonworks.com/HDP/centos6/2.x/updates/2.4.1.1 -python version_builder.py --file $filename --repo --repo-os redhat6 --repo-id HDP-UTILS-1.1.0.20 --repo-name HDP-UTILS --repo-url http://public-repo-1.hortonworks.com/HDP-UTILS-1.1.0.20/repos/centos6 +python version_builder.py --file $filename --repo --repo-os redhat6 --repo-id HDP-2.4 --repo-name HDP --repo-url http://public-repo-1.hortonworks.com/HDP/centos6/2.x/updates/2.4.1.1 --repo-unique true +python version_builder.py --file $filename --repo --repo-os redhat6 --repo-id HDP-UTILS-1.1.0.20 --repo-name HDP-UTILS --repo-url http://public-repo-1.hortonworks.com/HDP-UTILS-1.1.0.20/repos/centos6 --repo-unique false python version_builder.py --file $filename --finalize --xsd ../../ambari-server/src/main/resources/version_definition.xsd http://git-wip-us.apache.org/repos/asf/ambari/blob/6c3f75e1/contrib/version-builder/version_builder.py -- diff --git a/contrib/version-builder/version_builder.py b/contrib/version-builder/version_builder.py index 2c07b0c..6d1689a 100644 --- a/contrib/version-builder/version_builder.py +++ b/contrib/version-builder/version_builder.py @@ -173,7 +173,7 @@ class VersionBuilder: e = ET.SubElement(service_element, 'component') e.text = component - def add_repo(self, os_family, repo_id, repo_name, base_url): + def add_repo(self, os_family, repo_id, repo_name, base_url, unique): """ Adds a repository """ @@ -204,6 +204,10 @@ class VersionBuilder: e = ET.SubElement(repo_element, 'reponame') e.text = repo_name +if unique is not None: + e = ET.SubElement(repo_element, 'unique') + e.text = unique + def _check_xmllint(self): """ @@ -318,7 +322,7 @@ def process_repo(vb, options): if not options.repo: return - vb.add_repo(options.repo_os, options.repo_id, options.repo_name, options.repo_url) + vb.add_repo(options.repo_os, options.repo_id, options.repo_name, options.repo_url, options.unique) def validate_manifest(parser, options): """ @@ -426,11 +430,13 @@ def main(argv): help="The
[1/2] ambari git commit: AMBARI-18397. Update version-builder to include unique element (dlysnichenko)
Repository: ambari Updated Branches: refs/heads/branch-2.5 20eacc675 -> 6c3f75e1d refs/heads/trunk 9dbf079d9 -> a4185754b AMBARI-18397. Update version-builder to include unique element (dlysnichenko) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/a4185754 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/a4185754 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/a4185754 Branch: refs/heads/trunk Commit: a4185754b6720a313c7f9c5df8b6311d9e60fc84 Parents: 9dbf079 Author: Lisnichenko DmitroAuthored: Fri Sep 16 19:10:45 2016 +0300 Committer: Lisnichenko Dmitro Committed: Fri Sep 16 19:10:45 2016 +0300 -- contrib/version-builder/example.py | 4 ++-- contrib/version-builder/example.sh | 4 ++-- contrib/version-builder/version_builder.py | 12 +--- 3 files changed, 13 insertions(+), 7 deletions(-) -- http://git-wip-us.apache.org/repos/asf/ambari/blob/a4185754/contrib/version-builder/example.py -- diff --git a/contrib/version-builder/example.py b/contrib/version-builder/example.py index b9cdf56..8c7be5f 100644 --- a/contrib/version-builder/example.py +++ b/contrib/version-builder/example.py @@ -28,8 +28,8 @@ def main(args): vb.add_manifest("HDFS-271", "HDFS", "2.7.1.2.4.0") - vb.add_repo("redhat6", "HDP-2.4", "HDP", "http://public-repo-1.hortonworks.com/HDP/centos6/2.x/updates/2.4.2.0;) - vb.add_repo("redhat6", "HDP-UTILS-1.1.0.20", "HDP-UTILS", "http://public-repo-1.hortonworks.com/HDP-UTILS-1.1.0.20/repos/centos6;) + vb.add_repo("redhat6", "HDP-2.4", "HDP", "http://public-repo-1.hortonworks.com/HDP/centos6/2.x/updates/2.4.2.0;, "true") + vb.add_repo("redhat6", "HDP-UTILS-1.1.0.20", "HDP-UTILS", "http://public-repo-1.hortonworks.com/HDP-UTILS-1.1.0.20/repos/centos6;, "false") vb.persist() vb.finalize("../../ambari-server/src/main/resources/version_definition.xsd") http://git-wip-us.apache.org/repos/asf/ambari/blob/a4185754/contrib/version-builder/example.sh -- diff --git a/contrib/version-builder/example.sh b/contrib/version-builder/example.sh index 5bf8002..11689cd 100755 --- a/contrib/version-builder/example.sh +++ b/contrib/version-builder/example.sh @@ -40,8 +40,8 @@ python version_builder.py --file $filename --available --manifest-id HDFS-271 python version_builder.py --file $filename --os --os-family redhat6 --os-package-version 2_4_1_1_12345 #call any number of times for repo per os -python version_builder.py --file $filename --repo --repo-os redhat6 --repo-id HDP-2.4 --repo-name HDP --repo-url http://public-repo-1.hortonworks.com/HDP/centos6/2.x/updates/2.4.1.1 -python version_builder.py --file $filename --repo --repo-os redhat6 --repo-id HDP-UTILS-1.1.0.20 --repo-name HDP-UTILS --repo-url http://public-repo-1.hortonworks.com/HDP-UTILS-1.1.0.20/repos/centos6 +python version_builder.py --file $filename --repo --repo-os redhat6 --repo-id HDP-2.4 --repo-name HDP --repo-url http://public-repo-1.hortonworks.com/HDP/centos6/2.x/updates/2.4.1.1 --repo-unique true +python version_builder.py --file $filename --repo --repo-os redhat6 --repo-id HDP-UTILS-1.1.0.20 --repo-name HDP-UTILS --repo-url http://public-repo-1.hortonworks.com/HDP-UTILS-1.1.0.20/repos/centos6 --repo-unique false python version_builder.py --file $filename --finalize --xsd ../../ambari-server/src/main/resources/version_definition.xsd http://git-wip-us.apache.org/repos/asf/ambari/blob/a4185754/contrib/version-builder/version_builder.py -- diff --git a/contrib/version-builder/version_builder.py b/contrib/version-builder/version_builder.py index 2c07b0c..6d1689a 100644 --- a/contrib/version-builder/version_builder.py +++ b/contrib/version-builder/version_builder.py @@ -173,7 +173,7 @@ class VersionBuilder: e = ET.SubElement(service_element, 'component') e.text = component - def add_repo(self, os_family, repo_id, repo_name, base_url): + def add_repo(self, os_family, repo_id, repo_name, base_url, unique): """ Adds a repository """ @@ -204,6 +204,10 @@ class VersionBuilder: e = ET.SubElement(repo_element, 'reponame') e.text = repo_name +if unique is not None: + e = ET.SubElement(repo_element, 'unique') + e.text = unique + def _check_xmllint(self): """ @@ -318,7 +322,7 @@ def process_repo(vb, options): if not options.repo: return - vb.add_repo(options.repo_os, options.repo_id, options.repo_name, options.repo_url) + vb.add_repo(options.repo_os, options.repo_id, options.repo_name, options.repo_url,
ambari git commit: AMBARI-17518. improve resourcemanager HA description (wang yaoxin via ncole)
Repository: ambari Updated Branches: refs/heads/trunk 9dbcac6d5 -> 9dbf079d9 AMBARI-17518. improve resourcemanager HA description (wang yaoxin via ncole) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/9dbf079d Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/9dbf079d Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/9dbf079d Branch: refs/heads/trunk Commit: 9dbf079d957b2b449030a1efa95b77614a3f1ea2 Parents: 9dbcac6 Author: Nate ColeAuthored: Fri Sep 16 11:04:09 2016 -0400 Committer: Nate Cole Committed: Fri Sep 16 11:04:09 2016 -0400 -- ambari-web/app/models/host_component.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) -- http://git-wip-us.apache.org/repos/asf/ambari/blob/9dbf079d/ambari-web/app/models/host_component.js -- diff --git a/ambari-web/app/models/host_component.js b/ambari-web/app/models/host_component.js index dca7ff0..11ea659 100644 --- a/ambari-web/app/models/host_component.js +++ b/ambari-web/app/models/host_component.js @@ -330,8 +330,8 @@ App.HostComponentActionMap = { }, TOGGLE_RM_HA: { action: 'enableRMHighAvailability', -label: Em.I18n.t('admin.rm_highAvailability.button.enable'), -cssClass: 'icon-arrow-up', +label: App.get('isRMHaEnabled') ? Em.I18n.t('admin.rm_highAvailability.button.disable') : Em.I18n.t('admin.rm_highAvailability.button.enable'), +cssClass: App.get('isRMHaEnabled') ? 'icon-arrow-down' : 'icon-arrow-up', isHidden: App.get('isRMHaEnabled'), disabled: App.get('isSingleNode') || !RM || RM.get('isNotInstalled') },
[06/27] ambari git commit: AMBARI-18132 : Remove FIFO and Normalizer in ams-env config. (avijayan)
AMBARI-18132 : Remove FIFO and Normalizer in ams-env config. (avijayan) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/0e343585 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/0e343585 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/0e343585 Branch: refs/heads/branch-dev-patch-upgrade Commit: 0e3435856a2aee7951f765e90e55e027b6455c1a Parents: 9455b52 Author: Aravindan VijayanAuthored: Tue Sep 13 20:32:07 2016 -0700 Committer: Aravindan Vijayan Committed: Wed Sep 14 15:03:34 2016 -0700 -- .../server/upgrade/UpgradeCatalog250.java | 62 ++- .../0.1.0/configuration/ams-env.xml | 6 - .../0.1.0/package/scripts/params.py | 2 - .../server/upgrade/UpgradeCatalog250Test.java | 110 +++ 4 files changed, 171 insertions(+), 9 deletions(-) -- http://git-wip-us.apache.org/repos/asf/ambari/blob/0e343585/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog250.java -- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog250.java b/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog250.java index 43f489b..35c773a 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog250.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog250.java @@ -18,9 +18,18 @@ package org.apache.ambari.server.upgrade; import java.sql.SQLException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; import org.apache.ambari.server.AmbariException; +import org.apache.ambari.server.controller.AmbariManagementController; import org.apache.ambari.server.orm.dao.DaoUtils; +import org.apache.ambari.server.state.Cluster; +import org.apache.ambari.server.state.Clusters; +import org.apache.ambari.server.state.Config; +import org.apache.commons.lang.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -33,7 +42,7 @@ import com.google.inject.Injector; public class UpgradeCatalog250 extends AbstractUpgradeCatalog { protected static final String HOST_VERSION_TABLE = "host_version"; - + private static final String AMS_ENV = "ams-env"; /** * Logger. */ @@ -97,6 +106,7 @@ public class UpgradeCatalog250 extends AbstractUpgradeCatalog { */ @Override protected void executeDMLUpdates() throws AmbariException, SQLException { +updateAMSConfigs(); } protected void updateHostVersionTable() throws SQLException { @@ -106,6 +116,56 @@ public class UpgradeCatalog250 extends AbstractUpgradeCatalog { dbAccessor.addUniqueConstraint(HOST_VERSION_TABLE, "UQ_host_repo", "repo_version_id", "host_id"); } + protected void updateAMSConfigs() throws AmbariException { +AmbariManagementController ambariManagementController = injector.getInstance(AmbariManagementController.class); +Clusters clusters = ambariManagementController.getClusters(); + +if (clusters != null) { + Map clusterMap = clusters.getClusters(); + + if (clusterMap != null && !clusterMap.isEmpty()) { +for (final Cluster cluster : clusterMap.values()) { + + Config amsEnv = cluster.getDesiredConfigByType(AMS_ENV); + if (amsEnv != null) { +Map amsEnvProperties = amsEnv.getProperties(); +String content = amsEnvProperties.get("content"); +Map newProperties = new HashMap<>(); +newProperties.put("content", updateAmsEnvContent(content)); +updateConfigurationPropertiesForCluster(cluster, AMS_ENV, newProperties, true, true); + } + +} + } +} + } + + + protected String updateAmsEnvContent(String content) { +if (content == null) { + return null; +} + +List toReplaceList = new ArrayList<>(); +toReplaceList.add("\n# HBase normalizer enabled\n"); +toReplaceList.add("\n# HBase compaction policy enabled\n"); +toReplaceList.add("export AMS_HBASE_NORMALIZER_ENABLED={{ams_hbase_normalizer_enabled}}\n"); +toReplaceList.add("export AMS_HBASE_FIFO_COMPACTION_ENABLED={{ams_hbase_fifo_compaction_enabled}}\n"); + +//Because of AMBARI-15331 : AMS HBase FIFO compaction policy and Normalizer settings are not handled correctly +toReplaceList.add("export HBASE_NORMALIZATION_ENABLED={{ams_hbase_normalizer_enabled}}\n"); +toReplaceList.add("export HBASE_FIFO_COMPACTION_POLICY_ENABLED={{ams_hbase_fifo_compaction_policy_enabled}}\n"); + + +for (String toReplace : toReplaceList) { + if (content.contains(toReplace)) { +
[16/27] ambari git commit: AMBARI-18392 : Cluster failure due to APP_TIMELINE_SERVER and RESOURCEMANAGER failed to start. (avijayan)
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/branch-dev-patch-upgrade Commit: bead01cfe1a10be6a8dae0c9e681d4254b35db4e Parents: 513965f Author: Aravindan VijayanAuthored: 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 {oozie_shared_lib}/lib/spark")) +except: + print "No jar files
[04/27] ambari git commit: AMBARI-18185 : Selecting one host when topN is set, throws an error. (avijayan)
AMBARI-18185 : Selecting one host when topN is set, throws an error. (avijayan) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/4a099342 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/4a099342 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/4a099342 Branch: refs/heads/branch-dev-patch-upgrade Commit: 4a099342c1b5a8c1b7dbf77fda3ef0f24bfd26cd Parents: 1b89d68 Author: Aravindan VijayanAuthored: Tue Sep 13 20:16:03 2016 -0700 Committer: Aravindan Vijayan Committed: Wed Sep 14 15:03:33 2016 -0700 -- .../metrics/timeline/HBaseTimelineMetricStore.java| 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/ambari/blob/4a099342/ambari-metrics/ambari-metrics-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/metrics/timeline/HBaseTimelineMetricStore.java -- diff --git a/ambari-metrics/ambari-metrics-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/metrics/timeline/HBaseTimelineMetricStore.java b/ambari-metrics/ambari-metrics-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/metrics/timeline/HBaseTimelineMetricStore.java index 60ebdcf..a6f8e2f 100644 --- a/ambari-metrics/ambari-metrics-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/metrics/timeline/HBaseTimelineMetricStore.java +++ b/ambari-metrics/ambari-metrics-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/metrics/timeline/HBaseTimelineMetricStore.java @@ -228,7 +228,8 @@ public class HBaseTimelineMetricStore extends AbstractService implements Timelin .grouped(groupedByHosts); if (topNConfig != null) { - if (TopNCondition.isTopNHostCondition(metricNames, hostnames) || TopNCondition.isTopNMetricCondition(metricNames, hostnames)) { + if (TopNCondition.isTopNHostCondition(metricNames, hostnames) ^ //Only 1 condition should be true. +TopNCondition.isTopNMetricCondition(metricNames, hostnames)) { conditionBuilder.topN(topNConfig.getTopN()); conditionBuilder.isBottomN(topNConfig.getIsBottomN()); Function.ReadFunction readFunction = Function.ReadFunction.getFunction(topNConfig.getTopNFunction());
[02/27] ambari git commit: AMBARI-18389 - Config compare shows incorrect value after enabling kerberos (rzang)
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/9496772d Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/9496772d Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/9496772d Branch: refs/heads/branch-dev-patch-upgrade Commit: 9496772d9f662daefcb78f971a201df0172c2430 Parents: 08e426a Author: Richard ZangAuthored: Wed Sep 14 13:50:08 2016 -0700 Committer: Richard Zang Committed: Wed Sep 14 13:50:08 2016 -0700 -- .../app/models/configs/objects/service_config_property.js | 9 +++-- .../models/configs/objects/service_config_property_test.js | 2 -- 2 files changed, 7 insertions(+), 4 deletions(-) -- http://git-wip-us.apache.org/repos/asf/ambari/blob/9496772d/ambari-web/app/models/configs/objects/service_config_property.js -- diff --git a/ambari-web/app/models/configs/objects/service_config_property.js b/ambari-web/app/models/configs/objects/service_config_property.js index 0c7673d..5d85ae0 100644 --- a/ambari-web/app/models/configs/objects/service_config_property.js +++ b/ambari-web/app/models/configs/objects/service_config_property.js @@ -118,8 +118,13 @@ App.ServiceConfigProperty = Em.Object.extend({ /** * Placeholder used for configs with input type text */ - placeholder: Em.computed.firstNotBlank('placeholderText', 'savedValue'), - + placeholder: function() { +if (this.isEditable) { + return this.get('placeholderText') || this.get('savedValue'); +} +return null; + }.property('isEditable', 'placeholderText', 'savedValue'), + retypedPassword: '', description: '', displayType: 'string', // string, digits, number, directories, custom http://git-wip-us.apache.org/repos/asf/ambari/blob/9496772d/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 a6772d3..d462025 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 @@ -186,8 +186,6 @@ describe('App.ServiceConfigProperty', function () { serviceConfigProperty = getProperty(); }); - App.TestAliases.testAsComputedFirstNotBlank(getProperty(), 'placeholder', ['placeholderText', 'savedValue']); - App.TestAliases.testAsComputedAnd(getProperty(), 'hideFinalIcon', ['!isFinal', 'isNotEditable']); describe('#isPropertyOverridable', function () {
[11/27] ambari git commit: AMBARI-18389 - Config compare shows incorrect value after enabling kerberos (rzang)
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/branch-dev-patch-upgrade Commit: 561dc8ee0f524744b92c19e860e923ed890c1a36 Parents: 1123ba2 Author: Richard ZangAuthored: 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 () {
[21/27] ambari git commit: AMBARI-18404 - Upgrade Summary Endpoint Throws NPEs Due To JPA Cached Entities With Missing IDs (jonathanhurley)
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/branch-dev-patch-upgrade Commit: da5605706555d3aecca7a67fb399d9c501972ad4 Parents: 1efc99c Author: Jonathan HurleyAuthored: 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 +++ b/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/HostRoleCommand.java @@ -209,6 +209,22 @@ public class
[17/27] ambari git commit: AMBARI-18403 - YAML Maps Can Include Dashes and Other Non-Word Characters (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/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/branch-dev-patch-upgrade Commit: edf1b9b9f2182de2e14a194c5ca243f6cf39170d Parents: bead01c Author: Jonathan HurleyAuthored: 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)
[20/27] ambari git commit: AMBARI-18368. ADDENDUM. Atlas web UI alert after performing stack upgrade to HDP 2.5 and adding Atlas Service (alejandro)
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/branch-dev-patch-upgrade Commit: 1efc99c5adc536044425b9df45b72421c5a8323c Parents: d5cca62 Author: Alejandro FernandezAuthored: 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))
[07/27] ambari git commit: AMBARI-18154 : Ambari Dashboard, Cluster load widget - Incorrect value in Nodes._avg metric. (avijayan)
AMBARI-18154 : Ambari Dashboard, Cluster load widget - Incorrect value in Nodes._avg metric. (avijayan) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/aa0528ec Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/aa0528ec Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/aa0528ec Branch: refs/heads/branch-dev-patch-upgrade Commit: aa0528ecab47850f44dd5575ab7861083e67c6ea Parents: 4a09934 Author: Aravindan VijayanAuthored: Tue Sep 13 20:17:40 2016 -0700 Committer: Aravindan Vijayan Committed: Wed Sep 14 15:03:34 2016 -0700 -- .../TimelineMetricClusterAggregatorSecond.java | 34 ++-- ...melineMetricClusterAggregatorSecondTest.java | 6 ++-- .../src/main/resources/ganglia_properties.json | 2 +- 3 files changed, 36 insertions(+), 6 deletions(-) -- http://git-wip-us.apache.org/repos/asf/ambari/blob/aa0528ec/ambari-metrics/ambari-metrics-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/metrics/timeline/aggregators/TimelineMetricClusterAggregatorSecond.java -- diff --git a/ambari-metrics/ambari-metrics-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/metrics/timeline/aggregators/TimelineMetricClusterAggregatorSecond.java b/ambari-metrics/ambari-metrics-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/metrics/timeline/aggregators/TimelineMetricClusterAggregatorSecond.java index 6731eb3..5f40d21 100644 --- a/ambari-metrics/ambari-metrics-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/metrics/timeline/aggregators/TimelineMetricClusterAggregatorSecond.java +++ b/ambari-metrics/ambari-metrics-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/metrics/timeline/aggregators/TimelineMetricClusterAggregatorSecond.java @@ -34,11 +34,15 @@ import java.io.IOException; import java.sql.ResultSet; import java.sql.SQLException; import java.util.ArrayList; +import java.util.Collections; import java.util.Date; import java.util.HashMap; +import java.util.HashSet; import java.util.List; import java.util.Map; +import java.util.Set; +import static org.apache.hadoop.yarn.server.applicationhistoryservice.metrics.timeline.TimelineMetricConfiguration.HOST_APP_ID; import static org.apache.hadoop.yarn.server.applicationhistoryservice.metrics.timeline.TimelineMetricConfiguration.SERVER_SIDE_TIMESIFT_ADJUSTMENT; import static org.apache.hadoop.yarn.server.applicationhistoryservice.metrics.timeline.TimelineMetricConfiguration.TIMELINE_METRICS_CLUSTER_AGGREGATOR_INTERPOLATION_ENABLED; import static org.apache.hadoop.yarn.server.applicationhistoryservice.metrics.timeline.query.PhoenixTransactSQL.GET_METRIC_SQL; @@ -130,6 +134,7 @@ public class TimelineMetricClusterAggregatorSecond extends AbstractTimelineAggre throws SQLException, IOException { Map aggregateClusterMetrics = new HashMap (); +int numLiveHosts = 0; TimelineMetric metric = null; if (rs.next()) { @@ -145,18 +150,25 @@ public class TimelineMetricClusterAggregatorSecond extends AbstractTimelineAggre metric.addMetricValues(nextMetric.getMetricValues()); } else { // Process the current metric - processAggregateClusterMetrics(aggregateClusterMetrics, metric, timeSlices); + int numHosts = processAggregateClusterMetrics(aggregateClusterMetrics, metric, timeSlices); + numLiveHosts = Math.max(numHosts, numLiveHosts); metric = nextMetric; } } } // Process last metric if (metric != null) { - processAggregateClusterMetrics(aggregateClusterMetrics, metric, timeSlices); + int numHosts = processAggregateClusterMetrics(aggregateClusterMetrics, metric, timeSlices); + numLiveHosts = Math.max(numHosts, numLiveHosts); } // Add app level aggregates to save aggregateClusterMetrics.putAll(appAggregator.getAggregateClusterMetrics()); + +// Add liveHosts metric. +long timestamp = timeSlices.get(timeSlices.size() - 1)[1]; +processLiveHostsMetric(aggregateClusterMetrics, numLiveHosts, timestamp); + return aggregateClusterMetrics; } @@ -165,10 +177,11 @@ public class TimelineMetricClusterAggregatorSecond extends AbstractTimelineAggre * timeline.metrics.cluster.aggregator.minute.timeslice.interval * Normalize value by averaging them within the interval */ - protected void processAggregateClusterMetrics(Map
[14/27] ambari git commit: AMBARI-18400 Config group other than Default group takes forever to load (atkach)
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/branch-dev-patch-upgrade Commit: 3c06ca3b654e0abd6fd4265fb16693e1d1f7f97f Parents: 41a9190 Author: Andrii TkachAuthored: 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'); }); });
[13/27] ambari git commit: AMBARI-18399. Ambari UI to auto select Slider client to get deployed on the History Server host (akovalenko)
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/branch-dev-patch-upgrade Commit: 41a9190fc011dcfd9bc4b99dcba90ad0397b9f94 Parents: cc684be Author: Aleksandr KovalenkoAuthored: 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
[22/27] ambari git commit: AMBARI-18386. Handle Ranger hive repo config jdbc url change for stack 2.5 (mugdha)
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/branch-dev-patch-upgrade Commit: bdd261ef10eef1a5daa9d89f7b509bf6e23c370c Parents: da56057 Author: Mugdha VaradkarAuthored: 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 } http://git-wip-us.apache.org/repos/asf/ambari/blob/bdd261ef/ambari-server/src/main/resources/stacks/HDP/2.0.6/properties/stack_features.json
[05/27] ambari git commit: AMBARI-18125 : Allow for certain metrics to skip aggregation determined by client. (avijayan)
AMBARI-18125 : Allow for certain metrics to skip aggregation determined by client. (avijayan) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/f5ad1de8 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/f5ad1de8 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/f5ad1de8 Branch: refs/heads/branch-dev-patch-upgrade Commit: f5ad1de8689fc45980e5439d873a9331ea6f4723 Parents: 0e34358 Author: Aravindan VijayanAuthored: Wed Sep 14 15:03:23 2016 -0700 Committer: Aravindan Vijayan Committed: Wed Sep 14 15:03:34 2016 -0700 -- .../metrics2/sink/timeline/TimelineMetric.java | 11 ++ .../timeline/HadoopTimelineMetricsSink.java | 35 -- .../timeline/HadoopTimelineMetricsSinkTest.java | 4 +- .../src/main/python/core/host_info.py | 4 +- .../src/test/python/core/TestHostInfo.py| 43 +++ .../timeline/TimelineMetricConfiguration.java | 3 + .../TimelineMetricClusterAggregatorSecond.java | 30 - .../TimelineMetricMetadataManager.java | 9 +- .../metrics/timeline/query/Condition.java | 1 + .../timeline/query/DefaultCondition.java| 84 +++--- .../metrics/timeline/query/EmptyCondition.java | 6 + .../query/SplitByMetricNamesCondition.java | 6 + .../timeline/TestPhoenixTransactSQL.java| 50 ...melineMetricClusterAggregatorSecondTest.java | 5 + .../timeline/query/DefaultConditionTest.java| 116 +++ .../0.1.0/configuration/ams-site.xml| 12 ++ 16 files changed, 340 insertions(+), 79 deletions(-) -- http://git-wip-us.apache.org/repos/asf/ambari/blob/f5ad1de8/ambari-metrics/ambari-metrics-common/src/main/java/org/apache/hadoop/metrics2/sink/timeline/TimelineMetric.java -- diff --git a/ambari-metrics/ambari-metrics-common/src/main/java/org/apache/hadoop/metrics2/sink/timeline/TimelineMetric.java b/ambari-metrics/ambari-metrics-common/src/main/java/org/apache/hadoop/metrics2/sink/timeline/TimelineMetric.java index 98f4978..44c9d4a 100644 --- a/ambari-metrics/ambari-metrics-common/src/main/java/org/apache/hadoop/metrics2/sink/timeline/TimelineMetric.java +++ b/ambari-metrics/ambari-metrics-common/src/main/java/org/apache/hadoop/metrics2/sink/timeline/TimelineMetric.java @@ -17,6 +17,7 @@ */ package org.apache.hadoop.metrics2.sink.timeline; +import java.util.HashMap; import java.util.Map; import java.util.TreeMap; @@ -44,6 +45,7 @@ public class TimelineMetric implements Comparable { private String type; private String units; private TreeMap metricValues = new TreeMap (); + private Map metadata = new HashMap<>(); // default public TimelineMetric() { @@ -148,6 +150,15 @@ public class TimelineMetric implements Comparable { this.metricValues.putAll(metricValues); } + @XmlElement(name = "metadata") + public Map getMetadata () { +return metadata; + } + + public void setMetadata (Map metadata) { +this.metadata = metadata; + } + @Override public boolean equals(Object o) { if (this == o) return true; http://git-wip-us.apache.org/repos/asf/ambari/blob/f5ad1de8/ambari-metrics/ambari-metrics-hadoop-sink/src/main/java/org/apache/hadoop/metrics2/sink/timeline/HadoopTimelineMetricsSink.java -- diff --git a/ambari-metrics/ambari-metrics-hadoop-sink/src/main/java/org/apache/hadoop/metrics2/sink/timeline/HadoopTimelineMetricsSink.java b/ambari-metrics/ambari-metrics-hadoop-sink/src/main/java/org/apache/hadoop/metrics2/sink/timeline/HadoopTimelineMetricsSink.java index c534121..b720ba9 100644 --- a/ambari-metrics/ambari-metrics-hadoop-sink/src/main/java/org/apache/hadoop/metrics2/sink/timeline/HadoopTimelineMetricsSink.java +++ b/ambari-metrics/ambari-metrics-hadoop-sink/src/main/java/org/apache/hadoop/metrics2/sink/timeline/HadoopTimelineMetricsSink.java @@ -34,6 +34,7 @@ import java.io.IOException; import java.net.UnknownHostException; import java.util.ArrayList; import java.util.Collection; +import java.util.Collections; import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; @@ -228,6 +229,7 @@ public class HadoopTimelineMetricsSink extends AbstractTimelineMetricsSink imple String contextName = record.context(); StringBuilder sb = new StringBuilder(); + boolean skipAggregation = false; // Transform ipc.8020 -> ipc.client, ipc.8040 -> ipc.datanode, etc. if (contextName.startsWith("ipc.")) { @@ -239,17 +241,19 @@ public class HadoopTimelineMetricsSink extends
[27/27] ambari git commit: AMBARI-18226. Remove Redundant Embedded Postgres SQL (aonishuk)
AMBARI-18226. Remove Redundant Embedded Postgres SQL (aonishuk) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/9dbcac6d Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/9dbcac6d Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/9dbcac6d Branch: refs/heads/branch-dev-patch-upgrade Commit: 9dbcac6d5c30cd30d90e5643d87c0010d91317be Parents: 51cbf0d Author: Andrew OnishukAuthored: Fri Sep 16 13:54:08 2016 +0300 Committer: Andrew Onishuk Committed: Fri Sep 16 13:54:08 2016 +0300 -- .../ambari_server/dbConfiguration_linux.py | 164 +- .../python/ambari_server/serverConfiguration.py |2 + .../Ambari-DDL-Postgres-EMBEDDED-CREATE.sql | 1705 +- .../src/main/resources/scripts/change_owner.sh | 66 - .../src/test/python/TestAmbariServer.py | 118 +- 5 files changed, 192 insertions(+), 1863 deletions(-) -- http://git-wip-us.apache.org/repos/asf/ambari/blob/9dbcac6d/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 429a36e..797466d 100644 --- a/ambari-server/src/main/python/ambari_server/dbConfiguration_linux.py +++ b/ambari-server/src/main/python/ambari_server/dbConfiguration_linux.py @@ -45,7 +45,7 @@ from ambari_server.serverConfiguration import encrypt_password, store_password_f JDBC_RCA_DRIVER_PROPERTY, JDBC_RCA_URL_PROPERTY, \ PERSISTENCE_TYPE_PROPERTY, JDBC_CONNECTION_POOL_TYPE, JDBC_CONNECTION_POOL_ACQUISITION_SIZE, \ JDBC_CONNECTION_POOL_IDLE_TEST_INTERVAL, JDBC_CONNECTION_POOL_MAX_AGE, JDBC_CONNECTION_POOL_MAX_IDLE_TIME, \ -JDBC_CONNECTION_POOL_MAX_IDLE_TIME_EXCESS, JDBC_SQLA_SERVER_NAME +JDBC_CONNECTION_POOL_MAX_IDLE_TIME_EXCESS, JDBC_SQLA_SERVER_NAME, LOCAL_DATABASE_ADMIN_PROPERTY from ambari_commons.constants import AMBARI_SUDO_BINARY @@ -75,6 +75,8 @@ class LinuxDBMSConfig(DBMSConfig): self.database_username = DBMSConfig._init_member_with_prop_default(options, "database_username", properties, JDBC_USER_NAME_PROPERTY, DEFAULT_USERNAME) +self.local_admin_user = DBMSConfig._init_member_with_prop_default(options, "local_admin_user", + properties, LOCAL_DATABASE_ADMIN_PROPERTY, "postgres") self.database_password = getattr(options, "database_password", "") if not self.database_password: self.database_password = DBMSConfig._read_password_from_properties(properties, options) @@ -109,7 +111,14 @@ class LinuxDBMSConfig(DBMSConfig): "Invalid port.", False ) - + if self.persistence_type == STORAGE_TYPE_LOCAL: +self.local_admin_user = get_validated_string_input( +"Database admin user ("+ self.local_admin_user + "): ", +self.local_admin_user, +".+", +"Invalid username.", +False +) if not self._configure_database_name(): return False @@ -315,13 +324,13 @@ class LinuxDBMSConfig(DBMSConfig): # PostgreSQL configuration and setup class PGConfig(LinuxDBMSConfig): # PostgreSQL settings - SETUP_DB_CMD = [AMBARI_SUDO_BINARY, 'su', 'postgres', '-', + SETUP_DB_CMD = [AMBARI_SUDO_BINARY, 'su', 'postgres', '-', '--command=psql -f {0} -v username=\'"{1}"\' -v password="\'{2}\'" -v dbname="{3}"'] - UPGRADE_STACK_CMD = [AMBARI_SUDO_BINARY, 'su', 'postgres', - '--command=psql -f {0} -v stack_name="\'{1}\'" -v stack_version="\'{2}\'" -v dbname="{3}"'] - CHANGE_OWNER_COMMAND = [AMBARI_SUDO_BINARY, 'su', 'postgres', '-', - '--command=' + AmbariPath.get("/var/lib/ambari-server/resources/scripts/change_owner.sh") + ' -d {0} -s {1} -o {2}'] + EXECUTE_SCRIPT_AS_USER = [AMBARI_SUDO_BINARY, "bash", "-c", 'export PGPASSWORD={0} && psql -U {1} -f {2}'] + + EXECUTE_QUERY_AS_POSTGRES_FOR_DB_SILENT = [AMBARI_SUDO_BINARY, 'su', 'postgres', '-', '--command=psql -qAt -c "{0}" {1}'] + EXECUTE_QUERY_AS_POSTGRES_FOR_DB = [AMBARI_SUDO_BINARY, 'su', 'postgres', '-', '--command=psql -c "{0}" {1}'] PG_ERROR_BLOCKED = "is being accessed by other users" PG_STATUS_RUNNING = None @@ -447,10 +456,6 @@ class PGConfig(LinuxDBMSConfig): err = 'Unable to start PostgreSQL server. Exiting' raise FatalException(retcode, err) print 'Configuring local database...' -retcode, out, err = self._setup_db() -if not retcode == 0: - err = 'Running
[12/27] ambari git commit: AMBARI-18338. Microsoft-R client should work in a secured cluster (Balazs bence Sari via magyari_sandor)
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/branch-dev-patch-upgrade Commit: cc684be15b1fa5404ed86918f8b13d8ae2b0f1ae Parents: 561dc8e Author: Balazs Bence SariAuthored: 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 directories/files we need to call params.HdfsResource in code
[25/27] ambari git commit: AMBARI-18226. Remove Redundant Embedded Postgres SQL (aonishuk)
http://git-wip-us.apache.org/repos/asf/ambari/blob/9dbcac6d/ambari-server/src/main/resources/scripts/change_owner.sh -- diff --git a/ambari-server/src/main/resources/scripts/change_owner.sh b/ambari-server/src/main/resources/scripts/change_owner.sh deleted file mode 100755 index 6f0ac3d..000 --- a/ambari-server/src/main/resources/scripts/change_owner.sh +++ /dev/null @@ -1,66 +0,0 @@ -#!/bin/bash -# 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. - -usage() -{ -cat << EOF -usage: $0 options - -This script set ownership for all table, sequence and views for a given database - -OPTIONS: - -h Show this message - -d Database name - -o Owner - -s Schema (defaults to public) -EOF -} - -DB_NAME=""; -NEW_OWNER=""; -SCHEMA="public"; -while getopts "hd:o:s:" OPTION; do -case $OPTION in -h) -usage; -exit 1; -;; -d) -DB_NAME=$OPTARG; -;; -o) -NEW_OWNER=$OPTARG; -;; -s) -SCHEMA=$OPTARG; -;; -esac -done - -if [[ -z $DB_NAME ]] || [[ -z $NEW_OWNER ]]; then - usage; - exit 1; -fi - -# Using the NULL byte as the separator as its the only character disallowed from PG table names -IFS=\0; -for tbl in `psql -qAt -R\0 -c "SELECT tablename FROM pg_tables WHERE schemaname = '${SCHEMA}';" ${DB_NAME}` \ - `psql -qAt -R\0 -c "SELECT sequence_name FROM information_schema.sequences WHERE sequence_schema = '${SCHEMA}';" ${DB_NAME}` \ - `psql -qAt -R\0 -c "SELECT table_name FROM information_schema.views WHERE table_schema = '${SCHEMA}';" ${DB_NAME}` ; -do -psql -c "ALTER TABLE \"${SCHEMA}\".\"$tbl\" OWNER TO ${NEW_OWNER}" ${DB_NAME}; -done -unset IFS; \ No newline at end of file http://git-wip-us.apache.org/repos/asf/ambari/blob/9dbcac6d/ambari-server/src/test/python/TestAmbariServer.py -- diff --git a/ambari-server/src/test/python/TestAmbariServer.py b/ambari-server/src/test/python/TestAmbariServer.py index 9992eb3..cd1d294 100644 --- a/ambari-server/src/test/python/TestAmbariServer.py +++ b/ambari-server/src/test/python/TestAmbariServer.py @@ -1021,6 +1021,7 @@ class TestAmbariServer(TestCase): run_os_command_mock.return_value = (0, None, None) result = dbms._setup_db() self.assertTrue(run_os_command_mock.called) +self.assertEqual(run_os_command_mock.call_count, 2) self.assertEqual((0, None, None), result) pass @@ -3318,7 +3319,7 @@ class TestAmbariServer(TestCase): def test_prompt_db_properties_postgre_adv(self, gyni_mock, gvsi_mock, gvsi_2_mock, rp_mock, print_info_msg_mock, sls_mock, get_os_family_mock, get_pw_nam_mock, chown_mock, mkdir_mock, isdir_mock): gyni_mock.return_value = True -list_of_return_values = ["ambari-server", "ambari", "ambari", "1"] +list_of_return_values = ["ambari-server", "postgres", "ambari", "ambari", "1"] get_os_family_mock.return_value = OSConst.SUSE_FAMILY pw = MagicMock() pw.setattr('pw_uid', 0) @@ -3391,12 +3392,13 @@ class TestAmbariServer(TestCase): db_name = "db_ambari" postgres_schema = "sc_ambari" port = "1234" +local_admin_user = "postgres" oracle_service = "1" oracle_service_name = "ambari" user_name = "ambari" # Input values -postgres_embedded_values = [db_name, postgres_schema, hostname] +postgres_embedded_values = [local_admin_user, db_name, postgres_schema, hostname] oracle_values = [hostname, port, oracle_service, oracle_service_name, user_name] mysql_values = [hostname, port, db_name, user_name] postgres_external_values = [hostname, port, db_name, postgres_schema, user_name] @@ -3435,6 +3437,7 @@ class TestAmbariServer(TestCase): del args.dbms del args.database_host + del args.local_admin_user del args.database_port del args.database_name del args.database_username @@ -5218,7 +5221,8 @@ class TestAmbariServer(TestCase): @patch("ambari_server.serverUpgrade.update_ambari_env")
[18/27] ambari git commit: AMBARI-18367. Create authentication filter to encapsulate the various Ambari authentication methods (rlevas)
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); + +PermissionHelper permissionHelper = createMock(PermissionHelper.class); + +Cookie
[09/27] ambari git commit: AMBARI-18393. Hive Server Interactive (HSI) fails to start with 'Permission denied' for User Hive, if HSI starts before HS2.
AMBARI-18393. Hive Server Interactive (HSI) fails to start with 'Permission denied' for User Hive, if HSI starts before HS2. Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/565685d3 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/565685d3 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/565685d3 Branch: refs/heads/branch-dev-patch-upgrade Commit: 565685d326e5a877f8e4479736e75f59f728c9ec Parents: f5ad1de Author: Swapan ShridharAuthored: Wed Sep 14 15:37:51 2016 -0700 Committer: Swapan Shridhar Committed: Wed Sep 14 15:37:51 2016 -0700 -- .../0.12.0.2.0/package/scripts/hive_interactive.py | 8 .../python/stacks/2.5/HIVE/test_hive_server_int.py | 17 - 2 files changed, 24 insertions(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/ambari/blob/565685d3/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/hive_interactive.py -- diff --git a/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/hive_interactive.py b/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/hive_interactive.py index 1bcb954..6511d0e 100644 --- a/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/hive_interactive.py +++ b/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/hive_interactive.py @@ -58,6 +58,14 @@ Sets up the configs, jdbc connection and tarball copy to HDFS for Hive Server In def hive_interactive(name=None): import params + # Create Hive User Dir + params.HdfsResource(params.hive_hdfs_user_dir, + type="directory", + action="create_on_execute", + owner=params.hive_user, + mode=params.hive_hdfs_user_mode + ) + # list of properties that should be excluded from the config # this approach is a compromise against adding a dedicated config # type for hive_server_interactive or needed config groups on a http://git-wip-us.apache.org/repos/asf/ambari/blob/565685d3/ambari-server/src/test/python/stacks/2.5/HIVE/test_hive_server_int.py -- diff --git a/ambari-server/src/test/python/stacks/2.5/HIVE/test_hive_server_int.py b/ambari-server/src/test/python/stacks/2.5/HIVE/test_hive_server_int.py index b97c377..7477457 100644 --- a/ambari-server/src/test/python/stacks/2.5/HIVE/test_hive_server_int.py +++ b/ambari-server/src/test/python/stacks/2.5/HIVE/test_hive_server_int.py @@ -224,7 +224,22 @@ class TestHiveServerInteractive(RMFTestCase): self.assertNoMoreResources() - def assert_configure_default(self, no_tmp=False, default_fs_default='hdfs://c6401.ambari.apache.org:8020'): + def assert_configure_default(self, no_tmp=False, default_fs_default=u'hdfs://c6401.ambari.apache.org:8020'): + +self.assertResourceCalled('HdfsResource', '/user/hive', + immutable_paths = self.DEFAULT_IMMUTABLE_PATHS, + security_enabled = False, + hadoop_bin_dir = '/usr/hdp/current/hadoop-client/bin', + keytab = UnknownConfigurationMock(), + kinit_path_local = '/usr/bin/kinit', + user = 'hdfs', + dfs_type = '', + owner = 'hive', + hadoop_conf_dir = '/usr/hdp/current/hadoop-client/conf', + type = 'directory', + action = ['create_on_execute'], hdfs_resource_ignore_file='/var/lib/ambari-agent/data/.hdfs_resource_ignore', hdfs_site=self.getConfig()['configurations']['hdfs-site'], principal_name='missing_principal', default_fs=default_fs_default, + mode = 0755, + ) self.assertResourceCalled('Directory', '/etc/hive2', mode=0755,
[23/27] ambari git commit: AMBARI-14883. Express Upgrade - All Service Checks Failure - Queue State (aonishuk)
AMBARI-14883. Express Upgrade - All Service Checks Failure - Queue State (aonishuk) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/9f9e89af Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/9f9e89af Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/9f9e89af Branch: refs/heads/branch-dev-patch-upgrade Commit: 9f9e89afb2fd927500718321dc658fb7e0292bad Parents: bdd261e Author: Andrew OnishukAuthored: Fri Sep 16 11:35:39 2016 +0300 Committer: Andrew Onishuk Committed: Fri Sep 16 11:35:39 2016 +0300 -- .../stacks/HDP/2.1/upgrades/nonrolling-upgrade-2.3.xml | 10 ++ .../stacks/HDP/2.2/upgrades/nonrolling-upgrade-2.2.xml | 11 +++ .../stacks/HDP/2.2/upgrades/nonrolling-upgrade-2.3.xml | 11 +++ .../stacks/HDP/2.2/upgrades/nonrolling-upgrade-2.4.xml | 11 +++ .../stacks/HDP/2.3/upgrades/nonrolling-upgrade-2.3.xml | 11 +++ .../stacks/HDP/2.3/upgrades/nonrolling-upgrade-2.4.xml | 13 + .../stacks/HDP/2.3/upgrades/nonrolling-upgrade-2.5.xml | 11 +++ .../stacks/HDP/2.4/upgrades/nonrolling-upgrade-2.4.xml | 11 +++ .../stacks/HDP/2.4/upgrades/nonrolling-upgrade-2.5.xml | 11 +++ .../stacks/HDP/2.5/upgrades/nonrolling-upgrade-2.5.xml | 11 +++ 10 files changed, 111 insertions(+) -- http://git-wip-us.apache.org/repos/asf/ambari/blob/9f9e89af/ambari-server/src/main/resources/stacks/HDP/2.1/upgrades/nonrolling-upgrade-2.3.xml -- diff --git a/ambari-server/src/main/resources/stacks/HDP/2.1/upgrades/nonrolling-upgrade-2.3.xml b/ambari-server/src/main/resources/stacks/HDP/2.1/upgrades/nonrolling-upgrade-2.3.xml index 8cba53f..e3bb29d 100644 --- a/ambari-server/src/main/resources/stacks/HDP/2.1/upgrades/nonrolling-upgrade-2.3.xml +++ b/ambari-server/src/main/resources/stacks/HDP/2.1/upgrades/nonrolling-upgrade-2.3.xml @@ -628,6 +628,16 @@ + + UPGRADE + + + + Please start previously stopped YARN queues. If yarn-site's yarn.resourcemanager.work-preserving-recovery.enabled is set to true, then you can skip this step since the clients will retry on their own. + + + + true false http://git-wip-us.apache.org/repos/asf/ambari/blob/9f9e89af/ambari-server/src/main/resources/stacks/HDP/2.2/upgrades/nonrolling-upgrade-2.2.xml -- diff --git a/ambari-server/src/main/resources/stacks/HDP/2.2/upgrades/nonrolling-upgrade-2.2.xml b/ambari-server/src/main/resources/stacks/HDP/2.2/upgrades/nonrolling-upgrade-2.2.xml index 5aee3a8..d282888 100644 --- a/ambari-server/src/main/resources/stacks/HDP/2.2/upgrades/nonrolling-upgrade-2.2.xml +++ b/ambari-server/src/main/resources/stacks/HDP/2.2/upgrades/nonrolling-upgrade-2.2.xml @@ -554,6 +554,16 @@ + + UPGRADE + + + + Please start previously stopped YARN queues. If yarn-site's yarn.resourcemanager.work-preserving-recovery.enabled is set to true, then you can skip this step since the clients will retry on their own. + + + + true false @@ -576,6 +586,7 @@ + http://git-wip-us.apache.org/repos/asf/ambari/blob/9f9e89af/ambari-server/src/main/resources/stacks/HDP/2.2/upgrades/nonrolling-upgrade-2.3.xml -- diff --git a/ambari-server/src/main/resources/stacks/HDP/2.2/upgrades/nonrolling-upgrade-2.3.xml b/ambari-server/src/main/resources/stacks/HDP/2.2/upgrades/nonrolling-upgrade-2.3.xml index 66ef30e..391524a 100644 --- a/ambari-server/src/main/resources/stacks/HDP/2.2/upgrades/nonrolling-upgrade-2.3.xml +++ b/ambari-server/src/main/resources/stacks/HDP/2.2/upgrades/nonrolling-upgrade-2.3.xml @@ -856,6 +856,16 @@ + + UPGRADE + + + + Please start previously stopped YARN queues. If yarn-site's yarn.resourcemanager.work-preserving-recovery.enabled is set to true, then you can skip this step since the clients will retry on their own. + + + + true false @@ -878,6 +888,7 @@ + http://git-wip-us.apache.org/repos/asf/ambari/blob/9f9e89af/ambari-server/src/main/resources/stacks/HDP/2.2/upgrades/nonrolling-upgrade-2.4.xml -- diff --git a/ambari-server/src/main/resources/stacks/HDP/2.2/upgrades/nonrolling-upgrade-2.4.xml b/ambari-server/src/main/resources/stacks/HDP/2.2/upgrades/nonrolling-upgrade-2.4.xml index 2d921a2..27a41f4
[03/27] ambari git commit: AMBARI-18332: Blueprints: API should make available "setting" property from blueprint
AMBARI-18332: Blueprints: API should make available "setting" property from blueprint Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/1b89d686 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/1b89d686 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/1b89d686 Branch: refs/heads/branch-dev-patch-upgrade Commit: 1b89d6866e369906902f759a7a5d2ba865e8cbe0 Parents: 9496772 Author: Nahappan SomasundaramAuthored: Tue Sep 13 11:06:32 2016 -0700 Committer: Nahappan Somasundaram Committed: Wed Sep 14 14:42:16 2016 -0700 -- .../internal/BlueprintResourceProvider.java | 31 ++ .../internal/BlueprintResourceProviderTest.java | 104 +++ 2 files changed, 135 insertions(+) -- http://git-wip-us.apache.org/repos/asf/ambari/blob/1b89d686/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/BlueprintResourceProvider.java -- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/BlueprintResourceProvider.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/BlueprintResourceProvider.java index 775827b..1c127c0 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/BlueprintResourceProvider.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/BlueprintResourceProvider.java @@ -21,6 +21,7 @@ package org.apache.ambari.server.controller.internal; import com.google.common.base.Preconditions; import com.google.common.base.Strings; import com.google.gson.Gson; +import org.apache.ambari.server.orm.entities.BlueprintSettingEntity; import org.apache.ambari.server.utils.SecretReference; import org.apache.ambari.server.AmbariException; import org.apache.ambari.server.DuplicateResourceException; @@ -96,6 +97,10 @@ public class BlueprintResourceProvider extends AbstractControllerResourceProvide // Configurations public static final String CONFIGURATION_PROPERTY_ID = "configurations"; + + // Setting + public static final String SETTING_PROPERTY_ID = "settings"; + public static final String PROPERTIES_PROPERTY_ID = "properties"; public static final String PROPERTIES_ATTRIBUTES_PROPERTY_ID = "properties_attributes"; public static final String SCHEMA_IS_NOT_SUPPORTED_MESSAGE = @@ -320,6 +325,8 @@ public class BlueprintResourceProvider extends AbstractControllerResourceProvide setResourceProperty(resource, HOST_GROUP_PROPERTY_ID, listGroupProps, requestedIds); setResourceProperty(resource, CONFIGURATION_PROPERTY_ID, populateConfigurationList(entity.getConfigurations()), requestedIds); +setResourceProperty(resource, SETTING_PROPERTY_ID, + populateSettingList(entity.getSettings()), requestedIds); if (entity.getSecurityType() != null) { Map securityConfigMap = new LinkedHashMap<>(); @@ -387,6 +394,30 @@ public class BlueprintResourceProvider extends AbstractControllerResourceProvide } /** + * Populate a list of setting property maps from a collection of setting entities. + * + * @param settings collection of setting entities + * + * @return list of setting property maps + */ + public static List
[01/27] ambari git commit: AMBARI-18388. Link UI: add missing unit tests for models/configs/* and models/stack_version/* files (alexantonenko)
Repository: ambari Updated Branches: refs/heads/branch-dev-patch-upgrade 752e7c463 -> 9dbcac6d5 AMBARI-18388. Link UI: add missing unit tests for models/configs/* and models/stack_version/* files (alexantonenko) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/08e426ac Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/08e426ac Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/08e426ac Branch: refs/heads/branch-dev-patch-upgrade Commit: 08e426ac790957e3fab3edeef128a331fd5860bc Parents: 752e7c4 Author: Alex AntonenkoAuthored: Wed Sep 14 18:32:11 2016 +0300 Committer: Alex Antonenko Committed: Wed Sep 14 21:40:26 2016 +0300 -- ambari-web/app/assets/test/tests.js | 7 +- .../app/models/stack_version/service_simple.js | 2 +- ambari-web/app/models/stack_version/version.js | 2 +- ambari-web/test/aliases/computed/concat.js | 92 ++ ambari-web/test/aliases/computed/empty.js | 125 ++ ambari-web/test/aliases/computed/equal.js | 6 +- ambari-web/test/init_computed_aliases.js| 23 ++- ambari-web/test/models/configs/section_test.js | 55 -- .../test/models/configs/sub_section_test.js | 103 --- .../test/models/configs/theme/section_test.js | 55 ++ .../configs/theme/sub_section_tab_test.js | 169 +++ .../models/configs/theme/sub_section_test.js| 103 +++ .../models/stack_version/service_simple_test.js | 119 + .../test/models/stack_version/version_test.js | 38 + 14 files changed, 734 insertions(+), 165 deletions(-) -- http://git-wip-us.apache.org/repos/asf/ambari/blob/08e426ac/ambari-web/app/assets/test/tests.js -- diff --git a/ambari-web/app/assets/test/tests.js b/ambari-web/app/assets/test/tests.js index d918900..78c6196 100644 --- a/ambari-web/app/assets/test/tests.js +++ b/ambari-web/app/assets/test/tests.js @@ -401,16 +401,19 @@ var files = [ 'test/models/host_stack_version_test', 'test/models/upgrade_entity_test', 'test/models/finished_upgrade_entity_test', - 'test/models/configs/sub_section_test', - 'test/models/configs/section_test', 'test/models/configs/service_config_version_test', 'test/models/configs/config_group_test', 'test/models/configs/stack_config_property_test', 'test/models/configs/objects/service_config_test', 'test/models/configs/objects/service_config_category_test', 'test/models/configs/objects/service_config_property_test', + 'test/models/configs/theme/section_test', + 'test/models/configs/theme/sub_section_test', + 'test/models/configs/theme/sub_section_tab_test', 'test/models/configs/theme/tab_test', 'test/models/stack_version/repository_version_test', + 'test/models/stack_version/service_simple_test', + 'test/models/stack_version/version_test', 'test/routes/views_test', //contains test with fake timers that affect Date 'test/utils/lazy_loading_test', http://git-wip-us.apache.org/repos/asf/ambari/blob/08e426ac/ambari-web/app/models/stack_version/service_simple.js -- diff --git a/ambari-web/app/models/stack_version/service_simple.js b/ambari-web/app/models/stack_version/service_simple.js index f693cc8..c7d94e5 100644 --- a/ambari-web/app/models/stack_version/service_simple.js +++ b/ambari-web/app/models/stack_version/service_simple.js @@ -30,7 +30,7 @@ App.ServiceSimple = DS.Model.extend({ doNotShowAndInstall: function () { var skipServices = ['KERBEROS']; -if(!App.supports.installGanglia) { +if(!App.get('supports.installGanglia')) { skipServices.push('GANGLIA'); } return skipServices.contains(this.get('name')); http://git-wip-us.apache.org/repos/asf/ambari/blob/08e426ac/ambari-web/app/models/stack_version/version.js -- diff --git a/ambari-web/app/models/stack_version/version.js b/ambari-web/app/models/stack_version/version.js index 3f2fe37..4e18ca4 100644 --- a/ambari-web/app/models/stack_version/version.js +++ b/ambari-web/app/models/stack_version/version.js @@ -35,7 +35,7 @@ App.StackVersion = DS.Model.extend({ upgradeFailedHosts: DS.attr('array'), currentHosts: DS.attr('array'), - noInstalledHosts: Em.computed.empty('installedHosts'), + noInstalledHosts: Em.computed.empty('installedHosts'), noCurrentHosts: Em.computed.empty('currentHosts'), http://git-wip-us.apache.org/repos/asf/ambari/blob/08e426ac/ambari-web/test/aliases/computed/concat.js -- diff --git a/ambari-web/test/aliases/computed/concat.js
[10/27] ambari git commit: AMBARI-18384. Analyze and Optimize Ambari Server Unit Tests - Group 3.(vbrodetskyi)
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/branch-dev-patch-upgrade Commit: 1123ba265592958f188eaf9b1eac843bcb4d3f1c Parents: 565685d Author: Vitaly BrodetskyiAuthored: 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")); +hb.setTimestamp(System.currentTimeMillis()); +hb.setResponseId(12); +
[26/27] ambari git commit: AMBARI-18226. Remove Redundant Embedded Postgres SQL (aonishuk)
http://git-wip-us.apache.org/repos/asf/ambari/blob/9dbcac6d/ambari-server/src/main/resources/Ambari-DDL-Postgres-EMBEDDED-CREATE.sql -- diff --git a/ambari-server/src/main/resources/Ambari-DDL-Postgres-EMBEDDED-CREATE.sql b/ambari-server/src/main/resources/Ambari-DDL-Postgres-EMBEDDED-CREATE.sql index 8f03989..9943cae 100644 --- a/ambari-server/src/main/resources/Ambari-DDL-Postgres-EMBEDDED-CREATE.sql +++ b/ambari-server/src/main/resources/Ambari-DDL-Postgres-EMBEDDED-CREATE.sql @@ -26,1707 +26,4 @@ GRANT ALL PRIVILEGES ON DATABASE :dbname TO :username; CREATE SCHEMA ambari AUTHORIZATION :username; ALTER SCHEMA ambari OWNER TO :username; ALTER ROLE :username SET search_path TO 'ambari'; - ---create tables and grant privileges to db user- -CREATE TABLE ambari.stack( - stack_id BIGINT NOT NULL, - stack_name VARCHAR(255) NOT NULL, - stack_version VARCHAR(255) NOT NULL, - CONSTRAINT PK_stack PRIMARY KEY (stack_id), - CONSTRAINT UQ_stack UNIQUE (stack_name, stack_version) -); -GRANT ALL PRIVILEGES ON TABLE ambari.stack TO :username; - -CREATE TABLE ambari.extension( - extension_id BIGINT NOT NULL, - extension_name VARCHAR(255) NOT NULL, - extension_version VARCHAR(255) NOT NULL, - CONSTRAINT PK_extension PRIMARY KEY (extension_id), - CONSTRAINT UQ_extension UNIQUE(extension_name, extension_version)); -GRANT ALL PRIVILEGES ON TABLE ambari.extension TO :username; - -CREATE TABLE ambari.extensionlink( - link_id BIGINT NOT NULL, - stack_id BIGINT NOT NULL, - extension_id BIGINT NOT NULL, - CONSTRAINT PK_extensionlink PRIMARY KEY (link_id), - CONSTRAINT FK_extensionlink_stack_id FOREIGN KEY (stack_id) REFERENCES ambari.stack(stack_id), - CONSTRAINT FK_extensionlink_extension_id FOREIGN KEY (extension_id) REFERENCES ambari.extension(extension_id), - CONSTRAINT UQ_extension_link UNIQUE(stack_id, extension_id)); -GRANT ALL PRIVILEGES ON TABLE ambari.extensionlink TO :username; - -CREATE TABLE ambari.adminresourcetype ( - resource_type_id INTEGER NOT NULL, - resource_type_name VARCHAR(255) NOT NULL, - CONSTRAINT PK_adminresourcetype PRIMARY KEY (resource_type_id) -); -GRANT ALL PRIVILEGES ON TABLE ambari.adminresourcetype TO :username; - -CREATE TABLE ambari.adminresource ( - resource_id BIGINT NOT NULL, - resource_type_id INTEGER NOT NULL, - CONSTRAINT PK_adminresource PRIMARY KEY (resource_id), - CONSTRAINT FK_resource_resource_type_id FOREIGN KEY (resource_type_id) REFERENCES ambari.adminresourcetype(resource_type_id) -); -GRANT ALL PRIVILEGES ON TABLE ambari.adminresource TO :username; - -CREATE TABLE ambari.clusters ( - cluster_id BIGINT NOT NULL, - resource_id BIGINT NOT NULL, - upgrade_id BIGINT, - cluster_info VARCHAR(255) NOT NULL, - cluster_name VARCHAR(100) NOT NULL UNIQUE, - provisioning_state VARCHAR(255) NOT NULL DEFAULT 'INIT', - security_type VARCHAR(32) NOT NULL DEFAULT 'NONE', - desired_cluster_state VARCHAR(255) NOT NULL, - desired_stack_id BIGINT NOT NULL, - CONSTRAINT PK_clusters PRIMARY KEY (cluster_id), - CONSTRAINT FK_clusters_desired_stack_id FOREIGN KEY (desired_stack_id) REFERENCES ambari.stack(stack_id), - CONSTRAINT FK_clusters_resource_id FOREIGN KEY (resource_id) REFERENCES ambari.adminresource(resource_id) -); -GRANT ALL PRIVILEGES ON TABLE ambari.clusters TO :username; - -CREATE TABLE ambari.clusterconfig ( - config_id BIGINT NOT NULL, - version_tag VARCHAR(255) NOT NULL, - version BIGINT NOT NULL, - type_name VARCHAR(255) NOT NULL, - cluster_id BIGINT NOT NULL, - stack_id BIGINT NOT NULL, - config_data TEXT NOT NULL, - config_attributes TEXT, - create_timestamp BIGINT NOT NULL, - CONSTRAINT PK_clusterconfig PRIMARY KEY (config_id), - CONSTRAINT FK_clusterconfig_cluster_id FOREIGN KEY (cluster_id) REFERENCES ambari.clusters (cluster_id), - CONSTRAINT FK_clusterconfig_stack_id FOREIGN KEY (stack_id) REFERENCES ambari.stack(stack_id), - CONSTRAINT UQ_config_type_tag UNIQUE (cluster_id, type_name, version_tag), - CONSTRAINT UQ_config_type_version UNIQUE (cluster_id, type_name, version) -); -GRANT ALL PRIVILEGES ON TABLE ambari.clusterconfig TO :username; - -CREATE TABLE ambari.clusterconfigmapping ( - cluster_id BIGINT NOT NULL, - type_name VARCHAR(255) NOT NULL, - version_tag VARCHAR(255) NOT NULL, - create_timestamp BIGINT NOT NULL, - selected INTEGER NOT NULL DEFAULT 0, - user_name VARCHAR(255) NOT NULL DEFAULT '_db', - CONSTRAINT PK_clusterconfigmapping PRIMARY KEY (cluster_id, type_name, create_timestamp), - CONSTRAINT clusterconfigmappingcluster_id FOREIGN KEY (cluster_id) REFERENCES ambari.clusters (cluster_id) -); -GRANT ALL PRIVILEGES ON TABLE ambari.clusterconfigmapping TO :username; - -CREATE TABLE ambari.serviceconfig ( - service_config_id BIGINT NOT NULL, - cluster_id BIGINT NOT NULL, - service_name VARCHAR(255) NOT NULL, - version BIGINT NOT NULL, - create_timestamp BIGINT NOT NULL, - stack_id BIGINT NOT NULL, -
[19/27] ambari git commit: AMBARI-18367. Create authentication filter to encapsulate the various Ambari authentication methods (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/branch-dev-patch-upgrade Commit: d5cca62c85f97118ed9e2a3e14729d9e6cb6023d Parents: edf1b9b Author: Robert LevasAuthored: 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));
[15/27] ambari git commit: AMBARI-18402 - Alert definition should include AGGREGATE source type
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/branch-dev-patch-upgrade Commit: 513965f5850e4d3d900eb63d6b429d841498d529 Parents: 3c06ca3 Author: Tim ThorpeAuthored: 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
[24/27] ambari git commit: AMBARI-18407 BE:api/v1/persist/CLUSTER_CURRENT_STATUS takes more than 2s for transferring 307KB response. (atkach)
AMBARI-18407 BE:api/v1/persist/CLUSTER_CURRENT_STATUS takes more than 2s for transferring 307KB response. (atkach) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/51cbf0df Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/51cbf0df Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/51cbf0df Branch: refs/heads/branch-dev-patch-upgrade Commit: 51cbf0df6b6ba6922b236c3a0a4cfa39e3d919e5 Parents: 9f9e89a Author: Andrii TkachAuthored: Thu Sep 15 21:56:50 2016 +0300 Committer: Andrii Tkach Committed: Fri Sep 16 12:38:27 2016 +0300 -- .../global/user_settings_controller.js | 6 ++-- ambari-web/app/controllers/login_controller.js | 1 - ambari-web/app/router.js| 3 +- .../views/common/widget/graph_widget_view.js| 5 ++-- .../global/user_settings_controller_test.js | 31 +--- .../test/controllers/login_controller_test.js | 4 +++ .../common/widget/graph_widget_view_test.js | 4 +-- .../manage_alert_notifications_view_test.js | 5 8 files changed, 44 insertions(+), 15 deletions(-) -- http://git-wip-us.apache.org/repos/asf/ambari/blob/51cbf0df/ambari-web/app/controllers/global/user_settings_controller.js -- diff --git a/ambari-web/app/controllers/global/user_settings_controller.js b/ambari-web/app/controllers/global/user_settings_controller.js index 8bcba75..9580400 100644 --- a/ambari-web/app/controllers/global/user_settings_controller.js +++ b/ambari-web/app/controllers/global/user_settings_controller.js @@ -81,13 +81,13 @@ App.UserSettingsController = Em.Controller.extend(App.UserPref, { /** * Success-callback for user pref * - * @param {*} response + * @param {?object} response * @param {object} opt - * @returns {*} + * @returns {?object} * @method getUserPrefSuccessCallback */ getUserPrefSuccessCallback: function (response, opt) { -var getAllRequest = opt.url.contains('persist/?_'); +var getAllRequest = opt.url.endsWith('persist/'); if (Em.isNone(response)) { this.updateUserPrefWithDefaultValues(response, getAllRequest); } http://git-wip-us.apache.org/repos/asf/ambari/blob/51cbf0df/ambari-web/app/controllers/login_controller.js -- diff --git a/ambari-web/app/controllers/login_controller.js b/ambari-web/app/controllers/login_controller.js index 24c04f7..350da87 100644 --- a/ambari-web/app/controllers/login_controller.js +++ b/ambari-web/app/controllers/login_controller.js @@ -49,7 +49,6 @@ App.LoginController = Em.Object.extend({ } this.set('errorMessage', errorMessage); } -App.router.get('userSettingsController').dataLoading(); this.set('isSubmitDisabled', false); } http://git-wip-us.apache.org/repos/asf/ambari/blob/51cbf0df/ambari-web/app/router.js -- diff --git a/ambari-web/app/router.js b/ambari-web/app/router.js index c7a70f1..0270771 100644 --- a/ambari-web/app/router.js +++ b/ambari-web/app/router.js @@ -420,7 +420,6 @@ App.Router = Em.Router.extend({ loginSuccessCallback: function(data, opt, params) { var self = this; -App.router.set('loginController.isSubmitDisabled', false); App.usersMapper.map({"items": [data]}); this.setUserLoggedIn(data.Users.user_name); var requestData = { @@ -585,7 +584,7 @@ App.Router = Em.Router.extend({ } } App.set('isPermissionDataLoaded', true); -App.router.get('userSettingsController').dataLoading(); +App.router.get('loginController').postLogin(true, true); }, /** http://git-wip-us.apache.org/repos/asf/ambari/blob/51cbf0df/ambari-web/app/views/common/widget/graph_widget_view.js -- diff --git a/ambari-web/app/views/common/widget/graph_widget_view.js b/ambari-web/app/views/common/widget/graph_widget_view.js index 6348077..2ee76be 100644 --- a/ambari-web/app/views/common/widget/graph_widget_view.js +++ b/ambari-web/app/views/common/widget/graph_widget_view.js @@ -336,8 +336,9 @@ App.GraphWidgetView = Em.View.extend(App.WidgetMixin, App.ExportMetricsMixin, { }, loadData: function () { - Em.run.next(this, function () { -this._refreshGraph(this.get('parentView.data'), this.get('parentView')); + var self = this; + Em.run.next(function () { +self._refreshGraph(self.get('parentView.data'), self.get('parentView')); }); }, http://git-wip-us.apache.org/repos/asf/ambari/blob/51cbf0df/ambari-web/test/controllers/global/user_settings_controller_test.js
[08/27] ambari git commit: AMBARI-18289 : Invalid negative values for some AMS metrics. (avijayan)
AMBARI-18289 : Invalid negative values for some AMS metrics. (avijayan) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/9455b52d Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/9455b52d Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/9455b52d Branch: refs/heads/branch-dev-patch-upgrade Commit: 9455b52dd3126248ccea0d077d5da4512f4e2f21 Parents: aa0528e Author: Aravindan VijayanAuthored: Tue Sep 13 20:22:56 2016 -0700 Committer: Aravindan Vijayan Committed: Wed Sep 14 15:03:34 2016 -0700 -- .../conf/unix/metric_monitor.ini| 1 + .../src/main/python/core/config_reader.py | 3 ++ .../src/main/python/core/host_info.py | 39 .../0.1.0/configuration/ams-env.xml | 9 + .../0.1.0/package/scripts/params.py | 1 + .../package/templates/metric_monitor.ini.j2 | 1 + 6 files changed, 46 insertions(+), 8 deletions(-) -- http://git-wip-us.apache.org/repos/asf/ambari/blob/9455b52d/ambari-metrics/ambari-metrics-host-monitoring/conf/unix/metric_monitor.ini -- diff --git a/ambari-metrics/ambari-metrics-host-monitoring/conf/unix/metric_monitor.ini b/ambari-metrics/ambari-metrics-host-monitoring/conf/unix/metric_monitor.ini index 59ca5d7..e98c65c 100644 --- a/ambari-metrics/ambari-metrics-host-monitoring/conf/unix/metric_monitor.ini +++ b/ambari-metrics/ambari-metrics-host-monitoring/conf/unix/metric_monitor.ini @@ -21,6 +21,7 @@ debug_level = INFO metrics_servers = localhost enable_time_threshold = false enable_value_threshold = false +skip_disk_patterns = [emitter] send_interval = 60 http://git-wip-us.apache.org/repos/asf/ambari/blob/9455b52d/ambari-metrics/ambari-metrics-host-monitoring/src/main/python/core/config_reader.py -- diff --git a/ambari-metrics/ambari-metrics-host-monitoring/src/main/python/core/config_reader.py b/ambari-metrics/ambari-metrics-host-monitoring/src/main/python/core/config_reader.py index 44692f6..2e8a170 100644 --- a/ambari-metrics/ambari-metrics-host-monitoring/src/main/python/core/config_reader.py +++ b/ambari-metrics/ambari-metrics-host-monitoring/src/main/python/core/config_reader.py @@ -245,3 +245,6 @@ class Configuration: def get_ca_certs(self): return self._ca_cert_file_path + + def get_disk_metrics_skip_pattern(self): +return self.get("default", "skip_disk_patterns") \ No newline at end of file http://git-wip-us.apache.org/repos/asf/ambari/blob/9455b52d/ambari-metrics/ambari-metrics-host-monitoring/src/main/python/core/host_info.py -- diff --git a/ambari-metrics/ambari-metrics-host-monitoring/src/main/python/core/host_info.py b/ambari-metrics/ambari-metrics-host-monitoring/src/main/python/core/host_info.py index 845b270..f79cacd 100644 --- a/ambari-metrics/ambari-metrics-host-monitoring/src/main/python/core/host_info.py +++ b/ambari-metrics/ambari-metrics-host-monitoring/src/main/python/core/host_info.py @@ -26,6 +26,8 @@ import time import threading import socket import operator +import re +from collections import namedtuple logger = logging.getLogger() cached_hostname = None @@ -244,16 +246,37 @@ class HostInfo(): if delta <= 0: delta = float("inf") -io_counters = psutil.disk_io_counters() +skip_disk_patterns = self.__config.get_disk_metrics_skip_pattern() +logger.debug('skip_disk_patterns: %s' % skip_disk_patterns) +if not skip_disk_patterns or skip_disk_patterns == 'None': + io_counters = psutil.disk_io_counters() +else: + sdiskio = namedtuple('sdiskio', ['read_count', 'write_count', + 'read_bytes', 'write_bytes', + 'read_time', 'write_time']) + skip_disk_pattern_list = skip_disk_patterns.split(',') + rawdict = psutil.disk_io_counters(True) + if not rawdict: +raise RuntimeError("Couldn't find any physical disk") + trimmed_dict = {} + for disk, fields in rawdict.items(): +ignore_disk = False +for p in skip_disk_pattern_list: + if re.match(p, disk): +ignore_disk = True +if not ignore_disk: + trimmed_dict[disk] = sdiskio(*fields) + io_counters = sdiskio(*[sum(x) for x in zip(*trimmed_dict.values())]) new_disk_stats = { - 'read_count' : io_counters.read_count if hasattr(io_counters, 'read_count') else 0, - 'write_count' : io_counters.write_count if hasattr(io_counters, 'write_count') else 0, - 'read_bytes' : io_counters.read_bytes if
[1/3] ambari git commit: AMBARI-18226. Remove Redundant Embedded Postgres SQL (aonishuk)
Repository: ambari Updated Branches: refs/heads/trunk 51cbf0df6 -> 9dbcac6d5 http://git-wip-us.apache.org/repos/asf/ambari/blob/9dbcac6d/ambari-server/src/main/resources/scripts/change_owner.sh -- diff --git a/ambari-server/src/main/resources/scripts/change_owner.sh b/ambari-server/src/main/resources/scripts/change_owner.sh deleted file mode 100755 index 6f0ac3d..000 --- a/ambari-server/src/main/resources/scripts/change_owner.sh +++ /dev/null @@ -1,66 +0,0 @@ -#!/bin/bash -# 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. - -usage() -{ -cat << EOF -usage: $0 options - -This script set ownership for all table, sequence and views for a given database - -OPTIONS: - -h Show this message - -d Database name - -o Owner - -s Schema (defaults to public) -EOF -} - -DB_NAME=""; -NEW_OWNER=""; -SCHEMA="public"; -while getopts "hd:o:s:" OPTION; do -case $OPTION in -h) -usage; -exit 1; -;; -d) -DB_NAME=$OPTARG; -;; -o) -NEW_OWNER=$OPTARG; -;; -s) -SCHEMA=$OPTARG; -;; -esac -done - -if [[ -z $DB_NAME ]] || [[ -z $NEW_OWNER ]]; then - usage; - exit 1; -fi - -# Using the NULL byte as the separator as its the only character disallowed from PG table names -IFS=\0; -for tbl in `psql -qAt -R\0 -c "SELECT tablename FROM pg_tables WHERE schemaname = '${SCHEMA}';" ${DB_NAME}` \ - `psql -qAt -R\0 -c "SELECT sequence_name FROM information_schema.sequences WHERE sequence_schema = '${SCHEMA}';" ${DB_NAME}` \ - `psql -qAt -R\0 -c "SELECT table_name FROM information_schema.views WHERE table_schema = '${SCHEMA}';" ${DB_NAME}` ; -do -psql -c "ALTER TABLE \"${SCHEMA}\".\"$tbl\" OWNER TO ${NEW_OWNER}" ${DB_NAME}; -done -unset IFS; \ No newline at end of file http://git-wip-us.apache.org/repos/asf/ambari/blob/9dbcac6d/ambari-server/src/test/python/TestAmbariServer.py -- diff --git a/ambari-server/src/test/python/TestAmbariServer.py b/ambari-server/src/test/python/TestAmbariServer.py index 9992eb3..cd1d294 100644 --- a/ambari-server/src/test/python/TestAmbariServer.py +++ b/ambari-server/src/test/python/TestAmbariServer.py @@ -1021,6 +1021,7 @@ class TestAmbariServer(TestCase): run_os_command_mock.return_value = (0, None, None) result = dbms._setup_db() self.assertTrue(run_os_command_mock.called) +self.assertEqual(run_os_command_mock.call_count, 2) self.assertEqual((0, None, None), result) pass @@ -3318,7 +3319,7 @@ class TestAmbariServer(TestCase): def test_prompt_db_properties_postgre_adv(self, gyni_mock, gvsi_mock, gvsi_2_mock, rp_mock, print_info_msg_mock, sls_mock, get_os_family_mock, get_pw_nam_mock, chown_mock, mkdir_mock, isdir_mock): gyni_mock.return_value = True -list_of_return_values = ["ambari-server", "ambari", "ambari", "1"] +list_of_return_values = ["ambari-server", "postgres", "ambari", "ambari", "1"] get_os_family_mock.return_value = OSConst.SUSE_FAMILY pw = MagicMock() pw.setattr('pw_uid', 0) @@ -3391,12 +3392,13 @@ class TestAmbariServer(TestCase): db_name = "db_ambari" postgres_schema = "sc_ambari" port = "1234" +local_admin_user = "postgres" oracle_service = "1" oracle_service_name = "ambari" user_name = "ambari" # Input values -postgres_embedded_values = [db_name, postgres_schema, hostname] +postgres_embedded_values = [local_admin_user, db_name, postgres_schema, hostname] oracle_values = [hostname, port, oracle_service, oracle_service_name, user_name] mysql_values = [hostname, port, db_name, user_name] postgres_external_values = [hostname, port, db_name, postgres_schema, user_name] @@ -3435,6 +3437,7 @@ class TestAmbariServer(TestCase): del args.dbms del args.database_host + del args.local_admin_user del args.database_port del args.database_name del args.database_username @@ -5218,7 +5221,8 @@ class
[3/3] ambari git commit: AMBARI-18226. Remove Redundant Embedded Postgres SQL (aonishuk)
AMBARI-18226. Remove Redundant Embedded Postgres SQL (aonishuk) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/9dbcac6d Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/9dbcac6d Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/9dbcac6d Branch: refs/heads/trunk Commit: 9dbcac6d5c30cd30d90e5643d87c0010d91317be Parents: 51cbf0d Author: Andrew OnishukAuthored: Fri Sep 16 13:54:08 2016 +0300 Committer: Andrew Onishuk Committed: Fri Sep 16 13:54:08 2016 +0300 -- .../ambari_server/dbConfiguration_linux.py | 164 +- .../python/ambari_server/serverConfiguration.py |2 + .../Ambari-DDL-Postgres-EMBEDDED-CREATE.sql | 1705 +- .../src/main/resources/scripts/change_owner.sh | 66 - .../src/test/python/TestAmbariServer.py | 118 +- 5 files changed, 192 insertions(+), 1863 deletions(-) -- http://git-wip-us.apache.org/repos/asf/ambari/blob/9dbcac6d/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 429a36e..797466d 100644 --- a/ambari-server/src/main/python/ambari_server/dbConfiguration_linux.py +++ b/ambari-server/src/main/python/ambari_server/dbConfiguration_linux.py @@ -45,7 +45,7 @@ from ambari_server.serverConfiguration import encrypt_password, store_password_f JDBC_RCA_DRIVER_PROPERTY, JDBC_RCA_URL_PROPERTY, \ PERSISTENCE_TYPE_PROPERTY, JDBC_CONNECTION_POOL_TYPE, JDBC_CONNECTION_POOL_ACQUISITION_SIZE, \ JDBC_CONNECTION_POOL_IDLE_TEST_INTERVAL, JDBC_CONNECTION_POOL_MAX_AGE, JDBC_CONNECTION_POOL_MAX_IDLE_TIME, \ -JDBC_CONNECTION_POOL_MAX_IDLE_TIME_EXCESS, JDBC_SQLA_SERVER_NAME +JDBC_CONNECTION_POOL_MAX_IDLE_TIME_EXCESS, JDBC_SQLA_SERVER_NAME, LOCAL_DATABASE_ADMIN_PROPERTY from ambari_commons.constants import AMBARI_SUDO_BINARY @@ -75,6 +75,8 @@ class LinuxDBMSConfig(DBMSConfig): self.database_username = DBMSConfig._init_member_with_prop_default(options, "database_username", properties, JDBC_USER_NAME_PROPERTY, DEFAULT_USERNAME) +self.local_admin_user = DBMSConfig._init_member_with_prop_default(options, "local_admin_user", + properties, LOCAL_DATABASE_ADMIN_PROPERTY, "postgres") self.database_password = getattr(options, "database_password", "") if not self.database_password: self.database_password = DBMSConfig._read_password_from_properties(properties, options) @@ -109,7 +111,14 @@ class LinuxDBMSConfig(DBMSConfig): "Invalid port.", False ) - + if self.persistence_type == STORAGE_TYPE_LOCAL: +self.local_admin_user = get_validated_string_input( +"Database admin user ("+ self.local_admin_user + "): ", +self.local_admin_user, +".+", +"Invalid username.", +False +) if not self._configure_database_name(): return False @@ -315,13 +324,13 @@ class LinuxDBMSConfig(DBMSConfig): # PostgreSQL configuration and setup class PGConfig(LinuxDBMSConfig): # PostgreSQL settings - SETUP_DB_CMD = [AMBARI_SUDO_BINARY, 'su', 'postgres', '-', + SETUP_DB_CMD = [AMBARI_SUDO_BINARY, 'su', 'postgres', '-', '--command=psql -f {0} -v username=\'"{1}"\' -v password="\'{2}\'" -v dbname="{3}"'] - UPGRADE_STACK_CMD = [AMBARI_SUDO_BINARY, 'su', 'postgres', - '--command=psql -f {0} -v stack_name="\'{1}\'" -v stack_version="\'{2}\'" -v dbname="{3}"'] - CHANGE_OWNER_COMMAND = [AMBARI_SUDO_BINARY, 'su', 'postgres', '-', - '--command=' + AmbariPath.get("/var/lib/ambari-server/resources/scripts/change_owner.sh") + ' -d {0} -s {1} -o {2}'] + EXECUTE_SCRIPT_AS_USER = [AMBARI_SUDO_BINARY, "bash", "-c", 'export PGPASSWORD={0} && psql -U {1} -f {2}'] + + EXECUTE_QUERY_AS_POSTGRES_FOR_DB_SILENT = [AMBARI_SUDO_BINARY, 'su', 'postgres', '-', '--command=psql -qAt -c "{0}" {1}'] + EXECUTE_QUERY_AS_POSTGRES_FOR_DB = [AMBARI_SUDO_BINARY, 'su', 'postgres', '-', '--command=psql -c "{0}" {1}'] PG_ERROR_BLOCKED = "is being accessed by other users" PG_STATUS_RUNNING = None @@ -447,10 +456,6 @@ class PGConfig(LinuxDBMSConfig): err = 'Unable to start PostgreSQL server. Exiting' raise FatalException(retcode, err) print 'Configuring local database...' -retcode, out, err = self._setup_db() -if not retcode == 0: - err = 'Running database init script
[2/3] ambari git commit: AMBARI-18226. Remove Redundant Embedded Postgres SQL (aonishuk)
http://git-wip-us.apache.org/repos/asf/ambari/blob/9dbcac6d/ambari-server/src/main/resources/Ambari-DDL-Postgres-EMBEDDED-CREATE.sql -- diff --git a/ambari-server/src/main/resources/Ambari-DDL-Postgres-EMBEDDED-CREATE.sql b/ambari-server/src/main/resources/Ambari-DDL-Postgres-EMBEDDED-CREATE.sql index 8f03989..9943cae 100644 --- a/ambari-server/src/main/resources/Ambari-DDL-Postgres-EMBEDDED-CREATE.sql +++ b/ambari-server/src/main/resources/Ambari-DDL-Postgres-EMBEDDED-CREATE.sql @@ -26,1707 +26,4 @@ GRANT ALL PRIVILEGES ON DATABASE :dbname TO :username; CREATE SCHEMA ambari AUTHORIZATION :username; ALTER SCHEMA ambari OWNER TO :username; ALTER ROLE :username SET search_path TO 'ambari'; - ---create tables and grant privileges to db user- -CREATE TABLE ambari.stack( - stack_id BIGINT NOT NULL, - stack_name VARCHAR(255) NOT NULL, - stack_version VARCHAR(255) NOT NULL, - CONSTRAINT PK_stack PRIMARY KEY (stack_id), - CONSTRAINT UQ_stack UNIQUE (stack_name, stack_version) -); -GRANT ALL PRIVILEGES ON TABLE ambari.stack TO :username; - -CREATE TABLE ambari.extension( - extension_id BIGINT NOT NULL, - extension_name VARCHAR(255) NOT NULL, - extension_version VARCHAR(255) NOT NULL, - CONSTRAINT PK_extension PRIMARY KEY (extension_id), - CONSTRAINT UQ_extension UNIQUE(extension_name, extension_version)); -GRANT ALL PRIVILEGES ON TABLE ambari.extension TO :username; - -CREATE TABLE ambari.extensionlink( - link_id BIGINT NOT NULL, - stack_id BIGINT NOT NULL, - extension_id BIGINT NOT NULL, - CONSTRAINT PK_extensionlink PRIMARY KEY (link_id), - CONSTRAINT FK_extensionlink_stack_id FOREIGN KEY (stack_id) REFERENCES ambari.stack(stack_id), - CONSTRAINT FK_extensionlink_extension_id FOREIGN KEY (extension_id) REFERENCES ambari.extension(extension_id), - CONSTRAINT UQ_extension_link UNIQUE(stack_id, extension_id)); -GRANT ALL PRIVILEGES ON TABLE ambari.extensionlink TO :username; - -CREATE TABLE ambari.adminresourcetype ( - resource_type_id INTEGER NOT NULL, - resource_type_name VARCHAR(255) NOT NULL, - CONSTRAINT PK_adminresourcetype PRIMARY KEY (resource_type_id) -); -GRANT ALL PRIVILEGES ON TABLE ambari.adminresourcetype TO :username; - -CREATE TABLE ambari.adminresource ( - resource_id BIGINT NOT NULL, - resource_type_id INTEGER NOT NULL, - CONSTRAINT PK_adminresource PRIMARY KEY (resource_id), - CONSTRAINT FK_resource_resource_type_id FOREIGN KEY (resource_type_id) REFERENCES ambari.adminresourcetype(resource_type_id) -); -GRANT ALL PRIVILEGES ON TABLE ambari.adminresource TO :username; - -CREATE TABLE ambari.clusters ( - cluster_id BIGINT NOT NULL, - resource_id BIGINT NOT NULL, - upgrade_id BIGINT, - cluster_info VARCHAR(255) NOT NULL, - cluster_name VARCHAR(100) NOT NULL UNIQUE, - provisioning_state VARCHAR(255) NOT NULL DEFAULT 'INIT', - security_type VARCHAR(32) NOT NULL DEFAULT 'NONE', - desired_cluster_state VARCHAR(255) NOT NULL, - desired_stack_id BIGINT NOT NULL, - CONSTRAINT PK_clusters PRIMARY KEY (cluster_id), - CONSTRAINT FK_clusters_desired_stack_id FOREIGN KEY (desired_stack_id) REFERENCES ambari.stack(stack_id), - CONSTRAINT FK_clusters_resource_id FOREIGN KEY (resource_id) REFERENCES ambari.adminresource(resource_id) -); -GRANT ALL PRIVILEGES ON TABLE ambari.clusters TO :username; - -CREATE TABLE ambari.clusterconfig ( - config_id BIGINT NOT NULL, - version_tag VARCHAR(255) NOT NULL, - version BIGINT NOT NULL, - type_name VARCHAR(255) NOT NULL, - cluster_id BIGINT NOT NULL, - stack_id BIGINT NOT NULL, - config_data TEXT NOT NULL, - config_attributes TEXT, - create_timestamp BIGINT NOT NULL, - CONSTRAINT PK_clusterconfig PRIMARY KEY (config_id), - CONSTRAINT FK_clusterconfig_cluster_id FOREIGN KEY (cluster_id) REFERENCES ambari.clusters (cluster_id), - CONSTRAINT FK_clusterconfig_stack_id FOREIGN KEY (stack_id) REFERENCES ambari.stack(stack_id), - CONSTRAINT UQ_config_type_tag UNIQUE (cluster_id, type_name, version_tag), - CONSTRAINT UQ_config_type_version UNIQUE (cluster_id, type_name, version) -); -GRANT ALL PRIVILEGES ON TABLE ambari.clusterconfig TO :username; - -CREATE TABLE ambari.clusterconfigmapping ( - cluster_id BIGINT NOT NULL, - type_name VARCHAR(255) NOT NULL, - version_tag VARCHAR(255) NOT NULL, - create_timestamp BIGINT NOT NULL, - selected INTEGER NOT NULL DEFAULT 0, - user_name VARCHAR(255) NOT NULL DEFAULT '_db', - CONSTRAINT PK_clusterconfigmapping PRIMARY KEY (cluster_id, type_name, create_timestamp), - CONSTRAINT clusterconfigmappingcluster_id FOREIGN KEY (cluster_id) REFERENCES ambari.clusters (cluster_id) -); -GRANT ALL PRIVILEGES ON TABLE ambari.clusterconfigmapping TO :username; - -CREATE TABLE ambari.serviceconfig ( - service_config_id BIGINT NOT NULL, - cluster_id BIGINT NOT NULL, - service_name VARCHAR(255) NOT NULL, - version BIGINT NOT NULL, - create_timestamp BIGINT NOT NULL, - stack_id BIGINT NOT NULL, -
[2/3] ambari git commit: AMBARI-18226. Remove Redundant Embedded Postgres SQL (aonishuk)
http://git-wip-us.apache.org/repos/asf/ambari/blob/20eacc67/ambari-server/src/main/resources/Ambari-DDL-Postgres-EMBEDDED-CREATE.sql -- diff --git a/ambari-server/src/main/resources/Ambari-DDL-Postgres-EMBEDDED-CREATE.sql b/ambari-server/src/main/resources/Ambari-DDL-Postgres-EMBEDDED-CREATE.sql index 8f03989..9943cae 100644 --- a/ambari-server/src/main/resources/Ambari-DDL-Postgres-EMBEDDED-CREATE.sql +++ b/ambari-server/src/main/resources/Ambari-DDL-Postgres-EMBEDDED-CREATE.sql @@ -26,1707 +26,4 @@ GRANT ALL PRIVILEGES ON DATABASE :dbname TO :username; CREATE SCHEMA ambari AUTHORIZATION :username; ALTER SCHEMA ambari OWNER TO :username; ALTER ROLE :username SET search_path TO 'ambari'; - ---create tables and grant privileges to db user- -CREATE TABLE ambari.stack( - stack_id BIGINT NOT NULL, - stack_name VARCHAR(255) NOT NULL, - stack_version VARCHAR(255) NOT NULL, - CONSTRAINT PK_stack PRIMARY KEY (stack_id), - CONSTRAINT UQ_stack UNIQUE (stack_name, stack_version) -); -GRANT ALL PRIVILEGES ON TABLE ambari.stack TO :username; - -CREATE TABLE ambari.extension( - extension_id BIGINT NOT NULL, - extension_name VARCHAR(255) NOT NULL, - extension_version VARCHAR(255) NOT NULL, - CONSTRAINT PK_extension PRIMARY KEY (extension_id), - CONSTRAINT UQ_extension UNIQUE(extension_name, extension_version)); -GRANT ALL PRIVILEGES ON TABLE ambari.extension TO :username; - -CREATE TABLE ambari.extensionlink( - link_id BIGINT NOT NULL, - stack_id BIGINT NOT NULL, - extension_id BIGINT NOT NULL, - CONSTRAINT PK_extensionlink PRIMARY KEY (link_id), - CONSTRAINT FK_extensionlink_stack_id FOREIGN KEY (stack_id) REFERENCES ambari.stack(stack_id), - CONSTRAINT FK_extensionlink_extension_id FOREIGN KEY (extension_id) REFERENCES ambari.extension(extension_id), - CONSTRAINT UQ_extension_link UNIQUE(stack_id, extension_id)); -GRANT ALL PRIVILEGES ON TABLE ambari.extensionlink TO :username; - -CREATE TABLE ambari.adminresourcetype ( - resource_type_id INTEGER NOT NULL, - resource_type_name VARCHAR(255) NOT NULL, - CONSTRAINT PK_adminresourcetype PRIMARY KEY (resource_type_id) -); -GRANT ALL PRIVILEGES ON TABLE ambari.adminresourcetype TO :username; - -CREATE TABLE ambari.adminresource ( - resource_id BIGINT NOT NULL, - resource_type_id INTEGER NOT NULL, - CONSTRAINT PK_adminresource PRIMARY KEY (resource_id), - CONSTRAINT FK_resource_resource_type_id FOREIGN KEY (resource_type_id) REFERENCES ambari.adminresourcetype(resource_type_id) -); -GRANT ALL PRIVILEGES ON TABLE ambari.adminresource TO :username; - -CREATE TABLE ambari.clusters ( - cluster_id BIGINT NOT NULL, - resource_id BIGINT NOT NULL, - upgrade_id BIGINT, - cluster_info VARCHAR(255) NOT NULL, - cluster_name VARCHAR(100) NOT NULL UNIQUE, - provisioning_state VARCHAR(255) NOT NULL DEFAULT 'INIT', - security_type VARCHAR(32) NOT NULL DEFAULT 'NONE', - desired_cluster_state VARCHAR(255) NOT NULL, - desired_stack_id BIGINT NOT NULL, - CONSTRAINT PK_clusters PRIMARY KEY (cluster_id), - CONSTRAINT FK_clusters_desired_stack_id FOREIGN KEY (desired_stack_id) REFERENCES ambari.stack(stack_id), - CONSTRAINT FK_clusters_resource_id FOREIGN KEY (resource_id) REFERENCES ambari.adminresource(resource_id) -); -GRANT ALL PRIVILEGES ON TABLE ambari.clusters TO :username; - -CREATE TABLE ambari.clusterconfig ( - config_id BIGINT NOT NULL, - version_tag VARCHAR(255) NOT NULL, - version BIGINT NOT NULL, - type_name VARCHAR(255) NOT NULL, - cluster_id BIGINT NOT NULL, - stack_id BIGINT NOT NULL, - config_data TEXT NOT NULL, - config_attributes TEXT, - create_timestamp BIGINT NOT NULL, - CONSTRAINT PK_clusterconfig PRIMARY KEY (config_id), - CONSTRAINT FK_clusterconfig_cluster_id FOREIGN KEY (cluster_id) REFERENCES ambari.clusters (cluster_id), - CONSTRAINT FK_clusterconfig_stack_id FOREIGN KEY (stack_id) REFERENCES ambari.stack(stack_id), - CONSTRAINT UQ_config_type_tag UNIQUE (cluster_id, type_name, version_tag), - CONSTRAINT UQ_config_type_version UNIQUE (cluster_id, type_name, version) -); -GRANT ALL PRIVILEGES ON TABLE ambari.clusterconfig TO :username; - -CREATE TABLE ambari.clusterconfigmapping ( - cluster_id BIGINT NOT NULL, - type_name VARCHAR(255) NOT NULL, - version_tag VARCHAR(255) NOT NULL, - create_timestamp BIGINT NOT NULL, - selected INTEGER NOT NULL DEFAULT 0, - user_name VARCHAR(255) NOT NULL DEFAULT '_db', - CONSTRAINT PK_clusterconfigmapping PRIMARY KEY (cluster_id, type_name, create_timestamp), - CONSTRAINT clusterconfigmappingcluster_id FOREIGN KEY (cluster_id) REFERENCES ambari.clusters (cluster_id) -); -GRANT ALL PRIVILEGES ON TABLE ambari.clusterconfigmapping TO :username; - -CREATE TABLE ambari.serviceconfig ( - service_config_id BIGINT NOT NULL, - cluster_id BIGINT NOT NULL, - service_name VARCHAR(255) NOT NULL, - version BIGINT NOT NULL, - create_timestamp BIGINT NOT NULL, - stack_id BIGINT NOT NULL, -
[3/3] ambari git commit: AMBARI-18226. Remove Redundant Embedded Postgres SQL (aonishuk)
AMBARI-18226. Remove Redundant Embedded Postgres SQL (aonishuk) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/20eacc67 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/20eacc67 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/20eacc67 Branch: refs/heads/branch-2.5 Commit: 20eacc67554ad565e2977a40e5c3329faf764c94 Parents: f31e76f Author: Andrew OnishukAuthored: Fri Sep 16 13:50:49 2016 +0300 Committer: Andrew Onishuk Committed: Fri Sep 16 13:50:49 2016 +0300 -- .../ambari_server/dbConfiguration_linux.py | 164 +- .../python/ambari_server/serverConfiguration.py |2 + .../Ambari-DDL-Postgres-EMBEDDED-CREATE.sql | 1705 +- .../src/main/resources/scripts/change_owner.sh | 66 - .../src/test/python/TestAmbariServer.py | 118 +- 5 files changed, 192 insertions(+), 1863 deletions(-) -- http://git-wip-us.apache.org/repos/asf/ambari/blob/20eacc67/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 429a36e..797466d 100644 --- a/ambari-server/src/main/python/ambari_server/dbConfiguration_linux.py +++ b/ambari-server/src/main/python/ambari_server/dbConfiguration_linux.py @@ -45,7 +45,7 @@ from ambari_server.serverConfiguration import encrypt_password, store_password_f JDBC_RCA_DRIVER_PROPERTY, JDBC_RCA_URL_PROPERTY, \ PERSISTENCE_TYPE_PROPERTY, JDBC_CONNECTION_POOL_TYPE, JDBC_CONNECTION_POOL_ACQUISITION_SIZE, \ JDBC_CONNECTION_POOL_IDLE_TEST_INTERVAL, JDBC_CONNECTION_POOL_MAX_AGE, JDBC_CONNECTION_POOL_MAX_IDLE_TIME, \ -JDBC_CONNECTION_POOL_MAX_IDLE_TIME_EXCESS, JDBC_SQLA_SERVER_NAME +JDBC_CONNECTION_POOL_MAX_IDLE_TIME_EXCESS, JDBC_SQLA_SERVER_NAME, LOCAL_DATABASE_ADMIN_PROPERTY from ambari_commons.constants import AMBARI_SUDO_BINARY @@ -75,6 +75,8 @@ class LinuxDBMSConfig(DBMSConfig): self.database_username = DBMSConfig._init_member_with_prop_default(options, "database_username", properties, JDBC_USER_NAME_PROPERTY, DEFAULT_USERNAME) +self.local_admin_user = DBMSConfig._init_member_with_prop_default(options, "local_admin_user", + properties, LOCAL_DATABASE_ADMIN_PROPERTY, "postgres") self.database_password = getattr(options, "database_password", "") if not self.database_password: self.database_password = DBMSConfig._read_password_from_properties(properties, options) @@ -109,7 +111,14 @@ class LinuxDBMSConfig(DBMSConfig): "Invalid port.", False ) - + if self.persistence_type == STORAGE_TYPE_LOCAL: +self.local_admin_user = get_validated_string_input( +"Database admin user ("+ self.local_admin_user + "): ", +self.local_admin_user, +".+", +"Invalid username.", +False +) if not self._configure_database_name(): return False @@ -315,13 +324,13 @@ class LinuxDBMSConfig(DBMSConfig): # PostgreSQL configuration and setup class PGConfig(LinuxDBMSConfig): # PostgreSQL settings - SETUP_DB_CMD = [AMBARI_SUDO_BINARY, 'su', 'postgres', '-', + SETUP_DB_CMD = [AMBARI_SUDO_BINARY, 'su', 'postgres', '-', '--command=psql -f {0} -v username=\'"{1}"\' -v password="\'{2}\'" -v dbname="{3}"'] - UPGRADE_STACK_CMD = [AMBARI_SUDO_BINARY, 'su', 'postgres', - '--command=psql -f {0} -v stack_name="\'{1}\'" -v stack_version="\'{2}\'" -v dbname="{3}"'] - CHANGE_OWNER_COMMAND = [AMBARI_SUDO_BINARY, 'su', 'postgres', '-', - '--command=' + AmbariPath.get("/var/lib/ambari-server/resources/scripts/change_owner.sh") + ' -d {0} -s {1} -o {2}'] + EXECUTE_SCRIPT_AS_USER = [AMBARI_SUDO_BINARY, "bash", "-c", 'export PGPASSWORD={0} && psql -U {1} -f {2}'] + + EXECUTE_QUERY_AS_POSTGRES_FOR_DB_SILENT = [AMBARI_SUDO_BINARY, 'su', 'postgres', '-', '--command=psql -qAt -c "{0}" {1}'] + EXECUTE_QUERY_AS_POSTGRES_FOR_DB = [AMBARI_SUDO_BINARY, 'su', 'postgres', '-', '--command=psql -c "{0}" {1}'] PG_ERROR_BLOCKED = "is being accessed by other users" PG_STATUS_RUNNING = None @@ -447,10 +456,6 @@ class PGConfig(LinuxDBMSConfig): err = 'Unable to start PostgreSQL server. Exiting' raise FatalException(retcode, err) print 'Configuring local database...' -retcode, out, err = self._setup_db() -if not retcode == 0: - err = 'Running database init
[1/3] ambari git commit: AMBARI-18226. Remove Redundant Embedded Postgres SQL (aonishuk)
Repository: ambari Updated Branches: refs/heads/branch-2.5 f31e76f5c -> 20eacc675 http://git-wip-us.apache.org/repos/asf/ambari/blob/20eacc67/ambari-server/src/main/resources/scripts/change_owner.sh -- diff --git a/ambari-server/src/main/resources/scripts/change_owner.sh b/ambari-server/src/main/resources/scripts/change_owner.sh deleted file mode 100755 index 6f0ac3d..000 --- a/ambari-server/src/main/resources/scripts/change_owner.sh +++ /dev/null @@ -1,66 +0,0 @@ -#!/bin/bash -# 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. - -usage() -{ -cat << EOF -usage: $0 options - -This script set ownership for all table, sequence and views for a given database - -OPTIONS: - -h Show this message - -d Database name - -o Owner - -s Schema (defaults to public) -EOF -} - -DB_NAME=""; -NEW_OWNER=""; -SCHEMA="public"; -while getopts "hd:o:s:" OPTION; do -case $OPTION in -h) -usage; -exit 1; -;; -d) -DB_NAME=$OPTARG; -;; -o) -NEW_OWNER=$OPTARG; -;; -s) -SCHEMA=$OPTARG; -;; -esac -done - -if [[ -z $DB_NAME ]] || [[ -z $NEW_OWNER ]]; then - usage; - exit 1; -fi - -# Using the NULL byte as the separator as its the only character disallowed from PG table names -IFS=\0; -for tbl in `psql -qAt -R\0 -c "SELECT tablename FROM pg_tables WHERE schemaname = '${SCHEMA}';" ${DB_NAME}` \ - `psql -qAt -R\0 -c "SELECT sequence_name FROM information_schema.sequences WHERE sequence_schema = '${SCHEMA}';" ${DB_NAME}` \ - `psql -qAt -R\0 -c "SELECT table_name FROM information_schema.views WHERE table_schema = '${SCHEMA}';" ${DB_NAME}` ; -do -psql -c "ALTER TABLE \"${SCHEMA}\".\"$tbl\" OWNER TO ${NEW_OWNER}" ${DB_NAME}; -done -unset IFS; \ No newline at end of file http://git-wip-us.apache.org/repos/asf/ambari/blob/20eacc67/ambari-server/src/test/python/TestAmbariServer.py -- diff --git a/ambari-server/src/test/python/TestAmbariServer.py b/ambari-server/src/test/python/TestAmbariServer.py index 9992eb3..cd1d294 100644 --- a/ambari-server/src/test/python/TestAmbariServer.py +++ b/ambari-server/src/test/python/TestAmbariServer.py @@ -1021,6 +1021,7 @@ class TestAmbariServer(TestCase): run_os_command_mock.return_value = (0, None, None) result = dbms._setup_db() self.assertTrue(run_os_command_mock.called) +self.assertEqual(run_os_command_mock.call_count, 2) self.assertEqual((0, None, None), result) pass @@ -3318,7 +3319,7 @@ class TestAmbariServer(TestCase): def test_prompt_db_properties_postgre_adv(self, gyni_mock, gvsi_mock, gvsi_2_mock, rp_mock, print_info_msg_mock, sls_mock, get_os_family_mock, get_pw_nam_mock, chown_mock, mkdir_mock, isdir_mock): gyni_mock.return_value = True -list_of_return_values = ["ambari-server", "ambari", "ambari", "1"] +list_of_return_values = ["ambari-server", "postgres", "ambari", "ambari", "1"] get_os_family_mock.return_value = OSConst.SUSE_FAMILY pw = MagicMock() pw.setattr('pw_uid', 0) @@ -3391,12 +3392,13 @@ class TestAmbariServer(TestCase): db_name = "db_ambari" postgres_schema = "sc_ambari" port = "1234" +local_admin_user = "postgres" oracle_service = "1" oracle_service_name = "ambari" user_name = "ambari" # Input values -postgres_embedded_values = [db_name, postgres_schema, hostname] +postgres_embedded_values = [local_admin_user, db_name, postgres_schema, hostname] oracle_values = [hostname, port, oracle_service, oracle_service_name, user_name] mysql_values = [hostname, port, db_name, user_name] postgres_external_values = [hostname, port, db_name, postgres_schema, user_name] @@ -3435,6 +3437,7 @@ class TestAmbariServer(TestCase): del args.dbms del args.database_host + del args.local_admin_user del args.database_port del args.database_name del args.database_username @@ -5218,7 +5221,8 @@ class
ambari git commit: AMBARI-18407 BE:api/v1/persist/CLUSTER_CURRENT_STATUS takes more than 2s for transferring 307KB response. (atkach)
Repository: ambari Updated Branches: refs/heads/trunk 9f9e89afb -> 51cbf0df6 AMBARI-18407 BE:api/v1/persist/CLUSTER_CURRENT_STATUS takes more than 2s for transferring 307KB response. (atkach) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/51cbf0df Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/51cbf0df Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/51cbf0df Branch: refs/heads/trunk Commit: 51cbf0df6b6ba6922b236c3a0a4cfa39e3d919e5 Parents: 9f9e89a Author: Andrii TkachAuthored: Thu Sep 15 21:56:50 2016 +0300 Committer: Andrii Tkach Committed: Fri Sep 16 12:38:27 2016 +0300 -- .../global/user_settings_controller.js | 6 ++-- ambari-web/app/controllers/login_controller.js | 1 - ambari-web/app/router.js| 3 +- .../views/common/widget/graph_widget_view.js| 5 ++-- .../global/user_settings_controller_test.js | 31 +--- .../test/controllers/login_controller_test.js | 4 +++ .../common/widget/graph_widget_view_test.js | 4 +-- .../manage_alert_notifications_view_test.js | 5 8 files changed, 44 insertions(+), 15 deletions(-) -- http://git-wip-us.apache.org/repos/asf/ambari/blob/51cbf0df/ambari-web/app/controllers/global/user_settings_controller.js -- diff --git a/ambari-web/app/controllers/global/user_settings_controller.js b/ambari-web/app/controllers/global/user_settings_controller.js index 8bcba75..9580400 100644 --- a/ambari-web/app/controllers/global/user_settings_controller.js +++ b/ambari-web/app/controllers/global/user_settings_controller.js @@ -81,13 +81,13 @@ App.UserSettingsController = Em.Controller.extend(App.UserPref, { /** * Success-callback for user pref * - * @param {*} response + * @param {?object} response * @param {object} opt - * @returns {*} + * @returns {?object} * @method getUserPrefSuccessCallback */ getUserPrefSuccessCallback: function (response, opt) { -var getAllRequest = opt.url.contains('persist/?_'); +var getAllRequest = opt.url.endsWith('persist/'); if (Em.isNone(response)) { this.updateUserPrefWithDefaultValues(response, getAllRequest); } http://git-wip-us.apache.org/repos/asf/ambari/blob/51cbf0df/ambari-web/app/controllers/login_controller.js -- diff --git a/ambari-web/app/controllers/login_controller.js b/ambari-web/app/controllers/login_controller.js index 24c04f7..350da87 100644 --- a/ambari-web/app/controllers/login_controller.js +++ b/ambari-web/app/controllers/login_controller.js @@ -49,7 +49,6 @@ App.LoginController = Em.Object.extend({ } this.set('errorMessage', errorMessage); } -App.router.get('userSettingsController').dataLoading(); this.set('isSubmitDisabled', false); } http://git-wip-us.apache.org/repos/asf/ambari/blob/51cbf0df/ambari-web/app/router.js -- diff --git a/ambari-web/app/router.js b/ambari-web/app/router.js index c7a70f1..0270771 100644 --- a/ambari-web/app/router.js +++ b/ambari-web/app/router.js @@ -420,7 +420,6 @@ App.Router = Em.Router.extend({ loginSuccessCallback: function(data, opt, params) { var self = this; -App.router.set('loginController.isSubmitDisabled', false); App.usersMapper.map({"items": [data]}); this.setUserLoggedIn(data.Users.user_name); var requestData = { @@ -585,7 +584,7 @@ App.Router = Em.Router.extend({ } } App.set('isPermissionDataLoaded', true); -App.router.get('userSettingsController').dataLoading(); +App.router.get('loginController').postLogin(true, true); }, /** http://git-wip-us.apache.org/repos/asf/ambari/blob/51cbf0df/ambari-web/app/views/common/widget/graph_widget_view.js -- diff --git a/ambari-web/app/views/common/widget/graph_widget_view.js b/ambari-web/app/views/common/widget/graph_widget_view.js index 6348077..2ee76be 100644 --- a/ambari-web/app/views/common/widget/graph_widget_view.js +++ b/ambari-web/app/views/common/widget/graph_widget_view.js @@ -336,8 +336,9 @@ App.GraphWidgetView = Em.View.extend(App.WidgetMixin, App.ExportMetricsMixin, { }, loadData: function () { - Em.run.next(this, function () { -this._refreshGraph(this.get('parentView.data'), this.get('parentView')); + var self = this; + Em.run.next(function () { +self._refreshGraph(self.get('parentView.data'), self.get('parentView')); }); },
[2/2] ambari git commit: AMBARI-14883. Express Upgrade - All Service Checks Failure - Queue State (aonishuk)
AMBARI-14883. Express Upgrade - All Service Checks Failure - Queue State (aonishuk) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/f31e76f5 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/f31e76f5 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/f31e76f5 Branch: refs/heads/branch-2.5 Commit: f31e76f5ce2e61508fa2ccc48044c09fbac2afdc Parents: 357ba0a Author: Andrew OnishukAuthored: Fri Sep 16 11:35:46 2016 +0300 Committer: Andrew Onishuk Committed: Fri Sep 16 11:35:46 2016 +0300 -- .../stacks/HDP/2.1/upgrades/nonrolling-upgrade-2.3.xml | 10 ++ .../stacks/HDP/2.2/upgrades/nonrolling-upgrade-2.2.xml | 11 +++ .../stacks/HDP/2.2/upgrades/nonrolling-upgrade-2.3.xml | 11 +++ .../stacks/HDP/2.2/upgrades/nonrolling-upgrade-2.4.xml | 11 +++ .../stacks/HDP/2.3/upgrades/nonrolling-upgrade-2.3.xml | 11 +++ .../stacks/HDP/2.3/upgrades/nonrolling-upgrade-2.4.xml | 13 + .../stacks/HDP/2.3/upgrades/nonrolling-upgrade-2.5.xml | 11 +++ .../stacks/HDP/2.4/upgrades/nonrolling-upgrade-2.4.xml | 11 +++ .../stacks/HDP/2.4/upgrades/nonrolling-upgrade-2.5.xml | 11 +++ .../stacks/HDP/2.5/upgrades/nonrolling-upgrade-2.5.xml | 11 +++ 10 files changed, 111 insertions(+) -- http://git-wip-us.apache.org/repos/asf/ambari/blob/f31e76f5/ambari-server/src/main/resources/stacks/HDP/2.1/upgrades/nonrolling-upgrade-2.3.xml -- diff --git a/ambari-server/src/main/resources/stacks/HDP/2.1/upgrades/nonrolling-upgrade-2.3.xml b/ambari-server/src/main/resources/stacks/HDP/2.1/upgrades/nonrolling-upgrade-2.3.xml index 94c5c46..044e9de 100644 --- a/ambari-server/src/main/resources/stacks/HDP/2.1/upgrades/nonrolling-upgrade-2.3.xml +++ b/ambari-server/src/main/resources/stacks/HDP/2.1/upgrades/nonrolling-upgrade-2.3.xml @@ -620,6 +620,16 @@ + + UPGRADE + + + + Please start previously stopped YARN queues. If yarn-site's yarn.resourcemanager.work-preserving-recovery.enabled is set to true, then you can skip this step since the clients will retry on their own. + + + + true false http://git-wip-us.apache.org/repos/asf/ambari/blob/f31e76f5/ambari-server/src/main/resources/stacks/HDP/2.2/upgrades/nonrolling-upgrade-2.2.xml -- diff --git a/ambari-server/src/main/resources/stacks/HDP/2.2/upgrades/nonrolling-upgrade-2.2.xml b/ambari-server/src/main/resources/stacks/HDP/2.2/upgrades/nonrolling-upgrade-2.2.xml index d0bfec2..ba13bc9 100644 --- a/ambari-server/src/main/resources/stacks/HDP/2.2/upgrades/nonrolling-upgrade-2.2.xml +++ b/ambari-server/src/main/resources/stacks/HDP/2.2/upgrades/nonrolling-upgrade-2.2.xml @@ -554,6 +554,16 @@ + + UPGRADE + + + + Please start previously stopped YARN queues. If yarn-site's yarn.resourcemanager.work-preserving-recovery.enabled is set to true, then you can skip this step since the clients will retry on their own. + + + + true false @@ -576,6 +586,7 @@ + http://git-wip-us.apache.org/repos/asf/ambari/blob/f31e76f5/ambari-server/src/main/resources/stacks/HDP/2.2/upgrades/nonrolling-upgrade-2.3.xml -- diff --git a/ambari-server/src/main/resources/stacks/HDP/2.2/upgrades/nonrolling-upgrade-2.3.xml b/ambari-server/src/main/resources/stacks/HDP/2.2/upgrades/nonrolling-upgrade-2.3.xml index 3168f10..cb9a1e7 100644 --- a/ambari-server/src/main/resources/stacks/HDP/2.2/upgrades/nonrolling-upgrade-2.3.xml +++ b/ambari-server/src/main/resources/stacks/HDP/2.2/upgrades/nonrolling-upgrade-2.3.xml @@ -852,6 +852,16 @@ + + UPGRADE + + + + Please start previously stopped YARN queues. If yarn-site's yarn.resourcemanager.work-preserving-recovery.enabled is set to true, then you can skip this step since the clients will retry on their own. + + + + true false @@ -874,6 +884,7 @@ + http://git-wip-us.apache.org/repos/asf/ambari/blob/f31e76f5/ambari-server/src/main/resources/stacks/HDP/2.2/upgrades/nonrolling-upgrade-2.4.xml -- diff --git a/ambari-server/src/main/resources/stacks/HDP/2.2/upgrades/nonrolling-upgrade-2.4.xml b/ambari-server/src/main/resources/stacks/HDP/2.2/upgrades/nonrolling-upgrade-2.4.xml index 0f15286..886940b 100644 ---
[1/2] ambari git commit: AMBARI-14883. Express Upgrade - All Service Checks Failure - Queue State (aonishuk)
Repository: ambari Updated Branches: refs/heads/branch-2.5 357ba0a9a -> f31e76f5c refs/heads/trunk bdd261ef1 -> 9f9e89afb AMBARI-14883. Express Upgrade - All Service Checks Failure - Queue State (aonishuk) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/9f9e89af Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/9f9e89af Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/9f9e89af Branch: refs/heads/trunk Commit: 9f9e89afb2fd927500718321dc658fb7e0292bad Parents: bdd261e Author: Andrew OnishukAuthored: Fri Sep 16 11:35:39 2016 +0300 Committer: Andrew Onishuk Committed: Fri Sep 16 11:35:39 2016 +0300 -- .../stacks/HDP/2.1/upgrades/nonrolling-upgrade-2.3.xml | 10 ++ .../stacks/HDP/2.2/upgrades/nonrolling-upgrade-2.2.xml | 11 +++ .../stacks/HDP/2.2/upgrades/nonrolling-upgrade-2.3.xml | 11 +++ .../stacks/HDP/2.2/upgrades/nonrolling-upgrade-2.4.xml | 11 +++ .../stacks/HDP/2.3/upgrades/nonrolling-upgrade-2.3.xml | 11 +++ .../stacks/HDP/2.3/upgrades/nonrolling-upgrade-2.4.xml | 13 + .../stacks/HDP/2.3/upgrades/nonrolling-upgrade-2.5.xml | 11 +++ .../stacks/HDP/2.4/upgrades/nonrolling-upgrade-2.4.xml | 11 +++ .../stacks/HDP/2.4/upgrades/nonrolling-upgrade-2.5.xml | 11 +++ .../stacks/HDP/2.5/upgrades/nonrolling-upgrade-2.5.xml | 11 +++ 10 files changed, 111 insertions(+) -- http://git-wip-us.apache.org/repos/asf/ambari/blob/9f9e89af/ambari-server/src/main/resources/stacks/HDP/2.1/upgrades/nonrolling-upgrade-2.3.xml -- diff --git a/ambari-server/src/main/resources/stacks/HDP/2.1/upgrades/nonrolling-upgrade-2.3.xml b/ambari-server/src/main/resources/stacks/HDP/2.1/upgrades/nonrolling-upgrade-2.3.xml index 8cba53f..e3bb29d 100644 --- a/ambari-server/src/main/resources/stacks/HDP/2.1/upgrades/nonrolling-upgrade-2.3.xml +++ b/ambari-server/src/main/resources/stacks/HDP/2.1/upgrades/nonrolling-upgrade-2.3.xml @@ -628,6 +628,16 @@ + + UPGRADE + + + + Please start previously stopped YARN queues. If yarn-site's yarn.resourcemanager.work-preserving-recovery.enabled is set to true, then you can skip this step since the clients will retry on their own. + + + + true false http://git-wip-us.apache.org/repos/asf/ambari/blob/9f9e89af/ambari-server/src/main/resources/stacks/HDP/2.2/upgrades/nonrolling-upgrade-2.2.xml -- diff --git a/ambari-server/src/main/resources/stacks/HDP/2.2/upgrades/nonrolling-upgrade-2.2.xml b/ambari-server/src/main/resources/stacks/HDP/2.2/upgrades/nonrolling-upgrade-2.2.xml index 5aee3a8..d282888 100644 --- a/ambari-server/src/main/resources/stacks/HDP/2.2/upgrades/nonrolling-upgrade-2.2.xml +++ b/ambari-server/src/main/resources/stacks/HDP/2.2/upgrades/nonrolling-upgrade-2.2.xml @@ -554,6 +554,16 @@ + + UPGRADE + + + + Please start previously stopped YARN queues. If yarn-site's yarn.resourcemanager.work-preserving-recovery.enabled is set to true, then you can skip this step since the clients will retry on their own. + + + + true false @@ -576,6 +586,7 @@ + http://git-wip-us.apache.org/repos/asf/ambari/blob/9f9e89af/ambari-server/src/main/resources/stacks/HDP/2.2/upgrades/nonrolling-upgrade-2.3.xml -- diff --git a/ambari-server/src/main/resources/stacks/HDP/2.2/upgrades/nonrolling-upgrade-2.3.xml b/ambari-server/src/main/resources/stacks/HDP/2.2/upgrades/nonrolling-upgrade-2.3.xml index 66ef30e..391524a 100644 --- a/ambari-server/src/main/resources/stacks/HDP/2.2/upgrades/nonrolling-upgrade-2.3.xml +++ b/ambari-server/src/main/resources/stacks/HDP/2.2/upgrades/nonrolling-upgrade-2.3.xml @@ -856,6 +856,16 @@ + + UPGRADE + + + + Please start previously stopped YARN queues. If yarn-site's yarn.resourcemanager.work-preserving-recovery.enabled is set to true, then you can skip this step since the clients will retry on their own. + + + + true false @@ -878,6 +888,7 @@ + http://git-wip-us.apache.org/repos/asf/ambari/blob/9f9e89af/ambari-server/src/main/resources/stacks/HDP/2.2/upgrades/nonrolling-upgrade-2.4.xml -- diff --git a/ambari-server/src/main/resources/stacks/HDP/2.2/upgrades/nonrolling-upgrade-2.4.xml