You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by mp...@apache.org on 2017/11/28 17:37:58 UTC
ambari git commit: AMBARI-22480. Validate blueprint does not allow
lzo enable without setup with license agreement. Added io.compression.codecs
property validation. (mpapirkovskyy)
Repository: ambari
Updated Branches:
refs/heads/branch-feature-AMBARI-22457 606d876b6 -> 3a0ae86bb
AMBARI-22480. Validate blueprint does not allow lzo enable without setup with license agreement. Added io.compression.codecs property validation. (mpapirkovskyy)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/3a0ae86b
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/3a0ae86b
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/3a0ae86b
Branch: refs/heads/branch-feature-AMBARI-22457
Commit: 3a0ae86bbdbffb46cccb8bbe74c0d9093c18b561
Parents: 606d876
Author: Myroslav Papirkovskyi <mp...@hortonworks.com>
Authored: Tue Nov 28 14:51:58 2017 +0200
Committer: Myroslav Papirkovskyi <mp...@hortonworks.com>
Committed: Tue Nov 28 19:33:21 2017 +0200
----------------------------------------------------------------------
.../server/topology/BlueprintValidatorImpl.java | 4 +++-
.../server/topology/BlueprintImplTest.java | 20 +++++++++++++++++++-
2 files changed, 22 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/3a0ae86b/ambari-server/src/main/java/org/apache/ambari/server/topology/BlueprintValidatorImpl.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/topology/BlueprintValidatorImpl.java b/ambari-server/src/main/java/org/apache/ambari/server/topology/BlueprintValidatorImpl.java
index 7b7f7d7..2f0d97c 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/topology/BlueprintValidatorImpl.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/topology/BlueprintValidatorImpl.java
@@ -45,6 +45,7 @@ public class BlueprintValidatorImpl implements BlueprintValidator {
private final Stack stack;
public static final String LZO_CODEC_CLASS_PROPERTY_NAME = "io.compression.codec.lzo.class";
+ public static final String CODEC_CLASSES_PROPERTY_NAME = "io.compression.codecs";
public static final String LZO_CODEC_CLASS = "com.hadoop.compression.lzo.LzoCodec";
@Inject
@@ -110,7 +111,8 @@ public class BlueprintValidatorImpl implements BlueprintValidator {
String propertyName = propertyEntry.getKey();
String propertyValue = propertyEntry.getValue();
if (propertyValue != null) {
- if (!gplEnabled && configType.equals("core-site") && propertyName.equals(LZO_CODEC_CLASS_PROPERTY_NAME)
+ if (!gplEnabled && configType.equals("core-site")
+ && (propertyName.equals(LZO_CODEC_CLASS_PROPERTY_NAME) || propertyName.equals(CODEC_CLASSES_PROPERTY_NAME))
&& propertyValue.contains(LZO_CODEC_CLASS)) {
throw new GPLLicenseNotAcceptedException("Your Ambari server has not been configured to download LZO GPL software. " +
"Please refer to documentation to configure Ambari before proceeding.");
http://git-wip-us.apache.org/repos/asf/ambari/blob/3a0ae86b/ambari-server/src/test/java/org/apache/ambari/server/topology/BlueprintImplTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/topology/BlueprintImplTest.java b/ambari-server/src/test/java/org/apache/ambari/server/topology/BlueprintImplTest.java
index 1a9fd1f..5778404 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/topology/BlueprintImplTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/topology/BlueprintImplTest.java
@@ -176,7 +176,24 @@ public class BlueprintImplTest {
}
@Test(expected = GPLLicenseNotAcceptedException.class)
- public void testValidateConfigurations__gplIsNotAllowed() throws InvalidTopologyException,
+ public void testValidateConfigurations__gplIsNotAllowedCodecsProperty() throws InvalidTopologyException,
+ GPLLicenseNotAcceptedException, NoSuchFieldException, IllegalAccessException {
+ Map<String, Map<String, String>> lzoProperties = new HashMap<>();
+ lzoProperties.put("core-site", new HashMap<String, String>(){{
+ put(BlueprintValidatorImpl.CODEC_CLASSES_PROPERTY_NAME, "OtherCodec, " + BlueprintValidatorImpl.LZO_CODEC_CLASS);
+ }});
+ Configuration lzoUsageConfiguration = new Configuration(lzoProperties, EMPTY_ATTRIBUTES, EMPTY_CONFIGURATION);
+
+ org.apache.ambari.server.configuration.Configuration serverConfig = setupConfigurationWithGPLLicense(false);
+ replay(stack, group1, group2, serverConfig);
+
+ Blueprint blueprint = new BlueprintImpl("test", hostGroups, stack, lzoUsageConfiguration, null);
+ blueprint.validateRequiredProperties();
+ verify(stack, group1, group2, serverConfig);
+ }
+
+ @Test(expected = GPLLicenseNotAcceptedException.class)
+ public void testValidateConfigurations__gplIsNotAllowedLZOProperty() throws InvalidTopologyException,
GPLLicenseNotAcceptedException, NoSuchFieldException, IllegalAccessException {
Map<String, Map<String, String>> lzoProperties = new HashMap<>();
lzoProperties.put("core-site", new HashMap<String, String>(){{
@@ -198,6 +215,7 @@ public class BlueprintImplTest {
Map<String, Map<String, String>> lzoProperties = new HashMap<>();
lzoProperties.put("core-site", new HashMap<String, String>(){{
put(BlueprintValidatorImpl.LZO_CODEC_CLASS_PROPERTY_NAME, BlueprintValidatorImpl.LZO_CODEC_CLASS);
+ put(BlueprintValidatorImpl.CODEC_CLASSES_PROPERTY_NAME, "OtherCodec, " + BlueprintValidatorImpl.LZO_CODEC_CLASS);
}});
Configuration lzoUsageConfiguration = new Configuration(lzoProperties, EMPTY_ATTRIBUTES, EMPTY_CONFIGURATION);