|
@@ -18,29 +18,11 @@
|
|
|
|
|
|
package org.apache.ambari.server.controller;
|
|
|
|
|
|
-import static org.apache.ambari.server.agent.ExecutionCommand.KeyNames.AMBARI_DB_RCA_DRIVER;
|
|
|
-import static org.apache.ambari.server.agent.ExecutionCommand.KeyNames.AMBARI_DB_RCA_PASSWORD;
|
|
|
-import static org.apache.ambari.server.agent.ExecutionCommand.KeyNames.AMBARI_DB_RCA_URL;
|
|
|
-import static org.apache.ambari.server.agent.ExecutionCommand.KeyNames.AMBARI_DB_RCA_USERNAME;
|
|
|
-import static org.apache.ambari.server.agent.ExecutionCommand.KeyNames.COMMAND_TIMEOUT;
|
|
|
-import static org.apache.ambari.server.agent.ExecutionCommand.KeyNames.DB_DRIVER_FILENAME;
|
|
|
-import static org.apache.ambari.server.agent.ExecutionCommand.KeyNames.DB_NAME;
|
|
|
-import static org.apache.ambari.server.agent.ExecutionCommand.KeyNames.HOOKS_FOLDER;
|
|
|
-import static org.apache.ambari.server.agent.ExecutionCommand.KeyNames.JAVA_HOME;
|
|
|
-import static org.apache.ambari.server.agent.ExecutionCommand.KeyNames.JCE_NAME;
|
|
|
-import static org.apache.ambari.server.agent.ExecutionCommand.KeyNames.JDK_LOCATION;
|
|
|
-import static org.apache.ambari.server.agent.ExecutionCommand.KeyNames.JDK_NAME;
|
|
|
-import static org.apache.ambari.server.agent.ExecutionCommand.KeyNames.MYSQL_JDBC_URL;
|
|
|
-import static org.apache.ambari.server.agent.ExecutionCommand.KeyNames.ORACLE_JDBC_URL;
|
|
|
-import static org.apache.ambari.server.agent.ExecutionCommand.KeyNames.PACKAGE_LIST;
|
|
|
-import static org.apache.ambari.server.agent.ExecutionCommand.KeyNames.REPO_INFO;
|
|
|
-import static org.apache.ambari.server.agent.ExecutionCommand.KeyNames.SCRIPT;
|
|
|
-import static org.apache.ambari.server.agent.ExecutionCommand.KeyNames.SCRIPT_TYPE;
|
|
|
-import static org.apache.ambari.server.agent.ExecutionCommand.KeyNames.SERVICE_PACKAGE_FOLDER;
|
|
|
-import static org.apache.ambari.server.agent.ExecutionCommand.KeyNames.SERVICE_REPO_INFO;
|
|
|
-import static org.apache.ambari.server.agent.ExecutionCommand.KeyNames.STACK_NAME;
|
|
|
-import static org.apache.ambari.server.agent.ExecutionCommand.KeyNames.STACK_VERSION;
|
|
|
-
|
|
|
+import com.google.gson.Gson;
|
|
|
+import com.google.inject.Inject;
|
|
|
+import com.google.inject.Injector;
|
|
|
+import com.google.inject.Singleton;
|
|
|
+import com.google.inject.persist.Transactional;
|
|
|
import java.io.File;
|
|
|
import java.io.IOException;
|
|
|
import java.net.InetAddress;
|
|
@@ -56,7 +38,6 @@ import java.util.Map;
|
|
|
import java.util.Map.Entry;
|
|
|
import java.util.Set;
|
|
|
import java.util.TreeMap;
|
|
|
-
|
|
|
import org.apache.ambari.server.AmbariException;
|
|
|
import org.apache.ambari.server.ClusterNotFoundException;
|
|
|
import org.apache.ambari.server.DuplicateResourceException;
|
|
@@ -75,6 +56,28 @@ import org.apache.ambari.server.actionmanager.RequestFactory;
|
|
|
import org.apache.ambari.server.actionmanager.Stage;
|
|
|
import org.apache.ambari.server.actionmanager.StageFactory;
|
|
|
import org.apache.ambari.server.agent.ExecutionCommand;
|
|
|
+import static org.apache.ambari.server.agent.ExecutionCommand.KeyNames.AMBARI_DB_RCA_DRIVER;
|
|
|
+import static org.apache.ambari.server.agent.ExecutionCommand.KeyNames.AMBARI_DB_RCA_PASSWORD;
|
|
|
+import static org.apache.ambari.server.agent.ExecutionCommand.KeyNames.AMBARI_DB_RCA_URL;
|
|
|
+import static org.apache.ambari.server.agent.ExecutionCommand.KeyNames.AMBARI_DB_RCA_USERNAME;
|
|
|
+import static org.apache.ambari.server.agent.ExecutionCommand.KeyNames.COMMAND_TIMEOUT;
|
|
|
+import static org.apache.ambari.server.agent.ExecutionCommand.KeyNames.DB_DRIVER_FILENAME;
|
|
|
+import static org.apache.ambari.server.agent.ExecutionCommand.KeyNames.DB_NAME;
|
|
|
+import static org.apache.ambari.server.agent.ExecutionCommand.KeyNames.HOOKS_FOLDER;
|
|
|
+import static org.apache.ambari.server.agent.ExecutionCommand.KeyNames.JAVA_HOME;
|
|
|
+import static org.apache.ambari.server.agent.ExecutionCommand.KeyNames.JCE_NAME;
|
|
|
+import static org.apache.ambari.server.agent.ExecutionCommand.KeyNames.JDK_LOCATION;
|
|
|
+import static org.apache.ambari.server.agent.ExecutionCommand.KeyNames.JDK_NAME;
|
|
|
+import static org.apache.ambari.server.agent.ExecutionCommand.KeyNames.MYSQL_JDBC_URL;
|
|
|
+import static org.apache.ambari.server.agent.ExecutionCommand.KeyNames.ORACLE_JDBC_URL;
|
|
|
+import static org.apache.ambari.server.agent.ExecutionCommand.KeyNames.PACKAGE_LIST;
|
|
|
+import static org.apache.ambari.server.agent.ExecutionCommand.KeyNames.REPO_INFO;
|
|
|
+import static org.apache.ambari.server.agent.ExecutionCommand.KeyNames.SCRIPT;
|
|
|
+import static org.apache.ambari.server.agent.ExecutionCommand.KeyNames.SCRIPT_TYPE;
|
|
|
+import static org.apache.ambari.server.agent.ExecutionCommand.KeyNames.SERVICE_PACKAGE_FOLDER;
|
|
|
+import static org.apache.ambari.server.agent.ExecutionCommand.KeyNames.SERVICE_REPO_INFO;
|
|
|
+import static org.apache.ambari.server.agent.ExecutionCommand.KeyNames.STACK_NAME;
|
|
|
+import static org.apache.ambari.server.agent.ExecutionCommand.KeyNames.STACK_VERSION;
|
|
|
import org.apache.ambari.server.api.services.AmbariMetaInfo;
|
|
|
import org.apache.ambari.server.configuration.Configuration;
|
|
|
import org.apache.ambari.server.controller.internal.RequestOperationLevel;
|
|
@@ -130,12 +133,6 @@ import org.apache.http.client.utils.URIBuilder;
|
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
|
|
|
-import com.google.gson.Gson;
|
|
|
-import com.google.inject.Inject;
|
|
|
-import com.google.inject.Injector;
|
|
|
-import com.google.inject.Singleton;
|
|
|
-import com.google.inject.persist.Transactional;
|
|
|
-
|
|
|
@Singleton
|
|
|
public class AmbariManagementControllerImpl implements AmbariManagementController {
|
|
|
|
|
@@ -2839,10 +2836,11 @@ public class AmbariManagementControllerImpl implements AmbariManagementControlle
|
|
|
RepositoryInfo repositoryInfo = ambariMetaInfo.getRepository(rr.getStackName(), rr.getStackVersion(), rr.getOsType(), rr.getRepoId());
|
|
|
String repoName = repositoryInfo.getRepoName();
|
|
|
|
|
|
- boolean bFound = false;
|
|
|
+ boolean bFound = true;
|
|
|
+ String errorMessage = null;
|
|
|
|
|
|
String[] suffixes = configs.getRepoValidationSuffixes(rr.getOsType());
|
|
|
- for (int i = 0; i < suffixes.length && !bFound; i++) {
|
|
|
+ for (int i = 0; i < suffixes.length; i++) {
|
|
|
String suffix = String.format(suffixes[i], repoName);
|
|
|
String spec = rr.getBaseUrl();
|
|
|
|
|
@@ -2852,12 +2850,19 @@ public class AmbariManagementControllerImpl implements AmbariManagementControlle
|
|
|
spec = rr.getBaseUrl() + suffix.substring(1);
|
|
|
else
|
|
|
spec = rr.getBaseUrl() + suffix;
|
|
|
-
|
|
|
+
|
|
|
try {
|
|
|
IOUtils.readLines(usp.readFrom(spec));
|
|
|
- bFound = true;
|
|
|
} catch (IOException ioe) {
|
|
|
- LOG.error("IOException loading the base URL", ioe);
|
|
|
+ errorMessage = "Could not access base url . " + rr.getBaseUrl() + " . ";
|
|
|
+ if (LOG.isDebugEnabled()) {
|
|
|
+ errorMessage += ioe;
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ errorMessage += ioe.getMessage();
|
|
|
+ }
|
|
|
+ bFound = false;
|
|
|
+ break;
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -2866,8 +2871,8 @@ public class AmbariManagementControllerImpl implements AmbariManagementControlle
|
|
|
rr.getStackVersion(), rr.getOsType(), rr.getRepoId(),
|
|
|
rr.getBaseUrl());
|
|
|
} else {
|
|
|
- throw new IllegalArgumentException("Could not access base url '" +
|
|
|
- rr.getBaseUrl() + "'");
|
|
|
+ LOG.error(errorMessage);
|
|
|
+ throw new IllegalArgumentException(errorMessage);
|
|
|
}
|
|
|
}
|
|
|
}
|