Alon Bar-Lev has posted comments on this change.

Change subject: aaa: Change builtin authenticators and directories 
initialization
......................................................................


Patch Set 8:

(8 comments)

http://gerrit.ovirt.org/#/c/25741/8/backend/manager/modules/builtin-extensions/src/main/java/org/ovirt/engine/extensions/aaa/builtin/internal/InternalAuthenticator.java
File 
backend/manager/modules/builtin-extensions/src/main/java/org/ovirt/engine/extensions/aaa/builtin/internal/InternalAuthenticator.java:

Line 15:     @Override
Line 16:     public void authenticate(String user, String password) {
Line 17:         String adminUser = 
((Properties)context.get(ExtensionProperties.CONFIGURATION)).getProperty("config.authn.user.name");
Line 18:         String adminPassword =  
((Properties)context.get(ExtensionProperties.CONFIGURATION)).getProperty("config.authn.user.password");
Line 19:         if (!user.equals(adminUser) || 
!password.equals(adminPassword)) {
yes, but why double not?

 if (! (user.equals(adminUser) && password.equals(adminPassword)) {

is more human correct, no?
Line 20:             throw new 
AAAExtensionException(AAAExtensionException.AAAExtensionError.INCORRECT_CREDENTIALS,
 "");
Line 21:         }
Line 22:     }
Line 23: 


http://gerrit.ovirt.org/#/c/25741/8/backend/manager/modules/extensions-manager/src/main/java/org/ovirt/engine/core/extensions/mgr/ExtensionsManager.java
File 
backend/manager/modules/extensions-manager/src/main/java/org/ovirt/engine/core/extensions/mgr/ExtensionsManager.java:

Line 61:             return enabled;
Line 62:         }
Line 63: 
Line 64:         public String getProvides() {
Line 65:             return (String) context.get(ExtensionProperties.PROVIDES);
.split("[,]") and trim() to support multiple interfaces within single 
extension, please.

return List<String>
Line 66:         }
Line 67: 
Line 68:         public Map<ExtensionProperties, Object> getContext() {
Line 69:             return context;


Line 161:         ExtensionEntry entry = new ExtensionEntry(props, confFile);
Line 162:         ExtensionEntry alreadyLoadedEntry = 
loadedEntries.get(entry.getName());
Line 163:         if (alreadyLoadedEntry != null) {
Line 164:             throw new ConfigurationException(String.format(
Line 165:                     "Could not load the configuration '%1$s' from 
file %2$s. A configuration with the same name was already loaded from file 
%3$s",
add name of the already loaded as file maybe null
Line 166:                     entry.getName(),
Line 167:                     getFileName(entry.file),
Line 168:                     getFileName(alreadyLoadedEntry.file))
Line 169:              );


Line 168:                     getFileName(alreadyLoadedEntry.file))
Line 169:              );
Line 170:         }
Line 171:         loadedEntries.put(entry.getName(), entry);
Line 172:         entry.enabled = 
EngineLocalConfig.getInstance().getBoolean(ENGINE_EXTENSION_ENABLED + 
entry.getName(), entry.enabled);
put this in temp variable and set entry.enabled only if success.
Line 173:         //Activate the extension
Line 174:         if (entry.enabled && entry.extension == null) {
Line 175:             try {
Line 176:                 entry.extension = (Extension) lookupService(


Line 180:                         ).newInstance();
Line 181:                 entry.extension.setContext(entry.context);
Line 182:                 entry.extension.init();
Line 183:                 activatedEntries.put(entry.getName(), entry);
Line 184:                 MultiValueMapUtils.addToMap(entry.getProvides(), 
entry, providesEntries);
add entry.enabled = true here
Line 185:             } catch (Exception ex) {
Line 186:                 entry.enabled = false;
Line 187:                 log.error(
Line 188:                         String.format(


Line 182:                 entry.extension.init();
Line 183:                 activatedEntries.put(entry.getName(), entry);
Line 184:                 MultiValueMapUtils.addToMap(entry.getProvides(), 
entry, providesEntries);
Line 185:             } catch (Exception ex) {
Line 186:                 entry.enabled = false;
remove this^
Line 187:                 log.error(
Line 188:                         String.format(
Line 189:                                 "Error in activating extension %1$s. 
Exception message is %2$s",
Line 190:                                 entry.getName(),


Line 198:         }
Line 199:     }
Line 200: 
Line 201:     private String getFileName(File file) {
Line 202:         return file != null ? file.getAbsolutePath() : "null";
if you do this, better put N/A :)
Line 203:     }
Line 204: 
Line 205:     private Module loadModule(String moduleSpec) {
Line 206:         // If the module was not already loaded, load it


Line 253:                         
emptyIfNull(context.get(ExtensionProperties.VERSION)),
Line 254:                         
emptyIfNull(context.get(ExtensionProperties.LICENSE)),
Line 255:                         
emptyIfNull(context.get(ExtensionProperties.HOME)),
Line 256:                         
emptyIfNull(context.get(ExtensionProperties.AUTHOR)),
Line 257:                         emptyIfNull(entry.file)
getFileName?
Line 258:                         )
Line 259:                         );
Line 260:             }
Line 261:         }


-- 
To view, visit http://gerrit.ovirt.org/25741
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: Id8513cb992c5becef7e83c04a8da8bc7f1622348
Gerrit-PatchSet: 8
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Yair Zaslavsky <yzasl...@redhat.com>
Gerrit-Reviewer: Alon Bar-Lev <alo...@redhat.com>
Gerrit-Reviewer: Yair Zaslavsky <yzasl...@redhat.com>
Gerrit-Reviewer: automat...@ovirt.org
Gerrit-Reviewer: oVirt Jenkins CI Server
Gerrit-HasComments: Yes
_______________________________________________
Engine-patches mailing list
Engine-patches@ovirt.org
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to