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 2018/08/15 18:49:03 UTC

[ambari] branch trunk updated: AMBARI-24484. HDP-GPL repo's shouldn't be pushed to hosts when GPL license was not applied. (#2080)

This is an automated email from the ASF dual-hosted git repository.

mpapirkovskyy pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/ambari.git


The following commit(s) were added to refs/heads/trunk by this push:
     new 3f9d414  AMBARI-24484. HDP-GPL repo's shouldn't be pushed to hosts when GPL license was not applied. (#2080)
3f9d414 is described below

commit 3f9d414fc6b2efe7f0772fcf1c5f93768b5b6245
Author: Myroslav Papirkovskyi <mp...@apache.org>
AuthorDate: Wed Aug 15 21:49:00 2018 +0300

    AMBARI-24484. HDP-GPL repo's shouldn't be pushed to hosts when GPL license was not applied. (#2080)
    
    * AMBARI-24484. HDP-GPL repo's shouldn't be pushed to hosts when GPL license was not applied. (mpapirkovskyy)
    
    * AMBARI-24484. HDP-GPL repo's shouldn't be pushed to hosts when GPL license was not applied. (mpapirkovskyy)
---
 .../main/python/resource_management/libraries/script/script.py   | 9 +++++++++
 .../java/org/apache/ambari/server/agent/CommandRepository.java   | 1 +
 2 files changed, 10 insertions(+)

diff --git a/ambari-common/src/main/python/resource_management/libraries/script/script.py b/ambari-common/src/main/python/resource_management/libraries/script/script.py
index 022dd82..d3de7c6 100644
--- a/ambari-common/src/main/python/resource_management/libraries/script/script.py
+++ b/ambari-common/src/main/python/resource_management/libraries/script/script.py
@@ -781,6 +781,15 @@ class Script(object):
 
     service_name = config['serviceName'] if 'serviceName' in config else None
     repos = CommandRepository(config['repositoryFile'])
+
+    from resource_management.libraries.functions import lzo_utils
+
+    # remove repos with 'GPL' tag when GPL license is not approved
+    repo_tags_to_skip = set()
+    if not lzo_utils.is_gpl_license_accepted():
+      repo_tags_to_skip.add("GPL")
+    repos.items = [r for r in repos.items if not (repo_tags_to_skip & r.tags)]
+
     repo_ids = [repo.repo_id for repo in repos.items]
     Logger.info("Command repositories: {0}".format(", ".join(repo_ids)))
     repos.items = [x for x in repos.items if (not x.applicable_services or service_name in x.applicable_services) ]
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/agent/CommandRepository.java b/ambari-server/src/main/java/org/apache/ambari/server/agent/CommandRepository.java
index 00c837a..2671241 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/agent/CommandRepository.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/agent/CommandRepository.java
@@ -272,6 +272,7 @@ public class CommandRepository {
     private List<String> m_applicableServices;
 
     @SerializedName("tags")
+    @JsonProperty("tags")
     private Set<RepoTag> m_tags;