You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by jo...@apache.org on 2016/10/11 00:38:27 UTC
[01/11] ambari git commit: AMBARI-18546. BP format does not generate
property oozie.service.JPAService.jdbc.url.(vbrodetskyi)
Repository: ambari
Updated Branches:
refs/heads/branch-feature-AMBARI-18456 5cf5c8349 -> ed2018bf0
AMBARI-18546. BP format does not generate property oozie.service.JPAService.jdbc.url.(vbrodetskyi)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/58afcf93
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/58afcf93
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/58afcf93
Branch: refs/heads/branch-feature-AMBARI-18456
Commit: 58afcf93d8445c3b1ffacdd33c1cb12a8e8414cb
Parents: 72f1f6f
Author: Vitaly Brodetskyi <vb...@hortonworks.com>
Authored: Mon Oct 10 00:22:49 2016 +0300
Committer: Vitaly Brodetskyi <vb...@hortonworks.com>
Committed: Mon Oct 10 00:22:49 2016 +0300
----------------------------------------------------------------------
.../BlueprintConfigurationProcessor.java | 113 ++++++++++++++-----
.../BlueprintConfigurationProcessorTest.java | 82 ++++++++++++++
2 files changed, 169 insertions(+), 26 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/58afcf93/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/BlueprintConfigurationProcessor.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/BlueprintConfigurationProcessor.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/BlueprintConfigurationProcessor.java
index ba09368..8ff568a 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/BlueprintConfigurationProcessor.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/BlueprintConfigurationProcessor.java
@@ -84,7 +84,7 @@ public class BlueprintConfigurationProcessor {
/**
* Single host topology updaters
*/
- private static Map<String, Map<String, PropertyUpdater>> singleHostTopologyUpdaters =
+ protected static Map<String, Map<String, PropertyUpdater>> singleHostTopologyUpdaters =
new HashMap<String, Map<String, PropertyUpdater>>();
/**
@@ -117,7 +117,7 @@ public class BlueprintConfigurationProcessor {
* removed from export, but do not require an update during
* cluster creation
*/
- private static Map<String, Map<String, PropertyUpdater>> removePropertyUpdaters =
+ private Map<String, Map<String, PropertyUpdater>> removePropertyUpdaters =
new HashMap<String, Map<String, PropertyUpdater>>();
/**
@@ -196,6 +196,81 @@ public class BlueprintConfigurationProcessor {
public BlueprintConfigurationProcessor(ClusterTopology clusterTopology) {
this.clusterTopology = clusterTopology;
+ initRemovePropertyUpdaters();
+ }
+
+ public Map<String, Map<String, PropertyUpdater>> getRemovePropertyUpdaters() {
+ return removePropertyUpdaters;
+ }
+
+ public void initRemovePropertyUpdaters() {
+
+ if (containsHostFromHostGroups("oozie-site", "oozie.service.JPAService.jdbc.url")) {
+ Map<String, PropertyUpdater> oozieSiteUpdaters = singleHostTopologyUpdaters.get("oozie-site");
+ Map<String, PropertyUpdater> oozieEnvUpdaters = singleHostTopologyUpdaters.get("oozie-env");
+ if (oozieSiteUpdaters == null) {
+ oozieSiteUpdaters = new HashMap<>();
+ }
+ if (oozieEnvUpdaters == null) {
+ oozieEnvUpdaters = new HashMap<>();
+ }
+ oozieEnvUpdaters.put("oozie_existing_mysql_host", new SingleHostTopologyUpdater("OOZIE_SERVER"));
+ oozieEnvUpdaters.put("oozie_existing_oracle_host", new SingleHostTopologyUpdater("OOZIE_SERVER"));
+ oozieEnvUpdaters.put("oozie_existing_postgresql_host", new SingleHostTopologyUpdater("OOZIE_SERVER"));
+ oozieEnvUpdaters.put("oozie_existing_oracle_host", new SingleHostTopologyUpdater("OOZIE_SERVER"));
+ oozieEnvUpdaters.put("oozie_existing_postgresql_host", new SingleHostTopologyUpdater("OOZIE_SERVER"));
+ oozieSiteUpdaters.put("oozie.service.JPAService.jdbc.url", new SingleHostTopologyUpdater("OOZIE_SERVER"));
+
+ singleHostTopologyUpdaters.put("oozie-env", oozieEnvUpdaters);
+ singleHostTopologyUpdaters.put("oozie-site", oozieSiteUpdaters);
+ } else {
+ Map<String, PropertyUpdater> oozieEnvOriginalValueMap = new HashMap<String, PropertyUpdater>();
+ Map<String, PropertyUpdater> oozieSiteOriginalValueMap = new HashMap<String, PropertyUpdater>();
+ // register updaters for Oozie properties that may point to an external DB
+ oozieEnvOriginalValueMap.put("oozie_existing_mysql_host", new OriginalValuePropertyUpdater());
+ oozieEnvOriginalValueMap.put("oozie_existing_oracle_host", new OriginalValuePropertyUpdater());
+ oozieEnvOriginalValueMap.put("oozie_existing_postgresql_host", new OriginalValuePropertyUpdater());
+ oozieEnvOriginalValueMap.put("oozie_existing_oracle_host", new OriginalValuePropertyUpdater());
+ oozieEnvOriginalValueMap.put("oozie_existing_postgresql_host", new OriginalValuePropertyUpdater());
+ oozieSiteOriginalValueMap.put("oozie.service.JPAService.jdbc.url", new OriginalValuePropertyUpdater());
+
+ removePropertyUpdaters.put("oozie-env", oozieEnvOriginalValueMap);
+ removePropertyUpdaters.put("oozie-site", oozieSiteOriginalValueMap);
+ }
+
+ Map<String, PropertyUpdater> hiveEnvOriginalValueMap = new HashMap<String, PropertyUpdater>();
+ // register updaters for Hive properties that may point to an external DB
+ hiveEnvOriginalValueMap.put("hive_existing_oracle_host", new OriginalValuePropertyUpdater());
+ hiveEnvOriginalValueMap.put("hive_existing_mssql_server_2_host", new OriginalValuePropertyUpdater());
+ hiveEnvOriginalValueMap.put("hive_existing_mssql_server_host", new OriginalValuePropertyUpdater());
+ hiveEnvOriginalValueMap.put("hive_existing_postgresql_host", new OriginalValuePropertyUpdater());
+ hiveEnvOriginalValueMap.put("hive_existing_mysql_host", new OriginalValuePropertyUpdater());
+
+ removePropertyUpdaters.put("hive-env", hiveEnvOriginalValueMap);
+
+ }
+
+ private boolean containsHostFromHostGroups(String configType, String propertyName) {
+ String propertyValue = clusterTopology.getConfiguration().getPropertyValue(configType, propertyName);
+ if (StringUtils.isEmpty(propertyValue)) {
+ return false;
+ }
+ // check fir bp import
+ Matcher m = HostGroup.HOSTGROUP_REGEX.matcher(propertyValue);
+ if (m.find()) {
+ return true;
+ }
+
+ // check for bp export
+ for (HostGroupInfo groupInfo : clusterTopology.getHostGroupInfo().values()) {
+ Collection<String> hosts = groupInfo.getHostNames();
+ for (String host : hosts) {
+ if (propertyValue.contains(host)) {
+ return true;
+ }
+ }
+ }
+ return false;
}
public Collection<String> getRequiredHostGroups() {
@@ -2274,7 +2349,6 @@ public class BlueprintConfigurationProcessor {
Map<String, PropertyUpdater> hiveInteractiveSiteMap = new HashMap<String, PropertyUpdater>();
Map<String, PropertyUpdater> oozieEnvMap = new HashMap<String, PropertyUpdater>();
Map<String, PropertyUpdater> oozieEnvHeapSizeMap = new HashMap<String, PropertyUpdater>();
- Map<String, PropertyUpdater> oozieEnvOriginalValueMap = new HashMap<String, PropertyUpdater>();
Map<String, PropertyUpdater> multiWebhcatSiteMap = new HashMap<String, PropertyUpdater>();
Map<String, PropertyUpdater> multiHbaseSiteMap = new HashMap<String, PropertyUpdater>();
Map<String, PropertyUpdater> multiStormSiteMap = new HashMap<String, PropertyUpdater>();
@@ -2309,7 +2383,6 @@ public class BlueprintConfigurationProcessor {
singleHostTopologyUpdaters.put("yarn-site", yarnSiteMap);
singleHostTopologyUpdaters.put("hive-site", hiveSiteMap);
singleHostTopologyUpdaters.put("hive-interactive-env", hiveInteractiveEnvMap);
- singleHostTopologyUpdaters.put("oozie-site", oozieSiteMap);
singleHostTopologyUpdaters.put("storm-site", stormSiteMap);
singleHostTopologyUpdaters.put("accumulo-site", accumuloSiteMap);
singleHostTopologyUpdaters.put("falcon-startup.properties", falconStartupPropertiesMap);
@@ -2354,10 +2427,6 @@ public class BlueprintConfigurationProcessor {
dbHostTopologyUpdaters.put("hive-site", dbHiveSiteMap);
- removePropertyUpdaters.put("oozie-env", oozieEnvOriginalValueMap);
- removePropertyUpdaters.put("oozie-site", oozieSiteOriginalValueMap);
- removePropertyUpdaters.put("hive-env", hiveEnvOriginalValueMap);
-
nonTopologyUpdaters.put("hive-site", hiveSiteNonTopologyMap);
nonTopologyUpdaters.put("kafka-broker", kafkaBrokerNonTopologyMap);
nonTopologyUpdaters.put("storm-site", stormSiteNonTopologyMap);
@@ -2535,25 +2604,17 @@ public class BlueprintConfigurationProcessor {
// OOZIE_SERVER
- oozieSiteMap.put("oozie.base.url", new SingleHostTopologyUpdater("OOZIE_SERVER"));
- oozieSiteMap.put("oozie.authentication.kerberos.principal", new SingleHostTopologyUpdater("OOZIE_SERVER"));
- oozieSiteMap.put("oozie.ha.authentication.kerberos.principal", new SingleHostTopologyUpdater("OOZIE_SERVER"));
- oozieSiteMap.put("oozie.service.HadoopAccessorService.kerberos.principal", new SingleHostTopologyUpdater("OOZIE_SERVER"));
- multiCoreSiteMap.put("hadoop.proxyuser.oozie.hosts", new MultipleHostTopologyUpdater("OOZIE_SERVER"));
+ Map<String, PropertyUpdater> oozieStringPropertyUpdaterMap = singleHostTopologyUpdaters.get("oozie-site");
+ if (oozieStringPropertyUpdaterMap == null) {
+ oozieStringPropertyUpdaterMap = new HashMap<>();
+ }
+ oozieStringPropertyUpdaterMap.put("oozie.base.url", new SingleHostTopologyUpdater("OOZIE_SERVER"));
+ oozieStringPropertyUpdaterMap.put("oozie.authentication.kerberos.principal", new SingleHostTopologyUpdater("OOZIE_SERVER"));
+ oozieStringPropertyUpdaterMap.put("oozie.ha.authentication.kerberos.principal", new SingleHostTopologyUpdater("OOZIE_SERVER"));
+ oozieStringPropertyUpdaterMap.put("oozie.service.HadoopAccessorService.kerberos.principal", new SingleHostTopologyUpdater("OOZIE_SERVER"));
+ singleHostTopologyUpdaters.put("oozie-site", oozieStringPropertyUpdaterMap);
- // register updaters for Oozie properties that may point to an external DB
- oozieEnvOriginalValueMap.put("oozie_existing_mysql_host", new OriginalValuePropertyUpdater());
- oozieEnvOriginalValueMap.put("oozie_existing_oracle_host", new OriginalValuePropertyUpdater());
- oozieEnvOriginalValueMap.put("oozie_existing_postgresql_host", new OriginalValuePropertyUpdater());
- oozieEnvOriginalValueMap.put("oozie_existing_oracle_host", new OriginalValuePropertyUpdater());
- oozieEnvOriginalValueMap.put("oozie_existing_postgresql_host", new OriginalValuePropertyUpdater());
- oozieSiteOriginalValueMap.put("oozie.service.JPAService.jdbc.url", new OriginalValuePropertyUpdater());
- // register updaters for Hive properties that may point to an external DB
- hiveEnvOriginalValueMap.put("hive_existing_oracle_host", new OriginalValuePropertyUpdater());
- hiveEnvOriginalValueMap.put("hive_existing_mssql_server_2_host", new OriginalValuePropertyUpdater());
- hiveEnvOriginalValueMap.put("hive_existing_mssql_server_host", new OriginalValuePropertyUpdater());
- hiveEnvOriginalValueMap.put("hive_existing_postgresql_host", new OriginalValuePropertyUpdater());
- hiveEnvOriginalValueMap.put("hive_existing_mysql_host", new OriginalValuePropertyUpdater());
+ multiCoreSiteMap.put("hadoop.proxyuser.oozie.hosts", new MultipleHostTopologyUpdater("OOZIE_SERVER"));
// ZOOKEEPER_SERVER
multiHbaseSiteMap.put("hbase.zookeeper.quorum", new MultipleHostTopologyUpdater("ZOOKEEPER_SERVER"));
http://git-wip-us.apache.org/repos/asf/ambari/blob/58afcf93/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/BlueprintConfigurationProcessorTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/BlueprintConfigurationProcessorTest.java b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/BlueprintConfigurationProcessorTest.java
index 8a56da3..b49abe9 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/BlueprintConfigurationProcessorTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/BlueprintConfigurationProcessorTest.java
@@ -1700,6 +1700,10 @@ public class BlueprintConfigurationProcessorTest {
// call top-level export method
configProcessor.doUpdateForBlueprintExport();
+ // check that jdbc url and related properties are removed if oozie external db is on host which not included to cluster
+ assertFalse(BlueprintConfigurationProcessor.singleHostTopologyUpdaters.get("oozie-site").containsKey("oozie.service.JPAService.jdbc.url"));
+ assertTrue(configProcessor.getRemovePropertyUpdaters().get("oozie-site").containsKey("oozie.service.JPAService.jdbc.url"));
+
assertEquals("oozie property not exported correctly",
createExportedHostName(expectedHostGroupName), oozieSiteProperties.get("oozie.base.url"));
assertEquals("oozie property not exported correctly",
@@ -1726,6 +1730,84 @@ public class BlueprintConfigurationProcessorTest {
}
@Test
+ public void testOozieJDBCPropertiesNotRemoved() throws Exception {
+ final String expectedHostName = "c6401.apache.ambari.org";
+ final String expectedHostNameTwo = "c6402.ambari.apache.org";
+ final String expectedHostGroupName = "host_group_1";
+ final String expectedHostGroupNameTwo = "host_group_2";
+ final String expectedPortNum = "80000";
+
+ Map<String, Map<String, String>> configProperties = new HashMap<String, Map<String, String>>();
+ Map<String, String> oozieSiteProperties = new HashMap<String, String>();
+
+ configProperties.put("oozie-site", oozieSiteProperties);
+
+ oozieSiteProperties.put("oozie.service.JPAService.jdbc.url", "jdbc:mysql://" + expectedHostNameTwo + "/ooziedb");
+
+ Configuration clusterConfig = new Configuration(configProperties, Collections.<String, Map<String, Map<String, String>>>emptyMap());
+ Collection<String> hgComponents = new HashSet<String>();
+ hgComponents.add("OOZIE_SERVER");
+ hgComponents.add("ZOOKEEPER_SERVER");
+ TestHostGroup group1 = new TestHostGroup(expectedHostGroupName, hgComponents, Collections.singleton(expectedHostName));
+
+ Collection<String> hgComponents2 = new HashSet<String>();
+ hgComponents2.add("OOZIE_SERVER");
+ hgComponents2.add("ZOOKEEPER_SERVER");
+ TestHostGroup group2 = new TestHostGroup(expectedHostGroupNameTwo, hgComponents2, Collections.singleton(expectedHostNameTwo));
+
+ Collection<TestHostGroup> hostGroups = new HashSet<TestHostGroup>();
+ hostGroups.add(group1);
+ hostGroups.add(group2);
+
+ expect(stack.getCardinality("OOZIE_SERVER")).andReturn(new Cardinality("1+")).anyTimes();
+
+ ClusterTopology topology = createClusterTopology(bp, clusterConfig, hostGroups);
+ BlueprintConfigurationProcessor blueprintConfigurationProcessor = new BlueprintConfigurationProcessor(topology);
+
+ assertTrue(BlueprintConfigurationProcessor.singleHostTopologyUpdaters.get("oozie-site").containsKey("oozie.service.JPAService.jdbc.url"));
+ assertNull(blueprintConfigurationProcessor.getRemovePropertyUpdaters().get("oozie-site"));
+ }
+
+ @Test
+ public void testOozieJDBCPropertyAddedToSingleHostMapDuringImport() throws Exception {
+ final String expectedHostName = "c6401.apache.ambari.org";
+ final String expectedHostNameTwo = "c6402.ambari.apache.org";
+ final String expectedHostGroupName = "host_group_1";
+ final String expectedHostGroupNameTwo = "host_group_2";
+ final String expectedPortNum = "80000";
+
+ Map<String, Map<String, String>> configProperties = new HashMap<String, Map<String, String>>();
+ Map<String, String> oozieSiteProperties = new HashMap<String, String>();
+
+ configProperties.put("oozie-site", oozieSiteProperties);
+
+ oozieSiteProperties.put("oozie.service.JPAService.jdbc.url", "jdbc:mysql://" + "%HOSTGROUP::group1%" + "/ooziedb");
+
+ Configuration clusterConfig = new Configuration(configProperties, Collections.<String, Map<String, Map<String, String>>>emptyMap());
+ Collection<String> hgComponents = new HashSet<String>();
+ hgComponents.add("OOZIE_SERVER");
+ hgComponents.add("ZOOKEEPER_SERVER");
+ TestHostGroup group1 = new TestHostGroup(expectedHostGroupName, hgComponents, Collections.singleton(expectedHostName));
+
+ Collection<String> hgComponents2 = new HashSet<String>();
+ hgComponents2.add("OOZIE_SERVER");
+ hgComponents2.add("ZOOKEEPER_SERVER");
+ TestHostGroup group2 = new TestHostGroup(expectedHostGroupNameTwo, hgComponents2, Collections.singleton(expectedHostNameTwo));
+
+ Collection<TestHostGroup> hostGroups = new HashSet<TestHostGroup>();
+ hostGroups.add(group1);
+ hostGroups.add(group2);
+
+ expect(stack.getCardinality("OOZIE_SERVER")).andReturn(new Cardinality("1+")).anyTimes();
+
+ ClusterTopology topology = createClusterTopology(bp, clusterConfig, hostGroups);
+ BlueprintConfigurationProcessor blueprintConfigurationProcessor = new BlueprintConfigurationProcessor(topology);
+
+ assertTrue(BlueprintConfigurationProcessor.singleHostTopologyUpdaters.get("oozie-site").containsKey("oozie.service.JPAService.jdbc.url"));
+ assertNull(blueprintConfigurationProcessor.getRemovePropertyUpdaters().get("oozie-site"));
+ }
+
+ @Test
public void testZookeeperConfigExported() throws Exception {
final String expectedHostName = "c6401.apache.ambari.org";
final String expectedHostNameTwo = "c6402.ambari.apache.org";
[03/11] ambari git commit: AMBARI-18563. Ambari startup script
doesn't work on SUSE and potentially other OS's. (aonishuk)
Posted by jo...@apache.org.
AMBARI-18563. Ambari startup script doesn't work on SUSE and potentially other OS's. (aonishuk)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/a80c5a2d
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/a80c5a2d
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/a80c5a2d
Branch: refs/heads/branch-feature-AMBARI-18456
Commit: a80c5a2dbaa0c48f7df87dae6a23a027c2ab6022
Parents: 2d1d5f9
Author: Andrew Onishuk <ao...@hortonworks.com>
Authored: Mon Oct 10 17:52:36 2016 +0300
Committer: Andrew Onishuk <ao...@hortonworks.com>
Committed: Mon Oct 10 17:52:36 2016 +0300
----------------------------------------------------------------------
ambari-server/conf/unix/install-helper.sh | 1 +
ambari-server/sbin/ambari-server | 4 +++-
2 files changed, 4 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/a80c5a2d/ambari-server/conf/unix/install-helper.sh
----------------------------------------------------------------------
diff --git a/ambari-server/conf/unix/install-helper.sh b/ambari-server/conf/unix/install-helper.sh
index 229e146..34ec0e9 100644
--- a/ambari-server/conf/unix/install-helper.sh
+++ b/ambari-server/conf/unix/install-helper.sh
@@ -102,6 +102,7 @@ do_install(){
sed -i "s|ambari.root.dir\s*=\s*/|ambari.root.dir=${ROOT}|g" "$AMBARI_LOG4J"
sed -i "s|root_dir\s*=\s*/|root_dir = ${ROOT}|g" "$CA_CONFIG"
+ sed -i "s|^ROOT=\"/\"$|ROOT=\"${ROOT}\"|g" "$AMBARI_SERVER_EXECUTABLE"
AUTOSTART_SERVER_CMD=""
which chkconfig > /dev/null 2>&1
http://git-wip-us.apache.org/repos/asf/ambari/blob/a80c5a2d/ambari-server/sbin/ambari-server
----------------------------------------------------------------------
diff --git a/ambari-server/sbin/ambari-server b/ambari-server/sbin/ambari-server
index 762ae19..bdbdd0f 100755
--- a/ambari-server/sbin/ambari-server
+++ b/ambari-server/sbin/ambari-server
@@ -44,8 +44,10 @@ case "${1:-}" in
esac
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
-export ROOT=`dirname $(dirname $SCRIPT_DIR)`
+# the below line (ROOT="/") is replaced by install-helper.sh. Don't edit/remove it.
+ROOT="/"
ROOT=`echo $ROOT | sed 's/\/$//'`
+export ROOT
export PATH=$ROOT/usr/lib/ambari-server/*:$PATH:/sbin/:/usr/sbin
export AMBARI_CONF_DIR=$ROOT/etc/ambari-server/conf
[09/11] ambari git commit: AMBARI-18534 Advanced
storm-atlas-application.properties panel is not opened by default upon
filtering (Vivek Ratnavel Subramanian via zhewang)
Posted by jo...@apache.org.
AMBARI-18534 Advanced storm-atlas-application.properties panel is not opened by default upon filtering (Vivek Ratnavel Subramanian via zhewang)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/8f51c932
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/8f51c932
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/8f51c932
Branch: refs/heads/branch-feature-AMBARI-18456
Commit: 8f51c9324a407fa8ce8e92e2e77ee0a250c5cbc9
Parents: 0d7689d
Author: Zhe (Joe) Wang <zh...@apache.org>
Authored: Mon Oct 10 16:13:09 2016 -0700
Committer: Zhe (Joe) Wang <zh...@apache.org>
Committed: Mon Oct 10 16:13:09 2016 -0700
----------------------------------------------------------------------
.../common/configs/service_configs_by_category_view.js | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/8f51c932/ambari-web/app/views/common/configs/service_configs_by_category_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/common/configs/service_configs_by_category_view.js b/ambari-web/app/views/common/configs/service_configs_by_category_view.js
index 3eebfea..d9a4c5c 100644
--- a/ambari-web/app/views/common/configs/service_configs_by_category_view.js
+++ b/ambari-web/app/views/common/configs/service_configs_by_category_view.js
@@ -305,7 +305,7 @@ App.ServiceConfigsByCategoryView = Em.View.extend(App.UserPref, App.ConfigOverri
*/
filteredCategoryConfigs: function () {
Em.run.once(this, 'collapseCategory');
- }.observes('categoryConfigs.@each.isHiddenByFilter'),
+ }.observes('serviceConfigs.@each.isHiddenByFilter'),
collapseCategory: function () {
if (this.get('state') === 'destroyed') return;
@@ -330,7 +330,15 @@ App.ServiceConfigsByCategoryView = Em.View.extend(App.UserPref, App.ConfigOverri
} else if (isInitialRendering && !filteredResult.length) {
this.set('category.isCollapsed', true);
}
- var categoryBlock = $('.' + this.get('category.name').split(' ').join('.') + '>.accordion-body');
+ var classNames = this.get('category.name').split(' ');
+ // Escape the dots in category names
+ classNames = classNames.map(function(className) {
+ if(className.indexOf(".")) {
+ className = className.split(".").join("\\.");
+ }
+ return className;
+ });
+ var categoryBlock = $('.' + classNames.join('.') + '>.accordion-body');
this.get('category.isCollapsed') ? categoryBlock.hide() : categoryBlock.show();
},
[06/11] ambari git commit: AMBARI-18538. Microsoft R Server management pack should support for Redhat 7 (Balázs Bence Sári via magyari_sandor)
Posted by jo...@apache.org.
AMBARI-18538. Microsoft R Server management pack should support for Redhat 7 (Bal�zs Bence S�ri 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/24161edf
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/24161edf
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/24161edf
Branch: refs/heads/branch-feature-AMBARI-18456
Commit: 24161edf9f8a81592b120640bfa75a6ef3b1e0a1
Parents: 0a61db5
Author: Bal�zs Bence S�ri <bs...@hortonworks.com>
Authored: Mon Oct 10 17:37:09 2016 +0200
Committer: Sandor Magyari <sm...@hortonworks.com>
Committed: Mon Oct 10 17:37:09 2016 +0200
----------------------------------------------------------------------
.../custom-services/MICROSOFT_R/8.0.5/repos/repoinfo.xml | 7 +++++++
1 file changed, 7 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/24161edf/contrib/management-packs/microsoft-r_mpack/src/main/resources/custom-services/MICROSOFT_R/8.0.5/repos/repoinfo.xml
----------------------------------------------------------------------
diff --git a/contrib/management-packs/microsoft-r_mpack/src/main/resources/custom-services/MICROSOFT_R/8.0.5/repos/repoinfo.xml b/contrib/management-packs/microsoft-r_mpack/src/main/resources/custom-services/MICROSOFT_R/8.0.5/repos/repoinfo.xml
index deb58de..fac533d 100644
--- a/contrib/management-packs/microsoft-r_mpack/src/main/resources/custom-services/MICROSOFT_R/8.0.5/repos/repoinfo.xml
+++ b/contrib/management-packs/microsoft-r_mpack/src/main/resources/custom-services/MICROSOFT_R/8.0.5/repos/repoinfo.xml
@@ -23,6 +23,13 @@
<reponame>MSFT_R</reponame>
</repo>
</os>
+ <os family="redhat7">
+ <repo>
+ <baseurl>http://PLEASE_ENTER_REPO_URL</baseurl>
+ <repoid>MSFT_R-8.0</repoid>
+ <reponame>MSFT_R</reponame>
+ </repo>
+ </os>
<os family="suse11">
<repo>
<baseurl>http://PLEASE_ENTER_REPO_URL</baseurl>
[07/11] ambari git commit: AMBARI-18562 Cannot update repository on
the UI. (atkach)
Posted by jo...@apache.org.
AMBARI-18562 Cannot update repository on the UI. (atkach)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/da7b2ae1
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/da7b2ae1
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/da7b2ae1
Branch: refs/heads/branch-feature-AMBARI-18456
Commit: da7b2ae1f72dc3e264e2ad0919fe6204de9d9b97
Parents: 24161ed
Author: Andrii Tkach <at...@apache.org>
Authored: Mon Oct 10 16:44:35 2016 +0300
Committer: Andrii Tkach <at...@apache.org>
Committed: Mon Oct 10 18:42:54 2016 +0300
----------------------------------------------------------------------
.../main/admin/stack_and_upgrade_controller.js | 56 ++++++++++++--------
.../admin/stack_and_upgrade_controller_test.js | 45 +++++++++++-----
2 files changed, 66 insertions(+), 35 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/da7b2ae1/ambari-web/app/controllers/main/admin/stack_and_upgrade_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/admin/stack_and_upgrade_controller.js b/ambari-web/app/controllers/main/admin/stack_and_upgrade_controller.js
index 56a7a61..d00a652 100644
--- a/ambari-web/app/controllers/main/admin/stack_and_upgrade_controller.js
+++ b/ambari-web/app/controllers/main/admin/stack_and_upgrade_controller.js
@@ -1484,38 +1484,48 @@ App.MainAdminStackAndUpgradeController = Em.Controller.extend(App.LocalStorage,
if (os.get('isSelected')) {
os.get('repositories').forEach(function (repo) {
totalCalls++;
- App.ajax.send({
- name: 'admin.stack_versions.validate.repo',
- sender: this,
- data: {
- repo: repo,
- repoId: repo.get('repoId'),
- baseUrl: repo.get('baseUrl'),
- osType: os.get('osType'),
- stackName: App.get('currentStackName'),
- stackVersion: stackVersionNumber
- }
+ this.validationCall(repo, os, stackVersionNumber)
+ .success(function () {
+ totalCalls--;
+ if (totalCalls === 0) deferred.resolve(invalidUrls);
})
- .success(function () {
- totalCalls--;
- if (totalCalls === 0) deferred.resolve(invalidUrls);
- })
- .error(function () {
- repo.set('hasError', true);
- invalidUrls.push(repo);
- totalCalls--;
- if (totalCalls === 0) deferred.resolve(invalidUrls);
- });
- });
+ .error(function () {
+ repo.set('hasError', true);
+ invalidUrls.push(repo);
+ totalCalls--;
+ if (totalCalls === 0) deferred.resolve(invalidUrls);
+ });
+ }, this);
} else {
return deferred.resolve(invalidUrls);
}
- });
+ }, this);
}
return deferred.promise();
},
/**
+ *
+ * @param {Em.Object} repo
+ * @param {Em.Object} os
+ * @param {string} stackVersionNumber
+ */
+ validationCall: function(repo, os, stackVersionNumber) {
+ return App.ajax.send({
+ name: 'admin.stack_versions.validate.repo',
+ sender: this,
+ data: {
+ repo: repo,
+ repoId: repo.get('repoId'),
+ baseUrl: repo.get('baseUrl'),
+ osType: os.get('osType'),
+ stackName: App.get('currentStackName'),
+ stackVersion: stackVersionNumber
+ }
+ })
+ },
+
+ /**
* success callback for <code>installRepoVersion()<code>
* saves request id to the db
* @param data
http://git-wip-us.apache.org/repos/asf/ambari/blob/da7b2ae1/ambari-web/test/controllers/main/admin/stack_and_upgrade_controller_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/main/admin/stack_and_upgrade_controller_test.js b/ambari-web/test/controllers/main/admin/stack_and_upgrade_controller_test.js
index 12d0da3..be4a3b0 100644
--- a/ambari-web/test/controllers/main/admin/stack_and_upgrade_controller_test.js
+++ b/ambari-web/test/controllers/main/admin/stack_and_upgrade_controller_test.js
@@ -1404,24 +1404,45 @@ describe('App.MainAdminStackAndUpgradeController', function() {
describe("#validateRepoVersions()", function () {
- it("skip validation", function () {
+ beforeEach(function() {
+ sinon.stub(controller, 'validationCall').returns({
+ success: function() {
+ return {error: Em.K}
+ }
+ });
+ sinon.stub(controller, 'getStackVersionNumber').returns('v1')
+ });
+
+ afterEach(function() {
+ controller.validationCall.restore();
+ controller.getStackVersionNumber.restore();
+ });
+
+
+ it("validationCall should not be called", function () {
controller.validateRepoVersions(Em.Object.create({repoVersionId: 1}), true);
- var args = testHelpers.findAjaxRequest('name', 'admin.stack_versions.validate.repo');
- expect(args).to.not.exists;
+ expect(controller.validationCall.called).to.be.false;
});
- it("do validation", function () {
+ it("validationCall should be called", function () {
+ var os = Em.Object.create({
+ isSelected: true,
+ repositories: [
+ Em.Object.create()
+ ]
+ });
var repo = Em.Object.create({
repoVersionId: 1,
- operatingSystems: [
- Em.Object.create({
- isSelected: true,
- repositories: [
- Em.Object.create()
- ]
- })
- ]
+ operatingSystems: [ os ]
});
controller.validateRepoVersions(repo, false);
+ expect(controller.validationCall.calledOnce).to.be.true;
+ });
+ });
+
+ describe("#validationCall()", function () {
+
+ it("App.ajax.send should be called", function() {
+ controller.validationCall(Em.Object.create(), Em.Object.create(), 'v1');
var args = testHelpers.findAjaxRequest('name', 'admin.stack_versions.validate.repo');
expect(args[0]).to.exists;
});
[08/11] ambari git commit: AMBARI-18554. Improve package handling in Microsoft R Server Mpack (Balázs Bence Sári via magyari_sandor)
Posted by jo...@apache.org.
AMBARI-18554. Improve package handling in Microsoft R Server Mpack (Bal�zs Bence S�ri 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/0d7689d8
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/0d7689d8
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/0d7689d8
Branch: refs/heads/branch-feature-AMBARI-18456
Commit: 0d7689d844c1099facc6f6c6c10ba19f786de28a
Parents: da7b2ae
Author: Bal�zs Bence S�ri <bs...@hortonworks.com>
Authored: Mon Oct 10 17:49:51 2016 +0200
Committer: Sandor Magyari <sm...@hortonworks.com>
Committed: Mon Oct 10 17:49:51 2016 +0200
----------------------------------------------------------------------
.../8.0.5/package/scripts/microsoft_r.py | 11 +----------
.../MICROSOFT_R/8.0.5/metainfo.xml | 19 +++++++++++++++++++
2 files changed, 20 insertions(+), 10 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/0d7689d8/contrib/management-packs/microsoft-r_mpack/src/main/resources/common-services/MICROSOFT_R/8.0.5/package/scripts/microsoft_r.py
----------------------------------------------------------------------
diff --git a/contrib/management-packs/microsoft-r_mpack/src/main/resources/common-services/MICROSOFT_R/8.0.5/package/scripts/microsoft_r.py b/contrib/management-packs/microsoft-r_mpack/src/main/resources/common-services/MICROSOFT_R/8.0.5/package/scripts/microsoft_r.py
index 382bd0f..f6eb33e 100644
--- a/contrib/management-packs/microsoft-r_mpack/src/main/resources/common-services/MICROSOFT_R/8.0.5/package/scripts/microsoft_r.py
+++ b/contrib/management-packs/microsoft-r_mpack/src/main/resources/common-services/MICROSOFT_R/8.0.5/package/scripts/microsoft_r.py
@@ -22,22 +22,13 @@ from resource_management.core.logger import Logger
from resource_management.core.resources import Package
-rpms = ['microsoft-r-server-mro-8.0',
- 'microsoft-r-server-intel-mkl-8.0',
- 'microsoft-r-server-packages-8.0',
- 'microsoft-r-server-hadoop-8.0']
-
class MicrosoftR(Script):
def install(self, env):
Logger.info('Installing R Server Client...')
tmp_dir = Script.tmp_dir
Logger.debug('Using temp dir: {0}'.format(tmp_dir))
-
- for rpm in rpms:
- Logger.info('Installing {0}'.format(rpm))
- Package(rpm)
-
+ self.install_packages(env)
Logger.info('Installed R Server')
def configure(self, env):
http://git-wip-us.apache.org/repos/asf/ambari/blob/0d7689d8/contrib/management-packs/microsoft-r_mpack/src/main/resources/custom-services/MICROSOFT_R/8.0.5/metainfo.xml
----------------------------------------------------------------------
diff --git a/contrib/management-packs/microsoft-r_mpack/src/main/resources/custom-services/MICROSOFT_R/8.0.5/metainfo.xml b/contrib/management-packs/microsoft-r_mpack/src/main/resources/custom-services/MICROSOFT_R/8.0.5/metainfo.xml
index 31d5225..9470d22 100644
--- a/contrib/management-packs/microsoft-r_mpack/src/main/resources/custom-services/MICROSOFT_R/8.0.5/metainfo.xml
+++ b/contrib/management-packs/microsoft-r_mpack/src/main/resources/custom-services/MICROSOFT_R/8.0.5/metainfo.xml
@@ -23,6 +23,25 @@
<name>MICROSOFT_R</name>
<extends>common-services/MICROSOFT_R/8.0.5</extends>
<version>8.0.5.0</version>
+ <osSpecifics>
+ <osSpecific>
+ <osFamily>redhat6,redhat7,suse11</osFamily>
+ <packages>
+ <package>
+ <name>microsoft-r-server-mro-8.0</name>
+ </package>
+ <package>
+ <name>microsoft-r-server-intel-mkl-8.0</name>
+ </package>
+ <package>
+ <name>microsoft-r-server-packages-8.0</name>
+ </package>
+ <package>
+ <name>microsoft-r-server-hadoop-8.0</name>
+ </package>
+ </packages>
+ </osSpecific>
+ </osSpecifics>
</service>
</services>
</metainfo>
[10/11] ambari git commit: AMBARI-18559 At "Add Service Wizard",
when the installation is going on, if I click the close (X) on the wizard,
the service will only get INSTALLED not STARTED. (Vivek Ratnavel Subramanian
via zhewang)
Posted by jo...@apache.org.
AMBARI-18559 At "Add Service Wizard", when the installation is going on, if I click the close (X) on the wizard, the service will only get INSTALLED not STARTED. (Vivek Ratnavel Subramanian via zhewang)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/6587fda4
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/6587fda4
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/6587fda4
Branch: refs/heads/branch-feature-AMBARI-18456
Commit: 6587fda470bcf063027e55b315292018dc1e64b4
Parents: 8f51c93
Author: Zhe (Joe) Wang <zh...@apache.org>
Authored: Mon Oct 10 16:17:56 2016 -0700
Committer: Zhe (Joe) Wang <zh...@apache.org>
Committed: Mon Oct 10 16:17:56 2016 -0700
----------------------------------------------------------------------
ambari-web/app/messages.js | 1 +
ambari-web/app/routes/add_service_routes.js | 24 ++++++++++++++++++++++++
2 files changed, 25 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/6587fda4/ambari-web/app/messages.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/messages.js b/ambari-web/app/messages.js
index 5eafad2..7150081 100644
--- a/ambari-web/app/messages.js
+++ b/ambari-web/app/messages.js
@@ -2101,6 +2101,7 @@ Em.I18n.translations = {
'services.service.widgets.list-widget.nothingSelected': 'Nothing selected',
'services.add.header':'Add Service Wizard',
+ 'services.add.warning': 'Closing this dialog will continue to install the selected service(s) in the background, but the installed services need to be started manually. Are you sure you want to quit?',
'services.reassign.header':'Move Master Wizard',
'services.service.add':'Add Service',
'services.service.startAll':'Start All',
http://git-wip-us.apache.org/repos/asf/ambari/blob/6587fda4/ambari-web/app/routes/add_service_routes.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/routes/add_service_routes.js b/ambari-web/app/routes/add_service_routes.js
index 30c8e07..692d186 100644
--- a/ambari-web/app/routes/add_service_routes.js
+++ b/ambari-web/app/routes/add_service_routes.js
@@ -46,6 +46,16 @@ module.exports = App.WizardRoute.extend({
App.router.transitionTo('main.services.index');
},
onClose: function () {
+ var controller = router.get('addServiceController');
+ var currentStep = controller.get('currentStep');
+ if(currentStep == '7') {
+ // Show a warning popup
+ this.showWarningPopup();
+ } else {
+ this.afterWarning();
+ }
+ },
+ afterWarning: function () {
this.set('showCloseButton', false); // prevent user to click "Close" many times
App.router.get('updateController').set('isWorking', true);
App.router.get('updateController').updateServices(function () {
@@ -54,6 +64,20 @@ module.exports = App.WizardRoute.extend({
var exitPath = addServiceController.getDBProperty('onClosePath') || 'main.services.index';
addServiceController.resetOnClose(addServiceController, exitPath);
},
+ showWarningPopup: function() {
+ var mainPopupContext = this;
+ App.ModalPopup.show({
+ encodeBody: false,
+ header: Em.I18n.t('common.warning'),
+ primaryClass: 'btn-warning',
+ secondary: Em.I18n.t('form.cancel'),
+ body: Em.I18n.t('services.add.warning'),
+ onPrimary: function () {
+ this.hide();
+ mainPopupContext.afterWarning();
+ }
+ });
+ },
didInsertElement: function () {
this._super();
this.fitHeight();
[02/11] ambari git commit: AMBARI-18560. Add more logging to track
what condition resulted in skipping agent commands. (stoader)
Posted by jo...@apache.org.
AMBARI-18560. Add more logging to track what condition resulted in skipping agent commands. (stoader)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/2d1d5f9b
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/2d1d5f9b
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/2d1d5f9b
Branch: refs/heads/branch-feature-AMBARI-18456
Commit: 2d1d5f9b00e39a137c5aea8341436f408975cf82
Parents: 58afcf9
Author: Toader, Sebastian <st...@hortonworks.com>
Authored: Mon Oct 10 16:06:55 2016 +0200
Committer: Toader, Sebastian <st...@hortonworks.com>
Committed: Mon Oct 10 16:06:55 2016 +0200
----------------------------------------------------------------------
.../AmbariManagementControllerImpl.java | 2 +-
.../controller/ServiceComponentHostRequest.java | 4 +-
.../internal/HostComponentResourceProvider.java | 44 ++++++++++----------
3 files changed, 27 insertions(+), 23 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/2d1d5f9b/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java
index 1fc9dbf..ef4fc33 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java
@@ -2474,7 +2474,7 @@ public class AmbariManagementControllerImpl implements AmbariManagementControlle
if ((changedServices == null || changedServices.isEmpty())
&& (changedComps == null || changedComps.isEmpty())
&& (changedScHosts == null || changedScHosts.isEmpty())) {
- LOG.debug("Created 0 stages");
+ LOG.info("Created 0 stages");
return requestStages;
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/2d1d5f9b/ambari-server/src/main/java/org/apache/ambari/server/controller/ServiceComponentHostRequest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/ServiceComponentHostRequest.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/ServiceComponentHostRequest.java
index 73cedb4..4a07804 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/ServiceComponentHostRequest.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/ServiceComponentHostRequest.java
@@ -182,7 +182,9 @@ public class ServiceComponentHostRequest {
.append(", state=").append(state)
.append(", desiredStackId=").append(desiredStackId)
.append(", staleConfig=").append(staleConfig)
- .append(", adminState=").append(adminState).append("}");
+ .append(", adminState=").append(adminState)
+ .append(", maintenanceState=").append(maintenanceState)
+ .append("}");
return sb.toString();
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/2d1d5f9b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/HostComponentResourceProvider.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/HostComponentResourceProvider.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/HostComponentResourceProvider.java
index 85a4949..4f279c8 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/HostComponentResourceProvider.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/HostComponentResourceProvider.java
@@ -580,7 +580,7 @@ public class HostComponentResourceProvider extends AbstractControllerResourcePro
}
if (newState == null) {
- logComponentInfo("Nothing to do for new updateServiceComponentHost", request, oldState, null);
+ LOG.info(getServiceComponentRequestInfoLogMessage("Nothing to do for new updateServiceComponentHost", request, oldState, null));
continue;
}
@@ -594,7 +594,7 @@ public class HostComponentResourceProvider extends AbstractControllerResourcePro
if (sc.isClientComponent() && newState == State.STARTED &&
!requestProperties.containsKey(sch.getServiceComponentName().toLowerCase())) {
ignoredScHosts.add(sch);
- logComponentInfo("Ignoring ServiceComponentHost", request, sch.getState(), newState);
+ LOG.info(getServiceComponentRequestInfoLogMessage("Ignoring ServiceComponentHost as STARTED new desired state for client components is not valid", request, sch.getState(), newState));
continue;
}
@@ -610,13 +610,13 @@ public class HostComponentResourceProvider extends AbstractControllerResourcePro
!requestProperties.containsKey(sch.getServiceComponentName().toLowerCase())) {
ignoredScHosts.add(sch);
- logComponentInfo("Ignoring ServiceComponentHost", request, oldState, newState);
+ LOG.info(getServiceComponentRequestInfoLogMessage("Ignoring ServiceComponentHost as the current state matches the new desired state", request, oldState, newState));
continue;
}
if (! maintenanceStateHelper.isOperationAllowed(reqOpLvl, sch)) {
ignoredScHosts.add(sch);
- logComponentInfo("Ignoring ServiceComponentHost", request, oldState, newState);
+ LOG.info(getServiceComponentRequestInfoLogMessage("Ignoring ServiceComponentHost as operation is not allowed", request, oldState, newState));
continue;
}
@@ -632,7 +632,7 @@ public class HostComponentResourceProvider extends AbstractControllerResourcePro
}
if (isDirectTransition(oldSchState, newState)) {
- logComponentInfo("Handling direct transition update to host component", request, oldState, newState);
+ LOG.info(getServiceComponentRequestInfoLogMessage("Handling direct transition update to host component", request, oldState, newState));
directTransitionScHosts.put(sch, newState);
} else {
if (!changedScHosts.containsKey(sc.getName())) {
@@ -643,7 +643,7 @@ public class HostComponentResourceProvider extends AbstractControllerResourcePro
changedScHosts.get(sc.getName()).put(newState,
new ArrayList<ServiceComponentHost>());
}
- logComponentInfo("Handling update to host component", request, oldState, newState);
+ LOG.info(getServiceComponentRequestInfoLogMessage("Handling update to host component", request, oldState, newState));
changedScHosts.get(sc.getName()).get(newState).add(sch);
}
}
@@ -937,22 +937,24 @@ public class HostComponentResourceProvider extends AbstractControllerResourcePro
}
/**
- * Logs component info.
- *
- * @param msg base log msg
- * @param request the request to log
- * @param oldState current state
- * @param newDesiredState new desired state
+ * Constructs INFO level log message for {@link ServiceComponentHostRequest}
+ * @param msg base message
+ * @param request the request to construct the log message for
+ * @param oldState current state of the service host component that the request is for.
+ * @param newDesiredState new desired state for the service host component
*/
- private void logComponentInfo(String msg, ServiceComponentHostRequest request, State oldState, State newDesiredState) {
- LOG.debug("{}, clusterName={}, serviceName={}, componentName={}, hostname={}, currentState={}, newDesiredState={}",
- msg,
- request.getClusterName(),
- request.getServiceName(),
- request.getComponentName(),
- request.getHostname(),
- oldState == null ? "null" : oldState,
- newDesiredState == null ? "null" : newDesiredState);
+ private String getServiceComponentRequestInfoLogMessage(String msg, ServiceComponentHostRequest request, State oldState, State newDesiredState) {
+ StringBuilder sb = new StringBuilder();
+
+ sb.append(msg)
+ .append(", clusterName=").append(request.getClusterName())
+ .append(", serviceName=").append(request.getServiceName())
+ .append(", componentName=").append(request.getComponentName())
+ .append(", hostname=").append(request.getHostname())
+ .append(", currentState=").append(oldState == null ? "null" : oldState)
+ .append(", newDesiredState=").append(newDesiredState == null ? "null" : newDesiredState);
+
+ return sb.toString();
}
/**
[05/11] ambari git commit: AMBARI-18545. Kerberos server actions
should not timeout in minutes as specified in configuration (rlevas)
Posted by jo...@apache.org.
AMBARI-18545. Kerberos server actions should not timeout in minutes as specified in configuration (rlevas)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/0a61db56
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/0a61db56
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/0a61db56
Branch: refs/heads/branch-feature-AMBARI-18456
Commit: 0a61db5666f3ee8b82cdab0d50a1c8450b177ae7
Parents: 34c5686
Author: Robert Levas <rl...@hortonworks.com>
Authored: Mon Oct 10 11:16:01 2016 -0400
Committer: Robert Levas <rl...@hortonworks.com>
Committed: Mon Oct 10 11:16:01 2016 -0400
----------------------------------------------------------------------
.../apache/ambari/server/controller/KerberosHelperImpl.java | 6 +++---
.../org/apache/ambari/server/serveraction/ServerAction.java | 6 ++++++
2 files changed, 9 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/0a61db56/ambari-server/src/main/java/org/apache/ambari/server/controller/KerberosHelperImpl.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/KerberosHelperImpl.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/KerberosHelperImpl.java
index cd4a0b5..e15965b 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/KerberosHelperImpl.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/KerberosHelperImpl.java
@@ -2890,7 +2890,7 @@ public class KerberosHelperImpl implements KerberosHelper {
event,
commandParameters,
"Create Principals",
- configuration.getDefaultServerTaskTimeout());
+ Math.max(ServerAction.DEFAULT_LONG_RUNNING_TASK_TIMEOUT_SECONDS, configuration.getDefaultServerTaskTimeout()));
RoleGraph roleGraph = roleGraphFactory.createNew(roleCommandOrder);
roleGraph.build(stage);
@@ -2913,7 +2913,7 @@ public class KerberosHelperImpl implements KerberosHelper {
event,
commandParameters,
"Destroy Principals",
- configuration.getDefaultServerTaskTimeout());
+ Math.max(ServerAction.DEFAULT_LONG_RUNNING_TASK_TIMEOUT_SECONDS, configuration.getDefaultServerTaskTimeout()));
RoleGraph roleGraph = roleGraphFactory.createNew(roleCommandOrder);
roleGraph.build(stage);
@@ -2959,7 +2959,7 @@ public class KerberosHelperImpl implements KerberosHelper {
event,
commandParameters,
"Create Keytabs",
- configuration.getDefaultServerTaskTimeout());
+ Math.max(ServerAction.DEFAULT_LONG_RUNNING_TASK_TIMEOUT_SECONDS, configuration.getDefaultServerTaskTimeout()));
RoleGraph roleGraph = roleGraphFactory.createNew(roleCommandOrder);
roleGraph.build(stage);
http://git-wip-us.apache.org/repos/asf/ambari/blob/0a61db56/ambari-server/src/main/java/org/apache/ambari/server/serveraction/ServerAction.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/serveraction/ServerAction.java b/ambari-server/src/main/java/org/apache/ambari/server/serveraction/ServerAction.java
index b9bf5ce..7c69f52 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/serveraction/ServerAction.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/serveraction/ServerAction.java
@@ -33,6 +33,12 @@ public interface ServerAction {
public static final String ACTION_NAME = "ACTION_NAME";
public static final String ACTION_USER_NAME = "ACTION_USER_NAME";
+ /**
+ * The default timeout (in seconds) to use for potentially long running tasks such as creating
+ * Kerberos principals and generating Kerberos keytab files
+ */
+ int DEFAULT_LONG_RUNNING_TASK_TIMEOUT_SECONDS = 36000;
+
/**
* Gets the ExecutionCommand property of this ServerAction.
[04/11] ambari git commit: AMBARI-17311. Modify HTTP headers to
follow best security practices (Sangeeta Ravindran via rlevas)
Posted by jo...@apache.org.
AMBARI-17311. Modify HTTP headers to follow best security practices (Sangeeta Ravindran via rlevas)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/34c5686c
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/34c5686c
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/34c5686c
Branch: refs/heads/branch-feature-AMBARI-18456
Commit: 34c5686c3a0f80a5c7b78ddf05bb41cb13202438
Parents: a80c5a2
Author: Sangeeta Ravindran <sa...@gmail.com>
Authored: Mon Oct 10 11:05:40 2016 -0400
Committer: Robert Levas <rl...@hortonworks.com>
Committed: Mon Oct 10 11:09:58 2016 -0400
----------------------------------------------------------------------
ambari-server/conf/unix/ambari.properties | 6 +
ambari-server/conf/windows/ambari.properties | 6 +
.../server/configuration/Configuration.java | 135 +++++++++++++++++++
.../security/AbstractSecurityHeaderFilter.java | 43 ++++++
.../AmbariServerSecurityHeaderFilter.java | 3 +
.../AmbariViewsSecurityHeaderFilter.java | 3 +
.../AbstractSecurityHeaderFilterTest.java | 38 +++++-
.../AmbariServerSecurityHeaderFilterTest.java | 7 +
.../AmbariViewsSecurityHeaderFilterTest.java | 6 +
9 files changed, 246 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/34c5686c/ambari-server/conf/unix/ambari.properties
----------------------------------------------------------------------
diff --git a/ambari-server/conf/unix/ambari.properties b/ambari-server/conf/unix/ambari.properties
index 4dcbe99..371653f 100644
--- a/ambari-server/conf/unix/ambari.properties
+++ b/ambari-server/conf/unix/ambari.properties
@@ -113,11 +113,17 @@ rolling.upgrade.skip.packages.prefixes=
http.strict-transport-security=max-age=31536000
http.x-xss-protection=1; mode=block
http.x-frame-options=DENY
+http.x-content-type-options=nosniff
+http.cache-control=no-store
+http.pragma=no-cache
# HTTP Header settings for Ambari Views
views.http.strict-transport-security=max-age=31536000
views.http.x-xss-protection=1; mode=block
views.http.x-frame-options=SAMEORIGIN
+views.http.x-content-type-options=nosniff
+views.http.cache-control=no-store
+views.http.pragma=no-cache
mpacks.staging.path=$ROOT/var/lib/ambari-server/resources/mpacks
http://git-wip-us.apache.org/repos/asf/ambari/blob/34c5686c/ambari-server/conf/windows/ambari.properties
----------------------------------------------------------------------
diff --git a/ambari-server/conf/windows/ambari.properties b/ambari-server/conf/windows/ambari.properties
index 64cce3b..c1c0a99 100644
--- a/ambari-server/conf/windows/ambari.properties
+++ b/ambari-server/conf/windows/ambari.properties
@@ -93,10 +93,16 @@ ulimit.open.files=10000
http.strict-transport-security=max-age=31536000
http.x-xss-protection=1; mode=block
http.x-frame-options=DENY
+http.x-content-type-options=nosniff
+http.cache-control=no-store
+http.pragma=no-cache
# HTTP Header settings for Ambari Views
views.http.strict-transport-security=max-age=31536000
views.http.x-xss-protection=1; mode=block
views.http.x-frame-options=SAMEORIGIN
+views.http.x-content-type-options=nosniff
+views.http.cache-control=no-store
+views.http.pragma=no-cache
mpacks.staging.path=resources\\mpacks
http://git-wip-us.apache.org/repos/asf/ambari/blob/34c5686c/ambari-server/src/main/java/org/apache/ambari/server/configuration/Configuration.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/configuration/Configuration.java b/ambari-server/src/main/java/org/apache/ambari/server/configuration/Configuration.java
index 2e850ef..e976f45 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/configuration/Configuration.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/configuration/Configuration.java
@@ -2182,6 +2182,27 @@ public class Configuration {
"http.x-xss-protection", "1; mode=block");
/**
+ * The value that will be used to set the {@code X-Content-Type} HTTP response header.
+ */
+ @Markdown(description = "The value that will be used to set the `X-CONTENT-TYPE` HTTP response header.")
+ public static final ConfigurationProperty<String> HTTP_X_CONTENT_TYPE_HEADER_VALUE = new ConfigurationProperty<>(
+ "http.x-content-type-options", "nosniff");
+
+ /**
+ * The value that will be used to set the {@code Cache-Control} HTTP response header.
+ */
+ @Markdown(description = "The value that will be used to set the `Cache-Control` HTTP response header.")
+ public static final ConfigurationProperty<String> HTTP_CACHE_CONTROL_HEADER_VALUE = new ConfigurationProperty<>(
+ "http.cache-control", "no-store");
+
+ /**
+ * The value that will be used to set the {@code PRAGMA} HTTP response header.
+ */
+ @Markdown(description = "The value that will be used to set the `PRAGMA` HTTP response header.")
+ public static final ConfigurationProperty<String> HTTP_PRAGMA_HEADER_VALUE = new ConfigurationProperty<>(
+ "http.pragma", "no-cache");
+
+ /**
* The value that will be used to set the {@code Strict-Transport-Security}
* HTTP response header for Ambari View requests.
*/
@@ -2207,6 +2228,30 @@ public class Configuration {
"views.http.x-xss-protection", "1; mode=block");
/**
+ * The value that will be used to set the {@code X-Content-Type} HTTP response header.
+ * HTTP response header for Ambari View requests.
+ */
+ @Markdown(description = "The value that will be used to set the `X-CONTENT-TYPE` HTTP response header for Ambari View requests.")
+ public static final ConfigurationProperty<String> VIEWS_HTTP_X_CONTENT_TYPE_HEADER_VALUE = new ConfigurationProperty<>(
+ "views.http.x-content-type-options", "nosniff");
+
+ /**
+ * The value that will be used to set the {@code Cache-Control} HTTP response header.
+ * HTTP response header for Ambari View requests.
+ */
+ @Markdown(description = "The value that will be used to set the `Cache-Control` HTTP response header for Ambari View requests.")
+ public static final ConfigurationProperty<String> VIEWS_HTTP_CACHE_CONTROL_HEADER_VALUE = new ConfigurationProperty<>(
+ "views.http.cache-control", "no-store");
+
+ /**
+ * The value that will be used to set the {@code PRAGMA} HTTP response header.
+ * HTTP response header for Ambari View requests.
+ */
+ @Markdown(description = "The value that will be used to set the `PRAGMA` HTTP response header for Ambari View requests.")
+ public static final ConfigurationProperty<String> VIEWS_HTTP_PRAGMA_HEADER_VALUE = new ConfigurationProperty<>(
+ "views.http.pragma", "no-cache");
+
+ /**
* The time, in milliseconds, that requests to connect to a URL to retrieve
* Version Definition Files (VDF) will wait before being terminated.
*/
@@ -3284,6 +3329,51 @@ public class Configuration {
}
/**
+ * Get the value that should be set for the <code>X-Content-Type</code> HTTP response header for Ambari Server UI.
+ * <p/>
+ * By default this will be <code>nosniff</code>. For example:
+ * <p/>
+ * <code>
+ * X-Content-Type: nosniff
+ * </code>
+ *
+ * @return the X-Content-Type value - null or "" indicates that the value is not set
+ */
+ public String getXContentTypeHTTPResponseHeader() {
+ return getProperty(HTTP_X_CONTENT_TYPE_HEADER_VALUE);
+ }
+
+ /**
+ * Get the value that should be set for the <code>Cache-Control</code> HTTP response header for Ambari Server UI.
+ * <p/>
+ * By default this will be <code>no-store</code>. For example:
+ * <p/>
+ * <code>
+ * Cache-control: no-store
+ * </code>
+ *
+ * @return the Cache-Control value - null or "" indicates that the value is not set
+ */
+ public String getCacheControlHTTPResponseHeader() {
+ return getProperty(HTTP_CACHE_CONTROL_HEADER_VALUE);
+ }
+
+ /**
+ * Get the value that should be set for the <code>Pragma</code> HTTP response header for Ambari Server UI.
+ * <p/>
+ * By default this will be <code>no-cache</code>. For example:
+ * <p/>
+ * <code>
+ * Pragma: no-cache
+ * </code>
+ *
+ * @return the Pragma value - null or "" indicates that the value is not set
+ */
+ public String getPragmaHTTPResponseHeader() {
+ return getProperty(HTTP_PRAGMA_HEADER_VALUE);
+ }
+
+ /**
* Get the value that should be set for the <code>Strict-Transport-Security</code> HTTP response header for Ambari Views.
* <p/>
* By default this will be <code>max-age=31536000; includeSubDomains</code>. For example:
@@ -3331,6 +3421,51 @@ public class Configuration {
}
/**
+ * Get the value that should be set for the <code>X-Content-Type</code> HTTP response header for Ambari Views.
+ * <p/>
+ * By default this will be <code>nosniff</code>. For example:
+ * <p/>
+ * <code>
+ * X-Content-Type: nosniff
+ * </code>
+ *
+ * @return the X-Content-Type value - null or "" indicates that the value is not set
+ */
+ public String getViewsXContentTypeHTTPResponseHeader() {
+ return getProperty(VIEWS_HTTP_X_CONTENT_TYPE_HEADER_VALUE);
+ }
+
+ /**
+ * Get the value that should be set for the <code>Cache-Control</code> HTTP response header for Ambari Views.
+ * <p/>
+ * By default this will be <code>no-store</code>. For example:
+ * <p/>
+ * <code>
+ * Cache-control: no-store
+ * </code>
+ *
+ * @return the Cache-Control value - null or "" indicates that the value is not set
+ */
+ public String getViewsCacheControlHTTPResponseHeader() {
+ return getProperty(VIEWS_HTTP_CACHE_CONTROL_HEADER_VALUE);
+ }
+
+ /**
+ * Get the value that should be set for the <code>Pragma</code> HTTP response header for Ambari Views.
+ * <p/>
+ * By default this will be <code>no-cache</code>. For example:
+ * <p/>
+ * <code>
+ * Pragma: no-cache
+ * </code>
+ *
+ * @return the Pragma value - null or "" indicates that the value is not set
+ */
+ public String getViewsPragmaHTTPResponseHeader() {
+ return getProperty(VIEWS_HTTP_PRAGMA_HEADER_VALUE);
+ }
+
+ /**
* Check to see if the hostname of the agent is to be validated as a proper hostname or not
*
* @return true if agent hostnames should be checked as a valid hostnames; otherwise false
http://git-wip-us.apache.org/repos/asf/ambari/blob/34c5686c/ambari-server/src/main/java/org/apache/ambari/server/security/AbstractSecurityHeaderFilter.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/security/AbstractSecurityHeaderFilter.java b/ambari-server/src/main/java/org/apache/ambari/server/security/AbstractSecurityHeaderFilter.java
index 05c9ecb..423a013 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/security/AbstractSecurityHeaderFilter.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/security/AbstractSecurityHeaderFilter.java
@@ -53,6 +53,9 @@ public abstract class AbstractSecurityHeaderFilter implements Filter {
protected final static String STRICT_TRANSPORT_HEADER = "Strict-Transport-Security";
protected final static String X_FRAME_OPTIONS_HEADER = "X-Frame-Options";
protected final static String X_XSS_PROTECTION_HEADER = "X-XSS-Protection";
+ protected final static String X_CONTENT_TYPE_HEADER = "X-Content-Type-Options";
+ protected final static String CACHE_CONTROL_HEADER = "Cache-Control";
+ protected final static String PRAGMA_HEADER = "Pragma";
/**
* The logger.
@@ -87,6 +90,19 @@ public abstract class AbstractSecurityHeaderFilter implements Filter {
* The value for the X-XSS-Protection HTTP response header.
*/
private String xXSSProtectionHeader = Configuration.HTTP_X_XSS_PROTECTION_HEADER_VALUE.getDefaultValue();
+ /**
+ * The value for the Content-Type HTTP response header.
+ */
+ private String xContentTypeHeader = Configuration.HTTP_X_CONTENT_TYPE_HEADER_VALUE.getDefaultValue();
+ /**
+ * The value for the Cache-control HTTP response header.
+ */
+ private String cacheControlHeader = Configuration.HTTP_CACHE_CONTROL_HEADER_VALUE.getDefaultValue();
+ /**
+ * The value for the Pragma HTTP response header.
+ */
+ private String pragmaHeader = Configuration.HTTP_PRAGMA_HEADER_VALUE.getDefaultValue();
+
@Override
public void init(FilterConfig filterConfig) throws ServletException {
@@ -141,6 +157,18 @@ public abstract class AbstractSecurityHeaderFilter implements Filter {
this.xXSSProtectionHeader = xXSSProtectionHeader;
}
+ protected void setXContentTypeHeader(String xContentTypeHeader) {
+ this.xContentTypeHeader = xContentTypeHeader;
+ }
+
+ protected void setCacheControlHeader(String cacheControlHeader) {
+ this.cacheControlHeader = cacheControlHeader;
+ }
+
+ protected void setPragmaHeader(String pragmaHeader) {
+ this.pragmaHeader = pragmaHeader;
+ }
+
private void doFilterInternal(ServletRequest servletRequest, ServletResponse servletResponse) {
if (servletResponse instanceof HttpServletResponse) {
HttpServletResponse httpServletResponse = (HttpServletResponse) servletResponse;
@@ -159,6 +187,21 @@ public abstract class AbstractSecurityHeaderFilter implements Filter {
if (!StringUtils.isEmpty(xXSSProtectionHeader)) {
httpServletResponse.setHeader(X_XSS_PROTECTION_HEADER, xXSSProtectionHeader);
}
+
+ // Conditionally set the X-Content-Type HTTP response header if a value is supplied
+ if (!StringUtils.isEmpty(xContentTypeHeader)) {
+ httpServletResponse.setHeader(X_CONTENT_TYPE_HEADER, xContentTypeHeader);
+ }
+
+ // Conditionally set the X-Cache-Control HTTP response header if a value is supplied
+ if (!StringUtils.isEmpty(cacheControlHeader)) {
+ httpServletResponse.setHeader(CACHE_CONTROL_HEADER, cacheControlHeader);
+ }
+
+ // Conditionally set the X-Pragma HTTP response header if a value is supplied
+ if (!StringUtils.isEmpty(pragmaHeader)) {
+ httpServletResponse.setHeader(PRAGMA_HEADER, pragmaHeader);
+ }
}
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/34c5686c/ambari-server/src/main/java/org/apache/ambari/server/security/AmbariServerSecurityHeaderFilter.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/security/AmbariServerSecurityHeaderFilter.java b/ambari-server/src/main/java/org/apache/ambari/server/security/AmbariServerSecurityHeaderFilter.java
index b40953b..aa00ac2 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/security/AmbariServerSecurityHeaderFilter.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/security/AmbariServerSecurityHeaderFilter.java
@@ -47,6 +47,9 @@ public class AmbariServerSecurityHeaderFilter extends AbstractSecurityHeaderFilt
setStrictTransportSecurity(configuration.getStrictTransportSecurityHTTPResponseHeader());
setxFrameOptionsHeader(configuration.getXFrameOptionsHTTPResponseHeader());
setxXSSProtectionHeader(configuration.getXXSSProtectionHTTPResponseHeader());
+ setXContentTypeHeader(configuration.getXContentTypeHTTPResponseHeader());
+ setCacheControlHeader(configuration.getCacheControlHTTPResponseHeader());
+ setPragmaHeader(configuration.getPragmaHTTPResponseHeader());
}
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/34c5686c/ambari-server/src/main/java/org/apache/ambari/server/security/AmbariViewsSecurityHeaderFilter.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/security/AmbariViewsSecurityHeaderFilter.java b/ambari-server/src/main/java/org/apache/ambari/server/security/AmbariViewsSecurityHeaderFilter.java
index 5bff4e3..d1be8cc 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/security/AmbariViewsSecurityHeaderFilter.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/security/AmbariViewsSecurityHeaderFilter.java
@@ -43,5 +43,8 @@ public class AmbariViewsSecurityHeaderFilter extends AbstractSecurityHeaderFilte
setStrictTransportSecurity(configuration.getViewsStrictTransportSecurityHTTPResponseHeader());
setxFrameOptionsHeader(configuration.getViewsXFrameOptionsHTTPResponseHeader());
setxXSSProtectionHeader(configuration.getViewsXXSSProtectionHTTPResponseHeader());
+ setXContentTypeHeader(configuration.getViewsXContentTypeHTTPResponseHeader());
+ setCacheControlHeader(configuration.getViewsCacheControlHTTPResponseHeader());
+ setPragmaHeader(configuration.getViewsPragmaHTTPResponseHeader());
}
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/34c5686c/ambari-server/src/test/java/org/apache/ambari/server/security/AbstractSecurityHeaderFilterTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/security/AbstractSecurityHeaderFilterTest.java b/ambari-server/src/test/java/org/apache/ambari/server/security/AbstractSecurityHeaderFilterTest.java
index 7be70a3..d812ee6 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/security/AbstractSecurityHeaderFilterTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/security/AbstractSecurityHeaderFilterTest.java
@@ -95,7 +95,13 @@ public abstract class AbstractSecurityHeaderFilterTest extends EasyMockSupport {
expectLastCall().once();
servletResponse.setHeader(AbstractSecurityHeaderFilter.X_XSS_PROTECTION_HEADER, defatulPropertyValueMap.get(AbstractSecurityHeaderFilter.X_XSS_PROTECTION_HEADER));
expectLastCall().once();
-
+ servletResponse.setHeader(AbstractSecurityHeaderFilter.X_CONTENT_TYPE_HEADER, defatulPropertyValueMap.get(AbstractSecurityHeaderFilter.X_CONTENT_TYPE_HEADER));
+ expectLastCall().once();
+ servletResponse.setHeader(AbstractSecurityHeaderFilter.CACHE_CONTROL_HEADER, defatulPropertyValueMap.get(AbstractSecurityHeaderFilter.CACHE_CONTROL_HEADER));
+ expectLastCall().once();
+ servletResponse.setHeader(AbstractSecurityHeaderFilter.PRAGMA_HEADER, defatulPropertyValueMap.get(AbstractSecurityHeaderFilter.PRAGMA_HEADER));
+ expectLastCall().once();
+
FilterChain filterChain = createStrictMock(FilterChain.class);
filterChain.doFilter(servletRequest, servletResponse);
expectLastCall().once();
@@ -141,6 +147,12 @@ public abstract class AbstractSecurityHeaderFilterTest extends EasyMockSupport {
expectLastCall().once();
servletResponse.setHeader(AbstractSecurityHeaderFilter.X_XSS_PROTECTION_HEADER, defatulPropertyValueMap.get(AbstractSecurityHeaderFilter.X_XSS_PROTECTION_HEADER));
expectLastCall().once();
+ servletResponse.setHeader(AbstractSecurityHeaderFilter.X_CONTENT_TYPE_HEADER, defatulPropertyValueMap.get(AbstractSecurityHeaderFilter.X_CONTENT_TYPE_HEADER));
+ expectLastCall().once();
+ servletResponse.setHeader(AbstractSecurityHeaderFilter.CACHE_CONTROL_HEADER, defatulPropertyValueMap.get(AbstractSecurityHeaderFilter.CACHE_CONTROL_HEADER));
+ expectLastCall().once();
+ servletResponse.setHeader(AbstractSecurityHeaderFilter.PRAGMA_HEADER, defatulPropertyValueMap.get(AbstractSecurityHeaderFilter.PRAGMA_HEADER));
+ expectLastCall().once();
FilterChain filterChain = createStrictMock(FilterChain.class);
filterChain.doFilter(servletRequest, servletResponse);
@@ -171,6 +183,9 @@ public abstract class AbstractSecurityHeaderFilterTest extends EasyMockSupport {
properties.setProperty(propertyNameMap.get(AbstractSecurityHeaderFilter.STRICT_TRANSPORT_HEADER), "custom1");
properties.setProperty(propertyNameMap.get(AbstractSecurityHeaderFilter.X_FRAME_OPTIONS_HEADER), "custom2");
properties.setProperty(propertyNameMap.get(AbstractSecurityHeaderFilter.X_XSS_PROTECTION_HEADER), "custom3");
+ properties.setProperty(propertyNameMap.get(AbstractSecurityHeaderFilter.X_CONTENT_TYPE_HEADER), "custom4");
+ properties.setProperty(propertyNameMap.get(AbstractSecurityHeaderFilter.CACHE_CONTROL_HEADER), "custom5");
+ properties.setProperty(propertyNameMap.get(AbstractSecurityHeaderFilter.PRAGMA_HEADER), "custom6");
bind(OsFamily.class).toInstance(createNiceMock(OsFamily.class));
bind(Configuration.class).toInstance(new Configuration(properties));
@@ -187,6 +202,12 @@ public abstract class AbstractSecurityHeaderFilterTest extends EasyMockSupport {
expectLastCall().once();
servletResponse.setHeader(AbstractSecurityHeaderFilter.X_XSS_PROTECTION_HEADER, "custom3");
expectLastCall().once();
+ servletResponse.setHeader(AbstractSecurityHeaderFilter.X_CONTENT_TYPE_HEADER, "custom4");
+ expectLastCall().once();
+ servletResponse.setHeader(AbstractSecurityHeaderFilter.CACHE_CONTROL_HEADER, "custom5");
+ expectLastCall().once();
+ servletResponse.setHeader(AbstractSecurityHeaderFilter.PRAGMA_HEADER, "custom6");
+ expectLastCall().once();
FilterChain filterChain = createStrictMock(FilterChain.class);
filterChain.doFilter(servletRequest, servletResponse);
@@ -218,6 +239,9 @@ public abstract class AbstractSecurityHeaderFilterTest extends EasyMockSupport {
properties.setProperty(propertyNameMap.get(AbstractSecurityHeaderFilter.STRICT_TRANSPORT_HEADER), "custom1");
properties.setProperty(propertyNameMap.get(AbstractSecurityHeaderFilter.X_FRAME_OPTIONS_HEADER), "custom2");
properties.setProperty(propertyNameMap.get(AbstractSecurityHeaderFilter.X_XSS_PROTECTION_HEADER), "custom3");
+ properties.setProperty(propertyNameMap.get(AbstractSecurityHeaderFilter.X_CONTENT_TYPE_HEADER), "custom4");
+ properties.setProperty(propertyNameMap.get(AbstractSecurityHeaderFilter.CACHE_CONTROL_HEADER), "custom5");
+ properties.setProperty(propertyNameMap.get(AbstractSecurityHeaderFilter.PRAGMA_HEADER), "custom6");
bind(OsFamily.class).toInstance(createNiceMock(OsFamily.class));
bind(Configuration.class).toInstance(new Configuration(properties));
@@ -236,6 +260,12 @@ public abstract class AbstractSecurityHeaderFilterTest extends EasyMockSupport {
expectLastCall().once();
servletResponse.setHeader(AbstractSecurityHeaderFilter.X_XSS_PROTECTION_HEADER, "custom3");
expectLastCall().once();
+ servletResponse.setHeader(AbstractSecurityHeaderFilter.X_CONTENT_TYPE_HEADER, "custom4");
+ expectLastCall().once();
+ servletResponse.setHeader(AbstractSecurityHeaderFilter.CACHE_CONTROL_HEADER, "custom5");
+ expectLastCall().once();
+ servletResponse.setHeader(AbstractSecurityHeaderFilter.PRAGMA_HEADER, "custom6");
+ expectLastCall().once();
FilterChain filterChain = createStrictMock(FilterChain.class);
filterChain.doFilter(servletRequest, servletResponse);
@@ -266,6 +296,9 @@ public abstract class AbstractSecurityHeaderFilterTest extends EasyMockSupport {
properties.setProperty(propertyNameMap.get(AbstractSecurityHeaderFilter.STRICT_TRANSPORT_HEADER), "");
properties.setProperty(propertyNameMap.get(AbstractSecurityHeaderFilter.X_FRAME_OPTIONS_HEADER), "");
properties.setProperty(propertyNameMap.get(AbstractSecurityHeaderFilter.X_XSS_PROTECTION_HEADER), "");
+ properties.setProperty(propertyNameMap.get(AbstractSecurityHeaderFilter.X_CONTENT_TYPE_HEADER), "");
+ properties.setProperty(propertyNameMap.get(AbstractSecurityHeaderFilter.CACHE_CONTROL_HEADER), "");
+ properties.setProperty(propertyNameMap.get(AbstractSecurityHeaderFilter.PRAGMA_HEADER), "");
bind(OsFamily.class).toInstance(createNiceMock(OsFamily.class));
bind(Configuration.class).toInstance(new Configuration(properties));
@@ -309,6 +342,9 @@ public abstract class AbstractSecurityHeaderFilterTest extends EasyMockSupport {
properties.setProperty(propertyNameMap.get(AbstractSecurityHeaderFilter.STRICT_TRANSPORT_HEADER), "");
properties.setProperty(propertyNameMap.get(AbstractSecurityHeaderFilter.X_FRAME_OPTIONS_HEADER), "");
properties.setProperty(propertyNameMap.get(AbstractSecurityHeaderFilter.X_XSS_PROTECTION_HEADER), "");
+ properties.setProperty(propertyNameMap.get(AbstractSecurityHeaderFilter.X_CONTENT_TYPE_HEADER), "");
+ properties.setProperty(propertyNameMap.get(AbstractSecurityHeaderFilter.CACHE_CONTROL_HEADER), "");
+ properties.setProperty(propertyNameMap.get(AbstractSecurityHeaderFilter.PRAGMA_HEADER), "");
bind(OsFamily.class).toInstance(createNiceMock(OsFamily.class));
bind(Configuration.class).toInstance(new Configuration(properties));
http://git-wip-us.apache.org/repos/asf/ambari/blob/34c5686c/ambari-server/src/test/java/org/apache/ambari/server/security/AmbariServerSecurityHeaderFilterTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/security/AmbariServerSecurityHeaderFilterTest.java b/ambari-server/src/test/java/org/apache/ambari/server/security/AmbariServerSecurityHeaderFilterTest.java
index 6537130..7fa2386 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/security/AmbariServerSecurityHeaderFilterTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/security/AmbariServerSecurityHeaderFilterTest.java
@@ -40,12 +40,19 @@ public class AmbariServerSecurityHeaderFilterTest extends AbstractSecurityHeader
map.put(AbstractSecurityHeaderFilter.STRICT_TRANSPORT_HEADER, Configuration.HTTP_STRICT_TRANSPORT_HEADER_VALUE.getKey());
map.put(AbstractSecurityHeaderFilter.X_FRAME_OPTIONS_HEADER, Configuration.HTTP_X_FRAME_OPTIONS_HEADER_VALUE.getKey());
map.put(AbstractSecurityHeaderFilter.X_XSS_PROTECTION_HEADER, Configuration.HTTP_X_XSS_PROTECTION_HEADER_VALUE.getKey());
+ map.put(AbstractSecurityHeaderFilter.X_CONTENT_TYPE_HEADER, Configuration.HTTP_X_CONTENT_TYPE_HEADER_VALUE.getKey());
+ map.put(AbstractSecurityHeaderFilter.CACHE_CONTROL_HEADER, Configuration.HTTP_CACHE_CONTROL_HEADER_VALUE.getKey());
+ map.put(AbstractSecurityHeaderFilter.PRAGMA_HEADER, Configuration.HTTP_PRAGMA_HEADER_VALUE.getKey());
+
PROPERTY_NAME_MAP = Collections.unmodifiableMap(map);
map = new HashMap<String, String>();
map.put(AbstractSecurityHeaderFilter.STRICT_TRANSPORT_HEADER, Configuration.HTTP_STRICT_TRANSPORT_HEADER_VALUE.getDefaultValue());
map.put(AbstractSecurityHeaderFilter.X_FRAME_OPTIONS_HEADER, Configuration.HTTP_X_FRAME_OPTIONS_HEADER_VALUE.getDefaultValue());
map.put(AbstractSecurityHeaderFilter.X_XSS_PROTECTION_HEADER, Configuration.HTTP_X_XSS_PROTECTION_HEADER_VALUE.getDefaultValue());
+ map.put(AbstractSecurityHeaderFilter.X_CONTENT_TYPE_HEADER, Configuration.HTTP_X_CONTENT_TYPE_HEADER_VALUE.getDefaultValue());
+ map.put(AbstractSecurityHeaderFilter.CACHE_CONTROL_HEADER, Configuration.HTTP_CACHE_CONTROL_HEADER_VALUE.getDefaultValue());
+ map.put(AbstractSecurityHeaderFilter.PRAGMA_HEADER, Configuration.HTTP_PRAGMA_HEADER_VALUE.getDefaultValue());
DEFAULT_PROPERTY_VALUE_MAP = Collections.unmodifiableMap(map);
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/34c5686c/ambari-server/src/test/java/org/apache/ambari/server/security/AmbariViewsSecurityHeaderFilterTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/security/AmbariViewsSecurityHeaderFilterTest.java b/ambari-server/src/test/java/org/apache/ambari/server/security/AmbariViewsSecurityHeaderFilterTest.java
index c9d7974..d699ae0 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/security/AmbariViewsSecurityHeaderFilterTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/security/AmbariViewsSecurityHeaderFilterTest.java
@@ -41,12 +41,18 @@ public class AmbariViewsSecurityHeaderFilterTest extends AbstractSecurityHeaderF
map.put(AbstractSecurityHeaderFilter.STRICT_TRANSPORT_HEADER, Configuration.VIEWS_HTTP_STRICT_TRANSPORT_HEADER_VALUE.getKey());
map.put(AbstractSecurityHeaderFilter.X_FRAME_OPTIONS_HEADER, Configuration.VIEWS_HTTP_X_FRAME_OPTIONS_HEADER_VALUE.getKey());
map.put(AbstractSecurityHeaderFilter.X_XSS_PROTECTION_HEADER, Configuration.VIEWS_HTTP_X_XSS_PROTECTION_HEADER_VALUE.getKey());
+ map.put(AbstractSecurityHeaderFilter.X_CONTENT_TYPE_HEADER, Configuration.VIEWS_HTTP_X_CONTENT_TYPE_HEADER_VALUE.getKey());
+ map.put(AbstractSecurityHeaderFilter.CACHE_CONTROL_HEADER, Configuration.VIEWS_HTTP_CACHE_CONTROL_HEADER_VALUE.getKey());
+ map.put(AbstractSecurityHeaderFilter.PRAGMA_HEADER, Configuration.VIEWS_HTTP_PRAGMA_HEADER_VALUE.getKey());
PROPERTY_NAME_MAP = Collections.unmodifiableMap(map);
map = new HashMap<String, String>();
map.put(AbstractSecurityHeaderFilter.STRICT_TRANSPORT_HEADER, Configuration.VIEWS_HTTP_STRICT_TRANSPORT_HEADER_VALUE.getDefaultValue());
map.put(AbstractSecurityHeaderFilter.X_FRAME_OPTIONS_HEADER, Configuration.VIEWS_HTTP_X_FRAME_OPTIONS_HEADER_VALUE.getDefaultValue());
map.put(AbstractSecurityHeaderFilter.X_XSS_PROTECTION_HEADER, Configuration.VIEWS_HTTP_X_XSS_PROTECTION_HEADER_VALUE.getDefaultValue());
+ map.put(AbstractSecurityHeaderFilter.X_CONTENT_TYPE_HEADER, Configuration.VIEWS_HTTP_X_CONTENT_TYPE_HEADER_VALUE.getDefaultValue());
+ map.put(AbstractSecurityHeaderFilter.CACHE_CONTROL_HEADER, Configuration.VIEWS_HTTP_CACHE_CONTROL_HEADER_VALUE.getDefaultValue());
+ map.put(AbstractSecurityHeaderFilter.PRAGMA_HEADER, Configuration.VIEWS_HTTP_PRAGMA_HEADER_VALUE.getDefaultValue());
DEFAULT_PROPERTY_VALUE_MAP = Collections.unmodifiableMap(map);
}
[11/11] ambari git commit: Merge branch 'trunk' into
branch-feature-AMBARI-18456
Posted by jo...@apache.org.
Merge branch 'trunk' into branch-feature-AMBARI-18456
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/ed2018bf
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/ed2018bf
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/ed2018bf
Branch: refs/heads/branch-feature-AMBARI-18456
Commit: ed2018bf06ec5ee18eb3c0c618f664db0d058025
Parents: 5cf5c83 6587fda
Author: Jonathan Hurley <jh...@hortonworks.com>
Authored: Mon Oct 10 20:37:39 2016 -0400
Committer: Jonathan Hurley <jh...@hortonworks.com>
Committed: Mon Oct 10 20:37:39 2016 -0400
----------------------------------------------------------------------
ambari-server/conf/unix/ambari.properties | 6 +
ambari-server/conf/unix/install-helper.sh | 1 +
ambari-server/conf/windows/ambari.properties | 6 +
ambari-server/sbin/ambari-server | 4 +-
.../server/configuration/Configuration.java | 135 +++++++++++++++++++
.../AmbariManagementControllerImpl.java | 2 +-
.../server/controller/KerberosHelperImpl.java | 6 +-
.../controller/ServiceComponentHostRequest.java | 4 +-
.../BlueprintConfigurationProcessor.java | 113 ++++++++++++----
.../internal/HostComponentResourceProvider.java | 44 +++---
.../security/AbstractSecurityHeaderFilter.java | 43 ++++++
.../AmbariServerSecurityHeaderFilter.java | 3 +
.../AmbariViewsSecurityHeaderFilter.java | 3 +
.../server/serveraction/ServerAction.java | 6 +
.../BlueprintConfigurationProcessorTest.java | 82 +++++++++++
.../AbstractSecurityHeaderFilterTest.java | 38 +++++-
.../AmbariServerSecurityHeaderFilterTest.java | 7 +
.../AmbariViewsSecurityHeaderFilterTest.java | 6 +
.../main/admin/stack_and_upgrade_controller.js | 56 ++++----
ambari-web/app/messages.js | 1 +
ambari-web/app/routes/add_service_routes.js | 24 ++++
.../configs/service_configs_by_category_view.js | 12 +-
.../admin/stack_and_upgrade_controller_test.js | 45 +++++--
.../8.0.5/package/scripts/microsoft_r.py | 11 +-
.../MICROSOFT_R/8.0.5/metainfo.xml | 19 +++
.../MICROSOFT_R/8.0.5/repos/repoinfo.xml | 7 +
26 files changed, 583 insertions(+), 101 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/ed2018bf/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java
----------------------------------------------------------------------