ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dmitriu...@apache.org
Subject [2/2] ambari git commit: AMBARI-20119. "Use RedHat Satellite/Spacewalk" setting not working correctly in Ambari 2.4.2.0 (dlysnichenko)
Date Thu, 23 Feb 2017 13:10:59 GMT
AMBARI-20119. "Use RedHat Satellite/Spacewalk" setting not working correctly in Ambari 2.4.2.0
(dlysnichenko)


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

Branch: refs/heads/trunk
Commit: 70f23c07058b700a37b046e8412217b11a661aa4
Parents: aeb5d4e
Author: Lisnichenko Dmitro <dlysnichenko@hortonworks.com>
Authored: Thu Feb 23 15:10:33 2017 +0200
Committer: Lisnichenko Dmitro <dlysnichenko@hortonworks.com>
Committed: Thu Feb 23 15:10:33 2017 +0200

----------------------------------------------------------------------
 .../ambari/server/state/RepositoryInfo.java     | 20 ++++++++++++++++++--
 .../stack/upgrade/RepositoryVersionHelper.java  |  2 ++
 .../upgrade/RepositoryVersionHelperTest.java    |  3 ++-
 3 files changed, 22 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/70f23c07/ambari-server/src/main/java/org/apache/ambari/server/state/RepositoryInfo.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/state/RepositoryInfo.java
b/ambari-server/src/main/java/org/apache/ambari/server/state/RepositoryInfo.java
index 41ea5e7..31a00ca 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/state/RepositoryInfo.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/state/RepositoryInfo.java
@@ -34,6 +34,7 @@ public class RepositoryInfo {
   private String latestBaseUrl;
   private boolean repoSaved = false;
   private boolean unique = false;
+  private boolean ambariManagedRepositories = true;
 
   /**
    * @return the baseUrl
@@ -170,6 +171,7 @@ public class RepositoryInfo {
         + ", repoName=" + repoName
         + ", mirrorsList=" + mirrorsList
         + ", unique=" + unique
+        + ", ambariManagedRepositories=" + ambariManagedRepositories
         + " ]";
   }
 
@@ -186,12 +188,13 @@ public class RepositoryInfo {
         Objects.equal(repoName, that.repoName) &&
         Objects.equal(mirrorsList, that.mirrorsList) &&
         Objects.equal(defaultBaseUrl, that.defaultBaseUrl) &&
-        Objects.equal(latestBaseUrl, that.latestBaseUrl);
+        Objects.equal(latestBaseUrl, that.latestBaseUrl) &&
+        Objects.equal(ambariManagedRepositories, that.ambariManagedRepositories);
   }
 
   @Override
   public int hashCode() {
-    return Objects.hashCode(baseUrl, osType, repoId, repoName, mirrorsList, defaultBaseUrl,
latestBaseUrl, repoSaved, unique);
+    return Objects.hashCode(baseUrl, osType, repoId, repoName, mirrorsList, defaultBaseUrl,
latestBaseUrl, repoSaved, unique, ambariManagedRepositories);
   }
 
   public RepositoryResponse convertToResponse()
@@ -236,4 +239,17 @@ public class RepositoryInfo {
     }
   };
 
+  /**
+   * @return true if repositories managed by ambari
+   */
+  public boolean isAmbariManagedRepositories() {
+    return ambariManagedRepositories;
+  }
+
+  /**
+   * @param ambariManagedRepositories set is repositories managed by ambari
+   */
+  public void setAmbariManagedRepositories(boolean ambariManagedRepositories) {
+    this.ambariManagedRepositories = ambariManagedRepositories;
+  }
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/70f23c07/ambari-server/src/main/java/org/apache/ambari/server/state/stack/upgrade/RepositoryVersionHelper.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/state/stack/upgrade/RepositoryVersionHelper.java
b/ambari-server/src/main/java/org/apache/ambari/server/state/stack/upgrade/RepositoryVersionHelper.java
index 04f350f..7d5cbd0 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/state/stack/upgrade/RepositoryVersionHelper.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/state/stack/upgrade/RepositoryVersionHelper.java
@@ -162,6 +162,7 @@ public class RepositoryVersionHelper {
         repositoryJson.addProperty(RepositoryResourceProvider.REPOSITORY_MIRRORS_LIST_PROPERTY_ID,
repository.getMirrorsList());
         repositoryJson.addProperty(RepositoryResourceProvider.REPOSITORY_UNIQUE_PROPERTY_ID,
repository.isUnique());
         repositoriesJson.add(repositoryJson);
+        operatingSystemJson.addProperty(OperatingSystemResourceProvider.OPERATING_SYSTEM_AMBARI_MANAGED_REPOS,
repository.isAmbariManagedRepositories());
       }
       operatingSystemJson.add(RepositoryVersionResourceProvider.SUBRESOURCE_REPOSITORIES_PROPERTY_ID,
repositoriesJson);
       operatingSystemJson.addProperty(OperatingSystemResourceProvider.OPERATING_SYSTEM_OS_TYPE_PROPERTY_ID,
operatingSystem.getKey());
@@ -179,6 +180,7 @@ public class RepositoryVersionHelper {
         repositoryInfo.setRepoName(repositoryEntity.getName());
         repositoryInfo.setBaseUrl(repositoryEntity.getBaseUrl());
         repositoryInfo.setOsType(os.getOsType());
+        repositoryInfo.setAmbariManagedRepositories(os.isAmbariManagedRepos());
         repositoryInfos.add(repositoryInfo);
       }
     }

http://git-wip-us.apache.org/repos/asf/ambari/blob/70f23c07/ambari-server/src/test/java/org/apache/ambari/server/state/stack/upgrade/RepositoryVersionHelperTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/state/stack/upgrade/RepositoryVersionHelperTest.java
b/ambari-server/src/test/java/org/apache/ambari/server/state/stack/upgrade/RepositoryVersionHelperTest.java
index 00b8df4..a852743 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/state/stack/upgrade/RepositoryVersionHelperTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/state/stack/upgrade/RepositoryVersionHelperTest.java
@@ -58,9 +58,10 @@ public class RepositoryVersionHelperTest {
     repository.setOsType("os");
     repository.setRepoId("repoId");
     repository.setUnique(true);
+    repository.setAmbariManagedRepositories(true);
     repositories.add(repository);
 
     final String serialized = helper.serializeOperatingSystems(repositories);
-    Assert.assertEquals("[{\"repositories\":[{\"Repositories/base_url\":\"baseurl\",\"Repositories/repo_id\":\"repoId\",\"Repositories/unique\":true}],\"OperatingSystems/os_type\":\"os\"}]",
serialized);
+    Assert.assertEquals("[{\"OperatingSystems/ambari_managed_repositories\":true,\"repositories\":[{\"Repositories/base_url\":\"baseurl\",\"Repositories/repo_id\":\"repoId\",\"Repositories/unique\":true}],\"OperatingSystems/os_type\":\"os\"}]",
serialized);
   }
 }


Mime
View raw message