incubator-ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From swa...@apache.org
Subject svn commit: r1492926 - in /incubator/ambari/trunk/ambari-server/src/main/java/org/apache/ambari/server: configuration/Configuration.java security/encryption/CredentialProvider.java
Date Fri, 14 Jun 2013 01:48:35 GMT
Author: swagle
Date: Fri Jun 14 01:48:35 2013
New Revision: 1492926

URL: http://svn.apache.org/r1492926
Log:
AMBARI-2384. Ambari Server on dev VM with default ambari config fails to start. (swagle)

Modified:
    incubator/ambari/trunk/ambari-server/src/main/java/org/apache/ambari/server/configuration/Configuration.java
    incubator/ambari/trunk/ambari-server/src/main/java/org/apache/ambari/server/security/encryption/CredentialProvider.java

Modified: incubator/ambari/trunk/ambari-server/src/main/java/org/apache/ambari/server/configuration/Configuration.java
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-server/src/main/java/org/apache/ambari/server/configuration/Configuration.java?rev=1492926&r1=1492925&r2=1492926&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-server/src/main/java/org/apache/ambari/server/configuration/Configuration.java
(original)
+++ incubator/ambari/trunk/ambari-server/src/main/java/org/apache/ambari/server/configuration/Configuration.java
Fri Jun 14 01:48:35 2013
@@ -310,8 +310,16 @@ public class Configuration {
 
   private void loadCredentialProvider() {
     if (credentialProvider == null) {
-      this.credentialProvider = new CredentialProvider(null,
-        getMasterKeyLocation(), isMasterKeyPersisted());
+      try {
+        this.credentialProvider = new CredentialProvider(null,
+          getMasterKeyLocation(), isMasterKeyPersisted());
+      } catch (Exception e) {
+        LOG.info("Credential provider creation failed.\n" + e.getMessage());
+        if (LOG.isDebugEnabled()) {
+          e.printStackTrace();
+        }
+        this.credentialProvider = null;
+      }
     }
   }
 

Modified: incubator/ambari/trunk/ambari-server/src/main/java/org/apache/ambari/server/security/encryption/CredentialProvider.java
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-server/src/main/java/org/apache/ambari/server/security/encryption/CredentialProvider.java?rev=1492926&r1=1492925&r2=1492926&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-server/src/main/java/org/apache/ambari/server/security/encryption/CredentialProvider.java
(original)
+++ incubator/ambari/trunk/ambari-server/src/main/java/org/apache/ambari/server/security/encryption/CredentialProvider.java
Fri Jun 14 01:48:35 2013
@@ -43,7 +43,7 @@ public class CredentialProvider {
   static final Logger LOG = LoggerFactory.getLogger(CredentialProvider.class);
 
   public CredentialProvider(String masterKey, String masterKeyLocation,
-                            boolean isMasterKeyPersisted) {
+              boolean isMasterKeyPersisted) throws AmbariException {
     if (masterKeyLocation == null)
       throw new IllegalArgumentException("Master key location needed for " +
         "Credential Provider initialization.");
@@ -55,6 +55,9 @@ public class CredentialProvider {
       masterKeyService = new MasterKeyServiceImpl(masterKeyLocation,
         isMasterKeyPersisted);
     }
+    if (!masterKeyService.isMasterKeyInitialized()) {
+      throw new AmbariException("Master key initialization failed.");
+    }
     String storeDir = masterKeyLocation.substring(0,
       masterKeyLocation.indexOf(Configuration.MASTER_KEY_FILENAME_DEFAULT));
     this.keystoreService = new CredentialStoreServiceImpl(storeDir);



Mime
View raw message