[java-identity-provider] branch main updated: IDP-1854 Add a discovery option to the plugin command

Rod Widdowson rdw at steadingsoftware.com
Thu Sep 2 14:21:25 UTC 2021


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=530ba43a9476f4502a05820e1a72a2f8a4beed7c

The following commit(s) were added to refs/heads/main by this push:
       new  530ba43a9 IDP-1854 Add a discovery option to the plugin command
530ba43a9 is described below

commit 530ba43a9476f4502a05820e1a72a2f8a4beed7c
Author: Rod Widdowson <rdw at steadingsoftware.com>
AuthorDate: Thu Sep 2 15:19:13 2021 +0100

    IDP-1854 Add a discovery option to the plugin command
    
    https://shibboleth.atlassian.net/browse/IDP-1854
    
    Fix PEBKAC with final status from -I command.
---
 .../idp/installer/plugin/impl/PluginInstaller.java     | 18 ++++++++++++++----
 .../idp/installer/plugin/impl/PluginInstallerCLI.java  | 12 ++----------
 2 files changed, 16 insertions(+), 14 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 c51de4434..7574a0357 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
@@ -63,9 +63,7 @@ import org.apache.http.client.HttpClient;
 import org.apache.tools.ant.BuildException;
 import org.opensaml.security.httpclient.HttpClientSecurityParameters;
 import org.slf4j.Logger;
-
 import com.google.common.base.Predicates;
-
 import net.shibboleth.ext.spring.resource.HTTPResource;
 import net.shibboleth.idp.Version;
 import net.shibboleth.idp.installer.BuildWar;
@@ -89,7 +87,6 @@ import net.shibboleth.utilities.java.support.httpclient.HttpClientBuilder;
 import net.shibboleth.utilities.java.support.logic.Constraint;
 import net.shibboleth.utilities.java.support.primitive.StringSupport;
 import net.shibboleth.utilities.java.support.resource.Resource;
-
 /**
  *  The class where the heavy lifting of managing a plugin happens. 
  */
@@ -278,7 +275,7 @@ public final class PluginInstaller extends AbstractInitializableComponent implem
                throw new BuildException(e);
             }
             final PluginVersion pluginVersion = new PluginVersion(description);
-            final PluginVersion idpVersion = new PluginVersion(Version.getVersion());
+            final PluginVersion idpVersion = getIdPVersion();
             if (!state.getPluginInfo().isSupportedWithIdPVersion(pluginVersion, idpVersion)) {
                 LOG.error("Plugin {} version {} is not supported with IdP Version {}",
                         pluginId, pluginVersion, idpVersion);
@@ -985,5 +982,18 @@ public final class PluginInstaller extends AbstractInitializableComponent implem
         InstallerSupport.setReadOnly(distPath, true);
     }
     
+    /** Return a version we can use in a test proof manner.
+     * @return the IdP version or a fixed value
+     */
+    protected static PluginVersion getIdPVersion() {
+        final String version  = Version.getVersion();
+
+        if (version == null) {
+            LOG.error("Could not determine IdP Version. Assuming 4.2.0");
+            LOG.error("You should never see this outside a test environment");
+            return new PluginVersion(4,1,0);
+        } 
+        return new PluginVersion(version);
+    }
 }
 
diff --git a/idp-installer/src/main/java/net/shibboleth/idp/installer/plugin/impl/PluginInstallerCLI.java b/idp-installer/src/main/java/net/shibboleth/idp/installer/plugin/impl/PluginInstallerCLI.java
index 2ded29e91..069453098 100644
--- a/idp-installer/src/main/java/net/shibboleth/idp/installer/plugin/impl/PluginInstallerCLI.java
+++ b/idp-installer/src/main/java/net/shibboleth/idp/installer/plugin/impl/PluginInstallerCLI.java
@@ -475,7 +475,7 @@ public final class PluginInstallerCLI extends AbstractIdPHomeAwareCommandLine<Pl
         installer.installPlugin(info.getUpdateURL(versionToInstall),
                 info.getUpdateBaseName(versionToInstall) + ".tar.gz",
                 checkVersion);
-        return RC_IO;
+        return RC_OK;
     }
 
 
@@ -487,15 +487,7 @@ public final class PluginInstallerCLI extends AbstractIdPHomeAwareCommandLine<Pl
      */
     @Nullable private PluginVersion getBestVersion(final PluginVersion pluginVersion , final PluginInfo pluginInfo) {
 
-        final String idpVersionString = net.shibboleth.idp.Version.getVersion();
-
-        final PluginVersion idPVersion;
-        if (idpVersionString == null) {
-            idPVersion = new PluginVersion(4,1,0);
-            log.error("Could not determine IdP Version. Assuming 4.1.0");
-        } else {
-            idPVersion = new PluginVersion(idpVersionString);
-        }
+        final PluginVersion idPVersion = PluginInstaller.getIdPVersion();
 
         final List<PluginVersion> availableVersions = new ArrayList<>(pluginInfo.getAvailableVersions().keySet());
         availableVersions.sort(null);

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


More information about the commits mailing list