Ver código fonte

AMBARI-2510. Can't complete install after executing "ambari-server setup-https" (Dmitry Sen via mahadev)

git-svn-id: https://svn.apache.org/repos/asf/incubator/ambari/trunk@1497478 13f79535-47bb-0310-9956-ffa450edef68
Mahadev Konar 12 anos atrás
pai
commit
28ebbafbc4

+ 2 - 1
ambari-agent/src/main/puppet/modules/hdp/manifests/java/jce/package.pp

@@ -38,7 +38,8 @@ define hdp::java::jce::package(
   #TODO:SUHAS how to avoid redownload and install if correct version already present.
   # may be check the file sizes for local_policy and export_US policy jars? 
   # UNLESS  => "test -e ${java_exec}"
-  $curl_cmd = "mkdir -p ${artifact_dir}; curl -f --retry 10 ${jce_location}/${jce_policy_zip} -o ${jce_curl_target}"
+  # curl -k - ignoring unverified server ssl sertificate,
+  $curl_cmd = "mkdir -p ${artifact_dir}; curl -kf --retry 10 ${jce_location}/${jce_policy_zip} -o ${jce_curl_target}"
   exec{ "jce-download ${name}":
     command => $curl_cmd,
     creates => $jce_curl_target,

+ 3 - 2
ambari-agent/src/main/puppet/modules/hdp/manifests/java/package.pp

@@ -38,8 +38,9 @@ define hdp::java::package(
   }
   $java_exec = "${java_home}/bin/java"
   $java_dir = regsubst($java_home,'/[^/]+$','')
-   
-  $curl_cmd = "mkdir -p ${artifact_dir} ; curl -f --retry 10 ${jdk_location}/${jdk_bin} -o ${jdk_curl_target}"
+
+  # curl -k - ignoring unverified server ssl sertificate,
+  $curl_cmd = "mkdir -p ${artifact_dir} ; curl -kf --retry 10 ${jdk_location}/${jdk_bin} -o ${jdk_curl_target}"
   exec{ "${curl_cmd} ${name}":
     command => $curl_cmd,
     creates => $jdk_curl_target,

+ 15 - 8
ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java

@@ -164,14 +164,23 @@ public class AmbariManagementControllerImpl implements
     this.masterHostname =  InetAddress.getLocalHost().getCanonicalHostName();
 
     if (configs != null) {
-      this.jdkResourceUrl = "http://" + masterHostname + ":"
-          + configs.getClientApiPort()
+      String protocol, port;
+      if (configs.getApiSSLAuthentication() == true) {
+        protocol = "https";
+        port = String.valueOf(configs.getClientSSLApiPort());
+      } else {
+        protocol = "http";
+        port = String.valueOf(configs.getClientApiPort());
+      }
+
+      this.jdkResourceUrl = protocol + "://" + masterHostname + ":"
+          + port
           + JDK_RESOURCE_LOCATION;
-      this.ojdbcUrl = "http://" + masterHostname + ":" + 
-          + configs.getClientApiPort() + JDK_RESOURCE_LOCATION + "/" + configs.getOjdbcJarName();
+      this.ojdbcUrl = protocol + "://" + masterHostname + ":"
+          + port + JDK_RESOURCE_LOCATION + "/" + configs.getOjdbcJarName();
 
-      this.mysqljdbcUrl = "http://" + masterHostname + ":" + 
-          + configs.getClientApiPort() + JDK_RESOURCE_LOCATION + "/" + configs.getMySQLJarName();
+      this.mysqljdbcUrl = protocol + "://" + masterHostname + ":"
+          + port + JDK_RESOURCE_LOCATION + "/" + configs.getMySQLJarName();
       this.serverDB = configs.getServerDBName();
     } else {
       this.jdkResourceUrl = null;
@@ -179,8 +188,6 @@ public class AmbariManagementControllerImpl implements
       this.mysqljdbcUrl = null;
       this.serverDB = null;
     }
-    
-   
   }
 
   @Override