[java-identity-provider] branch main updated: IDP-2340 Plugin installer doesn't perform (or display) module file changes in certain conditions

Rod Widdowson rdw at steadingsoftware.com
Mon Oct 28 15:57:04 UTC 2024


This is an automated email from the git hooks/post-receive script.

rdw pushed a commit to branch main
in repository java-identity-provider.

View the commit online:
http://git.shibboleth.net/view/?p=java-identity-provider.git;a=commit;h=5848bdcc84e60c3ea55e66aa8f2f812291e2215b

The following commit(s) were added to refs/heads/main by this push:
     new 5848bdcc8 IDP-2340 Plugin installer doesn't perform (or display) module file changes in certain conditions
5848bdcc8 is described below

commit 5848bdcc84e60c3ea55e66aa8f2f812291e2215b
Author: Rod Widdowson <rdw at steadingsoftware.com>
AuthorDate: Mon Oct 28 15:56:54 2024 +0000

    IDP-2340 Plugin installer doesn't perform (or display) module file changes in certain conditions
    
    https://shibboleth.atlassian.net/browse/IDP-2340
    
     Change behavior as discussed in the case
---
 .../idp/installer/plugin/impl/PluginInstaller.java | 24 +++++++++++++++++-----
 1 file changed, 19 insertions(+), 5 deletions(-)

diff --git a/idp-installer/src/main/java/net/shibboleth/idp/installer/plugin/impl/PluginInstaller.java b/idp-installer/src/main/java/net/shibboleth/idp/installer/plugin/impl/PluginInstaller.java
index 525ddae2d..816fb86cb 100644
--- a/idp-installer/src/main/java/net/shibboleth/idp/installer/plugin/impl/PluginInstaller.java
+++ b/idp-installer/src/main/java/net/shibboleth/idp/installer/plugin/impl/PluginInstaller.java
@@ -157,6 +157,9 @@ public final class PluginInstaller extends AbstractInitializableComponent implem
     /** The Module Context. */
     @NonnullAfterInit private ModuleContext moduleContext;
 
+    /** The names of those plugin modules enabled by rule. */
+    @Nonnull private Set<String> reenabledPluginModules = new HashSet<>();
+
     /** Module Changes.*/
     @Nonnull private final  Map<ModuleResource,ResourceResult> moduleChanges = new HashMap<>();
 
@@ -545,13 +548,22 @@ public final class PluginInstaller extends AbstractInitializableComponent implem
     private void reEnableModules(final Set<String> loadedModules) throws BuildException  {
         try {
             final Iterator<IdPModule> modules = ServiceLoader.load(IdPModule.class, getDistributionLoader()).iterator();
+            LOG.debug("Reloading Plugin-supplied modules (if any)");
             while (modules.hasNext()) {
                 final IdPModule module = modules.next();
-                if (pluginId.equals(module.getOwnerId()) && loadedModules.contains(module.getId())) {
-                    LOG.debug("Re-enabling module {}", module.getId());
-                    captureChanges(module.enable(getModuleContext()));
+                if (pluginId.equals(module.getOwnerId())) {
+                    // IdP-2340
+                    final String moduleId = module.getId();
+                    if (reenabledPluginModules.contains(moduleId)) {
+                        LOG.debug("Module '{}' already enabled by Plugin rule", moduleId);
+                    } else if (!loadedModules.contains(module.getId())) {
+                        LOG.debug("Module '{]' not previously enabled", moduleId);
+                    } else {
+                        LOG.debug("Re-enabling module {}", moduleId);
+                        captureChanges(module.enable(getModuleContext()));
+                    }
                 } else {
-                    LOG.debug("Not re-enabling module {}, not provided by this plugin", module.getId());
+                    LOG.debug("Module {}, not provided by this plugin", module.getId());
                 }
             }
         } catch (final ServiceConfigurationError | ModuleException e) {
@@ -625,8 +637,10 @@ public final class PluginInstaller extends AbstractInitializableComponent implem
                     captureChanges(module.enable(getModuleContext()));
                     rollBack.getModulesEnabled().add(module);
                 } else {
-                    LOG.debug("Module {} is already enabled, so not enabling", moduleId);
+                    LOG.debug("Re-enabling Module {}", moduleId);
+                    captureChanges(module.enable(getModuleContext()));
                 }
+                reenabledPluginModules.add(moduleId);
             }
         } catch (final ModuleException e) {
             LOG.error("Error enabling {}", moduleId);

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the commits mailing list