Hello Ravi Nori,

I'd like you to do a code review.  Please visit

    https://gerrit.ovirt.org/38203

to review the following change.

Change subject: aaa : process initialization errors
......................................................................

aaa : process initialization errors

During initialization we should print and
ignore exceptions from the built-in providers.
At EngineExtensionsLoader each time load()
or initialize() is called, there should be
a try/catch to show potentials errors. same
for the entry engineInitialize().

Change-Id: I63265947ff066857db19d2534628d46f01b9f2e9
Bug-Url: https://bugzilla.redhat.com/1194410
Signed-off-by: Ravi Nori <[email protected]>
---
M 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/Backend.java
M 
backend/manager/modules/utils/src/main/java/org/ovirt/engine/core/utils/extensionsmgr/EngineExtensionsManager.java
2 files changed, 53 insertions(+), 8 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/03/38203/1

diff --git 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/Backend.java
 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/Backend.java
index 34dc6bb..dc5c95a 100644
--- 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/Backend.java
+++ 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/Backend.java
@@ -135,7 +135,13 @@
     @PostConstruct
     public void create() {
         checkDBConnectivity();
-        initialize();
+        try {
+            initialize();
+        } catch(Exception ex) {
+            log.error("Error during initialization", ex.getMessage());
+            log.debug("", ex);
+            throw ex;
+        }
     }
 
     @PreDestroy
diff --git 
a/backend/manager/modules/utils/src/main/java/org/ovirt/engine/core/utils/extensionsmgr/EngineExtensionsManager.java
 
b/backend/manager/modules/utils/src/main/java/org/ovirt/engine/core/utils/extensionsmgr/EngineExtensionsManager.java
index 3a04026..db00de9 100644
--- 
a/backend/manager/modules/utils/src/main/java/org/ovirt/engine/core/utils/extensionsmgr/EngineExtensionsManager.java
+++ 
b/backend/manager/modules/utils/src/main/java/org/ovirt/engine/core/utils/extensionsmgr/EngineExtensionsManager.java
@@ -59,8 +59,14 @@
     }
 
     public void engineInitialize() {
-        createInternalAAAConfigurations();
-        createKerberosLdapAAAConfigurations();
+        try {
+            createInternalAAAConfigurations();
+            createKerberosLdapAAAConfigurations();
+        } catch (Exception ex) {
+            log.error("Could not load built in configuration. Exception 
message is: {}",
+                    ex.getMessage());
+            log.debug("", ex);
+        }
 
         for (File directory : 
EngineLocalConfig.getInstance().getExtensionsDirectories()) {
             if (!directory.exists()) {
@@ -109,7 +115,14 @@
                     )
                 )
             ) {
-                initialize(extension.getContext().<String> 
get(Base.ContextKeys.INSTANCE_NAME));
+                try {
+                    
initialize(extension.getContext().<String>get(Base.ContextKeys.INSTANCE_NAME));
+                } catch (Exception ex) {
+                    log.error("Could not initialize extension '{}'. Exception 
message is: {}",
+                            
extension.getContext().<String>get(Base.ContextKeys.INSTANCE_NAME),
+                            ex.getMessage());
+                    log.debug("", ex);
+                }
             }
         }
 
@@ -141,7 +154,13 @@
         authConfig.put("config.authn.user.name", Config.<String> 
getValue(ConfigValues.AdminUser));
         authConfig.put("config.authn.user.password", Config.<String> 
getValue(ConfigValues.AdminPassword));
         authConfig.put(Base.ConfigKeys.SENSITIVE_KEYS, 
"config.authn.user.password)");
-        load(authConfig);
+        try {
+            load(authConfig);
+        } catch (Exception ex) {
+            log.error("Could not load auth config internal aaa extension based 
on configuration. Exception message is: {}",
+                    ex.getMessage());
+            log.debug("", ex);
+        }
 
         Properties dirConfig = new Properties();
         dirConfig.put(Base.ConfigKeys.NAME, "internal");
@@ -154,7 +173,13 @@
         dirConfig.put("config.authz.user.id", 
"fdfc627c-d875-11e0-90f0-83df133b58cc");
         dirConfig.put("config.query.filter.size",
                 
Config.getValue(ConfigValues.MaxLDAPQueryPartsNumber).toString());
-        load(dirConfig);
+        try {
+            load(dirConfig);
+        } catch (Exception ex) {
+            log.error("Could not load directory config internal aaa extension 
based on configuration. Exception message is: {}",
+                    ex.getMessage());
+            log.debug("", ex);
+        }
     }
 
     private void createKerberosLdapAAAConfigurations() {
@@ -194,7 +219,14 @@
                 authConfig.put("config.change.password.url", 
blankIfNull(passwordChangeUrlPerDomain.get(domain)));
                 authConfig.put("config.change.password.msg", 
blankIfNull(passwordChangeMsgPerDomain.get(domain)));
                 attachConfigValuesFromDb(authConfig, domain);
-                load(authConfig);
+                try {
+                    load(authConfig);
+                } catch (Exception ex) {
+                    log.error("Could not load auth config for extension {} 
based on configuration. Exception message is: {}",
+                            domain,
+                            ex.getMessage());
+                    log.debug("", ex);
+                }
 
                 Properties dirConfig = new Properties();
                 dirConfig.put(Base.ConfigKeys.NAME, domain);
@@ -206,7 +238,14 @@
                 dirConfig.put("config.query.filter.size",
                         
Config.getValue(ConfigValues.MaxLDAPQueryPartsNumber).toString());
                 attachConfigValuesFromDb(dirConfig, domain);
-                load(dirConfig);
+                try {
+                    load(dirConfig);
+                } catch (Exception ex) {
+                    log.error("Could not load directory config for extension 
{} based on configuration. Exception message is: {}",
+                            domain,
+                            ex.getMessage());
+                    log.debug("", ex);
+                }
             }
         }
     }


-- 
To view, visit https://gerrit.ovirt.org/38203
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I63265947ff066857db19d2534628d46f01b9f2e9
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: ovirt-engine-3.5
Gerrit-Owner: Alon Bar-Lev <[email protected]>
Gerrit-Reviewer: Ravi Nori <[email protected]>
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to