ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From alejan...@apache.org
Subject [2/2] ambari git commit: PreCheck when same build already exists (alejandro)
Date Thu, 03 Dec 2015 22:42:43 GMT
PreCheck when same build already exists (alejandro)


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

Branch: refs/heads/branch-2.2
Commit: 8ddca83a5143623e84c4c6bd22b10df72f320221
Parents: 4bbf0de
Author: Alejandro Fernandez <afernandez@hortonworks.com>
Authored: Wed Dec 2 16:43:17 2015 -0800
Committer: Alejandro Fernandez <afernandez@hortonworks.com>
Committed: Thu Dec 3 14:42:10 2015 -0800

----------------------------------------------------------------------
 .../ambari/server/checks/InstallPackagesCheck.java     | 13 +++++++++++++
 .../KNOX/0.5.0.2.2/package/scripts/upgrade.py          |  2 +-
 2 files changed, 14 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/8ddca83a/ambari-server/src/main/java/org/apache/ambari/server/checks/InstallPackagesCheck.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/checks/InstallPackagesCheck.java
b/ambari-server/src/main/java/org/apache/ambari/server/checks/InstallPackagesCheck.java
index 15b6140..b80d6e6 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/checks/InstallPackagesCheck.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/checks/InstallPackagesCheck.java
@@ -26,6 +26,7 @@ import org.apache.ambari.server.AmbariException;
 import org.apache.ambari.server.controller.PrereqCheckRequest;
 import org.apache.ambari.server.orm.entities.ClusterVersionEntity;
 import org.apache.ambari.server.orm.entities.HostVersionEntity;
+import org.apache.ambari.server.orm.entities.RepositoryVersionEntity;
 import org.apache.ambari.server.state.Cluster;
 import org.apache.ambari.server.state.Host;
 import org.apache.ambari.server.state.MaintenanceState;
@@ -56,7 +57,19 @@ public class InstallPackagesCheck extends AbstractCheckDescriptor {
     final String clusterName = request.getClusterName();
     final Cluster cluster = clustersProvider.get().getCluster(clusterName);
     final StackId targetStackId = request.getTargetStackId();
+    final String stackName = targetStackId.getStackName();
     final String repoVersion = request.getRepositoryVersion();
+
+    final RepositoryVersionEntity rve = repositoryVersionDaoProvider.get().findByStackNameAndVersion(stackName,
request.getRepositoryVersion());
+    if (rve.getVersion().indexOf("-") < 100 ) {
+      String message = MessageFormat.format("The Repository Version {0} for Stack {1} must
contain a \"-\" followed by a build number. " +
+              "Make sure that another registered repository does not have the same repo URL
or " +
+              "shares the same build number. Next, try reinstalling the Repository Version.",
rve.getVersion(), rve.getStackVersion());
+      prerequisiteCheck.setFailedOn(new LinkedHashSet<String>() {{ add("Repository
Version " + rve.getVersion()); }});
+      prerequisiteCheck.setStatus(PrereqCheckStatus.FAIL);
+      prerequisiteCheck.setFailReason(message);
+    }
+
     final ClusterVersionEntity clusterVersion = clusterVersionDAOProvider.get().findByClusterAndStackAndVersion(
         clusterName, targetStackId, repoVersion);
     final Set<String> failedHosts = new HashSet<String>();

http://git-wip-us.apache.org/repos/asf/ambari/blob/8ddca83a/ambari-server/src/main/resources/common-services/KNOX/0.5.0.2.2/package/scripts/upgrade.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/KNOX/0.5.0.2.2/package/scripts/upgrade.py
b/ambari-server/src/main/resources/common-services/KNOX/0.5.0.2.2/package/scripts/upgrade.py
index 55c5060..f0bc1ad 100644
--- a/ambari-server/src/main/resources/common-services/KNOX/0.5.0.2.2/package/scripts/upgrade.py
+++ b/ambari-server/src/main/resources/common-services/KNOX/0.5.0.2.2/package/scripts/upgrade.py
@@ -87,7 +87,7 @@ def _get_directory_mappings_during_upgrade():
     knox_data_dir = format('/usr/hdp/{upgrade_from_version}/knox/data')
 
 
-  directories = {knox_data_dir: BACKUP_DATA_ARCHIVE,
+    directories = {knox_data_dir: BACKUP_DATA_ARCHIVE,
                 params.knox_conf_dir + "/": BACKUP_CONF_ARCHIVE} # the trailing "/" is important
here so as to not include the "conf" folder itself
 
   Logger.info(format("Knox directories to backup:\n{directories}"))


Mime
View raw message